2018-06-03 22:26:41 +08:00

53 lines
1.7 KiB
Java

package com.tenwa.customer.handler.family;
import jbo.app.tenwa.customer.CUSTOMER_FAMILY;
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;
public class CustomerFamily extends CommonHandler{
@Override
protected void initDisplayForAdd(BizObject bo) throws Exception {
String customerId=this.asPage.getParameter("customerId");
bo.setAttributeValue("customerid", customerId);
super.initDisplayForAdd(bo);
}
@Override
protected boolean validityCheck(BizObject bo, boolean isInsert) {
try {
String oldcerttype="";
String oldcertid="";
//查询证件是否存在股东信息表中
String certtype=bo.getAttribute("CERTTYPE").toString();
String id=bo.getAttribute("id").toString();
String certid=bo.getAttribute("CERTID").toString();
if(!("".equals(id))){
BizObjectManager oldbom=JBOFactory.getBizObjectManager(CUSTOMER_FAMILY.CLASS_NAME);
BizObject oldbo1=oldbom.createQuery("id=:id").setParameter("id", id).getSingleResult(false);
oldcerttype=oldbo1.getAttribute("CERTTYPE").toString();
oldcertid=oldbo1.getAttribute("certid").toString();
}
if(!(certtype.equals(oldcerttype)&&certid.equals(oldcertid))){
BizObjectManager bom=JBOFactory.getBizObjectManager(CUSTOMER_FAMILY.CLASS_NAME);
BizObject bo1=bom.createQuery("CERTTYPE=:CERTTYPE and CERTID=:CERTID").setParameter("CERTTYPE", certtype)
.setParameter("CERTID", certid).getSingleResult(false);
if(bo1!=null){
this.errors="证件类型和证件号已经存在";
return false;
}
}
} catch (Exception e) {
// TODO: handle exception
}
return super.validityCheck(bo, isInsert);
}
}