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

90 lines
5.7 KiB
Java

package com.tenwa.lease.flow.riskalert;
import jbo.com.tenwa.lease.comm.LB_RISK_ALERT;
import jbo.com.tenwa.lease.comm.LB_RISK_ALERT_TEMP;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.dict.als.manage.NameManager;
import com.tenwa.template.check.DefaultBussinessCheck;
public class LBRiskAlertCheck extends DefaultBussinessCheck {
@Override
public Object run(Transaction Sqlca) throws Exception {
String flowunid=this.getAttribute("ObjectNo").toString();
BizObjectManager lraManager = JBOFactory.getBizObjectManager(LB_RISK_ALERT.CLASS_NAME);
BizObjectManager lratManager = JBOFactory.getBizObjectManager(LB_RISK_ALERT_TEMP.CLASS_NAME);
BizObject lrat = lratManager.createQuery("FLOWUNID=:flowunid ").setParameter("flowunid", flowunid).getSingleResult(false);
String alertObject =lrat.getAttribute("ALERT_OBJECT").toString();
if(alertObject.equals("alert_object01")){
String customerid = lrat.getAttribute("ALERT_CUSTOMER").toString();
BizObject lra = lraManager.createQuery("ALERT_OBJECT='alert_object01' and ALERT_STATUS='valid' and ALERT_CUSTOMER=:customerid").setParameter("customerid",customerid).getSingleResult(false);
BizObject lratOther = lratManager.createQuery("ALERT_OBJECT='alert_object01' and ALERT_STATUS='valid' and ALERT_CUSTOMER=:customerid and FLOWUNID<>:flowunid ").setParameter("customerid",customerid).setParameter("flowunid",flowunid).getSingleResult(false);
if(lra!=null || lratOther!=null){
putMsg(NameManager.getCustomerName(customerid)+"的风险预警在申请中或已申请!");
setPass(false);
}else{
setPass(true);
}
}else if(alertObject.equals("alert_object02")){
String custKind = lrat.getAttribute("ALERT_INDUSTRY").toString();
BizObject lra = lraManager.createQuery("ALERT_OBJECT='alert_object02' and ALERT_STATUS='valid' and ALERT_INDUSTRY=:custkind").setParameter("custkind",custKind).getSingleResult(false);
BizObject lratOther = lratManager.createQuery("ALERT_OBJECT='alert_object02' and ALERT_STATUS='valid' and ALERT_INDUSTRY=:custkind and FLOWUNID<>:flowunid ").setParameter("custkind",custKind).setParameter("flowunid",flowunid).getSingleResult(false);
if(lra!=null || lratOther!=null){
putMsg(NameManager.getItemName("cust_kind", custKind)+"的风险预警在申请中或已申请!");
setPass(false);
}else{
setPass(true);
}
}else if(alertObject.equals("alert_object03")){
String alertCity = lrat.getAttribute("ALERT_CITY").toString();
if(alertCity== null || alertCity.equals("")){
String provice = lrat.getAttribute("ALERT_PROVINCE").toString();
BizObject lra = lraManager.createQuery("ALERT_OBJECT='alert_object03' and ALERT_STATUS='valid' and ALERT_PROVINCE=:provice ").setParameter("provice",provice).getSingleResult(false);
BizObject lratOther = lratManager.createQuery("ALERT_OBJECT='alert_object03' and ALERT_STATUS='valid' and ALERT_PROVINCE=:provice and FLOWUNID<>:flowunid ").setParameter("provice",provice).setParameter("flowunid",flowunid).getSingleResult(false);
if(lra!=null || lratOther!=null){
putMsg(NameManager.getItemName("AreaCode", provice)+"的风险预警在申请中或已申请!");
setPass(false);
}else{
setPass(true);
}
}else{
BizObject lra = lraManager.createQuery("ALERT_OBJECT='alert_object03' and ALERT_STATUS='valid' and ALERT_CITY=:city ").setParameter("city",alertCity).getSingleResult(false);
BizObject lratOther = lratManager.createQuery("ALERT_OBJECT='alert_object03' and ALERT_STATUS='valid' and ALERT_CITY=:city and FLOWUNID<>:flowunid ").setParameter("city",alertCity).setParameter("flowunid",flowunid).getSingleResult(false);
if(lra!=null || lratOther!=null){
putMsg(NameManager.getItemName("AreaCode", alertCity)+"的风险预警在申请中或已申请!");
setPass(false);
}else{
setPass(true);
}
}
}else{
String alertCity = lrat.getAttribute("ALERT_CITY").toString();
String custKind = lrat.getAttribute("ALERT_INDUSTRY").toString();
if(alertCity== null || alertCity.equals("")){
String provice = lrat.getAttribute("ALERT_PROVINCE").toString();
BizObject lra = lraManager.createQuery("ALERT_OBJECT='alert_object04' and ALERT_STATUS='valid' and ALERT_PROVINCE=:provice and ALERT_INDUSTRY=:custkind ").setParameter("provice",provice).setParameter("custkind",custKind).getSingleResult(false);
BizObject lratOther = lratManager.createQuery("ALERT_OBJECT='alert_object04' and ALERT_STATUS='valid' and ALERT_PROVINCE=:provice and ALERT_INDUSTRY=:custkind and FLOWUNID<>:flowunid ").setParameter("provice",provice).setParameter("custkind",custKind).setParameter("flowunid",flowunid).getSingleResult(false);
if(lra!=null || lratOther!=null){
putMsg(NameManager.getItemName("AreaCode", provice)+"+"+NameManager.getItemName("cust_kind", custKind)+"的风险预警在申请中或已申请!");
setPass(false);
}else{
setPass(true);
}
}else{
BizObject lra = lraManager.createQuery("ALERT_OBJECT='alert_object04' and ALERT_STATUS='valid' and ALERT_CITY=:city and ALERT_INDUSTRY=:custkind ").setParameter("city",alertCity).setParameter("custkind",custKind).getSingleResult(false);
BizObject lratOther = lratManager.createQuery("ALERT_OBJECT='alert_object04' and ALERT_STATUS='valid' and ALERT_CITY=:city and ALERT_INDUSTRY=:custkind and FLOWUNID<>:flowunid ").setParameter("city",alertCity).setParameter("custkind",custKind).setParameter("flowunid",flowunid).getSingleResult(false);
if(lra!=null || lratOther!=null){
putMsg(NameManager.getItemName("AreaCode", alertCity)+"+"+NameManager.getItemName("cust_kind", custKind)+"的风险预警在申请中或已申请!");
setPass(false);
}else{
setPass(true);
}
}
}
return null;
}
}