From 6b13839488edcd06046e26a41fe897358176689c Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 13 十二月 2024 17:56:41 +0800
Subject: [PATCH] 采集质量

---
 iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateDeptLeaderMultiStrategy.java |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateDeptLeaderMultiStrategy.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateDeptLeaderMultiStrategy.java
new file mode 100644
index 0000000..259d80c
--- /dev/null
+++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateDeptLeaderMultiStrategy.java
@@ -0,0 +1,45 @@
+package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.dept;
+
+import cn.hutool.core.lang.Assert;
+import com.iailab.framework.common.util.string.StrUtils;
+import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
+import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 连续多级部门的负责人 {@link BpmTaskCandidateStrategy} 实现类
+ *
+ * @author hou
+ */
+@Component
+public class BpmTaskCandidateDeptLeaderMultiStrategy extends AbstractBpmTaskCandidateDeptLeaderStrategy {
+
+    @Override
+    public BpmTaskCandidateStrategyEnum getStrategy() {
+        return BpmTaskCandidateStrategyEnum.MULTI_DEPT_LEADER_MULTI;
+    }
+
+    @Override
+    public void validateParam(String param) {
+        // 参数格式: | 分隔:1)左边为部门(多个部门用 , 分隔)。2)右边为部门层级
+        String[] params = param.split("\\|");
+        Assert.isTrue(params.length == 2, "参数格式不匹配");
+        List<Long> deptIds = StrUtils.splitToLong(params[0], ",");
+        int level = Integer.parseInt(params[1]);
+        // 校验部门存在
+        deptApi.validateDeptList(deptIds).checkError();
+        Assert.isTrue(level > 0, "部门层级必须大于 0");
+    }
+
+    @Override
+    public Set<Long> calculateUsers(String param) {
+        String[] params = param.split("\\|");
+        List<Long> deptIds = StrUtils.splitToLong(params[0], ",");
+        int level = Integer.parseInt(params[1]);
+        return super.getMultiLevelDeptLeaderIds(deptIds, level);
+    }
+
+}

--
Gitblit v1.9.3