From 29fdcdb1c3870bb34fd9913a9cc3624d5dd13952 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 26 十二月 2024 18:26:32 +0800
Subject: [PATCH] 转办的部分实现

---
 business/src/main/java/com/ycl/domain/form/TaskDelegationForm.java         |   36 ++++++++++++++++++
 business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java |   30 +++++++++++++--
 common/src/main/java/com/ycl/common/enums/business/HandlerTypeEnum.java    |    7 ++-
 business/src/main/java/com/ycl/controller/ProjectProcessController.java    |    9 ++--
 business/src/main/java/com/ycl/service/ProjectProcessService.java          |    5 +-
 5 files changed, 74 insertions(+), 13 deletions(-)

diff --git a/business/src/main/java/com/ycl/controller/ProjectProcessController.java b/business/src/main/java/com/ycl/controller/ProjectProcessController.java
index ad52818..7c9bbc1 100644
--- a/business/src/main/java/com/ycl/controller/ProjectProcessController.java
+++ b/business/src/main/java/com/ycl/controller/ProjectProcessController.java
@@ -3,6 +3,7 @@
 import com.ycl.common.group.Update;
 import com.ycl.common.group.Add;
 import com.ycl.domain.form.RejectTaskForm;
+import com.ycl.domain.form.TaskDelegationForm;
 import com.ycl.domain.query.TaskQuery;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -82,11 +83,11 @@
         return projectProcessService.taskIsAuditing(processDefId, taskId);
     }
 
-    @PostMapping("/detail/task/reject")
-    @ApiOperation(value = "椹冲洖", notes = "椹冲洖")
+    @PostMapping("/detail/task/delegation")
+    @ApiOperation(value = "杞姙", notes = "灏嗕换鍔″鎵樼粰鍏跺畠浜哄姙鐞�")
 //    @PreAuthorize("@ss.hasPermi('projectProcess:detail')")
-    public Result rejectTask(@RequestBody RejectTaskForm form) {
-        return projectProcessService.rejectTask(form);
+    public Result taskDelegation(@RequestBody TaskDelegationForm form) {
+        return projectProcessService.taskDelegation(form);
     }
 
 
diff --git a/business/src/main/java/com/ycl/domain/form/TaskDelegationForm.java b/business/src/main/java/com/ycl/domain/form/TaskDelegationForm.java
new file mode 100644
index 0000000..8622742
--- /dev/null
+++ b/business/src/main/java/com/ycl/domain/form/TaskDelegationForm.java
@@ -0,0 +1,36 @@
+package com.ycl.domain.form;
+
+import com.ycl.common.enums.business.HandlerTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 浠诲姟杞姙
+ *
+ * @author锛歺p
+ * @date锛�2024/12/13 13:51
+ */
+@Data
+@ApiModel("浠诲姟杞姙琛ㄥ崟")
+public class TaskDelegationForm {
+
+    /**
+     * 褰撳墠浠诲姟id
+     *
+     */
+    private String taskId;
+
+    /**
+     * 鐢ㄦ埛缁勭被鍨�
+     *
+     */
+    private HandlerTypeEnum peopleType;
+
+    /**
+     * 涓嶅悓鐢ㄦ埛缁勫搴旈�夋嫨鐨刬d
+     *
+     */
+    @ApiModelProperty("涓嶅悓鐢ㄦ埛缁勫搴旈�夋嫨鐨刬d, 濡傦細peopleType鏄鑹诧紝杩欓噷灏卞搴旇鑹瞚d锛屽涓敤鑻辨枃閫楀彿闅斿紑")
+    private String targetId;
+}
diff --git a/business/src/main/java/com/ycl/service/ProjectProcessService.java b/business/src/main/java/com/ycl/service/ProjectProcessService.java
index 2beb75d..b5dcbc0 100644
--- a/business/src/main/java/com/ycl/service/ProjectProcessService.java
+++ b/business/src/main/java/com/ycl/service/ProjectProcessService.java
@@ -5,6 +5,7 @@
 import com.ycl.common.base.Result;
 import com.ycl.domain.form.ProjectProcessForm;
 import com.ycl.domain.form.RejectTaskForm;
+import com.ycl.domain.form.TaskDelegationForm;
 import com.ycl.domain.query.ProjectProcessQuery;
 import com.ycl.domain.query.TaskQuery;
 import com.ycl.domain.vo.CustomerTaskVO;
@@ -81,10 +82,10 @@
     Result taskIsAuditing(String processDefinitionId, String taskId);
 
     /**
-     * 椹冲洖浠诲姟
+     * 浠诲姟杞姙
      *
      * @param form
      * @return
      */
-    Result rejectTask(RejectTaskForm form);
+    Result taskDelegation(TaskDelegationForm form);
 }
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 ae71ab6..d24f751 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
@@ -20,6 +20,7 @@
 import com.ycl.domain.entity.ProjectInfo;
 import com.ycl.domain.entity.ProjectProcess;
 import com.ycl.domain.form.RejectTaskForm;
+import com.ycl.domain.form.TaskDelegationForm;
 import com.ycl.domain.vo.CustomerTaskVO;
 import com.ycl.domain.vo.ProjectProcessDetailVO;
 import com.ycl.mapper.ProjectInfoMapper;
@@ -360,10 +361,31 @@
     }
 
     @Override
-    public Result rejectTask(RejectTaskForm form) {
-        Task task = taskService.createTaskQuery().taskId(form.getTaskId()).singleResult();
-        taskCommonService.reject(form.getRejectedTaskDefKey(), task.getTaskDefinitionKey(), task.getProcessInstanceId(), form.getTaskId(), form.getAuditOpinion());
-        return Result.ok("椹冲洖鎴愬姛");
+    public Result taskDelegation(TaskDelegationForm form) {
+        Task task = taskService.createTaskQuery().taskId(form.getTaskId()).includeIdentityLinks().singleResult();
+        if (Objects.isNull(task)) {
+            throw new RuntimeException("鏈湪杩愯浠诲姟涓壘鍒拌浠诲姟锛屾棤娉曟墽琛岃浆鍔炴搷浣�");
+        }
+        // 闇�瑕佸厛绉婚櫎涔嬪墠鐨勫鐞嗕汉
+        for (IdentityLinkInfo identityLink : task.getIdentityLinks()) {
+            if (StringUtils.isNotBlank(identityLink.getUserId())) {
+                taskService.deleteCandidateUser(task.getId(), identityLink.getUserId());
+            } else if (StringUtils.isNotBlank(identityLink.getGroupId())) {
+                taskService.deleteCandidateGroup(task.getId(), identityLink.getGroupId());
+            }
+        }
+        // 鍐嶆柊澧炲鐞嗕汉
+        switch (form.getPeopleType()) {
+            case FIX_USER:
+                // 鎸囧畾鐢ㄦ埛鐨勮瘽锛屽彧鑳介�変竴涓敤鎴�
+                taskService.delegateTask(task.getId(), form.getTargetId());
+                break;
+            case USER:
+                // 鐢ㄦ埛缁勭殑璇濓紝鍙互閫夊涓敤鎴凤紝涓ユ牸鏉ヨ杩欓噷鐨勭敤鎴风粍骞朵笉鏄痜lowable涓殑缁勭殑姒傚康锛屽彧鏄紑婧愭鏋舵湁杩欎釜瀹氫箟
+
+        }
+
+        return Result.ok("杞姙鎴愬姛");
     }
 
     /**
diff --git a/common/src/main/java/com/ycl/common/enums/business/HandlerTypeEnum.java b/common/src/main/java/com/ycl/common/enums/business/HandlerTypeEnum.java
index 37ca447..2e974d3 100644
--- a/common/src/main/java/com/ycl/common/enums/business/HandlerTypeEnum.java
+++ b/common/src/main/java/com/ycl/common/enums/business/HandlerTypeEnum.java
@@ -12,9 +12,10 @@
 @Getter
 public enum HandlerTypeEnum {
 
-    USER("USER", "鐢ㄦ埛"),
-    DEPT("DEPT", "閮ㄩ棬"),
-    ROLE("ROLE", "瑙掕壊")
+    USER("USER", "鐢ㄦ埛缁�"),  // 涓ユ牸鏉ヨ杩欓噷鐨勭敤鎴风粍骞朵笉鏄痜lowable涓殑缁勭殑姒傚康锛屽彧鏄紑婧愭鏋舵湁杩欎釜瀹氫箟锛屽畠鍙槸鑳介厤缃涓敤鎴�
+    FIX_USER("FIX_USER", "鎸囧畾鐢ㄦ埛"), // 鍙兘閫夋嫨涓�涓汉
+    DEPT("DEPT", "閮ㄩ棬缁�"), // 鍙互閫夋嫨澶氫釜閮ㄩ棬
+    ROLE("ROLE", "瑙掕壊缁�") // 鍙互閫夋嫨澶氫釜瑙掕壊
     ;
 
     @JsonValue

--
Gitblit v1.8.0