处理客商重复问题
This commit is contained in:
parent
2d42b1f886
commit
7210809126
@ -35,19 +35,20 @@ import com.tenwa.lease.flow.project.businessapply.CustomerCompare;
|
||||
|
||||
public class LBCustomerRelaTempToFormalBusiness extends BaseBussiness {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@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();
|
||||
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<BizObject> boCT1 = bomCT1.createQuery("certtype='"+certType+"' and certid='"+certId+"'").getResultList(false);
|
||||
@ -63,62 +64,111 @@ public class LBCustomerRelaTempToFormalBusiness extends BaseBussiness {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,String>fromCondtion=new HashMap<String, String>();
|
||||
fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString());
|
||||
Map<String,String>otherProperty=new HashMap<String, String>();
|
||||
Map<String,String>infoProperty=new HashMap<String, String>();
|
||||
Map<String,String>personProperty=new HashMap<String, String>();
|
||||
Map<String,String>companyProperty=new HashMap<String, String>();
|
||||
//1.处理存量客户 还是用之前的客户id 存到 关联表中(只有自然人能做存量客户)
|
||||
if("cust_type.cust".equals(custType1)){
|
||||
/**
|
||||
* 承租人临时表到正式表
|
||||
*/
|
||||
fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString());
|
||||
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张表的所有信息
|
||||
|
||||
/**
|
||||
* VI_CUST_PERSON视图查出来6张表的所有信息
|
||||
* 正式表中只存储客户的最新的信息 所以通过 CustomerId 会查到唯一的一条 承租人
|
||||
* 将客户上一次的信息导入历史表之后,正式表做update操作
|
||||
*/
|
||||
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();
|
||||
String custName = cibo.getAttribute("customer_name").toString();
|
||||
fromCondtion.put("customerid", custid2);//区别担保人和承租人
|
||||
otherProperty.clear();
|
||||
otherProperty.put("customerid", CustId1);
|
||||
|
||||
//修改CUSTOMER_INFO、CUSTOMER_CERT
|
||||
Map<String,String>infoProperty=new HashMap<String, String>();
|
||||
infoProperty.put("customerid", CustId1);
|
||||
infoProperty.put("customername", custName);
|
||||
//修改CUSTOMER_PERSON
|
||||
Map<String,String>personProperty=new HashMap<String, String>();
|
||||
personProperty.put("customerid", CustId1);
|
||||
personProperty.put("FULLNAME", custName);
|
||||
//更新CUSTOMER_COMPANY
|
||||
Map<String,String>companyProperty=new HashMap<String, String>();
|
||||
companyProperty.put("customerid", CustId1);
|
||||
companyProperty.put("enterprisename", custName);
|
||||
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_INFO.CLASS_NAME, otherProperty, infoProperty, Sqlca);
|
||||
if("03".equals(this.getAttribute("CustomerType"))){ // 自然人
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, otherProperty, personProperty, Sqlca);
|
||||
}else{
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_COMPANY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_COMPANY.CLASS_NAME, otherProperty, companyProperty, 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, infoProperty, 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";
|
||||
/**
|
||||
* 查询客户正式表, 如果识别号有正式表数据, copy表用FLOWUNID做来源
|
||||
*/
|
||||
BizObjectManager bomCet = JBOFactory.getBizObjectManager("jbo.app.tenwa.customer.CUSTOMER_INFO",Sqlca);
|
||||
BizObject bo = bomCet.createQuery("certid='"+certId+"'").getSingleResult(false);
|
||||
if(bo!=null) {
|
||||
String CUSTOMERNAME = bo.getAttribute("CUSTOMERNAME").getString();
|
||||
/**
|
||||
* 更新表:
|
||||
* CUSTOMER_INFO_TEMP--> CUSTOMER_INFO
|
||||
*/
|
||||
fromCondtion.clear();
|
||||
fromCondtion.put("flowunid",flowunid);
|
||||
otherProperty.clear();
|
||||
otherProperty.put("customerid", CustId1);
|
||||
infoProperty.clear();
|
||||
infoProperty.put("customerid", CustId1);
|
||||
infoProperty.put("customername", CUSTOMERNAME);
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_INFO.CLASS_NAME, otherProperty, infoProperty, Sqlca);
|
||||
/**
|
||||
* 更新表:
|
||||
* CUSTOMER_PERSON_TEMP-->CUSTOMER_PERSON
|
||||
* CUSTOMER_COMPANY_TEMP-->CUSTOMER_COMPANY
|
||||
*/
|
||||
personProperty.clear();
|
||||
personProperty.put("customerid", CustId1);
|
||||
personProperty.put("FULLNAME", CUSTOMERNAME);
|
||||
companyProperty.clear();
|
||||
companyProperty.put("customerid", CustId1);
|
||||
companyProperty.put("enterprisename", CUSTOMERNAME);
|
||||
if("03".equals(this.getAttribute("CustomerType"))){ // 自然人
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, otherProperty, personProperty, Sqlca);
|
||||
}else{
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_COMPANY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_COMPANY.CLASS_NAME, otherProperty, companyProperty, Sqlca);
|
||||
}
|
||||
/**
|
||||
* 更新表:
|
||||
* CUSTOMER_ADDRESS_TEMP-->CUSTOMER_ADDRESS
|
||||
* CUSTOMER_CERT_TEMP-->CUSTOMER_CERT
|
||||
* CUSTOMER_TYPE_TEMP-->CUSTOMER_TYPE
|
||||
*/
|
||||
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, infoProperty, Sqlca);
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_TYPE_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_TYPE.CLASS_NAME, otherProperty, otherProperty, Sqlca);
|
||||
}else {
|
||||
//更新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();
|
||||
String custName = cibo.getAttribute("customer_name").toString();
|
||||
fromCondtion.put("customerid", custid2);//区别担保人和承租人
|
||||
otherProperty.clear();
|
||||
otherProperty.put("customerid", CustId1);
|
||||
|
||||
//修改CUSTOMER_INFO、CUSTOMER_CERT
|
||||
infoProperty.clear();
|
||||
infoProperty.put("customerid", CustId1);
|
||||
infoProperty.put("customername", custName);
|
||||
//修改CUSTOMER_PERSON
|
||||
personProperty.clear();
|
||||
personProperty.put("customerid", CustId1);
|
||||
personProperty.put("FULLNAME", custName);
|
||||
//更新CUSTOMER_COMPANY
|
||||
companyProperty.clear();
|
||||
companyProperty.put("customerid", CustId1);
|
||||
companyProperty.put("enterprisename", custName);
|
||||
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_INFO_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_INFO.CLASS_NAME, otherProperty, infoProperty, Sqlca);
|
||||
if("03".equals(this.getAttribute("CustomerType"))){ // 自然人
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_PERSON_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_PERSON.CLASS_NAME, otherProperty, personProperty, Sqlca);
|
||||
}else{
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_COMPANY_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_COMPANY.CLASS_NAME, otherProperty, companyProperty, 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, infoProperty, Sqlca);
|
||||
DataOperatorUtil.copySingleJBO(CUSTOMER_TYPE_TEMP.CLASS_NAME, fromCondtion, CUSTOMER_TYPE.CLASS_NAME, otherProperty, otherProperty, Sqlca);
|
||||
}
|
||||
}else{
|
||||
fromCondtion.clear();
|
||||
fromCondtion.put("flowunid",this.getAttribute("FlowUnid").toString());
|
||||
@ -141,32 +191,13 @@ public class LBCustomerRelaTempToFormalBusiness extends BaseBussiness {
|
||||
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);
|
||||
}
|
||||
otherProperty.clear();
|
||||
//otherProperty.put(LB_UNION_LESSEE.CUSTOMER_ID, custid);
|
||||
//otherProperty.put(LB_UNION_LESSEE.PROJECT_ID, ProjectId);
|
||||
otherProperty = this.getDefaultOtherProperty();
|
||||
fromCondtion.clear();
|
||||
fromCondtion.put(LB_UNION_LESSEE_TEMP.FLOWUNID,this.getAttribute("FlowUnid").toString());
|
||||
DataOperatorUtil.copySingleJBO(LB_UNION_LESSEE_TEMP.CLASS_NAME, fromCondtion, LB_UNION_LESSEE.CLASS_NAME, null, otherProperty, Sqlca);
|
||||
//List<BizObject> 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);
|
||||
}*/
|
||||
}
|
||||
//配偶信息不考虑存量客户
|
||||
fromCondtion.clear();
|
||||
|
||||
@ -24,20 +24,17 @@ import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE;
|
||||
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP;
|
||||
import jbo.prd.LB_PRODUCT_CORPUS_SOURCE;
|
||||
import jbo.prd.PRD_SPECIFIC_LIBRARY;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
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.are.util.StringFunction;
|
||||
import com.amarsoft.awe.dw.ui.page.body.imp.Integer;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.context.ASUser;
|
||||
import com.mchange.v2.async.StrandedTaskReporting;
|
||||
import com.tenwa.comm.util.date.DateAssistant;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.flow.baseBussion.BaseBussiness;
|
||||
import com.tenwa.flow.util.FlowUtil;
|
||||
@ -97,6 +94,7 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness {
|
||||
BizObjectManager bmLULT = JBOFactory.getBizObjectManager(LB_UNION_LESSEE_TEMP.CLASS_NAME,tx);
|
||||
BizObjectManager bmLECT = JBOFactory.getBizObjectManager(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME,tx);
|
||||
BizObjectManager bmCI = JBOFactory.getBizObjectManager(CUSTOMER_INFO_TEMP.CLASS_NAME,tx);
|
||||
BizObjectManager bomcct = JBOFactory.getBizObjectManager(CUSTOMER_CERT_TEMP.CLASS_NAME,tx);
|
||||
BizObjectManager bsbom = JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME, tx);
|
||||
String deptid = asUser.getOrgID();
|
||||
String distributoIid="";
|
||||
@ -212,7 +210,7 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness {
|
||||
}
|
||||
}
|
||||
}
|
||||
BizObject bmC = this.saveCustomerInfo(bmCI, tx, asUser,distributoIid);//新增主表客户信息
|
||||
BizObject bmC = this.saveCustomerInfo(bmCI,bomcct, tx, asUser,distributoIid);//新增主表客户信息
|
||||
customerId = bmC.getAttribute("customerid").getString();
|
||||
this.saveCustomerType(bmCTT, tx, customerId,asUser);//证件类型临时表
|
||||
this.savePersonOrCompany(bomC, tx, colName,customerId,asUser,lbat);//自然人||法人
|
||||
@ -229,7 +227,7 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness {
|
||||
return sMessage;
|
||||
}
|
||||
|
||||
private BizObject saveCustomerInfo(BizObjectManager bomCI,JBOTransaction tx,ASUser asUser,String distributoIid)throws Exception{
|
||||
private BizObject saveCustomerInfo(BizObjectManager bomCI,BizObjectManager bomcct,JBOTransaction tx,ASUser asUser,String distributoIid)throws Exception{
|
||||
BizObject bmC = bomCI.newObject();//保存客户信息
|
||||
//客户信息表
|
||||
String custty="03".equals(this.getAttribute("CustomerType"))? "Z":"F";
|
||||
@ -244,6 +242,20 @@ public class LBProjectIntoTempInitCarBusiness extends BaseBussiness {
|
||||
bmC.setAttributeValue("flowunid", this.getAttribute("FlowUnid"));//流程ID
|
||||
bmC.setAttributeValue("inputtime", StringFunction.getTodayNow());//登记时间,系统当前时间
|
||||
bomCI.saveObject(bmC);
|
||||
|
||||
//将注册证件添加到证件表中
|
||||
BizObject newCert = bomcct.newObject();
|
||||
newCert.setAttributeValue("customerid", bmC.getAttribute("customerid").getString());
|
||||
newCert.setAttributeValue("issuecountry","CHN");// 证件国别-没有选项,默认中国吧
|
||||
newCert.setAttributeValue("certtype",this.getAttribute("certtype").toString());
|
||||
newCert.setAttributeValue("certid",this.getAttribute("certid").toString());
|
||||
newCert.setAttributeValue("status","valid");
|
||||
newCert.setAttributeValue("customername",this.getAttribute("custname"));
|
||||
newCert.setAttributeValue("flowunid", this.getAttribute("FlowUnid"));//流程ID
|
||||
newCert.setAttributeValue("inputuserid", asUser.getUserID());
|
||||
newCert.setAttributeValue("inputorgid", asUser.getOrgID());
|
||||
newCert.setAttributeValue("inputtime", DateAssistant.getTodayNow());
|
||||
bomcct.saveObject(newCert);
|
||||
return bmC;
|
||||
}
|
||||
private void savePersonOrCompany(BizObjectManager bomC,JBOTransaction tx,String colName,String customerId,ASUser asUser,BizObject lbat)throws JBOException{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user