Esempio n. 1
0
 public String getPriceAppr() {
   Integer id = null;
   String type = null;
   if (servicePrice != null && servicePrice.getPriceId() != null) {
     id = servicePrice.getPriceId();
     type = RequestApproveType.ServicePrice.name();
   }
   if (subStepPrice != null && subStepPrice.getPriceId() != null) {
     id = subStepPrice.getPriceId();
     type = RequestApproveType.SubServicePrice.name();
   }
   if (id == null) {
     return "false";
   }
   Boolean approv =
       servService.checkPropertyApproved(id, type, RequestApproveType.ServicePrice.name());
   if (approv == false) {
     approv =
         servService.checkPropertyApproved(
             id,
             RequestApproveType.ServicePriceGroup.name(),
             RequestApproveType.ServicePrice.name());
   }
   return approv.toString();
 }
Esempio n. 2
0
  /*
   * service price return catalog return service detail return serviceprice
   */
  public String searchServicePrice() {
    this.catalog = this.productService.getCatalogList(CatalogType.SERVICE.value());
    if (catalog.isEmpty()) {
      return null;
    } else {
      currencyCode = catalog.get(0).getCurrencyCode();
      if (catalog.get(0) != null && !"".equals(catalog.get(0))) {
        id = catalog.get(0).getId();

        this.serviceBCategoryOfPriceList =
            this.servService.getServiceCategoryByCatalogId(catalog.get(0).getCatalogId(), null, 1);
        if (serviceBCategoryOfPriceList != null && !serviceBCategoryOfPriceList.isEmpty()) {
          if (serviceBCategoryOfPriceList.get(0) != null
              && !"".equals(serviceBCategoryOfPriceList.get(0))) {
            this.serviceCCategoryOfPriceList =
                this.servService.getServiceCategoryByCatalogId(
                    catalog.get(0).getCatalogId(),
                    serviceBCategoryOfPriceList.get(0).getCategoryId(),
                    2);

            if (serviceCCategoryOfPriceList != null && !serviceCCategoryOfPriceList.isEmpty()) {
              this.serviceCategoryOfPriceList =
                  this.servService.getServiceCategoryByCatalogId(
                      catalog.get(0).getCatalogId(),
                      serviceCCategoryOfPriceList.get(0).getCategoryId(),
                      3);
            } else {
              this.serviceCategoryOfPriceList = new ArrayList<ServiceCategory>();
            }
          }
        }
      } else {
        this.serviceCCategoryOfPriceList = new ArrayList<ServiceCategory>();
        this.serviceCategoryOfPriceList = new ArrayList<ServiceCategory>();
      }
      this.serviceType = serviceType.toLowerCase();
      if (serviceType == null || serviceType.equals("")) {
        this.servicePrice = new ServicePrice();
        this.returnType = "breakDown";
      } else if (serviceType.equals(ServiceDetailsType.PROTEIN.value())
          || serviceType.equals(ServiceDetailsType.BIOPROCESS.value())
          || serviceType.equals(ServiceDetailsType.PHARMACEUTICAL.value())
          || serviceType.equals(ServiceDetailsType.ANTIBODYDRUG.value())) {
        breakDown = this.servService.getServiceIntermediateAllList(serviceId);
        if (breakDown.isEmpty()) {
          this.servicePrice = new ServicePrice();
          this.group = new ArrayList<PriceRuleGroups>();
        } else {
          List<com.genscript.gsscm.serv.entity.Service> serv = null;
          if (breakDown.get(0) != null && !"".equals(breakDown.get(0))) {
            serv = this.servService.getServiceByCatalogNo(breakDown.get(0).getIntmdCatalogNo());
          }
          if (serv.isEmpty()) {
            this.servicePrice = new ServicePrice();
            this.group = new ArrayList<PriceRuleGroups>();
          } else {
            if (catalog != null && subSteps != null) {
              if (catalog.get(0) != null
                  && !"".equals(catalog.get(0))
                  && subSteps.get(0) != null
                  && !"".equals(subSteps.get(0))) {
                this.servicePrice =
                    this.servService.getServicePriceByServiceIdAndCatalogId(
                        catalog.get(0).getCatalogId(), serv.get(0).getServiceId());
              }
            }
            this.group =
                this.priceRuleService.searchPriceRuleGroupListByClsId(
                    serv.get(0).getServiceClsId());
          }
        }
        this.returnType = "breakDown";
      } else if (serviceType.equals(ServiceDetailsType.PROTEINSTEP.value())
          || serviceType.equals(ServiceDetailsType.BIOPROCESSSTEP.value())
          || serviceType.equals(ServiceDetailsType.PHARMACEUTICALSTEP.value())
          || serviceType.equals(ServiceDetailsType.ANTIBODYDRUGSTEP.value())) {
        subSteps = this.servService.getServiceSubStepsList(serviceId);
        System.out.println(subSteps.size() + "<<<<<<<<<<<<<<<<");
        this.group = new ArrayList<PriceRuleGroups>();
        if (subSteps.isEmpty()) {
          ServiceSubStepPrice ssp = new ServiceSubStepPrice();
          if (catalog.get(0) != null && !"".equals(catalog.get(0))) {
            ssp.setCatalogId(catalog.get(0).getCatalogId());
          }
          ssp.setLimitPrice(0.0);
          ssp.setStepId(1);
          this.servService.saveSubStepPrice(ssp);
          subStepPrice = new ServiceSubStepPrice();
          if (catalog != null
              && subSteps != null
              && catalog.get(0) != null
              && !"".equals(catalog.get(0))
              && subSteps.get(0) != null
              && !"".equals(subSteps.get(0))) {
            subStepPrice =
                this.servService.getSubStepPrice(
                    catalog.get(0).getCatalogId(), subSteps.get(0).getStepId());
          }
          this.group = this.priceRuleService.searchPriceRuleGroupListByClsId(clsId);

        } else {
          if (catalog.get(0) != null
              && !"".equals(catalog.get(0))
              && subSteps.get(0) != null
              && !"".equals(subSteps.get(0))) {
            subStepPrice =
                this.servService.getSubStepPrice(
                    catalog.get(0).getCatalogId(), subSteps.get(0).getStepId());
          }
          if (subStepPrice != null) {
            System.out.println(">>>>>>>>>>>." + subStepPrice.getPriceId());
          } else {
            ServiceSubStepPrice ssp = new ServiceSubStepPrice();
            if (catalog.get(0) != null && !"".equals(catalog.get(0))) {
              ssp.setCatalogId(catalog.get(0).getCatalogId());
            }
            ssp.setRetailPrice(0.0);
            ssp.setStepId(1);
            this.servService.saveSubStepPrice(ssp);
            if (catalog.get(0) != null && !"".equals(catalog.get(0))) {
              subStepPrice = this.servService.getSubStepPrice(catalog.get(0).getCatalogId(), 1);
            }
            System.out.println(">>>>>>>>>>>." + subStepPrice.getPriceId());
          }
          this.group = this.priceRuleService.searchPriceRuleGroupListByClsId(clsId);
        }
        this.returnType = "subSteps";
      } else {
        breakDown = null;
        this.servicePrice =
            this.servService.getServicePriceByServiceIdAndCatalogId(
                catalog.get(0).getCatalogId(), serviceId);
        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 && ccategory.getParentCatId() != null) {
              this.ccategoryId = ccategory.getCategoryId();
              ServiceCategory bcategory =
                  this.servService.getServiceCategoryDetail(ccategory.getParentCatId());
              if (bcategory != null) {
                this.bcategoryId = bcategory.getCategoryId();
              }
            }
          }
        }
        this.group = this.priceRuleService.searchPriceRuleGroupListByClsId(clsId);
        this.returnType = "serviceId";
      }
    }
    return SUCCESS;
  }
Esempio n. 3
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;
 }