From 245663c4f6092eb9f06905e684d6ecb04aeb1313 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期四, 16 一月 2025 22:33:08 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/project_management-java

---
 business/src/main/java/com/ycl/domain/vo/CustomerTaskVO.java               |   10 ++
 flowable/src/main/java/com/ycl/common/constant/ProcessConstants.java       |    4 
 system/src/main/java/com/ycl/framework/config/SecurityConfig.java          |    1 
 business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java |  222 ++++++++++++++++++++++++++++----------------
 flowable/src/main/java/com/ycl/service/common/TaskCommonService.java       |   23 ++++
 flowable/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java       |   31 +++---
 6 files changed, 194 insertions(+), 97 deletions(-)

diff --git a/business/src/main/java/com/ycl/domain/vo/CustomerTaskVO.java b/business/src/main/java/com/ycl/domain/vo/CustomerTaskVO.java
index e14bbd0..b346939 100644
--- a/business/src/main/java/com/ycl/domain/vo/CustomerTaskVO.java
+++ b/business/src/main/java/com/ycl/domain/vo/CustomerTaskVO.java
@@ -97,6 +97,16 @@
     private List<String> handlerUnitName;
 
     /**
+     * 瀹為檯澶勭悊浜篿d
+     */
+    private String actualHandlerUserId;
+
+    /**
+     * 瀹為檯澶勭悊浜哄鍚�
+     */
+    private String actualHandlerUserName;
+
+    /**
      * 鍔炵悊鏈熼檺
      */
     private String timeLimit;
diff --git a/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
index 9e7bda4..80790af 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
@@ -52,6 +52,7 @@
 import org.flowable.identitylink.api.IdentityLinkInfo;
 import org.flowable.identitylink.api.IdentityLinkType;
 import org.flowable.identitylink.api.history.HistoricIdentityLink;
+import org.flowable.identitylink.service.impl.persistence.entity.IdentityLinkEntityImpl;
 import org.flowable.task.api.Task;
 import org.flowable.task.api.TaskQuery;
 import org.flowable.task.api.history.HistoricTaskInstance;
@@ -155,6 +156,7 @@
         entity.setProcessDefId(processDefId);
         entity.setProcessInsId(processInsId);
         baseMapper.insert(entity);
+
         return Result.ok("娴佺▼鍚姩鎴愬姛");
     }
 
@@ -166,6 +168,14 @@
      * @return
      */
     private String startPro(Long projectId, String processDefId) {
+
+        ProjectInfo project = new LambdaQueryChainWrapper<>(projectInfoMapper)
+                .select(ProjectInfo::getCreateBy)
+                .eq(ProjectInfo::getId, projectId)
+                .one();
+        if (Objects.isNull(project)) {
+            throw new RuntimeException("椤圭洰涓嶅瓨鍦�");
+        }
         ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefId)
                 .latestVersion().singleResult();
         if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) {
@@ -176,6 +186,9 @@
         SysUser sysUser = SecurityUtils.getLoginUser().getUser();
         identityService.setAuthenticatedUserId(sysUser.getUserId().toString());
         variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId());
+
+        // 灏嗚椤圭洰鐨勭敵璇蜂汉锛堜笟涓绘柟锛変綔涓烘祦绋嬩腑鏌愪簺鐜妭鐨勫鐞嗕汉
+        variables.put(ProcessConstants.DATA_LAUNCH, project.getCreateBy());
         ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefId, projectId + "", variables);
         return processInstance.getId();
     }
@@ -262,11 +275,18 @@
         TaskQuery taskQuery = taskService.createTaskQuery()
                 .active()
                 .includeProcessVariables()
-                .includeIdentityLinks()
                 .orderByTaskCreateTime().desc();
 
         if (StringUtils.isNotBlank(taskName)) {
             taskQuery.processDefinitionNameLike(taskName);
+        }
+        if (! SecurityUtils.getLoginUser().getUser().isAdmin()) {
+            taskQuery
+                    .or()
+                    .taskCandidateGroupIn(taskCommonService.getCurrentUserGroups())
+                    .taskCandidateUser(SecurityUtils.getUserId() + "")
+                    .taskAssignee(SecurityUtils.getUserId() + "")
+                    .endOr();
         }
         result.total(taskQuery.count());
         List<Task> taskList = taskQuery.listPage(pageSize * (pageNum - 1), pageSize);
@@ -306,7 +326,11 @@
             List<String> handlerUnitNames = new ArrayList<>(2);
 
             // 娴佺▼澶勭悊浜轰俊鎭�
-            List<? extends IdentityLinkInfo> identityLinks = task.getIdentityLinks();
+            List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.getId());
+//            Boolean aboutMe = taskCommonService.taskAboutMe(identityLinks);
+//            if (! aboutMe) {
+//                continue;
+//            }
             for (IdentityLinkInfo identityLink : identityLinks) {
                 // 缁戝畾鐨勬槸鐢ㄦ埛锛屾煡鍑虹敤鎴峰鍚嶃�侀儴闂�
                 if (StringUtils.isNotBlank(identityLink.getUserId())) {
@@ -467,20 +491,25 @@
 
     @Override
     public Result taskDelegation(TaskDelegationForm form) {
-        Task task = taskService.createTaskQuery().taskId(form.getTaskId()).includeIdentityLinks().singleResult();
+        Task task = taskService.createTaskQuery().taskId(form.getTaskId()).singleResult();
         if (Objects.isNull(task)) {
             throw new RuntimeException("鏈湪杩愯浠诲姟涓壘鍒拌浠诲姟锛屾棤娉曟墽琛岃浆鍔炴搷浣�");
         }
+        List<IdentityLink> identityLinksForTask = taskService.getIdentityLinksForTask(task.getId());
         // 杞姙涔嬪墠鐨勫鐞嗕汉
         List<String> beforeHandlerIds = new ArrayList<>(2);
         // 杞姙涔嬪墠鐨勫鐞嗕汉绫诲瀷
         HandlerTypeEnum beforeHandlerType = null;
         // 闇�瑕佸厛绉婚櫎涔嬪墠鐨勫鐞嗕汉
-        for (IdentityLinkInfo identityLink : task.getIdentityLinks()) {
+        for (IdentityLinkInfo identityLink : identityLinksForTask) {
             if (StringUtils.isNotBlank(identityLink.getUserId())) {
                 beforeHandlerIds.add(identityLink.getUserId());
                 beforeHandlerType = HandlerTypeEnum.USER;
-                taskService.deleteCandidateUser(task.getId(), identityLink.getUserId());
+                if (IdentityLinkType.ASSIGNEE.equals(identityLink.getType())) {
+                    taskService.deleteUserIdentityLink(task.getId(), identityLink.getUserId(), IdentityLinkType.ASSIGNEE);
+                } else {
+                    taskService.deleteCandidateUser(task.getId(), identityLink.getUserId());
+                }
             } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                 beforeHandlerIds.add(identityLink.getGroupId());
                 if (identityLink.getGroupId().contains("dept")) {
@@ -567,73 +596,7 @@
         List<CustomerTaskVO> vos = new ArrayList<>();
         for (Task task : taskList) {
             CustomerTaskVO taskVO = new CustomerTaskVO();
-            // 褰撳墠娴佺▼淇℃伅
-            taskVO.setTaskId(task.getId());
-            taskVO.setCreateTime(task.getCreateTime());
-            taskVO.setProcessDefId(task.getProcessDefinitionId());
-            taskVO.setExecutionId(task.getExecutionId());
-            taskVO.setTaskName(task.getName());
-            taskVO.setTaskStatus(TaskStatusEnum.TODO);
-            // 娴佺▼瀹氫箟淇℃伅
-            ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
-                    .processDefinitionId(task.getProcessDefinitionId())
-                    .singleResult();
-            taskVO.setDeployId(pd.getDeploymentId());
-            taskVO.setProcessName(pd.getName());
-            taskVO.setProcessInsId(task.getProcessInstanceId());
-            taskVO.setTaskDefinitionKey(task.getTaskDefinitionKey());
-
-            // 娴佺▼鍙戣捣浜轰俊鎭�
-            this.setPromoterInfo(taskVO);
-
-            // 涓�涓换鍔″彲鑳芥湁澶氫釜鍊欓�変汉/缁勶紝鎵�浠ラ渶瑕佷娇鐢╨ist
-            List<Long> handlerIds = new ArrayList<>(2);
-            List<String> handlerNames = new ArrayList<>(2);
-            List<Long> handlerUnitIds = new ArrayList<>(2);
-            List<String> handlerUnitNames = new ArrayList<>(2);
-
-            // 娴佺▼澶勭悊浜轰俊鎭�
-            List<IdentityLink> identityLinksForTask = taskService.getIdentityLinksForTask(task.getId());
-            for (IdentityLink identityLink : identityLinksForTask) {
-                // 缁戝畾鐨勬槸鐢ㄦ埛锛屾煡鍑虹敤鎴峰鍚嶃�侀儴闂�
-                if (StringUtils.isNotBlank(identityLink.getUserId())) {
-                    taskVO.setHandlerType(HandlerTypeEnum.USER);
-                    SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId()));
-                    if (Objects.nonNull(sysUser)) {
-                        handlerIds.add(sysUser.getUserId());
-                        handlerNames.add(sysUser.getNickName());
-                        if (Objects.nonNull(sysUser.getDept())) {
-                            handlerUnitIds.add(sysUser.getDept().getDeptId());
-                            handlerUnitNames.add(sysUser.getDept().getDeptName());
-                        }
-                    }
-                    // 缁戝畾鐨勬槸瑙掕壊鎴栬�呴儴闂�
-                } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
-                    if (identityLink.getGroupId().startsWith("dept")) {   // 閮ㄩ棬鐨刬d鏄姞浜嗗墠缂�鐨勫锛歞ept:1
-                        taskVO.setHandlerType(HandlerTypeEnum.DEPT);
-                        String[] split = identityLink.getGroupId().split(":");
-                        if (split.length > 1) {
-                            // 閮ㄩ棬
-                            SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1]));
-                            if (Objects.nonNull(dept)) {
-                                handlerUnitIds.add(dept.getDeptId());
-                                handlerUnitNames.add(dept.getDeptName());
-                            }
-                        }
-                    } else {
-                        taskVO.setHandlerType(HandlerTypeEnum.ROLE);
-                        SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
-                        if (Objects.nonNull(role)) {
-                            handlerUnitIds.add(Long.parseLong(identityLink.getGroupId()));
-                            handlerUnitNames.add(role.getRoleName());
-                        }
-                    }
-                }
-                taskVO.setHandlerId(handlerIds);
-                taskVO.setHandlerName(handlerNames);
-                taskVO.setHandlerUnitId(handlerUnitIds);
-                taskVO.setHandlerUnitName(handlerUnitNames);
-            }
+            this.setRuntimeTaskInfo(task, taskVO);
             vos.add(taskVO);
         }
         result.put("taskList", vos);
@@ -680,7 +643,10 @@
             vo.setDeployId(process.getDeploymentId());
             vo.setTaskName(userTask.getName());
             vo.setProcessName(process.getProcessDefinitionName());
-            Task task = taskService.createTaskQuery().processInstanceId(process.getId()).taskDefinitionKey(userTask.getId()).singleResult();
+            Task task = taskService.createTaskQuery()
+                    .processInstanceId(process.getId())
+                    .taskDefinitionKey(userTask.getId())
+                    .singleResult();
 
             // 涓�涓换鍔″彲鑳芥湁澶氫釜鍊欓�変汉/缁勶紝鎵�浠ラ渶瑕佷娇鐢╨ist
             List<Long> handlerIds = new ArrayList<>(2);
@@ -744,16 +710,23 @@
                     vo.setTaskId(historicTasks.get(0).getId());
                     vo.setExecutionId(historicTasks.get(0).getExecutionId());
                     vo.setCreateTime(historicTasks.get(0).getStartTime());
+
                     // 鏌ヨ瀹為檯澶勭悊浜�
                     long handlerUserId = Long.parseLong(historicTasks.get(0).getAssignee());
                     SysUser handlerUser = sysUserService.selectUserById(handlerUserId);
                     if (Objects.nonNull(handlerUser)) {
                         handlerIds.add(handlerUserId);
                         handlerNames.add(handlerUser.getNickName());
+                        vo.setActualHandlerUserId(historicTasks.get(0).getAssignee());
+                        vo.setActualHandlerUserName(handlerUser.getNickName());
                     }
                     vo.setTaskDefinitionKey(historicTasks.get(0).getTaskDefinitionKey());
                     this.setPromoterAndHandler(vo, historicTasks.get(0).getIdentityLinks());
                 }
+                vo.setHandlerId(handlerIds);
+                vo.setHandlerName(handlerNames);
+                vo.setHandlerUnitId(handlerUnitIds);
+                vo.setHandlerUnitName(handlerUnitNames);
             } else {
                 vo.setTaskStatus(TaskStatusEnum.TODO);
                 vo.setTaskId(task.getId());
@@ -762,11 +735,9 @@
                 vo.setTaskDefinitionKey(task.getTaskDefinitionKey());
 
                 this.setPromoterAndHandler(vo, null);
+                this.setRuntimeTaskInfo(task, vo);
             }
-            vo.setHandlerId(handlerIds);
-            vo.setHandlerName(handlerNames);
-            vo.setHandlerUnitId(handlerUnitIds);
-            vo.setHandlerUnitName(handlerUnitNames);
+
             return vo;
         }).collect(Collectors.toList());
         result.data(vos);
@@ -809,8 +780,8 @@
             SysUser handlerUser = sysUserService.selectUserById(handlerUserId);
             if (Objects.nonNull(handlerUser)) {
 
-                vo.setHandlerId(Arrays.asList(handlerUserId));
-                vo.setHandlerName(Arrays.asList(handlerUser.getNickName()));
+                vo.setActualHandlerUserId(hisTaskList.get(0).getAssignee());
+                vo.setActualHandlerUserName(handlerUser.getNickName());
             }
             vo.setTaskDefinitionKey(hisTaskList.get(0).getTaskDefinitionKey());
             this.setPromoterAndHandler(vo, hisTaskList.get(0).getIdentityLinks());
@@ -818,6 +789,85 @@
             return vo;
         }).collect(Collectors.toList());
         return vos;
+    }
+
+    /**
+     * 璁剧疆杩愯鏃朵换鍔$殑淇℃伅
+     *
+     * @param task 浠诲姟
+     * @param taskVO 浠诲姟vo
+     */
+    private void setRuntimeTaskInfo(Task task, CustomerTaskVO taskVO) {
+        // 褰撳墠娴佺▼淇℃伅
+        taskVO.setTaskId(task.getId());
+        taskVO.setCreateTime(task.getCreateTime());
+        taskVO.setProcessDefId(task.getProcessDefinitionId());
+        taskVO.setExecutionId(task.getExecutionId());
+        taskVO.setTaskName(task.getName());
+        taskVO.setTaskStatus(TaskStatusEnum.TODO);
+        // 娴佺▼瀹氫箟淇℃伅
+        ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
+                .processDefinitionId(task.getProcessDefinitionId())
+                .singleResult();
+        taskVO.setDeployId(pd.getDeploymentId());
+        taskVO.setProcessName(pd.getName());
+        taskVO.setProcessInsId(task.getProcessInstanceId());
+        taskVO.setTaskDefinitionKey(task.getTaskDefinitionKey());
+
+        // 娴佺▼鍙戣捣浜轰俊鎭�
+        this.setPromoterInfo(taskVO);
+
+        // 涓�涓换鍔″彲鑳芥湁澶氫釜鍊欓�変汉/缁勶紝鎵�浠ラ渶瑕佷娇鐢╨ist
+        List<Long> handlerIds = new ArrayList<>(2);
+        List<String> handlerNames = new ArrayList<>(2);
+        List<Long> handlerUnitIds = new ArrayList<>(2);
+        List<String> handlerUnitNames = new ArrayList<>(2);
+
+        // 娴佺▼澶勭悊浜轰俊鎭�
+        List<IdentityLink> identityLinksForTask = taskService.getIdentityLinksForTask(task.getId());
+        for (IdentityLinkInfo identityLink : identityLinksForTask) {
+//            if (StringUtils.isBlank(((IdentityLinkEntityImpl)identityLink).getId())) {
+//                continue;
+//            }
+            // 缁戝畾鐨勬槸鐢ㄦ埛锛屾煡鍑虹敤鎴峰鍚嶃�侀儴闂�
+            if (StringUtils.isNotBlank(identityLink.getUserId())) {
+                taskVO.setHandlerType(HandlerTypeEnum.USER);
+                SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId()));
+                if (Objects.nonNull(sysUser)) {
+                    handlerIds.add(sysUser.getUserId());
+                    handlerNames.add(sysUser.getNickName());
+                    if (Objects.nonNull(sysUser.getDept())) {
+                        handlerUnitIds.add(sysUser.getDept().getDeptId());
+                        handlerUnitNames.add(sysUser.getDept().getDeptName());
+                    }
+                }
+                // 缁戝畾鐨勬槸瑙掕壊鎴栬�呴儴闂�
+            } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
+                if (identityLink.getGroupId().startsWith("dept")) {   // 閮ㄩ棬鐨刬d鏄姞浜嗗墠缂�鐨勫锛歞ept:1
+                    taskVO.setHandlerType(HandlerTypeEnum.DEPT);
+                    String[] split = identityLink.getGroupId().split(":");
+                    if (split.length > 1) {
+                        // 閮ㄩ棬
+                        SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1]));
+                        if (Objects.nonNull(dept)) {
+                            handlerUnitIds.add(dept.getDeptId());
+                            handlerUnitNames.add(dept.getDeptName());
+                        }
+                    }
+                } else {
+                    taskVO.setHandlerType(HandlerTypeEnum.ROLE);
+                    SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
+                    if (Objects.nonNull(role)) {
+                        handlerUnitIds.add(Long.parseLong(identityLink.getGroupId()));
+                        handlerUnitNames.add(role.getRoleName());
+                    }
+                }
+            }
+            taskVO.setHandlerId(handlerIds);
+            taskVO.setHandlerName(handlerNames);
+            taskVO.setHandlerUnitId(handlerUnitIds);
+            taskVO.setHandlerUnitName(handlerUnitNames);
+        }
     }
 
     /**
@@ -871,7 +921,10 @@
             vo.setDeployId(process.getDeploymentId());
             vo.setTaskName(userTask.getName());
             vo.setProcessName(process.getProcessDefinitionName());
-            Task task = taskService.createTaskQuery().processInstanceId(process.getId()).taskDefinitionKey(userTask.getId()).singleResult();
+            Task task = taskService.createTaskQuery()
+                    .processInstanceId(process.getId())
+                    .taskDefinitionKey(userTask.getId())
+                    .singleResult();
             if (Objects.isNull(task)) {
                 // 濡傛灉浠诲姟鍦ㄨ繍琛屾椂娌℃壘鍒帮紝閭d箞鍙兘涓烘湭寮�濮嬫垨鑰呭凡瀹屾垚锛屽彧鏌ヨ鏈紑濮嬬殑
                 List<HistoricTaskInstance> historicTasks = historyService.createHistoricTaskInstanceQuery()
@@ -927,6 +980,8 @@
                 } else {
                     continue;
                 }
+            } else {
+                this.setRuntimeTaskInfo(task, vo);
             }
             vos.add(vo);
         }
@@ -979,6 +1034,9 @@
         if (TaskStatusEnum.TODO.equals(taskVO.getTaskStatus())) {
             List<IdentityLink> identityLinksForTask = taskService.getIdentityLinksForTask(taskVO.getTaskId());
             for (IdentityLink identityLink : identityLinksForTask) {
+                if (StringUtils.isBlank(((IdentityLinkEntityImpl)identityLink).getId())) {
+                    continue;
+                }
                 // 缁戝畾鐨勬槸鐢ㄦ埛锛屾煡鍑虹敤鎴峰鍚嶃�侀儴闂�
                 if (StringUtils.isNotBlank(identityLink.getUserId())) {
                     SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId()));
@@ -1021,12 +1079,12 @@
                     taskVO.setHandlerType(HandlerTypeEnum.USER);
                     SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId()));
                     if (Objects.nonNull(sysUser)) {
-//                        taskVO.setHandlerId(sysUser.getUserId());
+                        handlerIds.add(sysUser.getUserId());
+                        handlerNames.add(sysUser.getNickName());
                         if (Objects.nonNull(sysUser.getDept())) {
                             handlerUnitIds.add(sysUser.getDept().getDeptId());
                             handlerUnitNames.add(sysUser.getDept().getDeptName());
                         }
-//                        taskVO.setHandlerName(sysUser.getNickName());
                     }
                     // 缁戝畾鐨勬槸瑙掕壊锛屾煡鍑鸿鑹插悕绉�
                 } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
diff --git a/flowable/src/main/java/com/ycl/common/constant/ProcessConstants.java b/flowable/src/main/java/com/ycl/common/constant/ProcessConstants.java
index 1a9fadb..04eecf3 100644
--- a/flowable/src/main/java/com/ycl/common/constant/ProcessConstants.java
+++ b/flowable/src/main/java/com/ycl/common/constant/ProcessConstants.java
@@ -70,6 +70,10 @@
      */
     public static final String PROCESS_INITIATOR = "INITIATOR";
 
+    /**
+     * 鎻愪氦鏁版嵁鏂�
+     */
+    public static final String DATA_LAUNCH = "data_launch";
 
     /**
      * 娴佺▼璺宠繃
diff --git a/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java b/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java
index e5abf8c..ac3d23e 100644
--- a/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java
+++ b/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java
@@ -5,10 +5,12 @@
 import com.ycl.common.core.domain.entity.SysUser;
 import com.ycl.common.enums.FlowComment;
 import com.ycl.common.enums.business.TaskStatusEnum;
+import com.ycl.common.utils.SecurityUtils;
 import com.ycl.domain.entity.SysForm;
 import com.ycl.domain.vo.FormDetailVO;
 import com.ycl.flow.FindNextNodeUtil;
 import com.ycl.service.ISysFormService;
+import com.ycl.system.service.ISysUserService;
 import lombok.RequiredArgsConstructor;
 import org.flowable.bpmn.model.*;
 import org.flowable.bpmn.model.Process;
@@ -18,6 +20,8 @@
 import org.flowable.engine.TaskService;
 import org.flowable.engine.history.HistoricProcessInstance;
 import org.flowable.engine.repository.ProcessDefinition;
+import org.flowable.identitylink.api.IdentityLink;
+import org.flowable.identitylink.api.IdentityLinkType;
 import org.flowable.task.api.Task;
 import org.flowable.task.api.history.HistoricTaskInstance;
 import org.springframework.stereotype.Service;
@@ -39,6 +43,7 @@
     private final RepositoryService repositoryService;
     private final TaskService taskService;
     private final HistoryService historyService;
+    private final ISysUserService sysUserService;
 
     /**
      * 閫氳繃褰撳墠鑺傜偣瀹氫箟key锛岃幏鍙栧叾涓婁竴涓妭鐐圭殑淇℃伅锛屽鏋滃墠闈㈡槸骞惰鐨勪細杩斿洖澶氫釜(鍖呭惈褰撳墠鑺傜偣)
@@ -272,6 +277,7 @@
      * @param taskId             褰撳墠浠诲姟id
      * @param msg                瀹℃牳鎰忚
      */
+    @Deprecated
     public void reject(String rejectedTaskDefKey, String rejectTaskDefKey, String processInsId, String taskId, String msg) {
         // 椹冲洖鐨勬牳蹇僡pi锛歳untimeService.createChangeActivityStateBuilder().moveXXX 鐨刟pi锛屽彲浠ヨ缃粠褰撳墠鑺傜偣绉诲姩鍒扮洰鏍囪妭鐐�
         // 椹冲洖鐨勬牳蹇冿細闇�瑕佹壘鍒板綋鍓嶈妭鐐广�佷互鍙婅娴佽浆鍒扮殑鐩爣鑺傜偣銆傚叾涓瘮杈冮夯鐑︾殑鏄鐞嗗苟琛岀瓑姣旇緝澶嶆潅鐨勬儏鍐�
@@ -294,4 +300,21 @@
     }
 
 
+    /**
+     * 鑾峰彇褰撳墠鐢ㄦ埛鐨勭粍
+     *
+     * @return
+     */
+    public List<String> getCurrentUserGroups() {
+        String deptId = "dept:" + SecurityUtils.getLoginUser().getDeptId();
+        List<String> roleIds;
+        if (CollectionUtils.isEmpty(SecurityUtils.getLoginUser().getUser().getRoles())) {
+            roleIds = new ArrayList<>(1);
+        } else {
+            roleIds = SecurityUtils.getLoginUser().getUser().getRoles().stream().map(role -> role.getRoleId() + "").collect(Collectors.toList());
+        }
+        roleIds.add(deptId);
+        return roleIds;
+    }
+
 }
diff --git a/flowable/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java b/flowable/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
index 6cf3937..0b762c0 100644
--- a/flowable/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
+++ b/flowable/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
@@ -151,15 +151,13 @@
         //娣诲姞娴佺▼鍙橀噺
         if(!processVariables.isEmpty()) taskService.setVariables(taskId,processVariables);
         taskService.addComment(taskId, task.getProcessInstanceId(), FlowComment.SUBMIT.getType(), "瀹屾垚鎻愪氦");
-        // 鍒ゆ柇褰撳墠浠诲姟鏄笉鏄浆鍔炶繃鐨�
-        Boolean delegation = flowLogService.taskDelegation(task.getProcessInstanceId(), task.getId());
-        if (delegation) {
+        if (DelegationState.PENDING.equals(task.getDelegationState())) {
             taskService.resolveTask(taskId, newV);
+        } else {
+            // 鍏堣褰撳墠鐢ㄦ埛璁ら杩欎釜浠诲姟
+            taskService.claim(taskId, SecurityUtils.getUserId() + "");
+            taskService.complete(taskId, newV);
         }
-        // 鍏堣褰撳墠鐢ㄦ埛璁ら杩欎釜浠诲姟
-        taskService.claim(taskId, SecurityUtils.getUserId() + "");
-        taskService.complete(taskId, newV);
-
         return AjaxResult.success("鎻愪氦鎴愬姛");
     }
 
@@ -1301,10 +1299,16 @@
                 List<JSONObject> oldFields = JSON.parseObject(JSON.toJSONString(formJson.get(ProcessConstants.WIDGET_LIST)), new TypeReference<List<JSONObject>>() {
                 });
 
-                // 璁剧疆宸插~鍐欑殑琛ㄥ崟涓虹鐢ㄧ姸鎬�
-                for (JSONObject oldField : oldFields) {
-                    JSONObject options = oldField.getJSONObject("options");
-                    options.put("disabled", true);
+                if(CollectionUtils.isNotEmpty(oldFields)) {
+                    // 璁剧疆宸插~鍐欑殑琛ㄥ崟涓虹鐢ㄧ姸鎬�
+                    for (JSONObject oldField : oldFields) {
+                        JSONObject options = oldField.getJSONObject("options");
+                        options.put("disabled", true);
+                    }
+                    formJson.put(ProcessConstants.WIDGET_LIST, oldFields);
+                    newP.put(ProcessConstants.TASK_FORM_KEY, formJson);
+                    newP.remove(formDetailVO.getBeforeNodeDefId() + "&" + ProcessConstants.TASK_FORM_KEY);
+                    formDetailVO.setFormJsonObj(newP);
                 }
                 // TODO 鏆傛椂鍙鐞嗙敤鎴蜂换鍔′笂鐨勮〃鍗�
 //                if (StringUtils.isNotBlank(task.getFormKey())) {
@@ -1324,10 +1328,7 @@
 //                    }
 //                    oldFields.addAll(newFields);
 //                }
-                formJson.put(ProcessConstants.WIDGET_LIST, oldFields);
-                newP.put(ProcessConstants.TASK_FORM_KEY, formJson);
-                newP.remove(formDetailVO.getBeforeNodeDefId() + "&" + ProcessConstants.TASK_FORM_KEY);
-                formDetailVO.setFormJsonObj(newP);
+
             }
         }
         return beforeNodes;
diff --git a/system/src/main/java/com/ycl/framework/config/SecurityConfig.java b/system/src/main/java/com/ycl/framework/config/SecurityConfig.java
index d3ebaa3..d5be009 100644
--- a/system/src/main/java/com/ycl/framework/config/SecurityConfig.java
+++ b/system/src/main/java/com/ycl/framework/config/SecurityConfig.java
@@ -115,6 +115,7 @@
                 // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂�
                 .antMatchers(HttpMethod.GET, "/flowable-ui", "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
+                .antMatchers("/common/upload").permitAll()
                 // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇�
                 .anyRequest().authenticated()
                 .and()

--
Gitblit v1.8.0