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(); }
/* * 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; }
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; }
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; }