85 lines
3.1 KiB
Java
85 lines
3.1 KiB
Java
package com.tenwa.flow.fund.copyebank;
|
||
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP;
|
||
import jbo.app.tenwa.calc.LC_RENT_INCOME_TEMP;
|
||
import jbo.com.tenwa.entity.comm.flow.FLOW_WORK_FLAG;
|
||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
|
||
import com.amarsoft.are.jbo.BizObject;
|
||
import com.amarsoft.are.jbo.JBOFactory;
|
||
import com.amarsoft.are.jbo.JBOTransaction;
|
||
import com.amarsoft.awe.util.Transaction;
|
||
import com.tenwa.flow.action.comm.BaseFlowStartAction;
|
||
import com.tenwa.flow.baseBussion.BaseBussiness;
|
||
import com.tenwa.template.check.DefaultBussinessCheck;
|
||
|
||
public class FlowCheck extends DefaultBussinessCheck {
|
||
|
||
@Override
|
||
public Object run(Transaction Sqlca) throws Exception {
|
||
JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||
try{
|
||
String flowunid = this.getAttribute("ObjectNo").toString();
|
||
JBOFactory.getBizObjectManager(FLOW_WORK_FLAG.CLASS_NAME,tx).createQuery("delete from O where flow_unid=:flowunid").setParameter("flowunid", flowunid).executeUpdate();
|
||
BaseFlowStartAction bfsa = new BaseFlowStartAction();
|
||
BaseBussiness bb = new BaseBussiness();
|
||
bb.setAttribute("ObjectNo", flowunid);
|
||
bb.initBussinessParam(tx);
|
||
bfsa.setApplyType(bb.getAttribute("applyType").toString());
|
||
bfsa.initFlowInfo();
|
||
Map<String,String> params = bfsa.getFlowParam();
|
||
params.put("FlowUnid", flowunid);
|
||
bfsa.setFlowParam(params);
|
||
boolean flag = true;
|
||
String message = ",";
|
||
List<String> contractIDs = new ArrayList<String>();
|
||
List<BizObject> bosLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME).createQuery("flowunid=:flowunid").setParameter("flowunid", flowunid).getResultList(false);
|
||
if(bosLFIT.size() > 0){
|
||
for(BizObject bo:bosLFIT){
|
||
String contractID = bo.getAttribute("contract_id").getString();
|
||
if(!contractIDs.contains(contractID)){
|
||
contractIDs.add(contractID);
|
||
}
|
||
}
|
||
}
|
||
List<BizObject> bosLRIT = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME).createQuery("flowunid=:flowunid").setParameter("flowunid", flowunid).getResultList(false);
|
||
if(bosLRIT.size() > 0){
|
||
for(BizObject bo:bosLRIT){
|
||
String contractID = bo.getAttribute("contract_id").getString();
|
||
if(!contractIDs.contains(contractID)){
|
||
contractIDs.add(contractID);
|
||
}
|
||
}
|
||
}
|
||
for(String con:contractIDs){
|
||
bfsa.FlowParam.put("ContractId", con);
|
||
String checkResult = bfsa.flowMutexCheck(tx);
|
||
if(checkResult.length() > 0){
|
||
BizObject boC = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME).createQuery("id=:contractID").setParameter("contractID", con).getSingleResult(false);
|
||
message += "ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD>š<EFBFBD>" + boC.getAttribute("contract_number").getString() + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + checkResult.substring(checkResult.indexOf("<EFBFBD><EFBFBD>")+1, checkResult.indexOf("[")) + "<EFBFBD><EFBFBD>";
|
||
flag = false;
|
||
}else{
|
||
bfsa.flowMutexInfoInit(tx);
|
||
}
|
||
}
|
||
if(!flag){
|
||
message = message.substring(1);
|
||
putMsg(message);
|
||
tx.commit();
|
||
this.setPass(false);
|
||
}else{
|
||
tx.commit();
|
||
putMsg("<EFBFBD><EFBFBD>֤ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
this.setPass(true);
|
||
}
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
tx.rollback();
|
||
}
|
||
return null;
|
||
}
|
||
|
||
}
|