From dafa8e964ca991e0dc349a351fe36d3fc6ed5ddd Mon Sep 17 00:00:00 2001
From: "1437892690@qq.com" <1437892690@qq.com>
Date: Wed, 31 Jul 2024 15:04:31 +0800
Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E6=B5=81=E7=A8=8B?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E8=8A=82=E7=82=B9=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E5=8F=82=E6=95=B0=E8=B5=8B=E5=80=BC=E4=B8=AD=E7=9A=84=E5=B7=A5?=
=?UTF-8?q?=E5=8D=95=E4=BF=A1=E6=81=AF=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=B8=80?=
=?UTF-8?q?=E4=B8=AA=E4=B8=8A=E6=8A=A5=E4=BA=BAuserId?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
关联 #[1212908925583360]流程自动化节点作业参数赋值中的工单信息中添加一个上报人userId http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1212908925583360
---
.../ProcessTaskOwnerUserIdCondition.java | 166 ++++++++++++++++++
1 file changed, 166 insertions(+)
create mode 100644 src/main/java/neatlogic/module/process/condition/handler/ProcessTaskOwnerUserIdCondition.java
diff --git a/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskOwnerUserIdCondition.java b/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskOwnerUserIdCondition.java
new file mode 100644
index 000000000..45b7fea36
--- /dev/null
+++ b/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskOwnerUserIdCondition.java
@@ -0,0 +1,166 @@
+/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .*/
+
+package neatlogic.module.process.condition.handler;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import neatlogic.framework.common.constvalue.FormHandlerType;
+import neatlogic.framework.common.constvalue.GroupSearch;
+import neatlogic.framework.common.constvalue.ParamType;
+import neatlogic.framework.common.constvalue.UserType;
+import neatlogic.framework.dao.mapper.UserMapper;
+import neatlogic.framework.dto.UserVo;
+import neatlogic.framework.form.constvalue.FormConditionModel;
+import neatlogic.framework.process.condition.core.IProcessTaskCondition;
+import neatlogic.framework.process.condition.core.ProcessTaskConditionBase;
+import neatlogic.framework.process.constvalue.ConditionConfigType;
+import neatlogic.framework.process.constvalue.ProcessFieldType;
+import neatlogic.framework.process.dto.ProcessTaskStepVo;
+import neatlogic.framework.process.dto.ProcessTaskVo;
+import neatlogic.module.process.dao.mapper.processtask.ProcessTaskMapper;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Component
+public class ProcessTaskOwnerUserIdCondition extends ProcessTaskConditionBase implements IProcessTaskCondition {
+
+ @Resource
+ private ProcessTaskMapper processTaskMapper;
+
+ @Resource
+ private UserMapper userMapper;
+
+ @Override
+ public String getName() {
+ return "owneruserid";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "上报人用户ID";
+ }
+
+ @Override
+ public String getHandler(FormConditionModel processWorkcenterConditionType) {
+ return FormHandlerType.USERSELECT.toString();
+ }
+
+ @Override
+ public String getType() {
+ return ProcessFieldType.COMMON.getValue();
+ }
+
+ @Override
+ public JSONObject getConfig(ConditionConfigType configType) {
+ JSONObject config = new JSONObject();
+ config.put("type", FormHandlerType.USERSELECT.toString());
+ config.put("multiple", true);
+ config.put("initConfig", new JSONObject() {
+ {
+ this.put("excludeList", new JSONArray() {{
+ if (ConditionConfigType.WORKCENTER.getValue().equals(configType.getValue())) {
+ this.add(GroupSearch.COMMON.getValuePlugin() + UserType.ALL.getValue());
+ }
+ }});
+ this.put("groupList", new JSONArray() {
+ {
+ if (ConditionConfigType.WORKCENTER.getValue().equals(configType.getValue())) {
+ this.add(GroupSearch.COMMON.getValue());
+ }
+ this.add(GroupSearch.USER.getValue());
+ }
+ });
+ this.put("includeList", new JSONArray() {
+ {
+ if (ConditionConfigType.WORKCENTER.getValue().equals(configType.getValue())) {
+ this.add(GroupSearch.COMMON.getValuePlugin() + UserType.VIP_USER.getValue());
+ this.add(GroupSearch.COMMON.getValuePlugin() + UserType.LOGIN_USER.getValue());
+ }
+ }
+ });
+ }
+ });
+ /* 以下代码是为了兼容旧数据结构,前端有些地方还在用 **/
+ config.put("isMultiple", true);
+ return config;
+ }
+
+ @Override
+ public Integer getSort() {
+ return 4;
+ }
+
+ @Override
+ public ParamType getParamType() {
+ return ParamType.ARRAY;
+ }
+
+ @Override
+ public Object valueConversionText(Object value, JSONObject config) {
+ if (value != null) {
+ if (value instanceof String) {
+ UserVo userVo = userMapper.getUserByUserId(value.toString());
+ if (userVo != null) {
+ return userVo.getUserName();
+ }
+ } else if (value instanceof List) {
+ List valueList = JSON.parseArray(JSON.toJSONString(value), String.class);
+ List textList = new ArrayList<>();
+ for (String valueStr : valueList) {
+ UserVo userVo = userMapper.getUserByUserId(valueStr);
+ if (userVo != null) {
+ textList.add(userVo.getUserName());
+ } else {
+ textList.add(valueStr);
+ }
+ }
+ return String.join("、", textList);
+ }
+ }
+ return value;
+ }
+
+ @Override
+ public Object getConditionParamData(ProcessTaskStepVo processTaskStepVo) {
+ ProcessTaskVo processTaskVo = processTaskMapper.getProcessTaskById(processTaskStepVo.getProcessTaskId());
+ if (processTaskVo == null) {
+ return null;
+ }
+ UserVo user = userMapper.getUserBaseInfoByUuid(processTaskVo.getOwner());
+ if (user != null) {
+ return user.getUserId();
+ }
+ return null;
+ }
+
+ @Override
+ public Object getConditionParamDataForHumanization(ProcessTaskStepVo processTaskStepVo) {
+ ProcessTaskVo processTaskVo = processTaskMapper.getProcessTaskById(processTaskStepVo.getProcessTaskId());
+ if (processTaskVo == null) {
+ return null;
+ }
+ UserVo user = userMapper.getUserBaseInfoByUuid(processTaskVo.getOwner());
+ if (user != null) {
+ return user.getUserName();
+ }
+ return null;
+ }
+
+}
--
Gitee