apzl_leasing/calc/com/tenwa/flow/BusinessApplyUserinfo.java
2020-03-13 14:17:07 +08:00

58 lines
2.4 KiB
Java

package com.tenwa.flow;
import java.text.SimpleDateFormat;
import java.util.Date;
import jbo.com.tenwa.entity.comm.flow.BUSINESS_APPLY_USERINFO;
import jbo.sys.FLOW_TASK;
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 BusinessApplyUserinfo extends BaseBussiness{
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String flowunid = this.getAttribute("ObjectNo").toString();
String ProjectId = this.getAttribute("ProjectId").toString();
String FlowName = this.getAttribute("FlowName").toString();
String FlowNo = this.getAttribute("ApplyType").toString();
BizObjectManager ftMange = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME,Sqlca);
BizObject ft = ftMange.createQuery(" O.objectno=:flowunid AND begintime = (SELECT MAX(ft.begintime) FROM jbo.sys.FLOW_TASK ft WHERE O.objectno=ft.objectno AND ft.phaseno='0030') ").setParameter("flowunid", flowunid).getSingleResult(false);
String userId = ft==null?"":ft.getAttribute("userid").toString();
String userName = ft==null?"":ft.getAttribute("username").toString();
String begintime = ft==null?"":ft.getAttribute("begintime").toString();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); //日期格式
String date = sdf.format(new Date()); //将系统时间转换成上方指定类型
BizObjectManager bauMange = JBOFactory.getBizObjectManager(BUSINESS_APPLY_USERINFO.CLASS_NAME,Sqlca);
BizObject bau = bauMange.createQuery(" flow_unid=:flow_unid and flow_phase_no='0030' ").setParameter("flow_unid", flowunid).getSingleResult(true);
if(bau == null){
bau = bauMange.newObject();
bau.setAttributeValue("userid", userId);
bau.setAttributeValue("username", userName);
bau.setAttributeValue("project_id", ProjectId);
bau.setAttributeValue("flow_unid", flowunid);
bau.setAttributeValue("flow_name", FlowName);
bau.setAttributeValue("flow_phase_no", "0030");
bau.setAttributeValue("flow_no", FlowNo);
bau.setAttributeValue("inputtime", date);
}else{
bau.setAttributeValue("userid", userId);
bau.setAttributeValue("username", userName);
bau.setAttributeValue("updatetime", date);
}
bauMange.saveObject(bau);
return "true";
}
}