package com.tenwa.flow.comm.handler; import java.util.List; import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT; import jbo.app.tenwa.customer.CUSTOMER_ADDRESS; import jbo.app.tenwa.customer.CUSTOMER_COMPANY; import jbo.app.tenwa.customer.CUSTOMER_TEL; 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.dw.handler.impl.CommonHandler; /** * * Author: guoshanglei 2017年5月11日 * Tester: * Describe:合同各方-承租人 * History Log: */ public class LBTenantryInfoHandler extends CommonHandler{ //合同各方承租人Info页面数据初始化 @Override protected void initDisplayForAdd(BizObject bo)throws Exception { //获取承租人ID String customerid=this.asPage.getAttribute("customerid").toString(); //承租人 BizObjectManager bom0 = JBOFactory.getBizObjectManager(LB_UNION_LESSEE_TEMP.CLASS_NAME); BizObject LB_UNION_LESSEE_TEMP = bom0.createQuery("CUSTOMER_ID=:CUSTOMER_ID").setParameter("CUSTOMER_ID",customerid).getSingleResult(false); if(LB_UNION_LESSEE_TEMP != null){ //获取承租人姓名 String customername = LB_UNION_LESSEE_TEMP.getAttribute("CUSTOMER_NAME").toString(); //初始化承租人ID bo.setAttributeValue("CLIENT", customerid); //初始化承租人 bo.setAttributeValue("CLIENTNAME", customername); } //联系地址 BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS.CLASS_NAME); //查询当前客户的通讯地址 @SuppressWarnings("unchecked") List CUSTOMER_ADDRESSS = bom.createQuery("customerid=:customerid and isnew='yes' and isadd='yes' order by updatetime desc").setParameter("customerid",customerid).getResultList(false); if(CUSTOMER_ADDRESSS != null && CUSTOMER_ADDRESSS.size() > 0){ BizObject CUSTOMER_ADDRESS = CUSTOMER_ADDRESSS.get(0); //获取地址详情 String dressdetail = CUSTOMER_ADDRESS.getAttribute("dressdetail").toString(); //初始化通讯地址 bo.setAttributeValue("CLIENT_ADDRESS", dressdetail); //获取邮编 String zipcode = CUSTOMER_ADDRESS.getAttribute("zipcode").toString(); //初始化邮编 bo.setAttributeValue("CLIENT_POSTCODE", zipcode); } //高管 BizObjectManager bom1 = JBOFactory.getBizObjectManager(CUSTOMER_COMPANY.CLASS_NAME); //查询高管信息 @SuppressWarnings("unchecked") List CUSTOMER_RELATIVES = bom1.createQuery("CUSTOMERID=:CUSTOMERID").setParameter("CUSTOMERID",customerid).getResultList(false); if(CUSTOMER_RELATIVES != null && CUSTOMER_RELATIVES.size() > 0){ //获取法人代表 String countrytaxno = CUSTOMER_RELATIVES.get(0).getAttribute("countrytaxno").toString(); //初始化法定代表人 bo.setAttributeValue("countrytaxno",countrytaxno); } //联系电话 BizObjectManager bom2 = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME); //查询当前客户联系电话为办公地址的最新联系电话 //BizObject CustomerTelList = bom2.createQuery("customerid=:customerid and isnew='yes' and teltype='030'").setParameter("customerid",customerid).getSingleResult(false); BizObject CustomerTelList = bom2.createQuery("customerid=:customerid and isnew='yes' ").setParameter("customerid",customerid).getSingleResult(false); if(CustomerTelList != null){ //获取联系人 String linkman = CustomerTelList.getAttribute("linkman").toString(); //获取电话 String telephone = CustomerTelList.getAttribute("telephone").toString(); //初始化联系人 bo.setAttributeValue("CLIENT_LINKMAN",linkman); //初始化电话 bo.setAttributeValue("CLIENT_TEL",telephone); //初始化邮箱 bo.setAttributeValue("CLIENT_EMAIL",CustomerTelList.getAttribute("mailbox").toString()); } //查询当前客户联系电话类型为手机的最新联系电话 BizObject CustomerTelList1 = bom2.createQuery("customerid=:customerid and isnew='yes' and teltype='010'").setParameter("customerid",customerid).getSingleResult(false); if(CustomerTelList1 != null){ //获取短信手机号 String telephone = CustomerTelList1.getAttribute("telephone").toString(); //初始化短信手机号 bo.setAttributeValue("CLIENT_MOBILE_NUMBER",telephone); } //账户信息 BizObjectManager bom3 = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT.CLASS_NAME); //查询当前客户联系电话为办公地址的最新联系电话 BizObject CUSTOMER_ACCOUNT = bom3.createQuery("customerid=:customerid and is_main='yes'").setParameter("customerid",customerid).getSingleResult(false); if(CUSTOMER_ACCOUNT != null){ //获取开户帐号 String acc_number = CUSTOMER_ACCOUNT.getAttribute("acc_number").toString(); //获取开户银行 String bank_name = CUSTOMER_ACCOUNT.getAttribute("bank_name").toString(); //获取开户户名 String account = CUSTOMER_ACCOUNT.getAttribute("account").toString(); //初始化开户帐号 bo.setAttributeValue("CLIENT_ACC_NUMBER",acc_number); //初始化开户银行 bo.setAttributeValue("CLIENT_ACC_BANK",bank_name); //初始化开户户名 bo.setAttributeValue("CLIENT_ACC_NAME",account); } super.initDisplayForAdd(bo); } }