示例#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;
  }