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/form/BpmTaskCandidateFormUserStrategy.java |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 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/form/BpmTaskCandidateFormUserStrategy.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/form/BpmTaskCandidateFormUserStrategy.java
new file mode 100644
index 0000000..ab8afe1
--- /dev/null
+++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/form/BpmTaskCandidateFormUserStrategy.java
@@ -0,0 +1,47 @@
+package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.form;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.lang.Assert;
+import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
+import com.iailab.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy;
+import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
+import org.flowable.bpmn.model.BpmnModel;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 表单内用户字段 {@link BpmTaskCandidateUserStrategy} 实现类
+ *
+ * @author hou
+ */
+@Component
+public class BpmTaskCandidateFormUserStrategy implements BpmTaskCandidateStrategy {
+
+    @Override
+    public BpmTaskCandidateStrategyEnum getStrategy() {
+        return BpmTaskCandidateStrategyEnum.FORM_USER;
+    }
+
+    @Override
+    public void validateParam(String param) {
+        Assert.notEmpty(param, "表单内用户字段不能为空");
+    }
+
+    @Override
+    public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
+        Object result = execution.getVariable(param);
+        return Convert.toSet(Long.class, result);
+    }
+
+    @Override
+    public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId,
+                                              String param, Long startUserId, String processDefinitionId,
+                                              Map<String, Object> processVariables) {
+        Object result = processVariables == null ? null : processVariables.get(param);
+        return Convert.toSet(Long.class, result);
+    }
+
+}

--
Gitblit v1.9.3