浏览代码

sop人员配置

wangliang 1 年之前
父节点
当前提交
339c956e2b

文件差异内容过多而无法显示
+ 13 - 1
sop-api/src/main/java/com/qmth/sop/server/api/TBSopInfoController.java


+ 29 - 7
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -658,20 +658,27 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Override
     @Override
     @Transactional
     @Transactional
     public Boolean taskApproverExchange(Long userId, Long taskId) {
     public Boolean taskApproverExchange(Long userId, Long taskId) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        if (Objects.equals(String.valueOf(sysUser.getId()), String.valueOf(userId))) {
+        Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
+        Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
+
+        if (Objects.nonNull(task.getAssignee()) && task.getAssignee().equals(userId.toString())) {
             throw ExceptionResultEnum.ERROR.exception("不能转给自己!");
             throw ExceptionResultEnum.ERROR.exception("不能转给自己!");
+        } else {
+            List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
+            if (!CollectionUtils.isEmpty(identityLinkList)) {
+                for (IdentityLink i : identityLinkList) {
+                    if (i.getTaskId().equals(taskId.toString()) && i.getUserId().equals(userId.toString())) {
+                        throw ExceptionResultEnum.ERROR.exception("不能转给自己!");
+                    }
+                }
+            }
         }
         }
-
         boolean lock = memoryLock.lock(SystemConstant.LOCK_FLOW_EXCHANGE_PREFIX + taskId, taskId,
         boolean lock = memoryLock.lock(SystemConstant.LOCK_FLOW_EXCHANGE_PREFIX + taskId, taskId,
                 SystemConstant.LOCK_FLOW_TIME_OUT);
                 SystemConstant.LOCK_FLOW_TIME_OUT);
         if (!lock) {
         if (!lock) {
             throw ExceptionResultEnum.ERROR.exception("正在转审中,请稍候再试!");
             throw ExceptionResultEnum.ERROR.exception("正在转审中,请稍候再试!");
         }
         }
         try {
         try {
-            Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
-            Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
-
             BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
             BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
             FlowNode currFlow = (FlowNode) bpmnModel.getMainProcess().getFlowElement(task.getTaskDefinitionKey());
             FlowNode currFlow = (FlowNode) bpmnModel.getMainProcess().getFlowElement(task.getTaskDefinitionKey());
             boolean multiInstance = false;
             boolean multiInstance = false;
@@ -699,7 +706,21 @@ public class ActivitiServiceImpl implements ActivitiService {
             }
             }
 
 
             if (!multiInstance) {
             if (!multiInstance) {
-                taskService.deleteCandidateUser(String.valueOf(taskId), String.valueOf(sysUser.getId()));
+                String oldUserId = task.getAssignee();
+                if (Objects.nonNull(task.getAssignee())) {
+                    oldUserId = task.getAssignee();
+                } else {
+                    List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
+                    if (!CollectionUtils.isEmpty(identityLinkList)) {
+                        for (IdentityLink i : identityLinkList) {
+                            if (i.getTaskId().equals(taskId.toString())) {
+                                oldUserId = i.getUserId();
+                                break;
+                            }
+                        }
+                    }
+                }
+                taskService.deleteCandidateUser(String.valueOf(taskId), oldUserId);
                 taskService.addCandidateUser(String.valueOf(taskId), String.valueOf(userId));
                 taskService.addCandidateUser(String.valueOf(taskId), String.valueOf(userId));
             } else {
             } else {
                 taskService.setAssignee(String.valueOf(taskId), String.valueOf(userId));
                 taskService.setAssignee(String.valueOf(taskId), String.valueOf(userId));
@@ -715,6 +736,7 @@ public class ActivitiServiceImpl implements ActivitiService {
             LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
             LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
             FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(
             FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(
                     GsonUtil.toJson(setupMap.get(task.getTaskDefinitionKey())), FlowTaskResult.class);
                     GsonUtil.toJson(setupMap.get(task.getTaskDefinitionKey())), FlowTaskResult.class);
+            SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             TFFlowLog tfFlowLog = new TFFlowLog(sysUser.getOrgId(), sysUser.getId(), sysUser.getId(),
             TFFlowLog tfFlowLog = new TFFlowLog(sysUser.getOrgId(), sysUser.getId(), sysUser.getId(),
                     currFlowTaskResult.getSetup(), Long.parseLong(task.getProcessInstanceId()),
                     currFlowTaskResult.getSetup(), Long.parseLong(task.getProcessInstanceId()),
                     Long.parseLong(task.getId()), tfCustomFlowEntity.getId(), String.valueOf(userId));
                     Long.parseLong(task.getId()), tfCustomFlowEntity.getId(), String.valueOf(userId));

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -754,7 +754,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                         approveUserIds.add(u.getUserId().toString());
                         approveUserIds.add(u.getUserId().toString());
                     }
                     }
                 } else {
                 } else {
-                    //todo 需要调用曹子轩项目经理变更的方法
+                    //todo 需要调用曹子轩项目经理变更的方法,并且注释是[系统]
                     Objects.requireNonNull(crmProjectResult.getRegionManagerId(), "未设置大区经理");
                     Objects.requireNonNull(crmProjectResult.getRegionManagerId(), "未设置大区经理");
                     try {
                     try {
                         tbUserArchivesService.findByUserId(crmProjectResult.getRegionManagerId());
                         tbUserArchivesService.findByUserId(crmProjectResult.getRegionManagerId());

+ 2 - 0
sop-business/src/main/resources/mapper/TBSopInfoMapper.xml

@@ -76,6 +76,7 @@
                cast(tfcf.flow_deployment_id as char) as flowDeploymentId,
                cast(tfcf.flow_deployment_id as char) as flowDeploymentId,
                IFNULL(art.NAME_,'--') as taskName,
                IFNULL(art.NAME_,'--') as taskName,
                art.TASK_DEF_KEY_ as taskDefKey,
                art.TASK_DEF_KEY_ as taskDefKey,
+               tbcd.id as crmDetailId,
                (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = tffa.flow_id) as taskId
                (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = tffa.flow_id) as taskId
                 <if test="fieldName != null and fieldName != ''">
                 <if test="fieldName != null and fieldName != ''">
                     ,${fieldName}
                     ,${fieldName}
@@ -92,6 +93,7 @@
                  left join ACT_RU_TASK art on art.PROC_INST_ID_ = tffa.flow_id
                  left join ACT_RU_TASK art on art.PROC_INST_ID_ = tffa.flow_id
                  left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
                  left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
                  left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
                  left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
+                 left join t_b_crm_detail tbcd on tbcd.sop_no = tbsi.sop_no
                  <if test="tableName != null and tableName != ''">
                  <if test="tableName != null and tableName != ''">
                      left join ${tableName} t on t.flow_deployment_id = tfcf.flow_deployment_id and t.code = tfcfe.code
                      left join ${tableName} t on t.flow_deployment_id = tfcf.flow_deployment_id and t.code = tfcfe.code
                  </if>
                  </if>

部分文件因为文件数量过多而无法显示