package com.tenwa.flow.comm.handler; import java.util.UUID; import jbo.app.tenwa.customer.CUSTOMER_ADDRESS_TEMP; import jbo.app.tenwa.customer.CUSTOMER_CERT_TEMP; import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP; 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.handler.impl.CommonHandler; /** * * Author: guoshanglei 2017年5月11日 * Tester: * Describe:担保单位 * History Log: */ public class LBGuaranteeUnitHandler01 extends CommonHandler{ //新增或修改时担保单位验重,担保单位不可重复 /* @Override protected boolean validityCheck(BizObject bo, boolean isInsert){ isInsert = true; try { String ID = bo.getAttribute("ID").toString(); String FlowUnid = bo.getAttribute("FlowUnid").toString(); String ASSUROR = bo.getAttribute("ASSUROR").toString();//获取担保人ID BizObjectManager bom = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME); //根据ID查询担保单位 BizObject LB_GUARANTEE_UNIT_TEMP = bom.createQuery("ASSUROR=:ASSUROR and FLOWUNID=:FLOWUNID").setParameter("ASSUROR",ASSUROR).setParameter("FLOWUNID",FlowUnid).getSingleResult(false); if(LB_GUARANTEE_UNIT_TEMP != null){ if(ID == ""){ this.errors = "担保单位重复,请重新选择!"; isInsert = false;//如果一存在该担保单位,isInsert设置为false }else if(!LB_GUARANTEE_UNIT_TEMP.getAttribute("ID").toString().equals(ID)){ this.errors = "担保单位重复,请重新选择!"; isInsert = false;//如果一存在该担保单位,isInsert设置为false } } } catch (JBOException e) { e.printStackTrace(); }//担保人ID return isInsert; } */ @Override protected void beforeInsert(JBOTransaction tx, BizObject bo) throws Exception { String customerid = bo.getAttribute("ASSUROR").getString(); bo.setAttributeValue("ASSUROR", customerid); BizObjectManager bm=JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME, tx); BizObject cpt=bm.newObject(); cpt.setAttributeValue("FULLNAME", bo.getAttribute("FULLNAME")); cpt.setAttributeValue("SEX", bo.getAttribute("SEX")); cpt.setAttributeValue("DRIVERLICENSE", bo.getAttribute("DRIVERLICENSE")); cpt.setAttributeValue("LICENSENAME", bo.getAttribute("LICENSENAME")); cpt.setAttributeValue("WORKCORP", bo.getAttribute("WORKCORP")); cpt.setAttributeValue("WORKADD", bo.getAttribute("WORKADD"));; cpt.setAttributeValue("title", bo.getAttribute("title")); cpt.setAttributeValue("mobile", bo.getAttribute("mobile")); cpt.setAttributeValue("certtype", bo.getAttribute("certtype")); cpt.setAttributeValue("certid", bo.getAttribute("certid")); cpt.setAttributeValue("FLOWUNID", bo.getAttribute("FLOWUNID")); cpt.setAttributeValue("customerid", customerid); bm.saveObject(cpt); BizObjectManager bom= JBOFactory.getBizObjectManager(CUSTOMER_CERT_TEMP.CLASS_NAME, tx); BizObject cct=bom.newObject(); cct.setAttributeValue("certtype", bo.getAttribute("certtype")); cct.setAttributeValue("certid", bo.getAttribute("certid")); cct.setAttributeValue("FLOWUNID", bo.getAttribute("FLOWUNID")); cct.setAttributeValue("inputorgid",this.curUser.getOrgID()); cct.setAttributeValue("inputuserid", this.curUser.getUserID()); cct.setAttributeValue("inputtime",StringFunction.getNow()); cct.setAttributeValue("customerid", customerid); bom.saveObject(cct); BizObjectManager bomCAT = JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, tx); BizObject boCAT = bomCAT.newObject(); boCAT.setAttributeValue("customerid", customerid); boCAT.setAttributeValue("isadd", "yes"); boCAT.setAttributeValue("isnew", "yes"); boCAT.setAttributeValue("country", "CHN"); 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); tx.commit(); } @Override protected void beforeUpdate(JBOTransaction tx, BizObject bo) throws Exception { String customerid=bo.getAttribute("ASSUROR").getString(); String flowunid=bo.getAttribute("flowunid").getString(); BizObjectManager bm=JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME, tx); BizObject cpt=bm.createQuery("customerid=:customerid and flowunid=:flowunid").setParameter("customerid", customerid).setParameter("flowunid", flowunid).getSingleResult(true); cpt.setAttributeValue("FULLNAME", bo.getAttribute("FULLNAME")); cpt.setAttributeValue("SEX", bo.getAttribute("SEX")); cpt.setAttributeValue("DRIVERLICENSE", bo.getAttribute("DRIVERLICENSE")); cpt.setAttributeValue("LICENSENAME", bo.getAttribute("LICENSENAME")); cpt.setAttributeValue("WORKCORP", bo.getAttribute("WORKCORP")); cpt.setAttributeValue("WORKADD", bo.getAttribute("WORKADD"));; cpt.setAttributeValue("title", bo.getAttribute("title")); cpt.setAttributeValue("mobile", bo.getAttribute("mobile")); cpt.setAttributeValue("certtype", bo.getAttribute("certtype")); cpt.setAttributeValue("certid", bo.getAttribute("certid")); bm.saveObject(cpt); BizObjectManager bom= JBOFactory.getBizObjectManager(CUSTOMER_CERT_TEMP.CLASS_NAME, tx); BizObject cct=bom.createQuery("customerid=:customerid and flowunid='"+flowunid+"'").setParameter("customerid", customerid).getSingleResult(true); cct.setAttributeValue("certtype", bo.getAttribute("certtype")); cct.setAttributeValue("certid", bo.getAttribute("certid")); bom.saveObject(cct); BizObjectManager bomCAT= JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, tx); BizObject boCAT=bomCAT.createQuery("customerid=:customerid and flowunid='"+flowunid+"'").setParameter("customerid", customerid).getSingleResult(true); 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); tx.commit(); } }