|
@@ -416,7 +416,7 @@ public class FlowInstance { |
|
|
|
|
|
|
|
|
boolean canDel = !isFinish && actInst.isMake() && !isNew; |
|
|
boolean canDel = !isFinish && actInst.isMake() && !isNew; |
|
|
buttons.add(createButton(FlowConst.Button.DEL, canDel)); |
|
|
buttons.add(createButton(FlowConst.Button.DEL, canDel)); |
|
|
buttons.add(createButton(FlowConst.Button.DISUSE, !isNew && !actInst.isMake())); |
|
|
|
|
|
|
|
|
buttons.add(createButton(FlowConst.Button.DISUSE, !isNew && !isFinish && !actInst.isMake())); |
|
|
buttons.add(createButton(FlowConst.Button.LOG, !isNew)); |
|
|
buttons.add(createButton(FlowConst.Button.LOG, !isNew)); |
|
|
buttons.add(createButton(FlowConst.Button.WORD, !isNew)); |
|
|
buttons.add(createButton(FlowConst.Button.WORD, !isNew)); |
|
|
buttons.add(createButton(FlowConst.Button.EXCEL, !isNew)); |
|
|
buttons.add(createButton(FlowConst.Button.EXCEL, !isNew)); |
|
@@ -462,7 +462,7 @@ public class FlowInstance { |
|
|
long user_id = us.getUserId(); |
|
|
long user_id = us.getUserId(); |
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
checkPermission(); |
|
|
checkPermission(); |
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
|
|
|
|
|
|
if (actInst.getStatu() >= FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
throw new BizException("当前任务已经提交,不能重复提交"); |
|
|
throw new BizException("当前任务已经提交,不能重复提交"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -528,8 +528,8 @@ public class FlowInstance { |
|
|
long user_id = us.getUserId(); |
|
|
long user_id = us.getUserId(); |
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
checkPermission(); |
|
|
checkPermission(); |
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
|
|
|
throw new BizException("当前任务已经提交,不能重复提交"); |
|
|
|
|
|
|
|
|
if (actInst.getStatu() >= FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
|
|
|
throw new BizException("当前任务已经完成,不能重复提交"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !FlowHelper.isMyWaitedTask(actInst.getEntityId(), user_id)) { |
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !FlowHelper.isMyWaitedTask(actInst.getEntityId(), user_id)) { |
|
@@ -600,6 +600,10 @@ public class FlowInstance { |
|
|
throw new BizException("当前单据已审批完成,不能作废单据"); |
|
|
throw new BizException("当前单据已审批完成,不能作废单据"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (actInst.getStatu() >= FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
|
|
|
throw new BizException("当前任务已经完成,不能作废单据"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !FlowHelper.isMyWaitedTask(actInst.getEntityId(), user_id)) { |
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !FlowHelper.isMyWaitedTask(actInst.getEntityId(), user_id)) { |
|
|
throw new BizException("您不是当前任务的办理人,不允许作废"); |
|
|
throw new BizException("您不是当前任务的办理人,不允许作废"); |
|
|
} |
|
|
} |
|
@@ -774,7 +778,7 @@ public class FlowInstance { |
|
|
long user_id = us.getUserId(); |
|
|
long user_id = us.getUserId(); |
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
checkPermission(); |
|
|
checkPermission(); |
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
|
|
|
|
|
|
if (actInst.getStatu() >= FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
throw new BizException("当前任务已经提交,不能驳回!"); |
|
|
throw new BizException("当前任务已经提交,不能驳回!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -800,6 +804,13 @@ public class FlowInstance { |
|
|
buildRejectTask(toTask, listInsertTask, listInsertCand, listTaskRel, listTaskComment); |
|
|
buildRejectTask(toTask, listInsertTask, listInsertCand, listTaskRel, listTaskComment); |
|
|
} |
|
|
} |
|
|
actInst.setStatu(FlowConst.ActivityStatu.REJECT.value); |
|
|
actInst.setStatu(FlowConst.ActivityStatu.REJECT.value); |
|
|
|
|
|
if (listInsertTask.size() > 0) { |
|
|
|
|
|
procInst.setTaskId(listInsertTask.get(0).getEntityId()); |
|
|
|
|
|
procInst.setActName(listInsertTask.get(0).getActName()); |
|
|
|
|
|
} else { |
|
|
|
|
|
procInst.setTaskId(actInst.getEntityId()); |
|
|
|
|
|
procInst.setActName(actInst.getActName()); |
|
|
|
|
|
} |
|
|
//先停止其他待办或办理中的任务 |
|
|
//先停止其他待办或办理中的任务 |
|
|
FlowHelper.stopTask(procInst.getId(), actInst.getId()); |
|
|
FlowHelper.stopTask(procInst.getId(), actInst.getId()); |
|
|
//保存入库 |
|
|
//保存入库 |
|
@@ -849,99 +860,6 @@ public class FlowInstance { |
|
|
listTaskComment.add(createComment(task)); |
|
|
listTaskComment.add(createComment(task)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void rejectTo(String comment, long toTaskId, List<Task> listInsertTask, List<TaskRel> listTaskRel, List<Comment> listTaskComment, List<Candidate> listInsertCand) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void rejectEx(String comment) { |
|
|
|
|
|
long user_id = us.getUserId(); |
|
|
|
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
|
|
|
checkPermission(); |
|
|
|
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
|
|
|
throw new BizException("当前任务已提交,不能驳回!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取前置任务,前置任务需要置为被驳回的办理状态,为保证流程信息,复制一份,作为新建任务处理 |
|
|
|
|
|
List<Task> new_acts = provider.findBeforeTasks(actInst.getEntityId()); |
|
|
|
|
|
if (CommUtil.isEmpty(new_acts)) { |
|
|
|
|
|
throw new BizException("没有找到前续任务,驳回失败!"); |
|
|
|
|
|
} |
|
|
|
|
|
//记录需要被删除后续任务的任务id |
|
|
|
|
|
StringBuilder sqlIn = new StringBuilder(128); |
|
|
|
|
|
//设为被驳回状态 |
|
|
|
|
|
for (Task act : new_acts) { |
|
|
|
|
|
act.setStatu(FlowConst.ActivityStatu.HANDLE.value); |
|
|
|
|
|
act.setReject(true); |
|
|
|
|
|
|
|
|
|
|
|
sqlIn.append(",").append(act.getEntityId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
actInst.setStatu(FlowConst.ActivityStatu.REJECT.value); |
|
|
|
|
|
|
|
|
|
|
|
procInst.setTaskId(new_acts.get(0).getEntityId()); |
|
|
|
|
|
procInst.setActName(new_acts.get(0).getActName()); |
|
|
|
|
|
if (new_acts.size() == 1 && new_acts.get(0).isMake()) { |
|
|
|
|
|
procInst.setStatu(FlowConst.InstanceStatu.BEGIN.value); |
|
|
|
|
|
} else { |
|
|
|
|
|
procInst.setStatu(FlowConst.InstanceStatu.RUNING.value); |
|
|
|
|
|
} |
|
|
|
|
|
//删除这些任务的后续任务 |
|
|
|
|
|
List<Task> del_acts = provider.findAfterTasks(sqlIn.substring(1)); |
|
|
|
|
|
EntityDao<Task> taskDao = getTaskDao(); |
|
|
|
|
|
taskDao.batchDelete(del_acts); |
|
|
|
|
|
taskDao.batchUpdateEntity(new_acts); |
|
|
|
|
|
getTaskRelDao().deleteEntity("where trl_src_task_id in (" + sqlIn.substring(1) + ")"); |
|
|
|
|
|
getProcInstDao().updateEntity(procInst); |
|
|
|
|
|
|
|
|
|
|
|
buildBillLog(FlowConst.Button.REJECT.value, comment, actInst, new_acts); |
|
|
|
|
|
listener.afterReject(actInst, new_acts); |
|
|
|
|
|
// comp.transCallback(FlowConst.FlowOptType.REJECT.value, actInst, new_acts); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 驳回到制单 |
|
|
|
|
|
* |
|
|
|
|
|
* @throws Exception |
|
|
|
|
|
*/ |
|
|
|
|
|
public void rejectToMake() { |
|
|
|
|
|
//校验权限,当前人员有权限干不,没权限直接抛异常 |
|
|
|
|
|
checkPermission(); |
|
|
|
|
|
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) { |
|
|
|
|
|
throw new BizException("当前任务已提交,不能驳回!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取前置任务,前置任务需要置为被驳回的办理状态,同时,前置任务的其他后置任务需要删除 |
|
|
|
|
|
Task make_act = provider.findMakeTask(actInst.getPriId()); |
|
|
|
|
|
if (EntityHelper.isEmpty(make_act)) { |
|
|
|
|
|
throw new BizException("没有找到制单任务,驳回到制单失败!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//设为被驳回状态 |
|
|
|
|
|
make_act.setStatu(FlowConst.ActivityStatu.HANDLE.value); |
|
|
|
|
|
make_act.setReject(true); |
|
|
|
|
|
|
|
|
|
|
|
actInst.setStatu(FlowConst.ActivityStatu.REJECT.value); |
|
|
|
|
|
|
|
|
|
|
|
procInst.setTaskId(make_act.getEntityId()); |
|
|
|
|
|
procInst.setActName(make_act.getActName()); |
|
|
|
|
|
procInst.setStatu(FlowConst.InstanceStatu.BEGIN.value); |
|
|
|
|
|
|
|
|
|
|
|
EntityDao<Task> taskDao = getTaskDao(); |
|
|
|
|
|
taskDao.updateEntity(make_act); |
|
|
|
|
|
//删除非制单步骤 |
|
|
|
|
|
taskDao.deleteEntity("where tsk_pri_id = ? and tsk_id <> ? ", make_act.getPriId(), make_act.getId()); |
|
|
|
|
|
getTaskRelDao().deleteEntity("where trl_pri_id = ? and trl_tsk_id <> ?", make_act.getPriId(), make_act.getId()); |
|
|
|
|
|
getProcInstDao().updateEntity(procInst); |
|
|
|
|
|
//删除候选人 |
|
|
|
|
|
getCandidateDao().deleteEntity(" where cnd_pri_id = ? and cnd_tsk_id <> ?", make_act.getPriId(), make_act.getId()); |
|
|
|
|
|
|
|
|
|
|
|
List<Task> make_acts = new ArrayList<>(); |
|
|
|
|
|
make_acts.add(make_act); |
|
|
|
|
|
|
|
|
|
|
|
buildBillLog(FlowConst.Button.REJECT.value, "TODO", actInst, make_acts); |
|
|
|
|
|
listener.afterReject(actInst, make_acts); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 状态变更,构建日志 |
|
|
* 状态变更,构建日志 |
|
|
*/ |
|
|
*/ |
|
|