2086 lines
71 KiB
Java
2086 lines
71 KiB
Java
package com.amarsoft.app.flow;
|
||
|
||
import com.amarsoft.amarscript.Any;
|
||
import com.amarsoft.amarscript.ELContext;
|
||
import com.amarsoft.amarscript.Expression;
|
||
import com.amarsoft.app.lc.util.DateAssistant;
|
||
import com.amarsoft.are.ARE;
|
||
import com.amarsoft.are.jbo.*;
|
||
import com.amarsoft.are.lang.StringX;
|
||
import com.amarsoft.are.msg.Message;
|
||
import com.amarsoft.are.msg.SMTPDispatcher;
|
||
import com.amarsoft.are.util.StringFunction;
|
||
import com.amarsoft.are.util.json.JSONDecoder;
|
||
import com.amarsoft.are.util.json.JSONObject;
|
||
import com.amarsoft.awe.util.ASResultSet;
|
||
import com.amarsoft.awe.util.SqlObject;
|
||
import com.amarsoft.awe.util.Transaction;
|
||
import com.amarsoft.biz.workflow.FlowPhase;
|
||
import com.amarsoft.biz.workflow.FlowService;
|
||
import com.amarsoft.biz.workflow.FlowTask;
|
||
import com.amarsoft.biz.workflow.TaskDataObject;
|
||
import com.amarsoft.context.ASUser;
|
||
import com.amarsoft.dict.als.manage.NameManager;
|
||
import com.tenwa.app.manage.constant.PushMessageConstant;
|
||
import com.tenwa.app.manage.util.PushMessageUtil;
|
||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||
import com.tenwa.flow.service.FLowStepEndNotice;
|
||
import com.tenwa.flow.service.FlowUserManageServie;
|
||
import com.tenwa.flow.service.FlowUserManageServieImp;
|
||
import com.tenwa.flow.task.BaseFlowTaskDataService;
|
||
import com.tenwa.flow.task.CommFlowTaskDataService;
|
||
import com.tenwa.flow.task.ProductFlowTaskDataService;
|
||
import com.tenwa.flow.task.TenwaFlowTask;
|
||
import com.tenwa.flow.util.FlowUtil;
|
||
import com.tenwa.officetempalte.util.FileOperatorUtil;
|
||
import com.tenwa.reckon.util.DateUtil;
|
||
import com.tenwa.reckon.util.UUIDUtil;
|
||
import jbo.app.APP_BUSINESS_TEMPLATE;
|
||
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
|
||
import jbo.com.tenwa.entity.comm.flow.FLOW_READER;
|
||
import jbo.com.tenwa.entity.comm.flow.FLOW_STEP_NODE;
|
||
import jbo.com.tenwa.entity.comm.flow.FLOW_WORK_FLAG;
|
||
import jbo.sys.*;
|
||
import org.apache.commons.lang.StringUtils;
|
||
|
||
import java.sql.SQLException;
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.*;
|
||
|
||
//import com.base.util.DateUtil;
|
||
|
||
/**
|
||
*
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ࣨ<EFBFBD><E0A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>runJavaMethodTrans<6E><73><EFBFBD><EFBFBD>, <20><><EFBFBD>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>̡<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>̡<EFBFBD><CCA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ء<EFBFBD><D8A1>˻<EFBFBD> <20>Ȳ<EFBFBD><C8B2><EFBFBD>
|
||
*/
|
||
public class FlowAction {
|
||
private String objectType;
|
||
private String objectNo;
|
||
private String flowNo;
|
||
private String applyType;
|
||
private String phaseNo;
|
||
private String userID;
|
||
private String orgID;
|
||
private String taskNo;
|
||
private String phaseAction;
|
||
private String phaseOpinion;
|
||
private String returnPoint;// <20><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>ʱ,Ҫ<>˻ص<CBBB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ˮ<EFBFBD><CBAE>
|
||
private String recommit;
|
||
private String readUserIds;// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
|
||
private String passReadid;// <20><><EFBFBD><EFBFBD>ID
|
||
private String AssignmentId;// ָ<><D6B8><EFBFBD><EFBFBD>ԱID
|
||
private String AssignSumbitType;// ָ<>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||
private String nextNodeType;
|
||
|
||
private FlowService flowService;
|
||
|
||
// app config
|
||
private String DATA_CODE;
|
||
private String GROUP_CODE;
|
||
private String DATA_NAME;
|
||
private String ISLIST;
|
||
private String ISSHOW;
|
||
private String DATA_POSITION;
|
||
private String ISCONVERT;
|
||
private String DONO;
|
||
private String SORTNO;
|
||
private String[] uids;
|
||
private String uid;
|
||
|
||
public String getObjectType() {
|
||
return objectType;
|
||
}
|
||
|
||
public void setObjectType(String objectType) {
|
||
this.objectType = objectType;
|
||
}
|
||
|
||
public String getObjectNo() {
|
||
return objectNo;
|
||
}
|
||
|
||
public void setObjectNo(String objectNo) {
|
||
this.objectNo = objectNo;
|
||
}
|
||
|
||
public String getFlowNo() {
|
||
return flowNo;
|
||
}
|
||
|
||
public void setFlowNo(String flowNo) {
|
||
this.flowNo = flowNo;
|
||
}
|
||
|
||
public String getApplyType() {
|
||
return applyType;
|
||
}
|
||
|
||
public void setApplyType(String applyType) {
|
||
this.applyType = applyType;
|
||
}
|
||
|
||
public String getPhaseNo() {
|
||
return phaseNo;
|
||
}
|
||
|
||
public void setPhaseNo(String phaseNo) {
|
||
this.phaseNo = phaseNo;
|
||
}
|
||
|
||
public String getUserID() {
|
||
return userID;
|
||
}
|
||
|
||
public void setUserID(String userID) {
|
||
this.userID = userID;
|
||
}
|
||
|
||
public String getOrgID() {
|
||
return orgID;
|
||
}
|
||
|
||
public void setOrgID(String orgID) {
|
||
this.orgID = orgID;
|
||
}
|
||
|
||
public String getTaskNo() {
|
||
return taskNo;
|
||
}
|
||
|
||
public void setTaskNo(String taskNo) {
|
||
this.taskNo = taskNo;
|
||
}
|
||
|
||
public String getPhaseAction() {
|
||
return phaseAction;
|
||
}
|
||
|
||
public void setPhaseAction(String phaseAction) {
|
||
this.phaseAction = phaseAction;
|
||
}
|
||
|
||
public String getPhaseOpinion() {
|
||
return phaseOpinion;
|
||
}
|
||
|
||
public void setPhaseOpinion(String phaseOpinion) {
|
||
this.phaseOpinion = phaseOpinion;
|
||
}
|
||
|
||
public String getReturnPoint() {
|
||
return returnPoint;
|
||
}
|
||
|
||
public void setReturnPoint(String returnPoint) {
|
||
this.returnPoint = returnPoint;
|
||
}
|
||
|
||
public String getRecommit() {
|
||
return recommit;
|
||
}
|
||
|
||
public void setRecommit(String recommit) {
|
||
this.recommit = recommit;
|
||
}
|
||
|
||
public String getReadUserIds() {
|
||
if (null == readUserIds) {
|
||
readUserIds = "";
|
||
}
|
||
return readUserIds;
|
||
}
|
||
|
||
public void setReadUserIds(String readUserIds) {
|
||
this.readUserIds = readUserIds;
|
||
}
|
||
|
||
public String getPassReadid() {
|
||
return passReadid;
|
||
}
|
||
|
||
public void setPassReadid(String passReadid) {
|
||
this.passReadid = passReadid;
|
||
}
|
||
|
||
public FlowAction() {
|
||
flowService = new FlowService();
|
||
}
|
||
|
||
public String getAssignSumbitType() {
|
||
return AssignSumbitType;
|
||
}
|
||
|
||
public void setAssignSumbitType(String assignSumbitType) {
|
||
AssignSumbitType = assignSumbitType;
|
||
}
|
||
|
||
public String getAssignmentId() {
|
||
return AssignmentId;
|
||
}
|
||
|
||
public void setAssignmentId(String assignmentId) {
|
||
AssignmentId = assignmentId;
|
||
}
|
||
|
||
public FlowService getFlowService() {
|
||
return flowService;
|
||
}
|
||
|
||
public void setFlowService(FlowService flowService) {
|
||
this.flowService = flowService;
|
||
}
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>,ֻ<><D6BB><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
private static Set<String> taskSet = new HashSet<>();
|
||
|
||
/**
|
||
* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @return success-<2D><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>; error-<2D><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||
*/
|
||
public String initFlow(JBOTransaction tx) throws Exception {
|
||
flowService.initFlow(applyType, objectNo, userID, tx);
|
||
return "success";
|
||
}
|
||
|
||
/**
|
||
* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @return success-<2D><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>; error-<2D><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||
*/
|
||
public String delete(JBOTransaction tx) throws Exception {
|
||
try {
|
||
/**<2A>ӿ<EFBFBD>ƽ̨ҵ<CCA8><D2B5>ȡ<EFBFBD><C8A1>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>*/
|
||
cancelOpinionLog(tx);
|
||
Map<String, String> condtion = new HashMap<String, String>();
|
||
condtion.put("flow_unid", objectNo);
|
||
BaseFlowTaskDataService deleteTaskService = null;
|
||
if (this.objectType.equals("ProductDefaultObject")) {
|
||
deleteTaskService = new ProductFlowTaskDataService(tx,
|
||
objectNo, this.flowNo, "", this.getFlowStartActionParm(
|
||
tx, objectNo));
|
||
} else {
|
||
deleteTaskService = new CommFlowTaskDataService(tx, objectNo,
|
||
this.flowNo, "", this.getFlowStartActionParm(tx,
|
||
objectNo));
|
||
}
|
||
deleteTaskService.initDeleteNodes();
|
||
deleteTaskService.exectueFlowDelete();
|
||
DataOperatorUtil.deleteJBOByCondtion(FLOW_WORK_FLAG.CLASS_NAME,
|
||
condtion, tx);
|
||
if (!"BusinessApplyFlow".equals(flowNo)) { //ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>״̬
|
||
DataOperatorUtil.deleteJBOByCondtion(
|
||
FLOW_BUSSINESS_OBJECT.CLASS_NAME, condtion, tx);
|
||
condtion.clear();
|
||
condtion.put("flowunid", objectNo);
|
||
DataOperatorUtil.deleteJBOByCondtion(FLOW_STEP_NODE.CLASS_NAME,
|
||
condtion, tx);
|
||
flowService.delete(objectNo, objectType, tx);
|
||
}
|
||
return "success@ɾ<><C9BE><EFBFBD>ɹ<EFBFBD>";
|
||
} catch (Exception e) {
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
return "fail@ɾ<><C9BE>ʧ<EFBFBD><CAA7>";
|
||
}
|
||
}
|
||
|
||
/**<2A>ӿ<EFBFBD>ƽ̨ҵ<CCA8><D2B5>ȡ<EFBFBD><C8A1>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>*/
|
||
public void cancelOpinionLog(JBOTransaction tx) throws JBOException {
|
||
|
||
BizObjectManager fboBm = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME,tx);
|
||
BizObject fboBo = fboBm.createQuery(" select O.FixedFlowParam from O where O.flow_unid=:flow_unid").setParameter("flow_unid",objectNo).getSingleResult(false);
|
||
String fixedFlowParam = fboBo.getAttribute("FixedFlowParam").toString();
|
||
net.sf.json.JSONObject flowParamJson = net.sf.json.JSONObject.fromObject(fixedFlowParam);
|
||
if(!flowParamJson.containsKey("channel"))return;
|
||
String applyType = flowParamJson.getString("ApplyType");
|
||
if(!"ContractBasicInfoChangeApply".equals(applyType)&&!"AccountChangeApply".equals(applyType)){
|
||
return;
|
||
}
|
||
String channel = flowParamJson.getString("channel");;
|
||
String flowunid = flowParamJson.getString("FlowUnid");
|
||
String projectNo = flowParamJson.getString("ProjectNo");
|
||
String applicationNo = flowParamJson.getString("applicationNo");
|
||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss") ;
|
||
String thisDate = dateFormat.format(new Date());
|
||
ASUser asUser=new ASUser(flowParamJson.getString("CurUserID"));
|
||
BizObjectManager ftBm = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME,tx);
|
||
BizObject ftBo = ftBm.createQuery(" SELECT O.begintime FROM O WHERE OBJECTNO=:OBJECTNO AND O.ENDTIME IS NULL AND O.phaseno = '0010'").setParameter("OBJECTNO",flowunid).getSingleResult(false);
|
||
BizObjectManager laolBm = JBOFactory.getBizObjectManager(LM_APPROVAL_OPINION_LOG.CLASS_NAME,tx);
|
||
BizObject laolbo = laolBm.newObject();
|
||
|
||
laolbo.setAttributeValue("CHANNEL",channel);
|
||
laolbo.setAttributeValue("APPLICATION_NO",applicationNo);
|
||
laolbo.setAttributeValue("PROJECT_NO",projectNo);
|
||
laolbo.setAttributeValue("FLOWUNID",flowunid);
|
||
laolbo.setAttributeValue("ITEMNO",applyType);
|
||
laolbo.setAttributeValue("APPROVE_STATUS","CANCEL");
|
||
laolbo.setAttributeValue("APPROVE_BEGINTIME",ftBo.getAttribute("begintime"));
|
||
laolbo.setAttributeValue("APPROVE_ENDTIME",thisDate);
|
||
laolbo.setAttributeValue("PUSH_NUMBER","0");
|
||
laolbo.setAttributeValue("INPUTTIME",thisDate);
|
||
laolbo.setAttributeValue("INPUTUSERID",asUser.getUserID());
|
||
laolbo.setAttributeValue("INPUTORGID",asUser.getOrgID());
|
||
if("ContractBasicInfoChangeApply".equals(applyType)){//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||
laolbo.setAttributeValue("APPROVE_OPINION","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>");
|
||
laolbo.setAttributeValue("PROCESS_NODE","CHANGE_INFORMATION_AFTER_LEASE");
|
||
}else if("AccountChangeApply".equals(applyType)){//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB>ۿ<DBBF><EEBFA8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||
laolbo.setAttributeValue("APPROVE_OPINION","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD>ۿ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>");
|
||
laolbo.setAttributeValue("PROCESS_NODE","CHANGE_ACCOUNT_AFTER_LEASE");
|
||
}
|
||
laolBm.saveObject(laolbo);
|
||
}
|
||
|
||
public Map<String, String> getFlowStartActionParm(JBOTransaction tx,
|
||
String ObjectNo) throws Exception {
|
||
BizObjectManager tableEquip = JBOFactory
|
||
.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME);
|
||
tx.join(tableEquip);
|
||
BizObjectQuery bqDest = tableEquip.createQuery("flow_unid=:flowunid");
|
||
bqDest.setParameter("flowunid", ObjectNo);
|
||
BizObject flowBussinessObject = bqDest.getSingleResult(true);// Ŀ<><C4BF>JBO<42><4F><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>
|
||
Map<String, String> mapParam = new HashMap<String, String>();
|
||
if (flowBussinessObject != null) {
|
||
mapParam.put("ProjectId",
|
||
flowBussinessObject.getAttribute("Proj_id").getString());
|
||
mapParam.put("ContractId",
|
||
flowBussinessObject.getAttribute("Contract_id").getString());
|
||
mapParam.put("FlowUnid",
|
||
flowBussinessObject.getAttribute("Flow_unid").getString());
|
||
mapParam.put("FlowKey", flowBussinessObject
|
||
.getAttribute("Flow_key").getString());
|
||
String fixedParam = flowBussinessObject.getAttribute(
|
||
"FixedFlowParam").getString();
|
||
if (fixedParam.length() > 0 && (!fixedParam.equals("[]"))) {
|
||
JSONObject jsonFixedFlowParam = JSONDecoder.decode(fixedParam);
|
||
mapParam.putAll(FileOperatorUtil
|
||
.getJsonObjectToMap(jsonFixedFlowParam));
|
||
}
|
||
|
||
}
|
||
return mapParam;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xuyunlong <20><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݹ鵵
|
||
*
|
||
* @param tx
|
||
* @throws Exception
|
||
*/
|
||
public void PhaseInfoArchive(String sFlowNo, String sPhaseNo,
|
||
String sObjectType, String sObjectNo, String sTaskNo,
|
||
String suerId, String sorgId, JBOTransaction tx) throws Exception {
|
||
|
||
Map<String, String> condtion = new HashMap<String, String>();
|
||
condtion.put("flow_unid", sObjectNo);
|
||
BaseFlowTaskDataService dataTaskService = null;
|
||
if (sObjectType.equals("ProductDefaultObject")) {
|
||
dataTaskService = new ProductFlowTaskDataService(tx, sObjectNo,
|
||
sFlowNo, sTaskNo,
|
||
this.getFlowStartActionParm(tx, sObjectNo));
|
||
} else {
|
||
dataTaskService = new CommFlowTaskDataService(tx, sObjectNo,
|
||
sFlowNo, sTaskNo,
|
||
this.getFlowStartActionParm(tx, sObjectNo));
|
||
}
|
||
dataTaskService.initPhaseNodes();
|
||
//dataTaskService.phaseFlowStepData();
|
||
//δȷ<CEB4><C8B7><EFBFBD>ӿڷ<D3BF><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD><CCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3>Ĵ˷<C4B4><CBB7><EFBFBD>
|
||
dataTaskService.phaseFlowStepData( sPhaseNo );
|
||
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>objectType,objectNo<4E><6F>FLOW_TASK<53>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>phaseNo<4E><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>ύʱ<E1BDBB><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ύ
|
||
*
|
||
* @return curPhaseNo--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>phaseNo
|
||
*/
|
||
public String getCurPhaseNo(JBOTransaction tx) throws Exception {
|
||
String curPhaseNo = "";
|
||
String endTime="";
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery(
|
||
"select phaseNo,endtime from O where SERIALNO=:SERIALNO")
|
||
.setParameter("SERIALNO", this.getTaskNo()).getSingleResult(false);
|
||
if (bo != null){
|
||
curPhaseNo = bo.getAttribute("phaseNo").getString();
|
||
if(bo.getAttribute("endtime")!=null){
|
||
endTime=bo.getAttribute("endtime").getString();
|
||
}
|
||
}
|
||
if(endTime.length()>0){curPhaseNo = "";}
|
||
return curPhaseNo;
|
||
}
|
||
|
||
/**
|
||
* <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ύ
|
||
*/
|
||
public String isCommited(JBOTransaction tx) throws Exception {
|
||
String sRet = "no";
|
||
BizObject bo = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME)
|
||
.createQuery("select EndTime from O where SerialNo=:taskNo")
|
||
.setParameter("taskNo", taskNo).getSingleResult(false);
|
||
if (bo != null) {
|
||
if (!StringX.isEmpty(bo.getAttribute("EndTime").getString()))
|
||
sRet = "yes";
|
||
}
|
||
tx.commit();
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>taskNo<4E><6F><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @return yes-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; no-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
||
*/
|
||
public String isSignOpinion(JBOTransaction tx) throws Exception {
|
||
String sRet = "no";
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_OPINION", tx)
|
||
.createQuery("select serialNo from O where serialNo=:taskNo")
|
||
.setParameter("taskNo", taskNo).getSingleResult(false);
|
||
BizObject bo1 = JBOFactory.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery("select phaseno from O where serialNo=:taskNo")
|
||
.setParameter("taskNo", taskNo).getSingleResult(false);
|
||
String phaseno = bo1.getAttribute("phaseno").getString();
|
||
if (bo != null || "0010".equals(phaseno)) {
|
||
sRet = "yes";
|
||
}
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @return success-<2D><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>; error-<2D><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||
*/
|
||
public String takeBack(JBOTransaction tx) throws Exception {
|
||
String taskSerialNo = "";// <20><><EFBFBD><EFBFBD>objectType,objectNo,flowNo,userID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery(
|
||
"select serialNo,RelativeSerialNo from O "
|
||
+ " where objectType=:objectType and objectNo=:objectNo and flowNo=:flowNo and userID=:userID and endTime is not null order by beginTime desc")
|
||
.setParameter("objectType", objectType)
|
||
.setParameter("objectNo", objectNo)
|
||
.setParameter("flowNo", flowNo).setParameter("userID", userID)
|
||
.getSingleResult(false);
|
||
if (bo != null) {
|
||
taskSerialNo = bo.getAttribute("serialNo").getString();
|
||
} else {// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
return "success";
|
||
}
|
||
// <20>½<C2BD><D7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
List list = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_OPINION", tx)
|
||
.createQuery(
|
||
"select O.serialNo from O,jbo.sys.FLOW_TASK FT where O.serialNo=FT.serialNo and FT.RelativeSerialNo =:RelativeSerialNo ")
|
||
.setParameter("RelativeSerialNo", taskSerialNo)
|
||
.getResultList(false);
|
||
if (list != null && list.size() > 0) {
|
||
ARE.getLog().info("<EFBFBD>½<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD>");
|
||
return "<EFBFBD>½<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD>";
|
||
}
|
||
String rv = flowService.takeBack(taskSerialNo, tx);// 0Ϊ<30>ɹ<EFBFBD> 1Ϊʧ<CEAA><CAA7>
|
||
if ("0".equals(rv))
|
||
return "success";
|
||
else
|
||
return rv;
|
||
}
|
||
|
||
/**
|
||
* <20>˻<EFBFBD>ǰһ<C7B0><D2BB>
|
||
*
|
||
* @return success-<2D><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>; error-<2D><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||
*/
|
||
public String backStep(JBOTransaction tx) throws Exception {
|
||
|
||
BizObjectManager ftManager = JBOFactory.getBizObjectManager(
|
||
"jbo.sys.FLOW_TASK", tx);
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵ı<CCB5><C4B1>ţ<EFBFBD><C5A3>α<D7B6><CEB1>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xuyunlong:<3A>˻ع鵵
|
||
BizObject ft = ftManager
|
||
.createQuery(
|
||
"select O.flowno,O.phaseno,O.objecttype,O.objectno,O.userid,O.orgid from O where serialNo=:serialNo ")
|
||
.setParameter("serialNo", taskNo).getSingleResult(false);
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1>浽<EFBFBD><E6B5BD>ʷ<EFBFBD><CAB7>¼<EFBFBD><C2BC>
|
||
PhaseInfoArchive(ft.getAttribute("flowno").getString(), ft
|
||
.getAttribute("phaseno").getString(),
|
||
ft.getAttribute("objecttype").getString(),
|
||
ft.getAttribute("objectno").getString(), taskNo, ft
|
||
.getAttribute("userid").getString(),
|
||
ft.getAttribute("orgid").getString(), tx);
|
||
String rv = flowService.backStep(taskNo, tx);
|
||
if ("0".equals(rv))
|
||
return "success";
|
||
else
|
||
return "error";
|
||
}
|
||
|
||
/**
|
||
* <20>˻ص<CBBB>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>̽ڵ<CCBD>
|
||
*
|
||
* @param ReturnPoint
|
||
* ָ<><D6B8><EFBFBD>˻ص<CBBB>
|
||
* @throws Exception
|
||
* */
|
||
public String returnTask(JBOTransaction tx) throws Exception {
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1>浽<EFBFBD><E6B5BD>ʷ<EFBFBD><CAB7>¼<EFBFBD><C2BC>
|
||
BizObjectManager ftManager = JBOFactory.getBizObjectManager(
|
||
"jbo.sys.FLOW_TASK", tx);
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵ı<CCB5><C4B1>ţ<EFBFBD><C5A3>α<D7B6><CEB1>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xuyunlong:<3A>˻ع鵵
|
||
BizObject ft = ftManager
|
||
.createQuery(
|
||
"select O.flowno,O.phaseno,O.objecttype,O.objectno,O.userid,O.orgid from O where serialNo=:serialNo ")
|
||
.setParameter("serialNo", taskNo).getSingleResult(false);
|
||
|
||
String objectNo = ft.getAttribute("objectno").getString();
|
||
|
||
BizObject boFBO = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME, tx)
|
||
.createQuery("flow_unid = '" + objectNo + "'").getSingleResult(false);
|
||
|
||
String fixedFlowParam = boFBO.getAttribute("FixedFlowParam").getString();
|
||
|
||
JSONObject jsonFixedFlowParam = JSONDecoder.decode(fixedFlowParam.replaceAll("@", ","));
|
||
Map<String, String> scriptMap = FileOperatorUtil.getJsonObjectToMap(jsonFixedFlowParam);
|
||
|
||
scriptMap.put("ObjectNo", objectNo);
|
||
|
||
BizObjectManager bm1 = JBOFactory.getFactory().getManager(FLOW_MODEL.CLASS_NAME);
|
||
BizObjectQuery bq1 = bm1
|
||
.createQuery(
|
||
"SELECT o.BACKSCRIPT FROM O where O.flowno=:flowno and O.phaseno='" + ft.getAttribute("phaseno").getString() + "'")
|
||
.setParameter("flowno", ft.getAttribute("flowno").getString());
|
||
BizObject stepConfig = bq1.getSingleResult(false);
|
||
String strScript = stepConfig.getAttribute("BACKSCRIPT").getString();
|
||
if (null != strScript && strScript.length() > 5) {
|
||
ELContext context = new ELContext();
|
||
context.setJBOTransaction(tx);
|
||
for (String key : scriptMap.keySet()) {
|
||
context.defineVarible("#" + key, scriptMap.get(key));
|
||
}
|
||
context.defineBean("flowBussinessObject", boFBO);
|
||
|
||
Any returnData = Expression.getExpressionValue(strScript, context);
|
||
}
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObjectManager utdbom = JBOFactory.getBizObjectManager(USER_TASK_DATA.CLASS_NAME, tx);
|
||
BizObjectManager utibom = JBOFactory.getBizObjectManager(USER_TASK_INFO.CLASS_NAME, tx);
|
||
BizObject utdbo = utdbom.createQuery("taskno = '" + taskNo + "' and userid = '" + ft.getAttribute("userid").toString() + "' and (status = 'approve_status01' or status = 'approve_status03')").getSingleResult(true);
|
||
if(utdbo != null) {
|
||
int taskNumber = utibom.createQuery("userid = '" + utdbo.getAttribute("userid")
|
||
+ "' and roleid = '" + utdbo.getAttribute("roleid") + "'").getSingleResult(false).getAttribute("task_number").getInt();
|
||
ARE.getLog().info("***********<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־***:Ϊ"+ taskNo + "<EFBFBD><EFBFBD>" + utdbo.getAttribute("userid") + "<EFBFBD>û<EFBFBD><EFBFBD>ر<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰδ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ" + taskNumber);
|
||
String status = utdbo.getAttribute("status").toString();
|
||
if("approve_status01".equals(status)) {
|
||
utibom.createQuery("update O set task_number = task_number - 1 where userid = '" + utdbo.getAttribute("userid")
|
||
+ "' and roleid = '" + utdbo.getAttribute("roleid") + "'").executeUpdate();
|
||
}
|
||
utdbo.setAttributeValue("status", "approve_status02");
|
||
utdbo.setAttributeValue("endtime", StringFunction.getTodayNow());
|
||
utdbom.saveObject(utdbo);
|
||
}
|
||
|
||
PhaseInfoArchive(ft.getAttribute("flowno").getString(), ft
|
||
.getAttribute("phaseno").getString(),
|
||
ft.getAttribute("objecttype").getString(),
|
||
ft.getAttribute("objectno").getString(), taskNo, ft
|
||
.getAttribute("userid").getString(),
|
||
ft.getAttribute("orgid").getString(), tx);
|
||
|
||
flowService.returnTask(taskNo, returnPoint,
|
||
("Y".equalsIgnoreCase(recommit) ? taskNo : ""), tx);
|
||
//<2F><><EFBFBD>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>֪ͨ
|
||
new FLowStepEndNotice().StepEndNotice(tx, ft.getAttribute("objectno").getString(),this.taskNo,"back");
|
||
|
||
return "<EFBFBD>˻سɹ<EFBFBD>";
|
||
}
|
||
|
||
/**
|
||
* <20>˻ز<CBBB><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @param ReturnPoint
|
||
* ָ<><D6B8><EFBFBD>˻ص<CBBB>
|
||
* @throws Exception
|
||
* */
|
||
public String returnSupply(JBOTransaction tx) throws Exception {
|
||
String sql = "select min(SerialNo) as v.minSerialNo from O where ObjectType =:ObjectType and ObjectNo =:ObjectNo ";
|
||
BizObject bo = JBOFactory.getBizObjectManager("jbo.sys.FLOW_TASK")
|
||
.createQuery(sql).setParameter("ObjectType", objectType)
|
||
.setParameter("ObjectNo", objectNo).getSingleResult(false);
|
||
if (bo != null) {
|
||
flowService.returnSupply(taskNo, bo.getAttribute("minSerialNo")
|
||
.getString(), tx);
|
||
}
|
||
return "success";
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||
*
|
||
* @return taskSerialNo-<2D><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>; ""-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; "error"-<2D><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||
*/
|
||
public String fetchTask(JBOTransaction tx) throws Exception {
|
||
String sRet = flowService.fetchTask(userID, flowNo, phaseNo, tx);
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻ص<CBBB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @return success-<2D><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>; error-<2D><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||
*/
|
||
public String returnTaskToPool(JBOTransaction tx) throws Exception {
|
||
flowService.returnTaskToPool(objectNo, objectType, phaseNo, flowNo, tx);
|
||
return "success";
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*/
|
||
public String changeOperator(JBOTransaction tx) throws Exception {
|
||
BizObject userBO = JBOFactory
|
||
.getBizObjectManager("jbo.sys.USER_INFO")
|
||
.createQuery(
|
||
"select O.userName,OI.OrgID,OI.OrgName "
|
||
+ "from O,jbo.sys.ORG_INFO OI where O.userID=:userID and O.belongOrg=OI.orgID")
|
||
.setParameter("userID", AssignmentId).getSingleResult(false);
|
||
if (userBO != null) {
|
||
this.initFlowTaskUserHis(tx);
|
||
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD>˵<EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FlowTask tf = new FlowTask(taskNo, tx);
|
||
userID = tf.UserID;
|
||
JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK")
|
||
.createQuery(
|
||
"update O set userID=:userID,userName=:userName,orgID=:orgID,orgName=:orgName where serialNo=:serialNo")
|
||
.setParameter("serialNo", taskNo)
|
||
.setParameter("userID", AssignmentId)
|
||
.setParameter("userName",
|
||
userBO.getAttribute("userName").getString())
|
||
.setParameter("orgID",
|
||
userBO.getAttribute("orgID").getString())
|
||
.setParameter("orgName",
|
||
userBO.getAttribute("orgName").getString())
|
||
.executeUpdate();
|
||
String role = tf.PhaseOpinion4;
|
||
String curRole = role;
|
||
Transaction tran = Transaction.createTransaction(tx);
|
||
ASUser user = ASUser.getUser(AssignmentId, tran);
|
||
if(!"".equals(role)) {
|
||
String now = StringFunction.getTodayNow().replaceAll(":", "<EFBFBD><EFBFBD>");
|
||
SqlObject sql = null;
|
||
ArrayList<String> ss = user.getRoleTable();
|
||
if(user.getRoleTable().contains(role)) {
|
||
sql = new SqlObject(("insert into user_task_data "
|
||
+ "select REPLACE(UUID(), '-', '') ,'" + AssignmentId + "', roleid, flowno, flowunid, project_id, contract_id, '" + now + "', endtime,"
|
||
+ " 'approve_status01', taskno"
|
||
+ " from user_task_data where userid = '" + userID + "' and taskno = '" + taskNo + "' and (status = 'approve_status01' or status = 'approve_status03')"));
|
||
sql.setDebugSql(sql.getDebugSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
sql.setOriginalSql(sql.getOriginalSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
sql.setRunSql(sql.getRunSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
tran.executeSQL(sql);
|
||
sql = new SqlObject("update user_task_info set task_number = task_number + 1 "
|
||
+ " where userid = '" + AssignmentId + "' and roleid = '" + curRole + "'");
|
||
tran.executeSQL(sql);
|
||
} else {
|
||
role = user.getRoleTable().get(0);
|
||
}
|
||
sql = new SqlObject("update user_task_data set endtime = '" + now + "',status = 'approve_status04'"
|
||
+ " where userid = '" + userID + "' and taskno = '" + taskNo + "' and (status = 'approve_status01' or status = 'approve_status03')");
|
||
sql.setDebugSql(sql.getDebugSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
sql.setOriginalSql(sql.getOriginalSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
sql.setRunSql(sql.getRunSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
tran.executeSQL(sql);
|
||
sql = new SqlObject("update user_task_info set task_number = task_number - 1 "
|
||
+ " where userid = '" + userID + "' and roleid = '" + curRole + "' and task_number >=1 ");
|
||
tran.executeSQL(sql);
|
||
}
|
||
}
|
||
return "";
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>ʷ
|
||
*
|
||
* @param tx
|
||
* @throws Exception
|
||
*/
|
||
public void initFlowTaskUserHis(JBOTransaction tx) throws Exception {
|
||
BizObject userBO = JBOFactory
|
||
.getBizObjectManager("jbo.sys.USER_INFO")
|
||
.createQuery(
|
||
"select O.userName,OI.OrgID,OI.OrgName "
|
||
+ "from O,jbo.sys.ORG_INFO OI where O.userID=:userID and O.belongOrg=OI.orgID")
|
||
.setParameter("userID", this.userID).getSingleResult(false);
|
||
BizObject task = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME)
|
||
.createQuery("select * from o where O.serialNo=:taskNo")
|
||
.setParameter("taskNo", this.taskNo).getSingleResult(false);
|
||
BizObjectManager flowUser = JBOFactory
|
||
.getBizObjectManager(FLOW_TASK_USER_HIS.CLASS_NAME);
|
||
tx.join(flowUser);
|
||
BizObject bo = flowUser.newObject();
|
||
bo.setAttributeValue("TaskNo", this.taskNo);
|
||
bo.setAttributeValue("SourceUser", task.getAttribute("USERID")
|
||
.getString());
|
||
bo.setAttributeValue("newUser", AssignmentId);
|
||
bo.setAttributeValue("inputuser", this.userID);
|
||
bo.setAttributeValue("INPUTORGID", userBO.getAttribute("orgID")
|
||
.getString());
|
||
bo.setAttributeValue("inputtime", DateAssistant.getTodayNow());
|
||
flowUser.saveObject(bo);
|
||
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1><EFBFBD>̽<EFBFBD><CCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String getFlowEndRelativeTaskNo(JBOTransaction tx) throws Exception {
|
||
String taskSerialNo = "";
|
||
if (phaseNo.equals("1000") || phaseNo.equals("8000")) {
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery("select RELATIVESERIALNO from O where ObjectNo =:ObjectNo and PhaseNo =:PhaseNo ")
|
||
.setParameter("ObjectNo", objectNo)
|
||
.setParameter("PhaseNo", phaseNo)
|
||
.getSingleResult(false);
|
||
if (bo != null)
|
||
taskSerialNo = bo.getAttribute("RELATIVESERIALNO").getString();
|
||
|
||
}
|
||
return taskSerialNo;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>flow_object<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡδ<C8A1><CEB4><EFBFBD>ɵ<EFBFBD>flow_task<73><6B>ˮ<EFBFBD><CBAE>
|
||
*
|
||
* @return taskSerialNo
|
||
*/
|
||
public String getUnfinishedTaskNo(JBOTransaction tx) throws Exception {
|
||
String taskSerialNo = "";
|
||
BizObject bo = null;
|
||
if (phaseNo.equals("1000") || phaseNo.equals("8000")) {
|
||
bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery(
|
||
"select RELATIVESERIALNO from O where ObjectNo =:ObjectNo and PhaseNo =:PhaseNo ")
|
||
.setParameter("ObjectNo", objectNo)
|
||
|
||
.setParameter("PhaseNo", phaseNo)
|
||
|
||
.getSingleResult(false);
|
||
|
||
if (bo != null)
|
||
taskSerialNo = bo.getAttribute("RELATIVESERIALNO").getString();
|
||
|
||
} else if(phaseNo.equals("8001")){
|
||
bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery("select SERIALNO from O where ObjectNo =:ObjectNo and PhaseNo ='0010' ")
|
||
.setParameter("ObjectNo", objectNo)
|
||
.getSingleResult(false);
|
||
if (bo != null)
|
||
taskSerialNo = bo.getAttribute("SERIALNO").getString();
|
||
} else {
|
||
bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery(
|
||
"select SerialNo from O where ObjectType =:ObjectType and ObjectNo =:ObjectNo and FlowNo =:FlowNo and PhaseNo =:PhaseNo "
|
||
+ " and (PhaseAction is null or PhaseAction='') and (UserID =:UserID or AgentUserID=:agentuserid or UserID in (SELECT fu.sourceUser FROM "
|
||
+ FLOW_ENTRUSTED_USER.CLASS_NAME
|
||
+ " fu WHERE fu.NewUser=:newuser) ) and (EndTime is null or EndTime ='') order by serialNo desc ")
|
||
.setParameter("ObjectType", objectType)
|
||
.setParameter("ObjectNo", objectNo)
|
||
.setParameter("FlowNo", flowNo)
|
||
.setParameter("PhaseNo", phaseNo)
|
||
.setParameter("UserID", userID)
|
||
.setParameter("agentuserid", userID)
|
||
.setParameter("newuser", userID).getSingleResult(false);
|
||
if (bo != null)
|
||
taskSerialNo = bo.getAttribute("SerialNo").getString();
|
||
}
|
||
return taskSerialNo;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>flowNo,phaseNo<4E>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؽڵ<D8BD>
|
||
*
|
||
* @return yes-<2D><>; no-<2D><>; error-<2D><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
||
*/
|
||
public String isPoolSubmit(JBOTransaction tx) throws Exception {
|
||
String sRet = "no";
|
||
String NodeType = flowService.getNodeProperty(flowNo, phaseNo, tx);
|
||
if (!StringX.isEmpty(NodeType)
|
||
&& NodeType.toUpperCase().contains("POOL")) {
|
||
sRet = "yes";
|
||
}
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>flowNo,phaseNo<4E>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ڵ<EFBFBD>
|
||
*
|
||
* @return yes-<2D><>; no-<2D><>; error-<2D><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
||
*/
|
||
public String isMeeting(JBOTransaction tx) throws Exception {
|
||
String sRet = "no";
|
||
String NodeType = flowService.getNodeProperty(flowNo, phaseNo, tx);
|
||
if (!StringX.isEmpty(NodeType)
|
||
&& NodeType.toUpperCase().contains("MEETING")) {
|
||
sRet = "yes";
|
||
}
|
||
if (sRet.equals("no")) {
|
||
if (isMultiUsers(tx).equals("Y")) {
|
||
sRet = "yes";
|
||
}
|
||
}
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>taskNo,phaseOpinion<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>θ<D7B6><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>κš<CEBA><C5A1><EFBFBD>һ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @return <20><><EFBFBD><EFBFBD>һ<EFBFBD>θ<D7B6><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>κš<CEBA><C5A1><EFBFBD>һ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD>
|
||
*/
|
||
public String getNextPhaseNumAndInfo(Transaction Sqlca) throws Exception {
|
||
String sRet = "", sPhaseNos = "", sPhaseNames = "";
|
||
FlowTask ft = new FlowTask(taskNo, Sqlca);
|
||
FlowPhase[] fps = ft.getNextFlowPhase("", phaseOpinion);
|
||
sRet = "" + fps.length;
|
||
for (int i = 0; i < fps.length; i++) {
|
||
sPhaseNos += fps[i].PhaseNo;
|
||
sPhaseNames += fps[i].PhaseName;
|
||
if (i < fps.length - 1) {
|
||
sPhaseNos += "|";
|
||
sPhaseNames += "|";
|
||
}
|
||
}
|
||
sRet = sRet + "@" + sPhaseNos + "@" + sPhaseNames;
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1>һ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @param tx
|
||
* @return
|
||
*/
|
||
public String getNextPhaseAttr(JBOTransaction tx) throws Exception {
|
||
return flowService.getNextPhaseAttr(tx, taskNo, phaseOpinion);
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1>һ<EFBFBD><EFBFBD><D7B6><EFBFBD>Ϣ
|
||
*
|
||
* @param trans
|
||
* @return
|
||
*/
|
||
public String getNextPhaseInfo(JBOTransaction trans) throws Exception {
|
||
String returnMessage = flowService.getNextPhaseInfo(trans, taskNo,
|
||
phaseAction, phaseOpinion);
|
||
return returnMessage;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD>ݵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>Ա
|
||
*
|
||
* @param trans
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String getPassActionList(JBOTransaction trans) throws Exception {
|
||
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", trans)
|
||
.createQuery(
|
||
"select flowmodel.ATTRIBUTE10,O.userid,O.objectno from O ,jbo.sys.FLOW_MODEL flowmodel where O.FLOWNO=flowmodel.flowno and O.PHASENO=flowmodel.phaseno and O.serialno=:taskno")
|
||
.setParameter("taskno", this.taskNo).getSingleResult(false);
|
||
String passReader = bo.getAttribute("ATTRIBUTE10").getString();
|
||
String userid = bo.getAttribute("userid").getString();
|
||
this.objectNo = bo.getAttribute("objectno").getString();
|
||
if (passReader == null || passReader.length() == 0) {
|
||
return "";
|
||
} else {
|
||
FlowUserManageServie fUserManager = new FlowUserManageServieImp(
|
||
trans, new ASUser(userid));
|
||
Map<String, String> model = new HashMap<String, String>();
|
||
model.put("flowunid", this.objectNo);
|
||
model.put("objectno", this.objectNo);
|
||
model.put("taskno", this.taskNo);
|
||
Map<String, String> mapPassReader = fUserManager
|
||
.getFlowOperatorUser(model, passReader);
|
||
fUserManager.closeTransaction();
|
||
String returnReader = "";
|
||
for (String key : mapPassReader.keySet()) {
|
||
if (returnReader.length() > 0) {
|
||
returnReader += "@";
|
||
}
|
||
returnReader = returnReader + key + " "
|
||
+ mapPassReader.get(key);
|
||
}
|
||
return returnReader;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1>Ա<EFBFBD>б<EFBFBD>
|
||
*
|
||
* @param trans
|
||
* @return
|
||
*/
|
||
public String getActionList(JBOTransaction trans) throws Exception {
|
||
String returnMessage = "";
|
||
String actionStr = "", aUserID = "", aRoleID = "";
|
||
String aUserName = "", aRoleName = "";
|
||
String[] actionList = flowService.getActionList(trans, taskNo,
|
||
phaseOpinion);
|
||
if (actionList != null) {
|
||
for (int i = 0; i < actionList.length; i++) {
|
||
String[] tempArr = actionList[i].split(" ");
|
||
if (tempArr.length > 1) {
|
||
if (actionStr.contains(tempArr[0])) {
|
||
continue;
|
||
}
|
||
aUserID = tempArr[0];
|
||
aUserName = NameManager
|
||
.getUserName(aUserID.contains("|") ? aUserID
|
||
.split("\\|")[1] : aUserID);
|
||
actionStr += "@" + aUserID + " " + aUserName;
|
||
if (tempArr.length > 2) {
|
||
aRoleID = tempArr[2];
|
||
aRoleName = NameManager.getRoleName(aRoleID);
|
||
actionStr += " " + aRoleID + " " + aRoleName;
|
||
}
|
||
} else {
|
||
aUserID = actionList[i];
|
||
aUserName = NameManager
|
||
.getUserName(aUserID.contains("|") ? aUserID
|
||
.split("\\|")[1] : aUserID);
|
||
actionStr += "@" + aUserID + " " + aUserName;
|
||
}
|
||
}
|
||
if (actionStr.contains("@")) {
|
||
actionStr = actionStr.substring(1);
|
||
}
|
||
returnMessage = actionStr;
|
||
}
|
||
return returnMessage;
|
||
}
|
||
|
||
public String getFlowTaskPassReader(Transaction Sqlca) throws Exception {
|
||
|
||
return null;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>taskNo,phaseOpinion<6F>õ<EFBFBD><C3B5>ύ<EFBFBD><E1BDBB><EFBFBD>б<EFBFBD>
|
||
*
|
||
* @param Sqlca
|
||
* @return {phaseno:actions,phaseno2:actions2}
|
||
*/
|
||
public String genPhaseAction(Transaction Sqlca) throws Exception {
|
||
StringBuffer sRet = new StringBuffer("{");
|
||
FlowTask ft = new FlowTask(taskNo, Sqlca);
|
||
FlowPhase[] fps = ft.getNextFlowPhase("", phaseOpinion);
|
||
String[] strs = ft.getActionList(phaseOpinion);
|
||
if (fps.length > 1) {// <20><><EFBFBD><EFBFBD>
|
||
for (int fp_i = 0; fp_i < fps.length; fp_i++) {
|
||
String str = "\"" + fps[fp_i].PhaseNo + "\":[";
|
||
for (int s_i = 0; s_i < strs.length; s_i++) {
|
||
if (strs[s_i].startsWith(fps[fp_i].PhaseNo)) {
|
||
str = str + "\"" + strs[s_i] + "\",";
|
||
}
|
||
}
|
||
if (str.endsWith(",")) {
|
||
str = str.substring(0, str.length() - 1);
|
||
}
|
||
str = str + "]";
|
||
if (fp_i > 0) {
|
||
sRet.append(",");
|
||
}
|
||
sRet.append(str);
|
||
}
|
||
} else if (fps.length == 1) {// <20>Dz<EFBFBD><C7B2><EFBFBD>
|
||
String str = "\"" + fps[0].PhaseNo + "\":[";
|
||
for (int i = 0; i < strs.length; i++) {
|
||
str = str + "\"" + strs[i] + "\",";
|
||
}
|
||
if (str.endsWith(",")) {
|
||
str = str.substring(0, str.length() - 1);
|
||
}
|
||
str = str + "]";
|
||
sRet.append(str);
|
||
}
|
||
sRet.append("}");
|
||
ARE.getLog().trace(sRet.toString());
|
||
return sRet.toString();
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD>裬<EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
|
||
* @throws Exception
|
||
*/
|
||
public String checkBackType(JBOTransaction tx) throws Exception {
|
||
FlowTask ft = new FlowTask(taskNo, tx);
|
||
if(ft.AssignedTaskNo.length() > 0) {
|
||
FlowTask ftB = new FlowTask(ft.AssignedTaskNo, tx);
|
||
this.nextNodeType = "TASK";
|
||
this.phaseOpinion = ftB.PhaseNo;
|
||
this.phaseAction = ftB.UserID + " " + ftB.UserName;
|
||
return this.submit(tx);
|
||
} else {
|
||
return "false";
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>taskNo<4E>õ<EFBFBD>flowTask<73><6B><EFBFBD><EFBFBD><F3A3ACB8><EFBFBD>phaseAction, phaseOpinion<6F>ύ
|
||
*
|
||
* @return
|
||
*/
|
||
public String submit(JBOTransaction tx) throws Exception {
|
||
String str = "success", attribute7, endTime = StringFunction.getTodayNow();
|
||
if(taskSet.contains(taskNo)){
|
||
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||
}
|
||
try {
|
||
ARE.getLog().warn("duplicate data validate use flow_task : "+taskNo);
|
||
taskSet.add(taskNo);
|
||
int attribute8;
|
||
BizObjectManager ftManager = JBOFactory.getBizObjectManager("jbo.sys.FLOW_TASK", tx);
|
||
|
||
BizObject ft = ftManager.createQuery(
|
||
"select O.relativeSerialNo,O.endTime,FM.attribute7,FM.attribute8 from O,jbo.sys.FLOW_MODEL FM where O.flowNo=FM.flowNo and O.phaseNo=FM.phaseNo and serialNo=:serialNo ")
|
||
.setParameter("serialNo", taskNo).getSingleResult(false);
|
||
if (ft == null) {return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>!";
|
||
} else if (!StringX.isEmpty(ft.getAttribute("endTime"))) {
|
||
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ύ<EFBFBD><EFBFBD>";
|
||
}
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObjectManager utdbom = JBOFactory.getBizObjectManager(USER_TASK_DATA.CLASS_NAME, tx);
|
||
BizObjectManager utibom = JBOFactory.getBizObjectManager(USER_TASK_INFO.CLASS_NAME, tx);
|
||
BizObject utdbo = utdbom.createQuery("taskno = '" + taskNo + "' and userid = '" + userID + "' and (status = 'approve_status01' or status = 'approve_status03')").getSingleResult(true);
|
||
if(utdbo != null) {
|
||
int taskNumber = utibom.createQuery("userid = '" + utdbo.getAttribute("userid")
|
||
+ "' and roleid = '" + utdbo.getAttribute("roleid") + "'").getSingleResult(false).getAttribute("task_number").getInt();
|
||
ARE.getLog().info("***********<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־***:Ϊ"+ taskNo + "<EFBFBD><EFBFBD>" + utdbo.getAttribute("userid") + "<EFBFBD>û<EFBFBD><EFBFBD>ر<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰδ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ" + taskNumber);
|
||
String status = utdbo.getAttribute("status").toString();
|
||
if("approve_status01".equals(status)) {
|
||
utibom.createQuery("update O set task_number = task_number - 1 where userid = '" + utdbo.getAttribute("userid")
|
||
+ "' and roleid = '" + utdbo.getAttribute("roleid") + "'").executeUpdate();
|
||
}
|
||
utdbo.setAttributeValue("status", "approve_status02");
|
||
utdbo.setAttributeValue("endtime", StringFunction.getTodayNow());
|
||
utdbom.saveObject(utdbo);
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD>beginTime<6D><65><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9>¼
|
||
ftManager
|
||
.createQuery(
|
||
"update O set beginTime=beginTime where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ")
|
||
.setParameter("relativeSerialNo",
|
||
ft.getAttribute("relativeSerialNo").getString())
|
||
.executeUpdate();
|
||
// <20><><EFBFBD><EFBFBD>ͬrelativeserialno<6E>Ҳ<EFBFBD><D2B2><EFBFBD>5000<30><30><EFBFBD>Ľεļ<CEB5>¼
|
||
BizObject allTaskNumBo = ftManager
|
||
.createQuery(" select count(1) as v.allTaskNum from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ")
|
||
.setParameter("relativeSerialNo",ft.getAttribute("relativeSerialNo").getString()).getSingleResult(false);
|
||
int allTaskNum = allTaskNumBo.getAttribute("allTaskNum").getInt();
|
||
//<2F><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>
|
||
if (allTaskNum > 1) {
|
||
attribute7 = ft.getAttribute("attribute7").getString();// 01,<2C><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>,02,<2C><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>,03,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ,04,N<>˴<EFBFBD><CBB4><EFBFBD>
|
||
attribute8 = ft.getAttribute("attribute8").getInt();// N<>˴<EFBFBD><CBB4><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
|
||
if ("04".equals(attribute7)&& (ft.getAttribute("attribute8").isNull()|| attribute8 >= allTaskNum || attribute8 < 1)) {
|
||
// <20><><EFBFBD><EFBFBD>N<EFBFBD>˴<EFBFBD><CBB4><EFBFBD>ʱû<CAB1><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// 02,<2C><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>
|
||
attribute7 = "02";
|
||
}
|
||
// <20><><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObject commitedTaskNumBo = ftManager
|
||
.createQuery(
|
||
" select count(1) as v.commited from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' and endTime is not null and length(endTime)>0 ")
|
||
.setParameter("relativeSerialNo",
|
||
ft.getAttribute("relativeSerialNo").getString())
|
||
.getSingleResult(false);
|
||
int commited = commitedTaskNumBo.getAttribute("commited").getInt();
|
||
|
||
if ("02".equals(attribute7) && commited + 1 < allTaskNum /*
|
||
* <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>
|
||
* +1<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*/
|
||
|| "04".equals(attribute7) && commited + 1 < attribute8 /*
|
||
* N<>˴<EFBFBD><CBB4><EFBFBD><EFBFBD><EFBFBD>
|
||
* <20><><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>
|
||
* +
|
||
* 1
|
||
* <
|
||
* N
|
||
*/) {
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||
ftManager
|
||
.createQuery(
|
||
"update O set endTime=:endTime,phaseAction=:phaseAction where serialNo=:serialNo")
|
||
.setParameter("serialNo", taskNo)
|
||
.setParameter("phaseAction", "δ<EFBFBD>ﵽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
|
||
.setParameter("endTime", endTime).executeUpdate();
|
||
return str;
|
||
}
|
||
}
|
||
|
||
if (!StringX.isSpace(phaseAction))
|
||
phaseAction = phaseAction.replace("@", ",");
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵ı<CCB5><C4B1>ţ<EFBFBD><C5A3>α<D7B6><CEB1>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xuyunlong <20>鵵ÿһ<C3BF><D2BB><EFBFBD>鵵
|
||
ft = ftManager
|
||
.createQuery(
|
||
"select O.flowno,O.phaseno,O.FLOWSTATE,O.ASSIGNEDTASKNO,O.objecttype,O.objectno,O.userid,O.orgid from O where serialNo=:serialNo ")
|
||
.setParameter("serialNo", taskNo).getSingleResult(false);
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1>浽<EFBFBD><E6B5BD>ʷ<EFBFBD><CAB7>¼<EFBFBD><C2BC>
|
||
PhaseInfoArchive(ft.getAttribute("flowno").getString(), ft
|
||
.getAttribute("phaseno").getString(),
|
||
ft.getAttribute("objecttype").getString(),
|
||
ft.getAttribute("objectno").getString(), taskNo, ft
|
||
.getAttribute("userid").getString(),
|
||
ft.getAttribute("orgid").getString(), tx);
|
||
|
||
if (this.phaseOpinion.equals("1000")
|
||
|| this.phaseOpinion.equals("8000")) {
|
||
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><CCBB><EFBFBD>
|
||
FlowUtil.deleteWorkFlowConflict(ft.getAttribute("objectno")
|
||
.getString(), tx);
|
||
Map<String, String> condtion = new HashMap<String, String>();
|
||
condtion.put("FlowUnid", ft.getAttribute("objectno").getString());
|
||
DataOperatorUtil.deleteJBOByCondtion(FLOW_STEP_NODE.CLASS_NAME,
|
||
condtion, tx);
|
||
}
|
||
if(this.nextNodeType.indexOf("JOIN")>=0){
|
||
if(this.getIsStepLastUser(tx).equals("No")){
|
||
ftManager
|
||
.createQuery(
|
||
"update O set endTime=:endTime,phaseAction=:phaseAction,taskstate=1 where serialNo=:serialNo")
|
||
.setParameter("serialNo", taskNo)
|
||
.setParameter("phaseAction", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧û<EFBFBD>н<EFBFBD><EFBFBD><EFBFBD>")
|
||
.setParameter("endTime", endTime).executeUpdate();
|
||
|
||
}else{
|
||
flowService.commitAction(taskNo, phaseAction, phaseOpinion, "", tx);
|
||
Transaction Sqlca =null;
|
||
Sqlca = Transaction.createTransaction(tx);
|
||
ASResultSet rs = null;
|
||
String sql="update flow_task set userid=replace(userid,'*','') where objectno=:objectno and userid like '*%' ";
|
||
SqlObject asql = new SqlObject(sql);
|
||
asql.setParameter("objectno",ft.getAttribute("objectno").getString());
|
||
Sqlca.executeSQL(asql);
|
||
}
|
||
}else{
|
||
flowService.commitAction(taskNo, phaseAction, phaseOpinion, "", tx);
|
||
|
||
if(ft.getAttribute("FLOWSTATE").getString().equals("ANYBACK")){ //<2F>˻<EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD>ύ
|
||
|
||
if(ft.getAttribute("ASSIGNEDTASKNO")!=null){
|
||
if(ft.getAttribute("ASSIGNEDTASKNO").getString().length()>0){//<2F><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>״̬
|
||
ftManager.createQuery("update o set FLOWSTATE='NORMAL' WHERE objectno=:objectno and endtime is null")
|
||
.setParameter("objectno", ft.getAttribute("objectno").getString()).executeUpdate();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
// <20><><EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObject taskUser = ftManager.createQuery("select O.userId from O where O.SERIALNO=:taskNo").setParameter("taskNo", this.taskNo).getSingleResult(false);
|
||
if (!taskUser.getAttribute("userId").getString().equals(this.userID)) {
|
||
this.doFinishAssignTask(tx);
|
||
}
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>endTime
|
||
ftManager
|
||
.createQuery(
|
||
"update O set endTime=:endTime, phaseAction=:phaseAction where ( endTime is null or endTime='' ) and relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ")
|
||
.setParameter("relativeSerialNo",
|
||
ft.getAttribute("relativeSerialNo").getString())
|
||
.setParameter("endTime", endTime)
|
||
.setParameter("phaseAction", "AutoFinish").executeUpdate();
|
||
// <20><><EFBFBD>ɴ<EFBFBD><C9B4>ĵĴ<C4B5><C4B4><EFBFBD>
|
||
this.startPassedByUser(tx);
|
||
savePushMsg(tx);
|
||
//<2F><><EFBFBD>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>֪ͨ
|
||
new FLowStepEndNotice().StepEndNotice(tx, ft.getAttribute("objectno").getString(),this.taskNo,"next");
|
||
}finally {
|
||
taskSet.remove(taskNo);
|
||
ARE.getLog().warn("current keep duplicate validate : "+taskSet.toString());
|
||
}
|
||
return str;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>flowStateΪvoted
|
||
*
|
||
* @return
|
||
*/
|
||
public String endMeetingTask(JBOTransaction tx) throws Exception {
|
||
BizObjectManager ftManager = JBOFactory.getBizObjectManager(
|
||
"jbo.sys.FLOW_TASK", tx);
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵ı<CCB5><C4B1>ţ<EFBFBD><C5A3>α<D7B6><CEB1>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xuyunlong
|
||
BizObject ft = ftManager
|
||
.createQuery(
|
||
"select O.flowno,O.phaseno,O.objecttype,O.objectno,O.userid,O.orgid from O where serialNo=:serialNo ")
|
||
.setParameter("serialNo", taskNo).getSingleResult(false);
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1>浽<EFBFBD><E6B5BD>ʷ<EFBFBD><CAB7>¼<EFBFBD><C2BC>
|
||
PhaseInfoArchive(ft.getAttribute("flowno").getString(), ft
|
||
.getAttribute("phaseno").getString(),
|
||
ft.getAttribute("objecttype").getString(),
|
||
ft.getAttribute("objectno").getString(), taskNo, ft
|
||
.getAttribute("userid").getString(),
|
||
ft.getAttribute("orgid").getString(), tx);
|
||
flowService.endMeetingTask(taskNo, tx);
|
||
return "success";
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽε<D7B6>taskNo<4E>õ<EFBFBD><C3B5><EFBFBD>ͶƱ<CDB6><C6B1>ίԱ<CEAF><D4B1><EFBFBD><EFBFBD>
|
||
*
|
||
* @return
|
||
*/
|
||
public String getVotedNum(JBOTransaction tx) throws Exception {
|
||
String sNum = "";
|
||
sNum = flowService.getVotedNum(taskNo, tx);
|
||
return sNum;
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽε<D7B6>flowstate<74>õ<EFBFBD>û<EFBFBD><C3BB>ͶƱ<CDB6><C6B1>ίԱ<CEAF><D4B1><EFBFBD><EFBFBD>
|
||
public String getMeetingNum(JBOTransaction tx) throws Exception {
|
||
int Num;
|
||
// String
|
||
// sql="Select flowstate From O Where objectNo=:objectNo and flowstate='MEETING'";
|
||
Map<String, String> searchCondtion = new HashMap<String, String>();
|
||
searchCondtion.put("objectNo", objectNo);
|
||
searchCondtion.put("flowstate", "MEETING");
|
||
List<BizObject> meeting = new ArrayList<BizObject>();
|
||
meeting = DataOperatorUtil.getSetJBO(FLOW_TASK.CLASS_NAME,
|
||
searchCondtion, tx);
|
||
Num = meeting.size();
|
||
return Num + "";
|
||
}
|
||
|
||
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>֧<EFBFBD>ķ<EFBFBD>֧<EFBFBD><D6A7>Ŀ
|
||
public String getForkNum(JBOTransaction tx) throws Exception {
|
||
String PostScript = "";
|
||
String Num = "";
|
||
String sql = "Select PostScript From O Where FlowNo=:FlowNo and PhaseNo=:PhaseNo";
|
||
BizObject bo = JBOFactory.getBizObjectManager("jbo.sys.FLOW_MODEL")
|
||
.createQuery(sql).setParameter("FlowNo", flowNo)
|
||
.setParameter("PhaseNo", phaseNo).getSingleResult(false);
|
||
if (bo != null) {
|
||
PostScript = bo.getAttribute("PostScript").getString();
|
||
}
|
||
Num = String.valueOf(PostScript.split(";").length);
|
||
return Num;
|
||
}
|
||
|
||
// <20>жϵ<D0B6>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>¸<EFBFBD><C2B8>ύ<EFBFBD>ڵ<EFBFBD><DAB5>Ƿ<EFBFBD>Ϊ<EFBFBD>ۺϽڵ<CFBD>: 1-<2D><> 0-<2D><><EFBFBD><EFBFBD>
|
||
public String isJoinNode(JBOTransaction tx) throws Exception {
|
||
String isJoin = "0";
|
||
isJoin = flowService.isJoinNode(taskNo, phaseAction, phaseOpinion, tx);
|
||
return isJoin;
|
||
}
|
||
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD>ύ<EFBFBD><E1BDBB>
|
||
public String getJoinUser(JBOTransaction tx) throws Exception {
|
||
String UserID = "";
|
||
FlowTask ftBusiness = new FlowTask(taskNo, tx);
|
||
FlowPhase[] sFlowPhase = ftBusiness.getNextFlowPhase(phaseAction,
|
||
phaseOpinion);
|
||
if (sFlowPhase.length == 1) {
|
||
String nextPhaseNo = sFlowPhase[0].PhaseNo;
|
||
String NodeType = sFlowPhase[0].NodeType;
|
||
if ("join".equalsIgnoreCase(NodeType)) {
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery(
|
||
"Select UserID From O Where ObjectNo=:ObjectNo and ObjectType=:ObjectType and PhaseNo=:PhaseNo and (EndTime is null or EndTime = '')")
|
||
.setParameter("ObjectNo", ftBusiness.ObjectNo)
|
||
.setParameter("ObjectType", ftBusiness.ObjectType)
|
||
.setParameter("PhaseNo", nextPhaseNo)
|
||
.getSingleResult(false);
|
||
if (bo != null) {
|
||
UserID = bo.getAttribute("UserID").getString();
|
||
if (UserID.startsWith("*")) {
|
||
UserID = UserID.substring(1);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return UserID;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>objectType, objectNo,flowNo <20>õ<EFBFBD>List(StringBuffer)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>̽ڵ<CCBD>nodes,
|
||
* <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢnodeText, <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>conn, ʵ<><CAB5>·<EFBFBD><C2B7>realPath<74><68>StringBuffer<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @return
|
||
*/
|
||
public List<StringBuffer> getFlowImgBufs() throws JBOException {
|
||
StringBuffer nodesBuf = new StringBuffer(), nodeTextBuf = new StringBuffer(), connBuf = new StringBuffer(), realPathBuf = new StringBuffer();
|
||
// flow_model<65><6C><EFBFBD><EFBFBD>
|
||
List<BizObject> prePhases, modelList = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_MODEL")
|
||
.createQuery(
|
||
"select * from O where flowNo=:flowNo order by phaseNo ")
|
||
.setParameter("flowNo", this.flowNo).getResultList(false);
|
||
// TODO
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD>phaseNo<4E><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>postScript<70><74><EFBFBD>жϵģ<CFB5><C4A3><EFBFBD><EFBFBD><EFBFBD>postScript<70><74>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><E0B7BD><EFBFBD><EFBFBD>ȡnextPhaseNo<4E><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϷ<D0B6><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
||
BizObjectQuery beginEndPointQuery = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_MODEL")
|
||
.createQuery(
|
||
"select O.phaseNo from O where flowNo=:flowNo and postScript is not null and "
|
||
+ "(postScript like :phaseNo1 or postScript like :phaseNo2 or postScript like :phaseNo3 or postScript like :phaseNo4) ")
|
||
.setParameter("flowNo", this.flowNo);
|
||
for (BizObject bo : modelList) {
|
||
String _phaseNo = bo.getAttribute("phaseNo").getString();
|
||
String _phaseName = bo.getAttribute("phaseName").getString();
|
||
String _nodeType = bo.getAttribute("nodeType").getString();
|
||
if (StringX.isEmpty(_nodeType))
|
||
_nodeType = "TASK";
|
||
int _x = bo.getAttribute("XCOORDINATE").getInt();
|
||
int _y = bo.getAttribute("YCOORDINATE").getInt();
|
||
int laneX = 0;// <20><>ȡӾ<C8A1><D3BE>X<EFBFBD><58><EFBFBD>꣨<EFBFBD><EAA3A8><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>
|
||
String swimLane = bo.getAttribute("swimLane").getString();
|
||
if (!StringX.isEmpty(swimLane)) {
|
||
List<BizObject> laneList = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_SWIMLANE")
|
||
.createQuery(
|
||
"Select * From O " + " Where LaneNo = :LaneNo")
|
||
.setParameter("LaneNo", swimLane).getResultList(false);
|
||
for (BizObject lane : laneList) {
|
||
String laneConstraint = lane.getAttribute("laneConstraint")
|
||
.getString().split(",")[0];
|
||
laneX = Integer.valueOf(laneConstraint);
|
||
}
|
||
}
|
||
|
||
// <20><><EFBFBD>ɽڵ<C9BD>
|
||
if (nodesBuf.length() > 0)
|
||
nodesBuf.append(",");
|
||
nodesBuf.append("'" + _phaseNo + "':r.rect(" + (_x + laneX) + ","
|
||
+ _y + ",33,30,10).data('nodeType','" + _nodeType
|
||
+ "').attr({title:''})");
|
||
// <20><><EFBFBD>ɽڵ<C9BD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||
if (nodeTextBuf.length() > 0)
|
||
nodeTextBuf.append(",");
|
||
nodeTextBuf.append(" r.text(" + (_x + laneX) + "+16, " + _y
|
||
+ "+42,'" + _phaseNo + "<br>" + _phaseName + "')");
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
prePhases = beginEndPointQuery
|
||
.setParameter("phaseNo1", "%'" + _phaseNo + "'%")
|
||
.setParameter("phaseNo2", "%\"" + _phaseNo + "\"%")
|
||
.setParameter("phaseNo3", "%;" + _phaseNo + "%")
|
||
.setParameter("phaseNo4", "%" + _phaseNo + ";%")
|
||
.getResultList(false);
|
||
for (BizObject prePhaseBo : prePhases) {
|
||
String prePhaseNo = prePhaseBo.getAttribute("phaseNo")
|
||
.getString();
|
||
connBuf.append("connections['" + prePhaseNo + "-" + _phaseNo
|
||
+ "']=r.connection(nodes['" + prePhaseNo
|
||
+ "'], nodes['" + _phaseNo + "'], connAttr );");
|
||
}
|
||
}
|
||
// flow_task<73><6B><EFBFBD><EFBFBD>
|
||
List<BizObject> ftBoList = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK")
|
||
.createQuery(
|
||
"select O.userName,O.beginTime,O.endTime, O.serialNo,O.relativeSerialNo,O.phaseNo, "
|
||
+ "FM.nodeType from O,jbo.sys.FLOW_MODEL FM where O.flowNo=:flowNo and O.objectType=:objectType and O.objectNo=:objectNo "
|
||
+ " and O.flowNo=FM.flowNo and O.phaseNo=FM.phaseNo and O.userID not like '*%' order by O.serialNo ")
|
||
.setParameter("flowNo", this.flowNo)
|
||
.setParameter("objectType", this.objectType)
|
||
.setParameter("objectNo", this.objectNo).getResultList(false);
|
||
TreeMap<String, String> ftMap = new TreeMap<String, String>();
|
||
for (int i = 0, size = ftBoList.size(); i < size; i++) {
|
||
BizObject ftBo = ftBoList.get(i);
|
||
String userName = ftBo.getAttribute("userName").getString(), beginTime = ftBo
|
||
.getAttribute("beginTime").getString(), endTime = ftBo
|
||
.getAttribute("endTime").getString(), relativeSerialNo = ftBo
|
||
.getAttribute("relativeSerialNo").getString(), tempPhaseNo = ftBo
|
||
.getAttribute("phaseNo").getString(), nodeType = ftBo
|
||
.getAttribute("nodeType").getString();
|
||
realPathBuf.append("nodes['" + tempPhaseNo
|
||
+ "'].attr({'title': nodes['" + tempPhaseNo
|
||
+ "'].attr()['title'] +'<br><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + userName + ",<2C><>ʼʱ<CABC><CAB1>:"
|
||
+ beginTime + ",<2C><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:" + endTime + "'});");
|
||
ftMap.put(ftBo.getAttribute("serialNo").getString(), tempPhaseNo
|
||
+ "@@" + (relativeSerialNo == null ? "" : relativeSerialNo));
|
||
if (i == size - 1)
|
||
this.phaseNo = tempPhaseNo;
|
||
}
|
||
ArrayList<String> realPathList = new ArrayList<String>();
|
||
for (String k : ftMap.keySet()) {
|
||
String phaseNoAndRelaSN = ftMap.get(k);
|
||
String[] arr = phaseNoAndRelaSN.split("@@");
|
||
if (arr.length > 1) {
|
||
realPathList.add(ftMap.get(arr[1]).split("@@")[0] + "-"
|
||
+ arr[0]);
|
||
}
|
||
}
|
||
// <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>·<EFBFBD><C2B7>
|
||
for (int i = 0, len = realPathList.size(); i < len; i++) {
|
||
String[] phaseNos = realPathList.get(i).split("-");
|
||
realPathBuf.append("realPaths['" + realPathList.get(i) + "-" + i
|
||
+ "']=r.connection(nodes['" + phaseNos[0] + "'], nodes['"
|
||
+ phaseNos[1] + "'], realPathAttr );");
|
||
}
|
||
ArrayList<StringBuffer> retList = new ArrayList<StringBuffer>();
|
||
// <20><> nodes, nodeText, conn, realPath ˳<><CBB3><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD><CEBC><EFBFBD>list
|
||
retList.add(nodesBuf);
|
||
retList.add(nodeTextBuf);
|
||
retList.add(connBuf);
|
||
retList.add(realPathBuf);
|
||
return retList;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD>ݵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>taskNo<4E>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD>ԱphaseAction, <20><><EFBFBD>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F1A3ACB4>Ľε<D7B6>Ĭ<EFBFBD>Ͻκ<D7B6>Ϊ5000
|
||
*/
|
||
|
||
public String passRound(JBOTransaction tx) throws Exception {
|
||
String sRet = "success";
|
||
FlowTask ft = new FlowTask(taskNo, tx);
|
||
ft.PhaseAction = this.phaseAction.replace("@", ",");
|
||
ft.RelativeFlowObject.changePhase(new FlowPhase(ft.FlowNo, "5000", tx),
|
||
ft, new TaskDataObject());
|
||
JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_OBJECT", tx)
|
||
.createQuery(
|
||
"update O set phaseType=:phaseType, phaseNo=:phaseNo, "
|
||
+ " phaseName=:phaseName where objectType=:objectType and objectNo=:objectNo ")
|
||
.setParameter("phaseType", ft.PhaseType)
|
||
.setParameter("phaseNo", ft.PhaseNo)
|
||
.setParameter("phaseName", ft.PhaseName)
|
||
.setParameter("objectType", ft.ObjectType)
|
||
.setParameter("objectNo", ft.ObjectNo).executeUpdate();
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>flowNo,phaseNo <20><>flow_model<65><6C>ATTRIBUTE7,<2C>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύҳ<E1BDBB><D2B3><EFBFBD>ϵ<EFBFBD><CFB5>ύ<EFBFBD><E1BDBB><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ѡ
|
||
* (01,<2C><><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>,02,<2C><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>,03,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ,04,N<>˴<EFBFBD><CBB4><EFBFBD>)
|
||
*/
|
||
|
||
public String isMultiUsers(JBOTransaction tx) throws Exception {
|
||
String sRet = "N";
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_MODEL", tx)
|
||
.createQuery(
|
||
"select ATTRIBUTE7 from O where flowNo=:flowNo and phaseNo=:phaseNo ")
|
||
.setParameter("flowNo", flowNo)
|
||
.setParameter("phaseNo", phaseNo).getSingleResult(false);
|
||
if (bo != null) {
|
||
String ATTRIBUTE7 = bo.getAttribute("ATTRIBUTE7").getString();
|
||
if (!StringX.isEmpty(ATTRIBUTE7) && !"01".equals(ATTRIBUTE7)) {
|
||
sRet = "Y";
|
||
}
|
||
}
|
||
return sRet;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||
*
|
||
* @param ReturnPoint
|
||
* ѡ<><D1A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ĵ<DEB8>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* @throws Exception
|
||
* */
|
||
public String taskAssign(JBOTransaction tx) throws Exception {
|
||
// ѡ<><D1A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>
|
||
String tUserID = phaseAction.split(" ")[0];
|
||
BizObject userBO = JBOFactory
|
||
.getBizObjectManager("jbo.sys.USER_INFO")
|
||
.createQuery(
|
||
"select O.userName,OI.OrgID,OI.OrgName "
|
||
+ "from O,jbo.sys.ORG_INFO OI where O.userID=:userID and O.belongOrg=OI.orgID")
|
||
.setParameter("userID", tUserID).getSingleResult(false);
|
||
if (userBO != null) {
|
||
JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK")
|
||
.createQuery(
|
||
"update O set userID=:userID,userName=:userName,orgID=:orgID,orgName=:orgName where serialNo=:serialNo")
|
||
.setParameter("serialNo", taskNo)
|
||
.setParameter("userID", tUserID)
|
||
.setParameter("userName",
|
||
userBO.getAttribute("userName").getString())
|
||
.setParameter("orgID",
|
||
userBO.getAttribute("orgID").getString())
|
||
.setParameter("orgName",
|
||
userBO.getAttribute("orgName").getString())
|
||
.executeUpdate();
|
||
}
|
||
return "";
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>objectType,objectNo<4E><6F>FLOW_TASK<53>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>phaseNo<4E><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>ύʱ<E1BDBB><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ύ
|
||
*
|
||
* @return curPhaseNo--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>phaseNo
|
||
*/
|
||
public String getPhaseDescribe(JBOTransaction tx) throws Exception {
|
||
String sPhaseDescribe = "";
|
||
BizObject bo = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_MODEL", tx)
|
||
.createQuery(
|
||
"Select phaseDescribe From O Where FlowNo=:FlowNo and phaseNo=:phaseNo")
|
||
.setParameter("flowNo", flowNo)
|
||
.setParameter("phaseNo", phaseNo).getSingleResult(false);
|
||
if (bo != null)
|
||
sPhaseDescribe = bo.getAttribute("phaseDescribe").getString();
|
||
return sPhaseDescribe;
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>
|
||
public void dispatcher(JBOTransaction tx) throws Exception {
|
||
SMTPDispatcher mail = new SMTPDispatcher();
|
||
Properties p = new Properties();
|
||
p.setProperty("mail.smtp.host", "mail.amarsoft.com");
|
||
p.setProperty("mail.mime.charset", "GBK");
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
p.setProperty("mail.user", "user");
|
||
p.setProperty("mail.password", "password");
|
||
mail.init(p);
|
||
|
||
Message m = new Message();
|
||
m.setMimeType("text/plain");
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
m.setSender("test@amarsoft.com");
|
||
m.setSubject("SMTP Dispatcher Test");
|
||
m.setBody("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣͨ<EFBFBD><EFBFBD>SMTPDispatcherֱ<EFBFBD>ӷ<EFBFBD><EFBFBD>ͣ<EFBFBD>" + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=" + phaseOpinion + ",<2C>ύ<EFBFBD><E1BDBB>="
|
||
+ phaseAction);
|
||
// <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
m.addRecipient("test@amarsoft.com");
|
||
mail.dispatchMessage(m);
|
||
}
|
||
|
||
public void startPassedByUser(JBOTransaction tx) throws Exception {
|
||
if (this.getReadUserIds().length() > 0) {
|
||
String[] userids = this.getReadUserIds().split("@");
|
||
for (int i = 0; i < userids.length; i++) {
|
||
BizObjectManager readerInfo = JBOFactory
|
||
.getBizObjectManager(FLOW_READER.CLASS_NAME);
|
||
tx.join(readerInfo);
|
||
BizObject Object = readerInfo.newObject();
|
||
Object.setAttributeValue("taskno", this.getTaskNo());
|
||
Object.setAttributeValue("flowunid", this.getObjectNo());
|
||
Object.setAttributeValue("reader", userids[i]);
|
||
Object.setAttributeValue("InputUserID", this.getUserID());
|
||
Object.setAttributeValue("InputOrgID", this.getOrgID());
|
||
Object.setAttributeValue("inputtime",
|
||
DateAssistant.getTodayNow());
|
||
Object.setAttributeValue("isRead", "0");
|
||
readerInfo.saveObject(Object);
|
||
}
|
||
}
|
||
}
|
||
|
||
public void endPassedByID(JBOTransaction tx) throws Exception {
|
||
BizObjectManager readerInfo = JBOFactory
|
||
.getBizObjectManager(FLOW_READER.CLASS_NAME);
|
||
tx.join(readerInfo);
|
||
BizObjectQuery bqDest = readerInfo.createQuery("id=:id");
|
||
bqDest.setParameter("id", this.passReadid);
|
||
BizObject Object = null;
|
||
Object = bqDest.getSingleResult(true);// Ŀ<><C4BF>JBO<42><4F><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>
|
||
Object.setAttributeValue("isRead", "1");
|
||
Object.setAttributeValue("UpdateUserID", this.userID);
|
||
Object.setAttributeValue("UpdateOrgID", this.getOrgID());
|
||
Object.setAttributeValue("UpdateTime", DateAssistant.getTodayNow());
|
||
readerInfo.saveObject(Object);
|
||
}
|
||
|
||
public String getIsOpitionsRequire(JBOTransaction tx) throws Exception {
|
||
BizObject bo = null;
|
||
BizObjectManager bm = null;
|
||
BizObjectQuery bq = null;
|
||
bm = JBOFactory.getFactory().getManager(FLOW_MODEL.CLASS_NAME);
|
||
bq = bm.createQuery("FlowNo=:FlowNo and PhaseNo=:PhaseNo")
|
||
.setParameter("FlowNo", this.getFlowNo())
|
||
.setParameter("PhaseNo", this.getPhaseNo());
|
||
bo = bq.getSingleResult(false);
|
||
String isRequireOpition = bo.getAttribute("OPINIONSREQUIRED")
|
||
.getString();
|
||
if (isRequireOpition == null || isRequireOpition == "") {
|
||
isRequireOpition = "Y";
|
||
}
|
||
return isRequireOpition;
|
||
}
|
||
|
||
public String getIsStepLastUser(JBOTransaction tx) throws Exception {
|
||
if(this.nextNodeType.indexOf("JOIN")>=0){
|
||
TenwaFlowTask ft = new TenwaFlowTask(taskNo, tx);//ʹ<><CAB9>jboTrans
|
||
String cnumber=ft.getForkLastNumber();
|
||
if(cnumber.equals("1")){
|
||
return "Yes";
|
||
}else{
|
||
return "No";
|
||
}
|
||
}else{
|
||
BizObject bo = null;
|
||
BizObjectManager bm = null;
|
||
BizObjectQuery bq = null;
|
||
bm = JBOFactory.getFactory().getManager(FLOW_MODEL.CLASS_NAME);
|
||
bq = bm.createQuery("FlowNo=:FlowNo and PhaseNo=:PhaseNo")
|
||
.setParameter("FlowNo", this.getFlowNo())
|
||
.setParameter("PhaseNo", this.getPhaseNo());
|
||
|
||
bo = bq.getSingleResult(false);
|
||
String operatorType = bo.getAttribute("ATTRIBUTE7").getString();
|
||
String operatorNunber = bo.getAttribute("ATTRIBUTE8").getString();
|
||
BizObjectManager ftManager = JBOFactory.getBizObjectManager(
|
||
"jbo.sys.FLOW_TASK", tx);
|
||
BizObject ft = ftManager
|
||
.createQuery(
|
||
"select O.relativeSerialNo,O.endTime,FM.attribute7,FM.attribute8 from O,jbo.sys.FLOW_MODEL FM where O.flowNo=FM.flowNo and O.phaseNo=FM.phaseNo and serialNo=:serialNo ")
|
||
.setParameter("serialNo", this.getTaskNo())
|
||
.getSingleResult(false);
|
||
BizObject allTaskNumBo = ftManager
|
||
.createQuery(
|
||
" select count(1) as v.allTaskNum from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ")
|
||
.setParameter("relativeSerialNo",
|
||
ft.getAttribute("relativeSerialNo").getString())
|
||
.getSingleResult(false);
|
||
int allTaskNum = allTaskNumBo.getAttribute("allTaskNum").getInt();
|
||
// <20><><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObject commitedTaskNumBo = ftManager
|
||
.createQuery(
|
||
" select count(1) as v.commited from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' and endTime is not null and length(endTime)>0 ")
|
||
.setParameter("relativeSerialNo",
|
||
ft.getAttribute("relativeSerialNo").getString())
|
||
.getSingleResult(false);
|
||
int commited = commitedTaskNumBo.getAttribute("commited").getInt();
|
||
if (operatorType.endsWith("02")) {
|
||
if ((commited + 1) == allTaskNum) {
|
||
return "Yes";
|
||
} else {
|
||
return "No";
|
||
}
|
||
|
||
}
|
||
if (operatorType.endsWith("04")) {
|
||
int configNumber = 1;
|
||
if (null == operatorNunber || operatorNunber.length() == 0) {
|
||
operatorNunber = "1";
|
||
}
|
||
configNumber = Integer.valueOf(operatorNunber);
|
||
if ((commited + 1) == configNumber) {
|
||
return "Yes";
|
||
} else {
|
||
return "No";
|
||
}
|
||
}
|
||
return "Yes";
|
||
}
|
||
}
|
||
|
||
public String getBackStepTaskInfo(JBOTransaction tx) throws Exception {
|
||
String sql = "";
|
||
List<BizObject> bos = JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery(
|
||
"SELECT O.serialno,O.phasename,O.userid,O.username FROM O WHERE O.objectno=:objectno AND O.phaseno=:phaseno ORDER BY endtime DESC")
|
||
.setParameter("phaseno", this.getPhaseNo())
|
||
.setParameter("objectno", this.getObjectNo())
|
||
.getResultList(false);
|
||
if (bos.size() > 0) {
|
||
return "{\"taskNo\":\"" + bos.get(0).getAttribute("serialno")
|
||
+ "\",\"phaseName\":\""
|
||
+ bos.get(0).getAttribute("phasename").getString()
|
||
+ "\",\"userId\":\""
|
||
+ bos.get(0).getAttribute("userid").getString()
|
||
+ "\",\"userName\":\""
|
||
+ bos.get(0).getAttribute("username").getString() + "\"}";
|
||
} else {
|
||
return "{}";
|
||
}
|
||
|
||
}
|
||
|
||
public String MulityTaskAssignment(JBOTransaction tx) throws Exception {
|
||
// ѡ<><D1A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>
|
||
String tUserID = this.getAssignmentId();
|
||
BizObject userBO = JBOFactory
|
||
.getBizObjectManager("jbo.sys.USER_INFO")
|
||
.createQuery(
|
||
"select O.userName,OI.OrgID,OI.OrgName "
|
||
+ "from O,jbo.sys.ORG_INFO OI where O.userID=:userID and O.belongOrg=OI.orgID")
|
||
.setParameter("userID", tUserID).getSingleResult(false);
|
||
if (userBO != null) {
|
||
String[] taskNos = this.getTaskNo().split("@");
|
||
for (int i = 0; i < taskNos.length; i++) {
|
||
JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK")
|
||
.createQuery(
|
||
"update O set AGENTUSERID=:userID,AGENTUSERNAME=:userName,AGENTORGID=:orgID,AGENTORGNAME=:orgName,ASSIGNSUBMITTYPE=:ASSIGNSUBMITTYPE,ASSIGNFINISH=0 where serialNo=:serialNo")
|
||
.setParameter("serialNo", taskNos[i])
|
||
.setParameter("userID", tUserID)
|
||
.setParameter("userName",
|
||
userBO.getAttribute("userName").getString())
|
||
.setParameter("orgID",
|
||
userBO.getAttribute("orgID").getString())
|
||
.setParameter("orgName",
|
||
userBO.getAttribute("orgName").getString())
|
||
.setParameter("ASSIGNSUBMITTYPE",
|
||
this.getAssignSumbitType()).executeUpdate();
|
||
}
|
||
}
|
||
return "";
|
||
}
|
||
|
||
// ɾ<><C9BE>ί<EFBFBD><CEAF><EFBFBD><EFBFBD>Ա
|
||
public String deleteMulityTaskAssignment(JBOTransaction tx)
|
||
throws Exception {
|
||
String[] taskNos = this.getTaskNo().split("@");
|
||
for (int i = 0; i < taskNos.length; i++) {
|
||
JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK")
|
||
.createQuery(
|
||
"update O set AGENTUSERID=:userID,AGENTUSERNAME=:userName,AGENTORGID=:orgID,AGENTORGNAME=:orgName,ASSIGNSUBMITTYPE='',ASSIGNFINISH='' where serialNo=:serialNo")
|
||
.setParameter("serialNo", taskNos[i])
|
||
.setParameter("userID", "").setParameter("userName", "")
|
||
.setParameter("orgID", "").setParameter("orgName", "")
|
||
.executeUpdate();
|
||
}
|
||
return "";
|
||
}
|
||
|
||
public String doFinishAssignTask(JBOTransaction tx) throws Exception {
|
||
BizObject userBO = JBOFactory
|
||
.getBizObjectManager("jbo.sys.USER_INFO")
|
||
.createQuery(
|
||
"select O.userName,OI.OrgID,OI.OrgName "
|
||
+ "from O,jbo.sys.ORG_INFO OI where O.userID=:userID and O.belongOrg=OI.orgID")
|
||
.setParameter("userID", this.userID).getSingleResult(false);
|
||
|
||
try {
|
||
JBOFactory
|
||
.getBizObjectManager("jbo.sys.FLOW_TASK", tx)
|
||
.createQuery(
|
||
"update O set AGENTUSERID=:userID,AGENTUSERNAME=:userName,AGENTORGID=:orgID,AGENTORGNAME=:orgName,ASSIGNFINISH='1' where serialNo=:serialNo")
|
||
.setParameter("serialNo", this.taskNo)
|
||
.setParameter("userID", this.userID)
|
||
.setParameter("userName",
|
||
userBO.getAttribute("userName").getString())
|
||
.setParameter("orgID",
|
||
userBO.getAttribute("orgID").getString())
|
||
.setParameter("orgName",
|
||
userBO.getAttribute("orgName").getString())
|
||
.executeUpdate();
|
||
} catch (Exception e) {
|
||
// TODO Auto-generated catch block
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
public String getDATA_CODE() {
|
||
return DATA_CODE;
|
||
}
|
||
|
||
public String getGROUP_CODE() {
|
||
return GROUP_CODE;
|
||
}
|
||
|
||
public void setDATA_CODE(String dATA_CODE) {
|
||
DATA_CODE = dATA_CODE;
|
||
}
|
||
|
||
public void setGROUP_CODE(String gROUP_CODE) {
|
||
GROUP_CODE = gROUP_CODE;
|
||
}
|
||
|
||
public void removeAppGroupTemp(JBOTransaction tx) throws Exception {
|
||
Map<String, String> condtion = new HashMap<String, String>();
|
||
condtion.put("DATA_CODE", this.DATA_CODE);
|
||
condtion.put("GROUP_CODE", this.GROUP_CODE);
|
||
DataOperatorUtil.deleteJBOByCondtion(APP_BUSINESS_TEMPLATE.CLASS_NAME,
|
||
condtion, tx);
|
||
}
|
||
|
||
public String getDATA_NAME() {
|
||
return DATA_NAME;
|
||
}
|
||
|
||
public String getISLIST() {
|
||
return ISLIST;
|
||
}
|
||
|
||
public String getISSHOW() {
|
||
return ISSHOW;
|
||
}
|
||
|
||
public String getDATA_POSITION() {
|
||
return DATA_POSITION;
|
||
}
|
||
|
||
public String getISCONVERT() {
|
||
return ISCONVERT;
|
||
}
|
||
|
||
public String getDONO() {
|
||
return DONO;
|
||
}
|
||
|
||
public String getSORTNO() {
|
||
return SORTNO;
|
||
}
|
||
|
||
public void setDATA_NAME(String dATA_NAME) {
|
||
DATA_NAME = dATA_NAME;
|
||
}
|
||
|
||
public void setISLIST(String iSLIST) {
|
||
ISLIST = iSLIST;
|
||
}
|
||
|
||
public void setISSHOW(String iSSHOW) {
|
||
ISSHOW = iSSHOW;
|
||
}
|
||
|
||
public void setDATA_POSITION(String dATA_POSITION) {
|
||
DATA_POSITION = dATA_POSITION;
|
||
}
|
||
|
||
public void setISCONVERT(String iSCONVERT) {
|
||
ISCONVERT = iSCONVERT;
|
||
}
|
||
|
||
public void setDONO(String dONO) {
|
||
DONO = dONO;
|
||
}
|
||
|
||
public void setSORTNO(String sORTNO) {
|
||
SORTNO = sORTNO;
|
||
}
|
||
|
||
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳɾ<D2B2><C9BE>
|
||
public void removeAppGroupChild(JBOTransaction tx) throws Exception {
|
||
Map<String, String> condtion = new HashMap<String, String>();
|
||
condtion.put("GROUP_CODE", this.GROUP_CODE);
|
||
DataOperatorUtil.deleteJBOByCondtion(APP_BUSINESS_TEMPLATE.CLASS_NAME,
|
||
condtion, tx);
|
||
}
|
||
|
||
public void modifyAppGroupTemp(JBOTransaction tx) throws Exception {
|
||
// DataOperatorUtil.deleteJBOByCondtion(APP_BUSINESS_TEMPLATE.CLASS_NAME,
|
||
// condtion, tx);
|
||
JBOFactory
|
||
.getBizObjectManager("jbo.app.APP_BUSINESS_TEMPLATE")
|
||
.createQuery(
|
||
"update O set "
|
||
+ "ISLIST=:ISLIST,ISSHOW=:ISSHOW,DATA_POSITION=:DATA_POSITION,ISCONVERT=:ISCONVERT "
|
||
+ "where GROUP_CODE=:GROUP_CODE AND DATA_CODE=:DATA_CODE")
|
||
.setParameter("ISLIST", this.ISLIST)
|
||
.setParameter("ISSHOW", this.ISSHOW)
|
||
.setParameter("DATA_POSITION", this.DATA_POSITION)
|
||
.setParameter("ISCONVERT", this.ISCONVERT)
|
||
.setParameter("GROUP_CODE", this.GROUP_CODE)
|
||
.setParameter("DATA_CODE", this.DATA_CODE).executeUpdate();
|
||
|
||
}
|
||
|
||
class PushThread extends Thread {
|
||
public void run() {
|
||
pushMsg();
|
||
}
|
||
}
|
||
|
||
private void savePushMsg(JBOTransaction tx) {
|
||
PushMessageConstant pc = null;
|
||
try {
|
||
pc = new PushMessageConstant();
|
||
} catch (Exception e1) {
|
||
return;
|
||
}
|
||
String IS_PUSH = pc.getIS_PUSH();
|
||
if (IS_PUSH.equalsIgnoreCase("false")) {
|
||
return;
|
||
}
|
||
String title = "";
|
||
String messageContent = "";
|
||
|
||
BizObjectManager ftManager = null;
|
||
try {
|
||
ftManager = JBOFactory.getBizObjectManager("jbo.sys.FLOW_TASK", tx);
|
||
} catch (JBOException e1) {
|
||
// TODO Auto-generated catch block
|
||
e1.printStackTrace();
|
||
}
|
||
try {
|
||
BizObject ft = ftManager
|
||
.createQuery(
|
||
"select BO.proj_name, O.flowname "
|
||
+ "FROM O,jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT BO "
|
||
+ "WHERE serialNo=:serialNo AND O.objectno=BO.flow_unid")
|
||
.setParameter("serialNo", this.taskNo)
|
||
.getSingleResult(false);
|
||
|
||
String projName = ft.getAttribute("proj_name") == null ? "" : ft
|
||
.getAttribute("proj_name").toString();
|
||
String flowName = ft.getAttribute("flowname") == null ? "" : ft
|
||
.getAttribute("flowname").toString();
|
||
title = flowName;
|
||
messageContent = projName;
|
||
} catch (JBOException e1) {
|
||
// TODO Auto-generated catch block
|
||
e1.printStackTrace();
|
||
}
|
||
|
||
if (phaseAction.indexOf("|") > -1) {
|
||
return;
|
||
} else {
|
||
String[] phaseArr = phaseAction.split("@");
|
||
this.uids = phaseArr;
|
||
for (String uid : phaseArr) {
|
||
if (StringUtils.isBlank(uid)) {
|
||
continue;
|
||
}
|
||
savePush(uid, title, messageContent);
|
||
}
|
||
}
|
||
PushThread t = new PushThread();
|
||
t.start();
|
||
}
|
||
|
||
private void savePush(String userid, String title, String messageContent) {
|
||
|
||
String date = DateUtil.getSystemTimeByFormat(new Date(),
|
||
"yyyy/MM/dd HH:mm:ss.SSS");
|
||
String pushId = UUIDUtil.getUUID();
|
||
try {
|
||
BizObjectManager bm = JBOFactory
|
||
.getBizObjectManager("jbo.app.APP_PUSH_MESSAGE");
|
||
BizObject bo = bm.newObject();
|
||
bo.setAttributeValue("ID", pushId);
|
||
bo.setAttributeValue("USERID", userid);
|
||
bo.setAttributeValue("TITLE", title);
|
||
bo.setAttributeValue("MESSAGE_CONTENT", messageContent);
|
||
bo.setAttributeValue("RECORD_TS", date);
|
||
bo.setAttributeValue("PUSH_TYPE", "0");
|
||
bm.saveObject(bo);
|
||
} catch (JBOException e) {
|
||
return;
|
||
}
|
||
}
|
||
|
||
private void pushMsg() {
|
||
String messagePayload = "";
|
||
messagePayload = "This is a message!";
|
||
PushMessageUtil pmu = new PushMessageUtil();
|
||
|
||
try {
|
||
pmu.sends(messagePayload, this.uids);
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
|
||
public String getUid() {
|
||
return uid;
|
||
}
|
||
|
||
public void setUid(String uid) {
|
||
this.uid = uid;
|
||
}
|
||
|
||
public String removeAppFlow(JBOTransaction tx) throws Exception {
|
||
String flow_no = "";
|
||
BizObjectManager bomAppFlowShow = JBOFactory
|
||
.getBizObjectManager("jbo.app.APP_FLOW_SHOW");
|
||
BizObject bo1 = bomAppFlowShow.createQuery(
|
||
"select flow_no from O where ID ='" + this.uid + "' ")
|
||
.getSingleResult(false);
|
||
if (bo1 != null) {
|
||
flow_no = bo1.getAttribute("flow_no").toString();
|
||
// BizObjectManager bomRoleFlow = JBOFactory
|
||
// .getBizObjectManager("jbo.app.role_flow");
|
||
// @SuppressWarnings("unchecked")
|
||
// List<BizObject> bo2 = bomRoleFlow.createQuery(
|
||
// "select ri.rolename, o.flowname, o.roleid from role_flow O LEFT JOIN role_info ri ON o.roleid = ri.roleid where o.flowname<>'' "
|
||
// + "and o.flowname is not null").getResultList(false);
|
||
String sql = "select ri.rolename, o.flowname, o.roleid from role_flow O "
|
||
+ "LEFT JOIN role_info ri ON o.roleid = ri.roleid "
|
||
+ "where o.flowname<>'' " + "and o.flowname is not null";
|
||
Transaction sqlca = Transaction.createTransaction("als");
|
||
ASResultSet rs = null;
|
||
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
||
try {
|
||
SqlObject sqlObject = new SqlObject(sql);
|
||
rs = sqlca.getResultSet(sqlObject);
|
||
while (rs.next()) {
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
map.put("rolename", rs.getString("rolename"));
|
||
map.put("flow", rs.getString("flowname"));
|
||
map.put("roleid", rs.getString("roleid"));
|
||
list.add(map);
|
||
}
|
||
} catch (SQLException e) {
|
||
ARE.getLog().error(e);
|
||
} catch (Exception e) {
|
||
ARE.getLog().error(e);
|
||
} finally {
|
||
if (rs != null) {
|
||
try {
|
||
rs.getStatement().close();
|
||
rs = null;
|
||
} catch (SQLException e) {
|
||
ARE.getLog().error(e);
|
||
}
|
||
}
|
||
}
|
||
boolean flag = true;
|
||
String roles = "";
|
||
if (list != null && list.size() > 0) {
|
||
for (Map<String, Object> map : list) {
|
||
String flows = map.get("flow") == null ? "" : map.get(
|
||
"flow").toString();
|
||
String rolename = map.get("rolename") == null ? "" : map
|
||
.get("rolename").toString();
|
||
String[] arr = flows.trim().split(",");
|
||
for (String str : arr) {
|
||
if (str.equals(flow_no)) {
|
||
flag = false;
|
||
roles += rolename + ",";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (!flag) {
|
||
roles = roles.trim();
|
||
if (roles.endsWith(",")) {
|
||
roles = roles.substring(0, roles.length() - 1);
|
||
}
|
||
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD>(\r\n" + roles + "\r\n) <20><><EFBFBD><EFBFBD>,<2C><EFBFBD>ɾ<EFBFBD><C9BE>!\r\n\r\n";
|
||
}
|
||
Map<String, String> condtion = new HashMap<String, String>();
|
||
condtion.put("id", this.uid);
|
||
try {
|
||
DataOperatorUtil.deleteJBOByCondtion("jbo.app.APP_FLOW_SHOW",
|
||
condtion, tx);
|
||
} catch (Exception e) {
|
||
return "ɾ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!";
|
||
}
|
||
} else {
|
||
return "<EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><EFBFBD>ɾ<EFBFBD><C9BE>!";
|
||
}
|
||
return "ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!";
|
||
}
|
||
|
||
public String getNextNodeType() {
|
||
return nextNodeType;
|
||
}
|
||
|
||
public void setNextNodeType(String nextNodeType) {
|
||
this.nextNodeType = nextNodeType;
|
||
}
|
||
|
||
}
|