2019-08-06 15:17:58 +08:00

109 lines
3.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.tenwa.flow.action.comm;
import jbo.sys.FLOW_LOG;
import jbo.sys.FLOW_TASK;
import com.amarsoft.app.flow.FlowAction;
import com.amarsoft.app.lc.util.DateAssistant;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.biz.workflow.FlowService;
import com.amarsoft.dict.als.manage.NameManager;
public abstract class CommonAction extends BaseTable {
public String ApplyType;
private FlowService flowService;
public String ObjectNo;
public String ObjectType;
public String initFLow(JBOTransaction tx) throws Exception {
return null;
};
//增加一个用于接口调用的发起流程方法, 返回一些需要的信息
public String interfaceInitFlow ( JBOTransaction tx ) throws Exception {
return null;
};
public String deleteFlow(JBOTransaction tx) throws Exception {
this.getFlowService().delete(ObjectNo, ObjectType, tx);
return "success";
}
public String startFlow(JBOTransaction tx, String flowUnid)throws Exception {
String returnValue = "success";
FlowAction flowAction = new FlowAction();
flowAction.setApplyType(getApplyType());
flowAction.setObjectNo(flowUnid);
flowAction.setUserID(this.CurUserID);
String flowActionReturn = flowAction.initFlow(tx);
if ("success".equals(flowActionReturn)) {
BizObjectManager tableEquip = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME);
tx.join(tableEquip);
BizObjectQuery bqDest = tableEquip.createQuery("ObjectNo=:ObjectNo");
bqDest.setParameter("ObjectNo",flowUnid);
BizObject Object = null;
Object = bqDest.getSingleResult(true);// 目标JBO需要做更新操作
// 初始化流程成功,返回成功标识+“@”+任务编号
returnValue = "success" + "@" +Object.getAttribute("SERIALNO").getString();
BizObjectManager flManager = JBOFactory.getBizObjectManager(FLOW_LOG.CLASS_NAME, tx);
BizObject fl = flManager.newObject();
fl.setAttributeValue("taskno", Object.getAttribute("SERIALNO").getString());
fl.setAttributeValue("flowunid", flowUnid);
fl.setAttributeValue("logcontent", NameManager.getUserName(this.CurUserID)+""+DateAssistant.getTodayNow()+"时发起流程");
fl = this.initTabeUserInfo(fl);
flManager.saveObject(fl);
}else{
returnValue = "failed" + "@" + flowAction.getTaskNo();
}
return returnValue;
}
public String getApplyType() {
return ApplyType;
}
public void setApplyType(String applyType) {
ApplyType = applyType;
}
public void setFlowService(FlowService flowService) {
this.flowService = flowService;
}
public FlowService getFlowService() {
if(null==flowService){
this.flowService= new FlowService();
return flowService;
}else{
return flowService;
}
}
public String getObjectNo() {
return ObjectNo;
}
public void setObjectNo(String objectNo) {
ObjectNo = objectNo;
}
public String getObjectType() {
return ObjectType;
}
public void setObjectType(String objectType) {
ObjectType = objectType;
}
}