apzl_leasing/src_tenwa/com/tenwa/apzl/comm/FileArchivingInfoTemp.java
2018-10-30 09:34:05 +08:00

42 lines
1.9 KiB
Java

package com.tenwa.apzl.comm;
import java.util.UUID;
import jbo.app.LB_FILE_ARCHIVING_INFO_TEMP;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
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.tenwa.flow.baseBussion.BaseBussiness;
public class FileArchivingInfoTemp extends BaseBussiness{
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String contract_id = this.getAttribute("ContractId").toString();
String flowunid = this.getAttribute("ObjectNo").toString();
//获取合同编号
BizObject contractInfoObject = JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME, "id=:contract_id").setParameter("contract_id", contract_id).getSingleResult(false);
String contract_number = contractInfoObject.getAttribute("contract_number").toString();
BizObjectManager fileArchivingManager = JBOFactory.getBizObjectManager(LB_FILE_ARCHIVING_INFO_TEMP.CLASS_NAME, Sqlca);
BizObject fileArchivingObject = fileArchivingManager.createQuery("contract_id=:contract_id").setParameter("contract_id", contract_id).getSingleResult(true);
if(fileArchivingObject == null){
//新增插入flowunid和contract_id
BizObject bo = fileArchivingManager.newObject();
String id = UUID.randomUUID().toString().replaceAll("-", "");
bo.setAttributeValue("id", id);
bo.setAttributeValue("contract_id", contract_id);
bo.setAttributeValue("contract_number", contract_number);
bo.setAttributeValue("flowunid", flowunid);
fileArchivingManager.saveObject(bo);
}else{
fileArchivingManager.createQuery("update O set flowunid=:flowunid where contract_id=:contract_id")
.setParameter("flowunid", flowunid).setParameter("contract_id", contract_id).executeUpdate();
}
return "true";
}
}