74 lines
2.0 KiB
Java
74 lines
2.0 KiB
Java
package com.tenwa.customer.controller.relative;
|
|
|
|
import java.util.List;
|
|
|
|
import jbo.app.tenwa.customer.CUSTOMER_RELATIVE;
|
|
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
import com.amarsoft.are.jbo.BizObjectManager;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.are.jbo.JBOTransaction;
|
|
|
|
public class CustomerRelativeController{
|
|
private String CERTID = "";
|
|
private String id = "";
|
|
private String customer_id = "";
|
|
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getCustomer_id() {
|
|
return customer_id;
|
|
}
|
|
|
|
public void setCustomer_id(String customer_id) {
|
|
this.customer_id = customer_id;
|
|
}
|
|
|
|
public String getCERTID() {
|
|
return CERTID;
|
|
}
|
|
|
|
public void setCERTID(String cERTID) {
|
|
CERTID = cERTID;
|
|
}
|
|
|
|
/**
|
|
* 新增时验证当前客户证件号码有无重复
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String checkCERTID(JBOTransaction tx)throws Exception {
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_RELATIVE.CLASS_NAME);
|
|
tx.join(bom);
|
|
//查询当前客户证件号与此相同且有效的条数
|
|
List<BizObject> CUSTOMER_RELATIVES = bom.createQuery("CUSTOMERID=:CUSTOMERID and CERTID=:CERTID and EFFECT='valid' ").setParameter("CUSTOMERID",customer_id).setParameter("CERTID",CERTID).getResultList(false);
|
|
if(CUSTOMER_RELATIVES != null && CUSTOMER_RELATIVES.size() > 0){
|
|
return "false";
|
|
}
|
|
return "true";
|
|
}
|
|
|
|
/**
|
|
* 修改时验证当前客户证件号码有无重复
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String editcheckCERTID(JBOTransaction tx)throws Exception {
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_RELATIVE.CLASS_NAME);
|
|
tx.join(bom);
|
|
//查询此条以外当前客户证件号与此相同且有效的条数
|
|
List<BizObject> CUSTOMER_RELATIVES = bom.createQuery("CUSTOMERID=:CUSTOMERID and CERTID=:CERTID and EFFECT='valid' and id<>:id").setParameter("CUSTOMERID",customer_id).setParameter("CERTID",CERTID).setParameter("id",id).getResultList(false);
|
|
if(CUSTOMER_RELATIVES != null && CUSTOMER_RELATIVES.size() > 0){
|
|
return "false";
|
|
}
|
|
return "true";
|
|
}
|
|
} |