From 0ff904671d58614308093a1d2f1473c6f23f90ad Mon Sep 17 00:00:00 2001 From: liyang <1305845247@qq.com> Date: Fri, 17 Aug 2018 11:13:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=94=B3=E8=AF=B7=E5=AD=98?= =?UTF-8?q?=E9=87=8F=E5=AE=A2=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectApprovalCreationInfo.jsp | 5 +- WebContent/WEB-INF/etc/jbo/jbo_lease.xml | 155 ++++++++++++++++++ .../businessapply/CustomerInfoCheck.java | 48 ++++++ .../LBCustomerRelaTempToFormalBusiness.java | 145 +++++++++++----- .../LBProjectIntoTempInitCarBusiness.java | 98 +++++++++-- 5 files changed, 399 insertions(+), 52 deletions(-) diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp index 0b50a5b02..c22157fd5 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp @@ -112,6 +112,9 @@ var price = getItemValue(0,getRow(),"price");//车辆指导价 var liter = getItemValue(0,getRow(),"liter");//排量 var geartype = getItemValue(0,getRow(),"geartype");//档位 + var CustomerId=""; + var ceckRes = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkNameAndCertId","certid="+certid+",certtype="+certtype); + CustomerId=ceckRes; if(carAttributes==""){ alert("请选择车辆属性"); @@ -152,7 +155,7 @@ } var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProductId="+productId+",ProductName="+productname+",CustomerType="+customerType+",carAttributes="+carAttributes+",leasehold="+leasehold+",carSystem="+carSystem+",custname="+custname+",certtype="+certtype+",certid="+certid+",productModel="+productModel+",carSeries="+carSeries+",versionid="+versionid+",modelid="+modelid+",businessType="+businessType+",price="+price+",liter="+liter+",geartype="+geartype+",sourcetype=web"; + sParams =sParams+",ProductId="+productId+",ProductName="+productname+",CustomerType="+customerType+",carAttributes="+carAttributes+",leasehold="+leasehold+",carSystem="+carSystem+",custname="+custname+",certtype="+certtype+",certid="+certid+",CustomerId="+CustomerId+",productModel="+productModel+",carSeries="+carSeries+",versionid="+versionid+",modelid="+modelid+",businessType="+businessType+",price="+price+",liter="+liter+",geartype="+geartype+",sourcetype=web"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.projectapproval.BusinessApprovalStartAction","initFLow",sParams);//定义流程中需要的参数 if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_" ) { diff --git a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml index c8140c581..a1958dbf4 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml @@ -4350,6 +4350,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java b/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java index 356e6abfd..5ffb657a8 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java +++ b/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java @@ -14,6 +14,9 @@ import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; public class CustomerInfoCheck { @@ -26,7 +29,34 @@ public class CustomerInfoCheck { private String mobileResult; private String repeatResult; private String flowunid; + private String custname; + private String certtype; + private String certid; + public String getCerttype() { + return certtype; + } + + public void setCerttype(String certtype) { + this.certtype = certtype; + } + + public String getCertid() { + return certid; + } + + public void setCertid(String certid) { + this.certid = certid; + } + + public String getCustname() { + return custname; + } + + public void setCustname(String custname) { + this.custname = custname; + } + public String checkName(JBOTransaction tx) throws JBOException{//校验姓名是否存在 if(customerType.equals("03")){//自然人 BizObject fullname = JBOFactory.createBizObjectQuery(CUSTOMER_PERSON.CLASS_NAME,"FULLNAME=:CustomerName").setParameter("CustomerName", this.CustomerName).getSingleResult(false); @@ -155,6 +185,24 @@ public class CustomerInfoCheck { return "error"; } + public String checkNameAndCertId(JBOTransaction tx)throws Exception{ + String CustomerId=""; + Transaction Sqlca=null; + try { + Sqlca=Transaction.createTransaction(tx); + String sql = "select c.CUSTOMERID from customer_cert c where exists ( select 1 from customer_type c1 where c1.custtype='cust_type.cust' and c1.customerid=c.customerid)and c.certid='"+certid+"' and c.certtype='"+certtype+"'"; + ASResultSet res = Sqlca.getASResultSet(new SqlObject(sql)); + while (res.next()) { + CustomerId=res.getString("CUSTOMERID"); + } + } catch (JBOException e) { + e.printStackTrace(); + return "ERROR"; + } + return CustomerId; + } + + public String getFlowunid() { return flowunid; } diff --git a/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBCustomerRelaTempToFormalBusiness.java b/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBCustomerRelaTempToFormalBusiness.java index 850377b82..97a3c89cb 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBCustomerRelaTempToFormalBusiness.java +++ b/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBCustomerRelaTempToFormalBusiness.java @@ -19,8 +19,16 @@ import jbo.app.tenwa.customer.CUSTOMER_PERSON; import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; import jbo.app.tenwa.customer.CUSTOMER_TYPE; import jbo.app.tenwa.customer.CUSTOMER_TYPE_TEMP; +import jbo.com.tenwa.lease.comm.VI_CUST_TENANT; + +import jbo.com.tenwa.lease.comm.CUST_PERSON_HIS; +import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT; +import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; +import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP; import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.awe.util.Transaction; import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.flow.baseBussion.BaseBussiness; @@ -31,48 +39,111 @@ public class LBCustomerRelaTempToFormalBusiness extends BaseBussiness { @Override public Object run(Transaction Sqlca) throws Exception { this.initBussinessParam(Sqlca); + String custType1 = ""; + String customeridForCust = ""; +// String custType = this.getAttribute("custType").toString(); + String ProjectId = this.getAttribute("ProjectId").toString(); + String CustomerId = this.getAttribute("CustomerId").toString(); + String flowunid = this.getAttribute("FlowUnid").toString(); + //String certType = this.getAttribute("certType").toString(); + String certType = this.getAttribute("certtype").toString(); + //String certId = this.getAttribute("certNo").toString(); + String certId = this.getAttribute("certid").toString(); + BizObjectManager bomCT1 = JBOFactory.getBizObjectManager(CUSTOMER_CERT.CLASS_NAME,Sqlca); + BizObjectManager bomCTT1 = JBOFactory.getBizObjectManager(CUSTOMER_TYPE.CLASS_NAME,Sqlca); //客户类型临时表 + List boCT1 = bomCT1.createQuery("certtype='"+certType+"' and certid='"+certId+"'").getResultList(false); + if(boCT1.size()>0){ + for(BizObject CT1:boCT1){ + customeridForCust = CT1.getAttribute("customerid").getString(); + BizObject boCTT1 = bomCTT1.createQuery("customerid='"+customeridForCust+"'").getSingleResult(false); + if(boCTT1!=null){ + custType1 = boCTT1.getAttribute("CUSTTYPE").getString(); + if("cust_type.cust".equals(custType1)){ + break; + } + } + } + } MapfromCondtion=new HashMap(); fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString()); - List unionList= DataOperatorUtil.getSetJBO(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion, Sqlca); - MaptoCondtion=new HashMap(); - CustomerCompare cc=new CustomerCompare(); - MapotherProperty=new HashMap(); - otherProperty.put("customerid", unionList.size()>0?unionList.get(0).getAttribute("customerid").toString():UUID.randomUUID().toString().replaceAll("-", "")); - DataOperatorUtil.copyJBOSet(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion,CUSTOMER_INFO.CLASS_NAME, null,otherProperty,cc, Sqlca); - DataOperatorUtil.copyJBOSet(CUSTOMER_TYPE_TEMP.CLASS_NAME, fromCondtion,CUSTOMER_TYPE.CLASS_NAME, null,otherProperty,cc, Sqlca); - for(BizObject union:unionList){ + MapotherProperty=new HashMap(); + //1.处理存量客户 还是用之前的客户id 存到 关联表中(只有自然人能做存量客户) + if("cust_type.cust".equals(custType1)){ + String CustId1 = customeridForCust; + otherProperty.put(LB_UNION_LESSEE.CUSTOMER_ID, CustId1); + otherProperty.put(LB_UNION_LESSEE.PROJECT_ID, ProjectId); + DataOperatorUtil.copySingleJBO(LB_UNION_LESSEE_TEMP.CLASS_NAME, fromCondtion, LB_UNION_LESSEE.CLASS_NAME, null, otherProperty, Sqlca); + //VI_CUST_PERSON视图查出来6张表的所有信息 + fromCondtion.clear(); + fromCondtion.put("customerid",CustId1); + //正式表中只存储客户的最新的信息 所以通过 CustomerId 会查到唯一的一条 承租人 + otherProperty.clear(); + otherProperty.put("STATUS","02"); + DataOperatorUtil.copySingleJBO(VI_CUST_TENANT.CLASS_NAME, fromCondtion, CUST_PERSON_HIS.CLASS_NAME, null, otherProperty, Sqlca); + //将客户上一次的信息导入历史表之后,正式表做update操作 + //更新CUSTOMER_INFO信息 + fromCondtion.clear(); + fromCondtion.put("flowunid",flowunid); + BizObject cibo = DataOperatorUtil.getJBOBySQL("flowunid=:flowunid", LB_UNION_LESSEE_TEMP.CLASS_NAME, fromCondtion, Sqlca); + String custid2 = cibo.getAttribute("customer_id").toString(); + fromCondtion.put("customerid", custid2);//区别担保人和承租人 + otherProperty.clear(); + otherProperty.put("customerid", CustId1); + DataOperatorUtil.copySingleJBO(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_INFO.CLASS_NAME, otherProperty, otherProperty, Sqlca); + DataOperatorUtil.copySingleJBO(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, otherProperty, otherProperty, Sqlca); + DataOperatorUtil.copySingleJBO(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_ADDRESS.CLASS_NAME, otherProperty, otherProperty, Sqlca); + DataOperatorUtil.copySingleJBO(CUSTOMER_CERT_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_CERT.CLASS_NAME, otherProperty, otherProperty, Sqlca); + DataOperatorUtil.copySingleJBO(CUSTOMER_FAMILY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_FAMILY.CLASS_NAME, otherProperty, otherProperty, Sqlca); + DataOperatorUtil.copySingleJBO(CUSTOMER_TYPE_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_TYPE.CLASS_NAME, otherProperty, otherProperty, Sqlca); + /* CustomerCompare cc= new CustomerCompare(); + otherProperty.clear(); + otherProperty.put(LB_GUARANTEE_UNIT.PROJECT_ID,ProjectId); + //将担保人信息导入正式表,担保人和承租人在相同的表中,为了保证这些表中的数据的唯一,每一次都校验身份证。并将信息存储在历史表中 + this.copyGuarantee(Sqlca, flowunid, cc, otherProperty);*/ + return "true"; + }else{ fromCondtion.clear(); - fromCondtion.put("customerid", union.getAttribute("customerid").getString()); fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString()); - toCondtion.clear(); - toCondtion.put("customerid", union.getAttribute("customerid").getString()); - if("03".equals(union.getAttribute(CUSTOMER_INFO_TEMP.CUSTOMERTYPE).toString())){ - DataOperatorUtil.copyJBOSet(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, toCondtion, null, cc, Sqlca); - }else{ - DataOperatorUtil.copyJBOSet(CUSTOMER_COMPANY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_COMPANY.CLASS_NAME, toCondtion, null, cc, Sqlca); + List unionList= DataOperatorUtil.getSetJBO(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion, Sqlca); + MaptoCondtion=new HashMap(); + CustomerCompare cc=new CustomerCompare(); + otherProperty.clear(); + otherProperty.put("customerid", unionList.size()>0?unionList.get(0).getAttribute("customerid").toString():UUID.randomUUID().toString().replaceAll("-", "")); + DataOperatorUtil.copyJBOSet(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion,CUSTOMER_INFO.CLASS_NAME, null,otherProperty,cc, Sqlca); + DataOperatorUtil.copyJBOSet(CUSTOMER_TYPE_TEMP.CLASS_NAME, fromCondtion,CUSTOMER_TYPE.CLASS_NAME, null,otherProperty,cc, Sqlca); + for(BizObject union:unionList){ + fromCondtion.clear(); + fromCondtion.put("customerid", union.getAttribute("customerid").getString()); + fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString()); + toCondtion.clear(); + toCondtion.put("customerid", union.getAttribute("customerid").getString()); + if("03".equals(union.getAttribute(CUSTOMER_INFO_TEMP.CUSTOMERTYPE).toString())){ + DataOperatorUtil.copyJBOSet(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, toCondtion, null, cc, Sqlca); + }else{ + DataOperatorUtil.copyJBOSet(CUSTOMER_COMPANY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_COMPANY.CLASS_NAME, toCondtion, null, cc, Sqlca); + } + DataOperatorUtil.copyJBOSet(CUSTOMER_CERT_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_CERT.CLASS_NAME, toCondtion, null, cc, Sqlca); + DataOperatorUtil.copyJBOSet(CUSTOMER_FAMILY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_FAMILY.CLASS_NAME, toCondtion, null, cc, Sqlca); + DataOperatorUtil.copyJBOSet(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_ADDRESS.CLASS_NAME, toCondtion, null, cc, Sqlca); } - DataOperatorUtil.copyJBOSet(CUSTOMER_CERT_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_CERT.CLASS_NAME, toCondtion, null, cc, Sqlca); - DataOperatorUtil.copyJBOSet(CUSTOMER_FAMILY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_FAMILY.CLASS_NAME, toCondtion, null, cc, Sqlca); - DataOperatorUtil.copyJBOSet(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_ADDRESS.CLASS_NAME, toCondtion, null, cc, Sqlca); + //List unitList=DataOperatorUtil.getSetJBO(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME, fromCondtion, Sqlca); + /* for(BizObject unit:unitList){ + fromCondtion.clear(); + fromCondtion.put("id",unit.getAttribute("id").toString()); + DataOperatorUtil.copySingleJBO(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME, fromCondtion, LB_GUARANTEE_UNIT.CLASS_NAME, null, null, Sqlca); + + fromCondtion.clear(); + fromCondtion.put("customerid",unit.getAttribute("ASSUROR").getString()); + fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString()); + toCondtion.clear(); + toCondtion.put("customerid", unit.getAttribute("ASSUROR").getString()); + DataOperatorUtil.copyJBOSet(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, toCondtion, null, cc, Sqlca); + DataOperatorUtil.copyJBOSet(CUSTOMER_CERT_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_CERT.CLASS_NAME, toCondtion, null, cc, Sqlca); + DataOperatorUtil.copyJBOSet(CUSTOMER_FAMILY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_FAMILY.CLASS_NAME, toCondtion, null, cc, Sqlca); + DataOperatorUtil.copyJBOSet(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_ADDRESS.CLASS_NAME, toCondtion, null, cc, Sqlca); + }*/ } - //List unitList=DataOperatorUtil.getSetJBO(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME, fromCondtion, Sqlca); -/* for(BizObject unit:unitList){ - fromCondtion.clear(); - fromCondtion.put("id",unit.getAttribute("id").toString()); - DataOperatorUtil.copySingleJBO(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME, fromCondtion, LB_GUARANTEE_UNIT.CLASS_NAME, null, null, Sqlca); - - fromCondtion.clear(); - fromCondtion.put("customerid",unit.getAttribute("ASSUROR").getString()); - fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString()); - toCondtion.clear(); - toCondtion.put("customerid", unit.getAttribute("ASSUROR").getString()); - DataOperatorUtil.copyJBOSet(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, toCondtion, null, cc, Sqlca); - DataOperatorUtil.copyJBOSet(CUSTOMER_CERT_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_CERT.CLASS_NAME, toCondtion, null, cc, Sqlca); - DataOperatorUtil.copyJBOSet(CUSTOMER_FAMILY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_FAMILY.CLASS_NAME, toCondtion, null, cc, Sqlca); - DataOperatorUtil.copyJBOSet(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_ADDRESS.CLASS_NAME, toCondtion, null, cc, Sqlca); - }*/ - - String sMessage="true"; - return sMessage; + String sMessage="true"; + return sMessage; } } \ No newline at end of file diff --git a/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBProjectIntoTempInitCarBusiness.java b/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBProjectIntoTempInitCarBusiness.java index 9b05caffc..55dd0b899 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBProjectIntoTempInitCarBusiness.java +++ b/src_tenwa/com/tenwa/lease/flow/project/commbusiness/LBProjectIntoTempInitCarBusiness.java @@ -2,15 +2,29 @@ package com.tenwa.lease.flow.project.commbusiness; +import jbo.app.tenwa.customer.CUSTOMER_ADDRESS; +import jbo.app.tenwa.customer.CUSTOMER_ADDRESS_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_CERT; +import jbo.app.tenwa.customer.CUSTOMER_CERT_TEMP; import jbo.app.tenwa.customer.CUSTOMER_COMPANY_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_FAMILY; +import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_INFO; import jbo.app.tenwa.customer.CUSTOMER_INFO_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_PERSON; import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_TYPE; import jbo.app.tenwa.customer.CUSTOMER_TYPE_TEMP; import jbo.app.tenwa.customer.DISTRIBUTOR_INFO; import jbo.com.tenwa.lease.carbrand.BUSINESS_STATUS; import jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR_TEMP; import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP; import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOException; @@ -19,6 +33,7 @@ import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.are.util.StringFunction; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; +import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.flow.baseBussion.BaseBussiness; /** * 项目基本信息初始化 @@ -38,6 +53,11 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness { public String initBusinessApply(JBOTransaction tx,ASUser asUser) throws Exception { String className = ""; String colName = ""; + //String certId = this.getAttribute("certNo").toString(); + String certId = this.getAttribute("certid").toString(); + //String certType = this.getAttribute("certType").toString(); + String certType = this.getAttribute("certtype").toString(); + String flowunid = this.getAttribute("ObjectNo").toString(); if("03".equals(this.getAttribute("CustomerType"))){ // 自然人 className = CUSTOMER_PERSON_TEMP.CLASS_NAME; colName = "FULLNAME"; @@ -56,21 +76,71 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness { String deptid = asUser.getOrgID(); String distributoIid=""; String vndrName=""; - if(deptid.startsWith("8006")) { - BizObject distributor_bo=JBOFactory.createBizObjectQuery(DISTRIBUTOR_INFO.CLASS_NAME,"orgid=:orgid").setParameter("orgid",deptid).getSingleResult(false); - if(distributor_bo!=null){ - distributoIid=distributor_bo.getAttribute("distributor_no").toString(); - vndrName=distributor_bo.getAttribute("distributor_name").toString(); - } + String custType = ""; + //通过证件号码和客户类型查询是否为存量客户 + BizObjectManager bomCT1 = JBOFactory.getBizObjectManager(CUSTOMER_CERT.CLASS_NAME,tx); + BizObjectManager bomCTT1 = JBOFactory.getBizObjectManager(CUSTOMER_TYPE.CLASS_NAME,tx); //客户类型临时表 + //证件表中如果这个人做过承租人也做过担保有 相同的证件号码就有2条信息,一个作为担保人,一个承租人 + List boCT1 = bomCT1.createQuery("certtype='"+certType+"' and certid='"+certId+"'").getResultList(false); + if(boCT1.size()>0){ + for(BizObject CT1:boCT1){ + String customeridForCust = CT1.getAttribute("customerid").getString(); + BizObject boCTT1 = bomCTT1.createQuery("customerid='"+customeridForCust+"'").getSingleResult(false); + if(boCTT1!=null){ + custType = boCTT1.getAttribute("CUSTTYPE").getString(); + if("cust_type.cust".equals(custType)){ + break; + } + } + } + } + String custName=""; + String customerId = ""; + if("cust_type.cust".equals(custType)){ + if(deptid.startsWith("8006")) { + BizObject distributor_bo=JBOFactory.createBizObjectQuery(DISTRIBUTOR_INFO.CLASS_NAME,"orgid=:orgid").setParameter("orgid",deptid).getSingleResult(false); + if(distributor_bo!=null){ + distributoIid=distributor_bo.getAttribute("distributor_no").toString(); + vndrName=distributor_bo.getAttribute("distributor_name").toString(); + } + } + custName = this.getAttribute("custname").toString(); + customerId = this.getAttribute("CustomerId").toString(); + MapotherProperty=new HashMap(); + MapfromCondtion=new HashMap(); + fromCondtion.put("CUSTOMERID",customerId); + otherProperty.put("FLOWUNID", flowunid); + otherProperty.put(CUSTOMER_INFO_TEMP.customerid, customerId); + //otherProperty.put(CUSTOMER_INFO_TEMP.distributor_id, distributoIid); + //拷到临时表 + DataOperatorUtil.copySingleJBO(CUSTOMER_INFO.CLASS_NAME, fromCondtion, CUSTOMER_INFO_TEMP.CLASS_NAME, null, otherProperty, tx); + DataOperatorUtil.copySingleJBO(CUSTOMER_CERT.CLASS_NAME, fromCondtion, CUSTOMER_CERT_TEMP.CLASS_NAME, null, otherProperty, tx); + DataOperatorUtil.copySingleJBO(CUSTOMER_FAMILY.CLASS_NAME, fromCondtion, CUSTOMER_FAMILY_TEMP.CLASS_NAME, null, otherProperty, tx); + DataOperatorUtil.copySingleJBO(CUSTOMER_ADDRESS.CLASS_NAME, fromCondtion, CUSTOMER_ADDRESS_TEMP.CLASS_NAME, null, otherProperty, tx); + DataOperatorUtil.copySingleJBO(CUSTOMER_PERSON.CLASS_NAME, fromCondtion, CUSTOMER_PERSON_TEMP.CLASS_NAME, null, otherProperty, tx); + DataOperatorUtil.copySingleJBO(CUSTOMER_TYPE.CLASS_NAME, fromCondtion, CUSTOMER_TYPE_TEMP.CLASS_NAME, null, otherProperty, tx); + //无论是不是存量客户都在 项目表 和 客户和项目关联表 中都新增一条数据,客户和项目是一对多的 + this.saveProjInfo(bm, tx, asUser,distributoIid); + this.saveEquipmentCar(bmLECT, tx, asUser,vndrName); //车辆租赁物信息表 + this.saveUnionLessee(bmLULT,tx,customerId,asUser); + this.saveBusinessStatus(bsbom, tx, asUser);//项目进度表 + }else{ + if(deptid.startsWith("8006")) { + BizObject distributor_bo=JBOFactory.createBizObjectQuery(DISTRIBUTOR_INFO.CLASS_NAME,"orgid=:orgid").setParameter("orgid",deptid).getSingleResult(false); + if(distributor_bo!=null){ + distributoIid=distributor_bo.getAttribute("distributor_no").toString(); + vndrName=distributor_bo.getAttribute("distributor_name").toString(); + } + } + BizObject bmC = this.saveCustomerInfo(bmCI, tx, asUser,distributoIid);//新增主表客户信息 + customerId = bmC.getAttribute("customerid").getString(); + this.saveCustomerType(bmCTT, tx, customerId,asUser);//证件类型临时表 + this.savePersonOrCompany(bomC, tx, colName,customerId,asUser);//自然人||法人 + this.saveEquipmentCar(bmLECT, tx, asUser,vndrName); //车辆租赁物信息表 + this.saveUnionLessee(bmLULT, tx, customerId, asUser);//union表 + this.saveProjInfo(bm, tx, asUser,distributoIid);//保存项目信息表 + this.saveBusinessStatus(bsbom, tx, asUser);//项目进度表 } - BizObject bmC = this.saveCustomerInfo(bmCI, tx, asUser,distributoIid);//新增主表客户信息 - String customerId = bmC.getAttribute("customerid").getString(); - this.saveCustomerType(bmCTT, tx, customerId,asUser);//证件类型临时表 - this.savePersonOrCompany(bomC, tx, colName,customerId,asUser);//自然人||法人 - this.saveEquipmentCar(bmLECT, tx, asUser,vndrName); //车辆租赁物信息表 - this.saveUnionLessee(bmLULT, tx, customerId, asUser);//union表 - this.saveProjInfo(bm, tx, asUser,distributoIid);//保存项目信息表 - this.saveBusinessStatus(bsbom, tx, asUser);//项目进度表 String sMessage="true"; return sMessage; }