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 com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.awe.util.Transaction; import com.tenwa.flow.action.comm.BaseFlowStartAction; import com.tenwa.flow.baseBussion.BaseBussiness; public class FundCreateFlowMutex extends BaseBussiness { @SuppressWarnings("unchecked") @Override public Object run(Transaction Sqlca) throws Exception { this.initBussinessParam(Sqlca); String flowunid=this.getAttribute("ObjectNo").toString(); JBOFactory.getBizObjectManager(FLOW_WORK_FLAG.CLASS_NAME,Sqlca).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(Sqlca); bfsa.setApplyType(bb.getAttribute("applyType").toString()); bfsa.initFlowInfo(); Map params = bfsa.getFlowParam(); params.put("FlowUnid", flowunid); bfsa.setFlowParam(params); List contractIDs = new ArrayList(); List 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 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); bfsa.flowMutexInfoInit(Sqlca); } String sMessage="true"; return sMessage; } }