|
|
@@ -2,6 +2,7 @@ package cc.smtweb.system.bpm.web.engine.flow; |
|
|
|
|
|
|
|
import cc.smtweb.framework.core.common.SwMap; |
|
|
|
import cc.smtweb.framework.core.db.DbEngine; |
|
|
|
import cc.smtweb.framework.core.db.EntityDao; |
|
|
|
import cc.smtweb.framework.core.db.EntityHelper; |
|
|
|
import cc.smtweb.framework.core.exception.BizException; |
|
|
|
import cc.smtweb.framework.core.exception.SwException; |
|
|
@@ -290,14 +291,14 @@ public class FlowInstance { |
|
|
|
//启动流程 |
|
|
|
public void save() { |
|
|
|
if (opt_mode == FlowConst.OperatorType.NEW) { |
|
|
|
DbEngine.getInstance().findDao(ProcInst.class).insertEntity(procInst); |
|
|
|
DbEngine.getInstance().findDao(Task.class).insertEntity(actInst); |
|
|
|
getProcInstDao().insertEntity(procInst); |
|
|
|
getTaskDao().insertEntity(actInst); |
|
|
|
buildBillLog(FlowConst.Button.ADD.value, null, null); |
|
|
|
opt_mode = FlowConst.OperatorType.EDIT; |
|
|
|
} else { |
|
|
|
DbEngine.getInstance().findDao(ProcInst.class).updateEntity(procInst); |
|
|
|
getProcInstDao().updateEntity(procInst); |
|
|
|
if (actInst != null) { |
|
|
|
DbEngine.getInstance().findDao(Task.class).updateEntity(actInst); |
|
|
|
getTaskDao().updateEntity(actInst); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -308,13 +309,13 @@ public class FlowInstance { |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
public void delete() { |
|
|
|
DbEngine.getInstance().findDao(ProcInst.class).deleteEntity(procInst); |
|
|
|
DbEngine.getInstance().findDao(Task.class).deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
DbEngine.getInstance().findDao(Candidate.class).deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
DbEngine.getInstance().findDao(Care.class).deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
DbEngine.getInstance().findDao(Comment.class).deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
DbEngine.getInstance().findDao(Sign.class).deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
DbEngine.getInstance().findDao(TaskRel.class).deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
getProcInstDao().deleteEntity(procInst); |
|
|
|
getTaskDao().deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
getCandidateDao().deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
getCareDao().deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
getCommentDao().deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
getSignDao().deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
getTaskRelDao().deleteEntity("where bill_id=?", procInst.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -452,7 +453,7 @@ public class FlowInstance { |
|
|
|
throw new BizException("非制单步骤,必须办理人本人操作!"); |
|
|
|
} |
|
|
|
} |
|
|
|
/* |
|
|
|
|
|
|
|
public void submitToEnd() { |
|
|
|
long user_id = us.getUserId(); |
|
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
@@ -477,7 +478,7 @@ public class FlowInstance { |
|
|
|
List<Candidate> listInsertCand = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Activity act : new_acts) { |
|
|
|
buildTask(act, listInsertTask, listInsertCand, listTaskRel, user_id); |
|
|
|
// buildTask(act, listInsertTask, listInsertCand, listTaskRel, user_id); todo |
|
|
|
} |
|
|
|
|
|
|
|
actInst.setHandler(user_id); |
|
|
@@ -491,27 +492,25 @@ public class FlowInstance { |
|
|
|
procInst.setTaskId(actInst.getEntityId()); |
|
|
|
} |
|
|
|
|
|
|
|
if (new_acts.size() == 1 && new_acts.get(0).getType() == FlowConst.ActivityType.endEvent.value) { |
|
|
|
procInst.setstatu(FlowConst.InstanceStatu.FINISH.value); |
|
|
|
procInst.setEndTime(UtilDateTime.nowDateTimeString()); |
|
|
|
if (new_acts.size() == 1 && new_acts.get(0).getType() == FlowConst.ActivityType.END.value) { |
|
|
|
procInst.setStatu(FlowConst.InstanceStatu.FINISH.value); |
|
|
|
procInst.setEndTime(DateUtil.nowDateTimeLong()); |
|
|
|
} else { |
|
|
|
procInst.setstatu(FlowConst.InstanceStatu.RUNING.value); |
|
|
|
procInst.setStatu(FlowConst.InstanceStatu.RUNING.value); |
|
|
|
} |
|
|
|
|
|
|
|
//保存入库 |
|
|
|
if (!listInsertTask.isEmpty()) { |
|
|
|
actDao.batchInsert(listInsertTask); |
|
|
|
new CandidateDao().batchInsert(listInsertCand); |
|
|
|
new ActinstRelDao().batchInsert(listTaskRel); |
|
|
|
getTaskDao().batchInsertEntity(listInsertTask); |
|
|
|
getCandidateDao().batchInsertEntity(listInsertCand); |
|
|
|
getTaskRelDao().batchInsertEntity(listTaskRel); |
|
|
|
} |
|
|
|
actDao.update(actInst); |
|
|
|
new ProcinstDao().update(procInst); |
|
|
|
|
|
|
|
buildBillLog(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask); |
|
|
|
comp.transCallback(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask); |
|
|
|
getTaskDao().updateEntity(actInst); |
|
|
|
getProcInstDao().updateEntity(procInst); |
|
|
|
|
|
|
|
buildBillLog(FlowConst.Button.SUBMIT.value, actInst, listInsertTask); |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 提交 |
|
|
@@ -947,4 +946,32 @@ public class FlowInstance { |
|
|
|
new LogDao().insert(logEntity); |
|
|
|
*/ |
|
|
|
} |
|
|
|
|
|
|
|
private EntityDao<ProcInst> getProcInstDao() { |
|
|
|
return DbEngine.getInstance().findDao(ProcInst.class); |
|
|
|
} |
|
|
|
|
|
|
|
private EntityDao<Task> getTaskDao() { |
|
|
|
return DbEngine.getInstance().findDao(Task.class); |
|
|
|
} |
|
|
|
|
|
|
|
private EntityDao<Candidate> getCandidateDao() { |
|
|
|
return DbEngine.getInstance().findDao(Candidate.class); |
|
|
|
} |
|
|
|
|
|
|
|
private EntityDao<Care> getCareDao() { |
|
|
|
return DbEngine.getInstance().findDao(Care.class); |
|
|
|
} |
|
|
|
|
|
|
|
private EntityDao<Comment> getCommentDao() { |
|
|
|
return DbEngine.getInstance().findDao(Comment.class); |
|
|
|
} |
|
|
|
|
|
|
|
private EntityDao<Sign> getSignDao() { |
|
|
|
return DbEngine.getInstance().findDao(Sign.class); |
|
|
|
} |
|
|
|
|
|
|
|
private EntityDao<TaskRel> getTaskRelDao() { |
|
|
|
return DbEngine.getInstance().findDao(TaskRel.class); |
|
|
|
} |
|
|
|
} |