apzl_leasing/src_tenwa/com/tenwa/flow/comm/handler/BusinessCustomerInfoHandler.java

128 lines
7.3 KiB
Java

package com.tenwa.flow.comm.handler;
import jbo.app.tenwa.customer.CUSTOMER_ADDRESS_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP;
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.are.jbo.JBOTransaction;
import com.amarsoft.awe.dw.handler.impl.CommonHandler;
public class BusinessCustomerInfoHandler extends CommonHandler {
@Override
protected void beforeInsert(JBOTransaction tx, BizObject bo)
throws Exception {
BizObjectManager bomCAT = JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, tx);
BizObject boCAT = bomCAT.newObject();
boCAT.setAttributeValue("customerid", bo.getAttribute("customerid"));
boCAT.setAttributeValue("isadd", "yes");
boCAT.setAttributeValue("isnew", "yes");
boCAT.setAttributeValue("country", "CHN");
boCAT.setAttributeValue("addtype", "0060");
boCAT.setAttributeValue("status", "valid");
boCAT.setAttributeValue("province", bo.getAttribute("province"));
boCAT.setAttributeValue("dressdetail", bo.getAttribute("dressdetail"));
boCAT.setAttributeValue("zipcode", bo.getAttribute("zipcode"));
boCAT.setAttributeValue("fulladdress", bo.getAttribute("fulladdress"));
boCAT.setAttributeValue("flowunid", bo.getAttribute("FLOWUNID"));
bomCAT.saveObject(boCAT);
}
@Override
protected void beforeUpdate(JBOTransaction tx, BizObject bo)
throws Exception {
BizObjectManager bomCAT= JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, tx);
BizObjectManager bomLULT= JBOFactory.getBizObjectManager(LB_UNION_LESSEE_TEMP.CLASS_NAME, tx);
BizObjectManager cftManage = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME, tx);
BizObjectManager lpitManage = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx);
BizObject boCAT=bomCAT.createQuery("customerid=:customerid and flowunid='"+bo.getAttribute("FLOWUNID").getString()+"'").setParameter("customerid", bo.getAttribute("customerid").getString()).getSingleResult(true);
BizObject boLULT=bomLULT.createQuery("customer_id=:customerid and flowunid='"+bo.getAttribute("FLOWUNID").getString()+"'").setParameter("customerid", bo.getAttribute("customerid").getString()).getSingleResult(true);
BizObject lpit=lpitManage.createQuery("flowunid='"+bo.getAttribute("FLOWUNID").getString()+"'").getSingleResult(true);
boLULT.setAttributeValue("customer_name", bo.getAttribute("fullname"));
bomLULT.saveObject(boLULT);
if(boCAT==null){
boCAT=bomCAT.newObject();
boCAT.setAttributeValue("customerid", bo.getAttribute("customerid"));
boCAT.setAttributeValue("flowunid", bo.getAttribute("flowunid"));
boCAT.setAttributeValue("isadd", "yes");
boCAT.setAttributeValue("isnew", "yes");
boCAT.setAttributeValue("country", "CHN");
boCAT.setAttributeValue("addtype", "0060");
}
boCAT.setAttributeValue("addtype", "0060");
boCAT.setAttributeValue("province", bo.getAttribute("province"));
boCAT.setAttributeValue("dressdetail", bo.getAttribute("dressdetail"));
boCAT.setAttributeValue("zipcode", bo.getAttribute("zipcode"));
boCAT.setAttributeValue("fulladdress", bo.getAttribute("fulladdress"));
bomCAT.saveObject(boCAT);
if(!("01".equals(bo.getAttribute("MARRIAGE").getString()))){
BizObject cft = cftManage.createQuery("flowunid=:flowunid and Spouse_='Y'").setParameter("flowunid", bo.getAttribute("flowunid").getString()).getSingleResult(true);
if(cft!=null){
cftManage.deleteObject(cft);
}
}
if(lpit==null){
BizObject lpitNew = lpitManage.newObject();
lpitNew.setAttributeValue("flowunid", bo.getAttribute("flowunid"));
lpitNew.setAttributeValue("IS_NETCAR", bo.getAttribute("IS_NETCAR"));
lpitNew.setAttributeValue("IS_OPERATION", bo.getAttribute("IS_OPERATION"));
lpitNew.setAttributeValue("IS_AFFILIATED", bo.getAttribute("IS_AFFILIATED"));
lpitNew.setAttributeValue("IS_OPERATION_QUALIFICATION", bo.getAttribute("IS_OPERATION_QUALIFICATION"));
lpitNew.setAttributeValue("TRANSPORTCERTID", bo.getAttribute("TRANSPORTCERTID"));
lpitNew.setAttributeValue("AFFILIATEDNAME", bo.getAttribute("AFFILIATEDNAME"));
lpitNew.setAttributeValue("NETCERTNAME", bo.getAttribute("NETCERTNAME"));
lpitNew.setAttributeValue("LEGALPERSONNAME", bo.getAttribute("LEGALPERSONNAME"));
lpitNew.setAttributeValue("AFFILIATEDDATE", bo.getAttribute("AFFILIATEDDATE"));
lpitNew.setAttributeValue("AFFILIATEDENDDATE", bo.getAttribute("AFFILIATEDENDDATE"));
lpitNew.setAttributeValue("REGISTEREDMONEY", bo.getAttribute("REGISTEREDMONEY"));
lpitNew.setAttributeValue("AFFILIATEDACTUALADDRESS", bo.getAttribute("AFFILIATEDACTUALADDRESS"));
lpitNew.setAttributeValue("AFFILIATEDADDRESS", bo.getAttribute("AFFILIATEDADDRESS"));
lpitNew.setAttributeValue("TRANSPORTDATE", bo.getAttribute("TRANSPORTDATE"));
lpitNew.setAttributeValue("NETCERTID", bo.getAttribute("NETCERTID"));
lpitNew.setAttributeValue("LEGALPERSONID", bo.getAttribute("LEGALPERSONID"));
lpitManage.saveObject(lpitNew);
}else{
if("1".equals(bo.getAttribute("IS_NETCAR").toString())){
lpit.setAttributeValue("IS_NETCAR", bo.getAttribute("IS_NETCAR"));
lpit.setAttributeValue("IS_OPERATION", bo.getAttribute("IS_OPERATION"));
lpit.setAttributeValue("IS_AFFILIATED", bo.getAttribute("IS_AFFILIATED"));
lpit.setAttributeValue("IS_OPERATION_QUALIFICATION", bo.getAttribute("IS_OPERATION_QUALIFICATION"));
lpit.setAttributeValue("TRANSPORTCERTID", bo.getAttribute("TRANSPORTCERTID"));
lpit.setAttributeValue("AFFILIATEDNAME", bo.getAttribute("AFFILIATEDNAME"));
lpit.setAttributeValue("NETCERTNAME", bo.getAttribute("NETCERTNAME"));
lpit.setAttributeValue("LEGALPERSONNAME", bo.getAttribute("LEGALPERSONNAME"));
lpit.setAttributeValue("AFFILIATEDDATE", bo.getAttribute("AFFILIATEDDATE"));
lpit.setAttributeValue("AFFILIATEDENDDATE", bo.getAttribute("AFFILIATEDENDDATE"));
lpit.setAttributeValue("REGISTEREDMONEY", bo.getAttribute("REGISTEREDMONEY"));
lpit.setAttributeValue("AFFILIATEDACTUALADDRESS", bo.getAttribute("AFFILIATEDACTUALADDRESS"));
lpit.setAttributeValue("AFFILIATEDADDRESS", bo.getAttribute("AFFILIATEDADDRESS"));
lpit.setAttributeValue("TRANSPORTDATE", bo.getAttribute("TRANSPORTDATE"));
lpit.setAttributeValue("NETCERTID", bo.getAttribute("NETCERTID"));
lpit.setAttributeValue("LEGALPERSONID", bo.getAttribute("LEGALPERSONID"));
}else{
lpit.setAttributeValue("IS_NETCAR", bo.getAttribute("IS_NETCAR"));
lpit.setAttributeValue("IS_OPERATION",null);
lpit.setAttributeValue("IS_AFFILIATED", null);
lpit.setAttributeValue("IS_OPERATION_QUALIFICATION",null );
lpit.setAttributeValue("TRANSPORTCERTID",null);
lpit.setAttributeValue("AFFILIATEDNAME",null );
lpit.setAttributeValue("NETCERTNAME",null );
lpit.setAttributeValue("LEGALPERSONNAME",null );
lpit.setAttributeValue("AFFILIATEDDATE",null );
lpit.setAttributeValue("AFFILIATEDENDDATE",null );
lpit.setAttributeValue("REGISTEREDMONEY",null);
lpit.setAttributeValue("AFFILIATEDACTUALADDRESS",null );
lpit.setAttributeValue("AFFILIATEDADDRESS",null );
lpit.setAttributeValue("TRANSPORTDATE",null);
lpit.setAttributeValue("NETCERTID", null);
lpit.setAttributeValue("LEGALPERSONID", null);
}
lpitManage.saveObject(lpit);
}
}
}