diff --git a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepUserStatus.java b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepUserStatus.java index 70918af2cf5b9211538026b441e99f9efd8c7348..80ea17d2368dc599591424305547351a4a9861b0 100755 --- a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepUserStatus.java +++ b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepUserStatus.java @@ -1,14 +1,14 @@ package neatlogic.framework.process.constvalue; -import neatlogic.framework.util.I18n; - public enum ProcessTaskStepUserStatus { - DOING("doing", new I18n("处理中")), DONE("done", new I18n("处理完毕")); + DOING("doing", "处理中"), + DONE("done", "处理完毕"), + TRANSFERRED("transferred", "已转交"); private String status; - private I18n text; + private String text; - private ProcessTaskStepUserStatus(String _status, I18n _text) { + ProcessTaskStepUserStatus(String _status, String _text) { this.status = _status; this.text = _text; } @@ -18,7 +18,7 @@ public enum ProcessTaskStepUserStatus { } public String getText() { - return text.toString(); + return text; } public static String getValue(String _status) { diff --git a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepUserType.java b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepUserType.java new file mode 100644 index 0000000000000000000000000000000000000000..cdffe5987cf2d22eb7ba65f389aa39690cfe6239 --- /dev/null +++ b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepUserType.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.process.constvalue; + +public enum ProcessTaskStepUserType { + MAJOR("major", "处理人"), + MINOR("minor", "协助处理人"), + HISTORY_MAJOR("history_major", "历史处理人"), + ; + + private final String value; + private final String text; + + ProcessTaskStepUserType(String value, String text) { + this.value = value; + this.text = text; + } + + public String getValue() { + return value; + } + + public String getText() { + return text; + } +} diff --git a/src/main/java/neatlogic/framework/process/crossover/IProcessTaskCrossoverMapper.java b/src/main/java/neatlogic/framework/process/crossover/IProcessTaskCrossoverMapper.java index 00e6c228b49c852c1d14100d0ddde51bca40d12e..45aba42baeb527fbfa418ba59e4157c16e9b6d0d 100644 --- a/src/main/java/neatlogic/framework/process/crossover/IProcessTaskCrossoverMapper.java +++ b/src/main/java/neatlogic/framework/process/crossover/IProcessTaskCrossoverMapper.java @@ -174,6 +174,8 @@ public interface IProcessTaskCrossoverMapper extends ICrossoverService { int updateProcessTaskStepUserStatus(ProcessTaskStepUserVo processTaskStepUserVo); + int updateProcessTaskStepMajorUserUserTypeAndStatus(ProcessTaskStepUserVo processTaskStepUserVo); + int updateProcessTaskTitleOwnerPriorityUuid(ProcessTaskVo processTaskVo); int updateProcessTaskStepWorkerUuid(ProcessTaskStepWorkerVo processTaskStepWorkerVo); diff --git a/src/main/java/neatlogic/framework/process/dto/ProcessTaskStepReplyVo.java b/src/main/java/neatlogic/framework/process/dto/ProcessTaskStepReplyVo.java index 5ab860c2dc2e9b5d2d0e3de4e22a0389eea9ce61..c9558f938b5a3a264cdb5ecf1136c8fcea0b0802 100644 --- a/src/main/java/neatlogic/framework/process/dto/ProcessTaskStepReplyVo.java +++ b/src/main/java/neatlogic/framework/process/dto/ProcessTaskStepReplyVo.java @@ -1,15 +1,15 @@ package neatlogic.framework.process.dto; -import java.util.ArrayList; -import java.util.List; - import com.alibaba.fastjson.annotation.JSONField; - import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.common.dto.BaseEditorVo; +import neatlogic.framework.dto.WorkAssignmentUnitVo; import neatlogic.framework.file.dto.FileVo; import neatlogic.framework.restful.annotation.EntityField; +import java.util.ArrayList; +import java.util.List; + public class ProcessTaskStepReplyVo extends BaseEditorVo { @EntityField(name = "回复id", type = ApiParamType.LONG) private Long id; @@ -40,6 +40,9 @@ public class ProcessTaskStepReplyVo extends BaseEditorVo { private String sourceName; @EntityField(name = "操作人角色", type = ApiParamType.STRING) private String operatorRole; + @EntityField(name = "目标对象列表", type = ApiParamType.JSONARRAY) + List targetList; + public ProcessTaskStepReplyVo() {} public ProcessTaskStepReplyVo(ProcessTaskStepContentVo processTaskStepContentVo) { super.setFcd(processTaskStepContentVo.getFcd()); @@ -147,4 +150,12 @@ public class ProcessTaskStepReplyVo extends BaseEditorVo { public void setOperatorRole(String operatorRole) { this.operatorRole = operatorRole; } + + public List getTargetList() { + return targetList; + } + + public void setTargetList(List targetList) { + this.targetList = targetList; + } } diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java index 0ead69d46e698d1d2b1078f10bf1997d7f78ae1d..d1ffb85bfff88c4e5395e9d0c01c762d17b9b307 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java @@ -372,11 +372,29 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { throw new ProcessTaskStepNoMatchedWorkerException(); } - ProcessTaskStepUserVo processTaskStepUserVo = new ProcessTaskStepUserVo(); - processTaskStepUserVo.setProcessTaskStepId(currentProcessTaskStepVo.getId()); - processTaskStepUserVo.setUserType(ProcessUserType.MAJOR.getValue());// 只删除主处理人人 - processTaskCrossoverMapper.deleteProcessTaskStepUser(processTaskStepUserVo); - + if (!oldUserList.isEmpty()) { + boolean changeMajorUser = true; + ProcessTaskStepUserVo oldUserVo = oldUserList.get(0); + for (ProcessTaskStepWorkerVo workerVo : workerSet) { + if (Objects.equals(workerVo.getUuid(), oldUserVo.getUserUuid())) { + changeMajorUser = false; + break; + } + } + if (changeMajorUser) { + oldUserVo.setUserType(ProcessTaskStepUserType.HISTORY_MAJOR.getValue()); + oldUserVo.setStatus(ProcessTaskStepUserStatus.DONE.getValue()); + int count = processTaskCrossoverMapper.updateProcessTaskStepMajorUserUserTypeAndStatus(oldUserVo); + System.out.println("count = " + count); + List processTaskStepUserList = processTaskCrossoverMapper.getProcessTaskStepUserListByProcessTaskIdList(Collections.singletonList(currentProcessTaskStepVo.getProcessTaskId())); + System.out.println("processTaskStepUserList = " + JSONObject.toJSONString(processTaskStepUserList)); + } else { + ProcessTaskStepUserVo processTaskStepUserVo = new ProcessTaskStepUserVo(); + processTaskStepUserVo.setProcessTaskStepId(currentProcessTaskStepVo.getId()); + processTaskStepUserVo.setUserType(ProcessUserType.MAJOR.getValue());// 只删除主处理人人 + processTaskCrossoverMapper.deleteProcessTaskStepUser(processTaskStepUserVo); + } + } /* 当只分配到一个用户时,自动设置为处理人,不需要抢单 **/ if (workerSet.size() == 1 && autoStart == 1) { for (ProcessTaskStepWorkerVo workerVo : workerSet) { @@ -1691,6 +1709,10 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } } for (ProcessTaskStepUserVo oldUser : oldUserList) { + /* 更新处理人状态 **/ + oldUser.setUserType(ProcessTaskStepUserType.HISTORY_MAJOR.getValue()); + oldUser.setStatus(ProcessTaskStepUserStatus.TRANSFERRED.getValue()); + processTaskCrossoverMapper.updateProcessTaskStepMajorUserUserTypeAndStatus(oldUser); if (workerUserUuidList.contains(oldUser.getUserUuid())) { String userName = oldUser.getUserName(); if (StringUtils.isBlank(userName)) { @@ -1703,13 +1725,21 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } } /* 清空user表 **/ - ProcessTaskStepUserVo processTaskStepUserVo = new ProcessTaskStepUserVo(); - processTaskStepUserVo.setProcessTaskStepId(currentProcessTaskStepVo.getId()); - processTaskStepUserVo.setUserType(ProcessUserType.MAJOR.getValue()); - processTaskCrossoverMapper.deleteProcessTaskStepUser(processTaskStepUserVo); +// ProcessTaskStepUserVo processTaskStepUserVo = new ProcessTaskStepUserVo(); +// processTaskStepUserVo.setProcessTaskStepId(currentProcessTaskStepVo.getId()); +// processTaskStepUserVo.setUserType(ProcessUserType.MAJOR.getValue()); +// processTaskCrossoverMapper.deleteProcessTaskStepUser(processTaskStepUserVo); } /* 保存描述内容 **/ + JSONArray contentTargetList = new JSONArray(); + for (ProcessTaskStepWorkerVo workerVo : workerList) { + JSONObject contentTargetObj = new JSONObject(); + contentTargetObj.put("type", workerVo.getType()); + contentTargetObj.put("uuid", workerVo.getUuid()); + contentTargetList.add(contentTargetObj); + } + currentProcessTaskStepVo.getParamObj().put("contentTargetList", contentTargetList); processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_TRANSFER); /* 根据子类需要把最终处理人放进来,引擎将自动写入数据库,也可能为空,例如一些特殊的流程节点 **/ @@ -1764,7 +1794,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } catch (ProcessTaskException e) { logger.error(e.getMessage(), e); processTaskStepVo.setError(e.getMessage()); - currentProcessTaskStepVo.setIsActive(1); + processTaskStepVo.setIsActive(1); processTaskStepVo.setStatus(ProcessTaskStepStatus.FAILED.getValue()); updateProcessTaskStepStatus(processTaskStepVo); } finally {