Exemple #1
0
 /**
  * 获取saler的名称
  *
  * @return
  */
 public String getSalerName() {
   int id = 0;
   String msg = "";
   try {
     id = Integer.parseInt(Struts2Util.getParameter("orderNo"));
     Map m = this.apInvoiceDao.getInfoByOrder(id);
     msg =
         "{ state:'success', currency:'"
             + m.get("currency")
             + "', name : '"
             + m.get("name")
             + "',saleId:'"
             + m.get("saleId")
             + "',amt:"
             + m.get("amt")
             + ",currency:'"
             + m.get("currency")
             + "',symbol:'"
             + m.get("symbol")
             + "' }";
   } catch (Exception e) {
     e.printStackTrace();
     msg = "{ state:'error',msg:'" + e.getMessage() + "' }";
   }
   Struts2Util.renderJson(msg);
   return null;
 }
Exemple #2
0
  public String saveServicePriceToSession() throws Exception {
    Map<String, Object> rt = new HashMap<String, Object>();
    String returnType = ServletActionContext.getRequest().getParameter("returnType");
    String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
    String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
    String key = null;
    if ("serviceId".equals(returnType)) {
      servicePrice.setServiceId(Integer.valueOf(serviceIdDetail));
      key = servicePrice.getCatalogId() + "_" + servicePrice.getServiceId();
    } else {
      List<com.genscript.gsscm.serv.entity.Service> serv =
          this.servService.getServiceByCatalogNo(catalogNo);
      servicePrice.setServiceId(serv.get(0).getServiceId());
      key = servicePrice.getCatalogId() + "_" + catalogNo;
    }

    ServicePrice sp =
        this.servService.getServicePriceByServiceIdAndCatalogId(
            servicePrice.getCatalogId(), servicePrice.getServiceId());
    if (sp == null) {
      sp = servicePrice;
    } else {
      sp.setLimitPrice(servicePrice.getLimitPrice());
      sp.setStandardPrice(servicePrice.getStandardPrice());
      sp.setPriceRuleGroup(servicePrice.getPriceRuleGroup());
      sp.setCategoryId(servicePrice.getCategoryId());
    }
    SessionUtil.updateOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key, sp);
    rt.put("key", key);
    rt.put("message", SUCCESS);
    Struts2Util.renderJson(rt);
    return null;
  }
Exemple #3
0
  /**
   * 检查该发票是否对过账,如果已经对过账,则不能修改currency
   *
   * @return
   */
  public String checkInvoiceIsAllocatied() {
    int invoiceId = 0;
    String msg = "";
    try {
      invoiceId = Integer.parseInt(Struts2Util.getParameter("invoiceId"));

      boolean flag = this.apInvoiceDao.isAllocation(invoiceId);
      msg = "{ state:'success',flag : " + flag + "}";
    } catch (Exception e) {
      e.printStackTrace();
      msg = "{ state:'error',msg:'" + e.getMessage() + "' }";
    }
    Struts2Util.renderJson(msg);
    return null;
  }
Exemple #4
0
 public String searchServicePriceByCategoryIdServiceId() {
   Map<String, Object> rt = new HashMap<String, Object>();
   String catalogId = ServletActionContext.getRequest().getParameter("catalogId");
   String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
   String returnType = ServletActionContext.getRequest().getParameter("returnType");
   String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
   String key = null;
   if ("serviceId".equals(returnType)) {
     key = catalogId + "_" + serviceIdDetail;
   } else {
     key = catalogId + "_" + catalogNo;
   }
   Object obj =
       SessionUtil.getOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key);
   if (obj != null) {
     this.servicePrice = (ServicePrice) obj;
   } else {
     if ("serviceId".equals(returnType)) {
       this.servicePrice =
           this.servService.getServicePriceByServiceIdAndCatalogId(
               catalogId, Integer.valueOf(serviceIdDetail));
     } else {
       List<com.genscript.gsscm.serv.entity.Service> serv =
           this.servService.getServiceByCatalogNo(catalogNo);
       if (serv.isEmpty()) {
         this.servicePrice = new ServicePrice();
         this.group = new ArrayList<PriceRuleGroups>();
       } else {
         this.servicePrice =
             this.servService.getServicePriceByServiceIdAndCatalogId(
                 catalogId, serv.get(0).getServiceId());
         this.group =
             this.priceRuleService.searchPriceRuleGroupListByClsId(serv.get(0).getServiceClsId());
       }
     }
   }
   Catalog catg = this.productService.getCatalogByCatalogId(catalogId);
   rt.put("priceAppr", this.getPriceAppr());
   rt.put("group", group);
   rt.put("currencyCode", catg.getCurrencyCode());
   rt.put("id", catg.getId());
   rt.put("message", SUCCESS);
   rt.put("servicePrice", servicePrice);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #5
0
  public String priceApprovedSaveSession() {
    Map<String, Object> rt = new HashMap<String, Object>();
    String key = Struts2Util.getParameter("priceId");
    String approved = Struts2Util.getParameter("approved");
    String groupApproved = Struts2Util.getParameter("groupApproved");
    String approvedReason = Struts2Util.getParameter("approvedReason");
    String oldVal = Struts2Util.getParameter("oldPriceApproved");
    ServicePriceDTO dto = new ServicePriceDTO();
    if (key == null) {
      key = Struts2Util.getParameter("subPriceId");
      if (key != null) {
        dto.setPriceId(Integer.valueOf(key));
        dto.setServiceSubPriceApprove(Double.valueOf(approved));
        dto.setServicePriceReason(approvedReason);
        dto.setServicePriceOldVal(Double.valueOf(oldVal));
        SessionUtil.updateOneRow(
            SessionPdtServ.ServiceSubPriceApproved.value(), sessionServiceId, key, dto);
        rt.put("key", key);
      }
    } else {
      dto.setPriceId(Integer.valueOf(key));
      if (groupApproved != null && !groupApproved.equals("")) {
        dto.setServiceRuleGroupPriceApprove(Integer.valueOf(groupApproved));
      }
      if (approved != null && !approved.equals("")) {
        dto.setServicePriceApprove(Double.valueOf(approved));
      }
      dto.setServicePriceReason(approvedReason);
      if (oldVal != null && !oldVal.equals("")) {
        dto.setServicePriceOldVal(Double.valueOf(oldVal));
      } else {
        dto.setServicePriceOldVal(Double.valueOf(0));
      }

      SessionUtil.updateOneRow(
          SessionPdtServ.ServicePriceApproved.value(), sessionServiceId, key, dto);
      rt.put("key", key);
    }

    rt.put("message", SUCCESS);
    Struts2Util.renderJson(rt);
    return null;
  }
Exemple #6
0
 public String saveServiceSubStepPriceToSession() throws Exception {
   Map<String, Object> rt = new HashMap<String, Object>();
   String key = subStepPrice.getCatalogId() + "_" + subStepPrice.getStepId();
   ServiceSubStepPrice sssp =
       this.servService.getSubStepPrice(subStepPrice.getCatalogId(), subStepPrice.getStepId());
   if (sssp == null) {
     sssp = subStepPrice;
   } else {
     sssp.setLimitPrice(subStepPrice.getLimitPrice());
     sssp.setRetailPrice(subStepPrice.getRetailPrice());
     sssp.setCatalogId(subStepPrice.getCatalogId());
   }
   SessionUtil.updateOneRow(
       SessionPdtServ.ServiceSubStepPricing.value(), sessionServiceId, key, sssp);
   rt.put("key", key);
   rt.put("message", SUCCESS);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #7
0
 public String searchSubStepPrice() {
   Map<String, Object> rt = new HashMap<String, Object>();
   String catalogId = ServletActionContext.getRequest().getParameter("catalogId");
   String stepId = ServletActionContext.getRequest().getParameter("stepId");
   String key = catalogId + "_" + stepId;
   Object obj =
       SessionUtil.getOneRow(SessionPdtServ.ServiceSubStepPricing.value(), sessionServiceId, key);
   if (obj != null) {
     this.subStepPrice = (ServiceSubStepPrice) obj;
   } else {
     this.subStepPrice = this.servService.getSubStepPrice(catalogId, Integer.valueOf(stepId));
   }
   Catalog catg = this.productService.getCatalogByCatalogId(catalogId);
   rt.put("priceAppr", this.getPriceAppr());
   rt.put("currencyCode", catg.getCurrencyCode());
   rt.put("id", catg.getId());
   rt.put("message", SUCCESS);
   rt.put("subStepPrice", subStepPrice);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #8
0
 public String getCategoryByCatalogAndCategory() {
   Map<String, Object> rt = new HashMap<String, Object>();
   String catalogId = Struts2Util.getParameter("catalogId");
   String categoryId = Struts2Util.getParameter("categoryId");
   String categoryLevel = Struts2Util.getParameter("categoryLevel");
   if (categoryLevel.equals("2")) {
     this.serviceCCategoryOfPriceList =
         this.servService.getServiceCategoryByCatalogId(catalogId, Integer.valueOf(categoryId), 2);
     categoryLevel = "3";
     if (this.serviceCCategoryOfPriceList != null && !this.serviceCCategoryOfPriceList.isEmpty()) {
       this.serviceCategoryOfPriceList =
           this.servService.getServiceCategoryByCatalogId(
               catalogId, serviceCCategoryOfPriceList.get(0).getCategoryId(), 3);
     }
   } else if (categoryLevel.equals("3")) {
     this.serviceCategoryOfPriceList =
         this.servService.getServiceCategoryByCatalogId(catalogId, Integer.valueOf(categoryId), 3);
   }
   rt.put("serviceCategoryOfPriceList", serviceCategoryOfPriceList);
   rt.put("serviceCCategoryOfPriceList", serviceCCategoryOfPriceList);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #9
0
  public String searchServicePriceByCatalogId() {
    Map<String, Object> rt = new HashMap<String, Object>();
    String catalogId = ServletActionContext.getRequest().getParameter("catalogId");
    String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
    String returnType = ServletActionContext.getRequest().getParameter("returnType");
    String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
    this.serviceBCategoryOfPriceList =
        this.servService.getServiceCategoryByCatalogId(catalogId, null, 1);
    if (serviceBCategoryOfPriceList != null && !serviceBCategoryOfPriceList.isEmpty()) {
      this.serviceCCategoryOfPriceList =
          this.servService.getServiceCategoryByCatalogId(
              catalogId, serviceBCategoryOfPriceList.get(0).getCategoryId(), 2);
      if (serviceCCategoryOfPriceList != null && !serviceCCategoryOfPriceList.isEmpty()) {
        this.serviceCategoryOfPriceList =
            this.servService.getServiceCategoryByCatalogId(
                catalogId, serviceCCategoryOfPriceList.get(0).getCategoryId(), 3);
      } else {
        this.serviceCategoryOfPriceList = new ArrayList<ServiceCategory>();
      }
    } else {
      this.serviceCCategoryOfPriceList = new ArrayList<ServiceCategory>();
      this.serviceCategoryOfPriceList = new ArrayList<ServiceCategory>();
    }

    if (serviceCategoryOfPriceList == null || serviceCategoryOfPriceList.isEmpty()) {
      this.servicePrice = new ServicePrice();
    } else {

      String key = null;
      if ("serviceId".equals(returnType)) {
        key = catalogId + "_" + serviceIdDetail;
      } else {
        key = catalogId + "_" + catalogNo;
      }
      Object obj =
          SessionUtil.getOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key);
      if (obj != null) {
        this.servicePrice = (ServicePrice) obj;
        if (servicePrice != null && servicePrice.getCategoryId() != null) {
          ServiceCategory pcategory =
              this.servService.getServiceCategoryDetail(servicePrice.getCategoryId());
          if (pcategory != null && pcategory.getParentCatId() != null) {
            ServiceCategory ccategory =
                this.servService.getServiceCategoryDetail(pcategory.getParentCatId());
            if (ccategory != null) {
              this.ccategoryId = ccategory.getCategoryId();
              if (ccategory.getParentCatId() != null) {
                ServiceCategory bcategory =
                    this.servService.getServiceCategoryDetail(ccategory.getParentCatId());
                if (bcategory != null) {
                  this.bcategoryId = bcategory.getCategoryId();
                }
              }
            }
          }
        }
      } else {
        if ("serviceId".equals(returnType)) {
          this.servicePrice =
              this.servService.getServicePriceByServiceIdAndCatalogId(
                  catalogId, Integer.valueOf(serviceIdDetail));
          if (servicePrice != null && servicePrice.getCategoryId() != null) {
            ServiceCategory pcategory =
                this.servService.getServiceCategoryDetail(servicePrice.getCategoryId());
            if (pcategory != null && pcategory.getParentCatId() != null) {
              ServiceCategory ccategory =
                  this.servService.getServiceCategoryDetail(pcategory.getParentCatId());
              if (ccategory != null) {
                this.ccategoryId = ccategory.getCategoryId();
                if (ccategory.getParentCatId() != null) {
                  ServiceCategory bcategory =
                      this.servService.getServiceCategoryDetail(ccategory.getParentCatId());
                  if (bcategory != null) {
                    this.bcategoryId = bcategory.getCategoryId();
                  }
                }
              }
            }
          }
        } else {
          List<com.genscript.gsscm.serv.entity.Service> serv =
              this.servService.getServiceByCatalogNo(catalogNo);
          if (serv.isEmpty()) {
            this.servicePrice = new ServicePrice();
          } else {
            this.servicePrice =
                this.servService.getServicePriceByServiceIdAndCatalogId(
                    catalogId, serv.get(0).getServiceId());
          }
        }
      }
    }
    Catalog catg = this.productService.getCatalogByCatalogId(catalogId);
    rt.put("priceAppr", this.getPriceAppr());
    rt.put("serviceCategoryOfPriceList", serviceCategoryOfPriceList);
    rt.put("serviceBCategoryOfPriceList", serviceBCategoryOfPriceList);
    rt.put("serviceCCategoryOfPriceList", serviceCCategoryOfPriceList);
    rt.put("ccategoryId", this.ccategoryId);
    rt.put("bcategoryId", this.bcategoryId);
    rt.put("currencyCode", catg.getCurrencyCode());
    rt.put("id", catg.getId());
    rt.put("message", SUCCESS);
    rt.put("servicePrice", servicePrice);
    Struts2Util.renderJson(rt);
    return null;
  }