Ejemplo n.º 1
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;
  }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
  }