diff --git a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml index 0b7d47f1c..aaf5d2a06 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml @@ -3980,6 +3980,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/com/amarsoft/app/util/ProductParamUtil.java b/src/com/amarsoft/app/util/ProductParamUtil.java index 8734deb96..90a6cec27 100644 --- a/src/com/amarsoft/app/util/ProductParamUtil.java +++ b/src/com/amarsoft/app/util/ProductParamUtil.java @@ -489,6 +489,86 @@ public class ProductParamUtil { } return parameterValue; } + + /** + * ´«Èë²úÆ·±àºÅ¡¢×é¼þÀàÐͱàºÅºÍ×é¼þID,·µ»Øµ¥¸ö×é¼þËùÓвÎÊý + * @param productId ²úÆ·±àºÅ + * @param componentType ×é¼þÀàÐͱàºÅ + * @param id ¶ÔÓ¦×é¼þµÄID + * @return ²ÎÊý¶ÔÓ¦µÄÖµ + * @throws Exception + * @author zhulh + */ + public static Map getProductComponentAllParameters(String productId,String componentType,String id) throws Exception{ + Map parameValue = new HashMap(); + String realXmlPath = getProductValueXmlBySql(productId); + //List componentList = XMLHelper.getBusinessObjectList(realXmlPath,"Component||Status='1'","ID"); + /*List exists = new ArrayList(); + BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME); + BizObject boLPI = bomLPI.createQuery("ID=:ID").setParameter("ID", realXmlPath).getSingleResult(true); + String pData = boLPI.getAttribute("PRODUCT_DATA").getString(); + String type = componentType; + if("".equals(pData)){ + }else{ + JSONArray jsonArray = JSONArray.fromObject(pData); + Iterator it = jsonArray.iterator(); + while(it.hasNext()){ + JSONObject jo = (JSONObject)it.next().get("jbo.sample.Component"); + if(type.equals(jo.get("TYPE"))){ + JSONArray ja = JSONArray.fromObject(jo.get("Parameter")); + BusinessObject b = BusinessObject.createBusinessObject("Component"); + b.setAttributes(jo); + BusinessObject[] bos = new BusinessObject[ja.size()]; + for(int i=0;i exists = BusinessObjectHelper.getBusinessObjectsBySql(componentList, "Type like :Type", "Type",componentType); + List exists = getBusinessObject(realXmlPath, componentType); + for(BusinessObject bo:exists){ + List parameters = bo.getBusinessObjects("Parameter"); + if(!id.equals(bo.getString("ID"))){ + continue; + } + for(BusinessObject boP:parameters){ + String parameterValue = ""; + String parameterValueMax = ""; + String parameterValueMin = ""; + if(boP.containsAttribute("OPTIONALVALUE")){ + parameterValue = boP.getString("OPTIONALVALUE"); + }else if(boP.containsAttribute("MANDATORYVALUE")){ + parameterValue = boP.getString("MANDATORYVALUE"); + }else if(boP.containsAttribute("VALUE")){ + parameterValue = boP.getString("VALUE"); + } + if(boP.containsAttribute("MAXIMUMVALUE")){ + parameterValueMax = boP.getString("MAXIMUMVALUE"); + } + if(boP.containsAttribute("MINIMUMVALUE")){ + parameterValueMin = boP.getString("MINIMUMVALUE"); + } + parameValue.put(boP.getString("PARAMETERID"), parameterValue); + if(!"".equals(parameterValueMax)){ + parameValue.put(boP.getString("PARAMETERID")+"-MAX", parameterValueMax); + } + if(!"".equals(parameterValueMin)){ + parameValue.put(boP.getString("PARAMETERID")+"-MIN", parameterValueMin); + } + } + if(!parameValue.isEmpty()) { + break; + } + } + return parameValue; + } + /** * »ñÈ¡Îå¼¶·ÖÀà½á¹û * @param productId diff --git a/src_sys/com/tenwa/flow/action/comm/BaseFlowStartAction.java b/src_sys/com/tenwa/flow/action/comm/BaseFlowStartAction.java index 6c3549b68..8b256a77c 100644 --- a/src_sys/com/tenwa/flow/action/comm/BaseFlowStartAction.java +++ b/src_sys/com/tenwa/flow/action/comm/BaseFlowStartAction.java @@ -16,7 +16,14 @@ import com.amarsoft.are.jbo.JBOTransaction; import com.tenwa.comm.util.jboutil.DataOperatorUtil; public class BaseFlowStartAction extends FlowBussionAction { + private String error_message = "failed@·¢ÆðÁ÷³Ì³ö´í"; + public String getError_message() { + return error_message; + } + public void setError_message(String error_message) { + this.error_message = error_message; + } @Override public String initFLow(JBOTransaction tx) throws Exception { try { @@ -44,7 +51,7 @@ public class BaseFlowStartAction extends FlowBussionAction { // TODO Auto-generated catch block e.printStackTrace(); tx.rollback(); - return "failed@·¢ÆðÁ÷³Ì³ö´í"; + return error_message; } } /** diff --git a/src_tenwa/com/tenwa/lease/flow/project/projectapproval/BusinessApprovalStartAction.java b/src_tenwa/com/tenwa/lease/flow/project/projectapproval/BusinessApprovalStartAction.java index bc497950d..fa66607d1 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/projectapproval/BusinessApprovalStartAction.java +++ b/src_tenwa/com/tenwa/lease/flow/project/projectapproval/BusinessApprovalStartAction.java @@ -1,27 +1,16 @@ package com.tenwa.lease.flow.project.projectapproval; -import java.util.List; import java.util.Map; import java.util.UUID; -import jbo.app.tenwa.customer.CUSTOMER_CERT; -import jbo.app.tenwa.customer.CUSTOMER_COMPANY; -import jbo.app.tenwa.customer.CUSTOMER_INFO; -import jbo.app.tenwa.customer.CUSTOMER_PERSON; -import jbo.app.tenwa.customer.CUSTOMER_TEL; -import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT; -import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO; -import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; - import com.amarsoft.app.util.ProductParamUtil; import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.util.StringFunction; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.tenwa.comm.exception.BusinessException; import com.tenwa.flow.action.comm.BaseFlowStartAction; import com.tenwa.util.SerialNumberUtil; @@ -58,6 +47,24 @@ public class BusinessApprovalStartAction extends BaseFlowStartAction{ String projectNO = ""; //¸ù¾ÝÒµÎñÀàÐÍ£¬Éú³É²»Í¬µÄÏîÄ¿±àºÅ if(businessType.equals("1")){//1ÊÇÆû³µÒµÎñ + //²¹³äÒµÎñÂß¼­£¬Èç¹ûÌùÏ¢Óà¶î²»¹»µÄÇé¿ö£¬¾Í²»¸øÍ¨¹ý + Map discount = ProductParamUtil.getProductComponentAllParameters(this.getProductId(), "PRD0315", "DISCOUNT"); + if(!discount.isEmpty() && null != discount.get("DISCOUNT_ALL") && null != discount.get("CostType08")) { + synchronized (this) { + String discountAll = discount.get("DISCOUNT_ALL"); + String discountValue = discount.get("CostType08"); + Transaction tran = Transaction.createTransaction(tx); + String result = tran.getString(new SqlObject("select case when " + discountAll + "-ifnull(sum(discount), 0) >= " + discountValue + " then '0' else '1' end from lb_discount_occupy where product_id = '" + this.getProductId() + "'")); + if("0".equals(result)) { + ASUser user = ASUser.getUser(this.CurUserID, tran); + tran.executeSQL(new SqlObject("insert into lb_discount_occupy(id, product_id, flowunid, project_id, discount, inputuserid, inputorgid, inputtime) " + + " values (replace(uuid(),'-',''), '" + this.getProductId() + "', '" + flowBussiness.getAttribute("flow_unid").toString() + "', '" + uuid.replaceAll("-", "") + "'," + + " " + discountValue + ", '" + this.CurUserID + "', '" + user.getOrgID() + "', replace(now(),'-','/'))")); + } else { + throw new BusinessException("failed@²úÆ·ÌùÏ¢¶îÒÑÓÃÍê"); + } + } + } projectNO=SerialNumberUtil.getProjectSerialNumber1(this.getAsUser().getOrgID(), tx);//Éú³ÉA¿ªÍ·±àºÅ }else if(businessType.equals("2")){//2ÊÇ´«Í³ÒµÎñ projectNO=SerialNumberUtil.getProjectSerialNumber2(this.getAsUser().getOrgID(), tx);//Éú³ÉT¿ªÍ·±àºÅ @@ -250,5 +257,4 @@ public class BusinessApprovalStartAction extends BaseFlowStartAction{ public void setCerttype(String certtype) { this.certtype = certtype; } - }