apzl_leasing/src_tenwa/com/tenwa/flow/comm/handler/LBSupplierHandler.java
2018-06-03 22:26:41 +08:00

75 lines
3.7 KiB
Java

package com.tenwa.flow.comm.handler;
import java.util.List;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.dw.handler.impl.CommonHandler;
public class LBSupplierHandler extends CommonHandler{
@Override
protected void initDisplayForAdd(BizObject bo) throws Exception {
String customerid=this.asPage.getParameter("customerid");//客户编号
String flow_unid=this.asPage.getParameter("FlowUnid");//流程编号
String customername="";//供应商
String cust_relative_name="";//法人代表
String linkman="";//联系人
String dressdetail="";//注册地址
String linkdressdetail="";//通讯地址
String zipcode="";//邮编
String telephone="";//电话
String seller_acc_number="";//开户账号
String seller_acc_bank="";//开户银行
String seller_acc_name="";//开户户名
//客户基本信息
BizObject cust=JBOFactory.getBizObjectManager("jbo.app.tenwa.customer.CUSTOMER_INFO").createQuery("customerid=:customerid").setParameter("customerid",customerid).getSingleResult(false);
if(cust!=null){
customername=cust.getAttribute("customername").toString();
}
//高管信息表
List<BizObject> cust_relative=JBOFactory.getBizObjectManager("jbo.app.tenwa.customer.CUSTOMER_RELATIVE").createQuery("customerid=:customerid order by inputtime asc").setParameter("customerid",customerid).getResultList(false);
if(cust_relative.size()>0){
BizObject cr=cust_relative.get(cust_relative.size()-1);
cust_relative_name=cr.getAttribute("customername").toString();//最后登记的高管
}
//联系电话中类型为办公电话的最新的联系人
BizObject tel=JBOFactory.getBizObjectManager("jbo.app.tenwa.customer.CUSTOMER_TEL").createQuery("customerid=:customerid and teltype='030' and isnew='yes'").setParameter("customerid",customerid).getSingleResult(false);
if(tel!=null){
linkman=tel.getAttribute("linkman").toString();
telephone=tel.getAttribute("telephone").toString();
}
//该承租人在联系地址信息中的最新的通讯地址
BizObject address=JBOFactory.getBizObjectManager("jbo.app.tenwa.customer.CUSTOMER_ADDRESS").createQuery("customerid=:customerid and addtype='0100' and isnew='yes'").setParameter("customerid",customerid).getSingleResult(false);
if(address!=null){
dressdetail=address.getAttribute("dressdetail").toString();
}
//该承租人在联系地址信息中的注册地址
BizObject linkaddress=JBOFactory.getBizObjectManager("jbo.app.tenwa.customer.CUSTOMER_ADDRESS").createQuery("customerid=:customerid and isadd='yes'").setParameter("customerid",customerid).getSingleResult(false);
if(linkaddress!=null){
linkdressdetail=linkaddress.getAttribute("dressdetail").toString();
zipcode=linkaddress.getAttribute("zipcode").toString();
}
BizObject bank=JBOFactory.getBizObjectManager(jbo.app.tenwa.customer.CUSTOMER_ACCOUNT.CLASS_NAME).createQuery("customerid=:customerid and is_main='yes'").setParameter("customerid",customerid).getSingleResult(false);
if(bank!=null){
seller_acc_number=bank.getAttribute("acc_number").toString();
seller_acc_bank=bank.getAttribute("bank_name").toString();
seller_acc_name=bank.getAttribute("account").toString();
}
bo.setAttributeValue("SELLER", customerid);
bo.setAttributeValue("SELLER_LEGAL_PERSON", cust_relative_name);
bo.setAttributeValue("SELLER_LINKMAN", linkman);
bo.setAttributeValue("SELLER_REGISTER_ADDR",dressdetail);
bo.setAttributeValue("SELLER_ADDR", linkdressdetail);
bo.setAttributeValue("SELLER_POSTCODE", zipcode);
bo.setAttributeValue("SELLER_TEL", telephone);
bo.setAttributeValue("FLOWUNID", flow_unid);
bo.setAttributeValue("seller_acc_number",seller_acc_number);
bo.setAttributeValue("seller_acc_bank",seller_acc_bank);
bo.setAttributeValue("seller_acc_name",seller_acc_name);
super.initDisplayForAdd(bo);
}
}