From bd217b95d43c0c4a325a8db7a6add35b85cf86c5 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Sun, 1 Dec 2024 17:36:17 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-IT?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1-=E6=B5=81=E7=A8=8B=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A1=B5=E6=94=AF=E6=8C=81=E6=9F=A5=E7=9C=8B=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=A4=87=E4=BB=BD=E7=9A=84=E6=B5=81=E7=A8=8B=E5=9B=BE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1302178805809152]后端-IT服务-流程编辑页支持查看工单备份的流程图信息 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1302178805809152 --- .../GetProcessFormAttributeListApi.java | 82 +++++++++++ .../api/process/ListProcessFormTagApi.java | 109 +++++++++++++++ .../api/process/ProcessConditionList.java | 45 ++++-- .../api/process/ProcessFormGetApi.java | 129 ++++++++++++++++++ .../process/api/process/ProcessGetApi.java | 72 +++++++--- .../process/api/process/ProcessParamList.java | 45 +++--- 6 files changed, 431 insertions(+), 51 deletions(-) create mode 100644 src/main/java/neatlogic/module/process/api/process/GetProcessFormAttributeListApi.java create mode 100644 src/main/java/neatlogic/module/process/api/process/ListProcessFormTagApi.java create mode 100644 src/main/java/neatlogic/module/process/api/process/ProcessFormGetApi.java diff --git a/src/main/java/neatlogic/module/process/api/process/GetProcessFormAttributeListApi.java b/src/main/java/neatlogic/module/process/api/process/GetProcessFormAttributeListApi.java new file mode 100644 index 000000000..27ddb6bc5 --- /dev/null +++ b/src/main/java/neatlogic/module/process/api/process/GetProcessFormAttributeListApi.java @@ -0,0 +1,82 @@ +/* + * 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.api.process; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.form.dao.mapper.FormMapper; +import neatlogic.framework.form.dto.FormAttributeVo; +import neatlogic.framework.form.dto.FormVo; +import neatlogic.framework.form.exception.FormNotFoundException; +import neatlogic.framework.form.service.IFormCrossoverService; +import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; +import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import neatlogic.module.process.service.ProcessTaskService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service + +@OperationType(type = OperationTypeEnum.SEARCH) +public class GetProcessFormAttributeListApi extends PrivateApiComponentBase { + + @Resource + private FormMapper formMapper; + + @Resource + private ProcessTaskService processTaskService; + + @Override + public String getName() { + return "nmtaf.getformattributelistapi.getname"; + } + + @Input({ + @Param(name = "processTaskId", type = ApiParamType.STRING, desc = "term.itsm.processtaskid"), + @Param(name = "formUuid", type = ApiParamType.STRING, desc = "term.framework.formuuid"), + @Param(name = "tag", type = ApiParamType.STRING, desc = "common.tag") + }) + @Output({ + @Param(name = "tbodyList", explode = FormAttributeVo[].class, desc = "common.tbodylist") + }) + @Description(desc = "nmtaf.getformattributelistapi.getname") + @Override + public Object myDoService(JSONObject paramObj) throws Exception { + String tag = paramObj.getString("tag"); + Long processTaskId = paramObj.getLong("processTaskId"); + if (processTaskId != null) { + return processTaskService.getFormAttributeListByProcessTaskIdAngTagNew(processTaskId, tag); + } else { + String formUuid = paramObj.getString("formUuid"); + FormVo form = formMapper.getFormByUuid(formUuid); + if (form == null) { + throw new FormNotFoundException(formUuid); + } + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + return formCrossoverService.getFormAttributeListNew(formUuid, form.getName(), tag); + } + } + + @Override + public String getToken() { + return "process/form/attribute/list"; + } +} diff --git a/src/main/java/neatlogic/module/process/api/process/ListProcessFormTagApi.java b/src/main/java/neatlogic/module/process/api/process/ListProcessFormTagApi.java new file mode 100644 index 000000000..9683df9f9 --- /dev/null +++ b/src/main/java/neatlogic/module/process/api/process/ListProcessFormTagApi.java @@ -0,0 +1,109 @@ +/*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.api.process; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.form.dao.mapper.FormMapper; +import neatlogic.framework.form.dto.FormAttributeVo; +import neatlogic.framework.form.dto.FormVersionVo; +import neatlogic.framework.form.dto.FormVo; +import neatlogic.framework.form.exception.FormActiveVersionNotFoundExcepiton; +import neatlogic.framework.form.exception.FormNotFoundException; +import neatlogic.framework.process.dto.ProcessTaskFormVo; +import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; +import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import neatlogic.framework.util.TableResultUtil; +import neatlogic.module.process.dao.mapper.processtask.ProcessTaskMapper; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Service +@OperationType(type = OperationTypeEnum.SEARCH) +public class ListProcessFormTagApi extends PrivateApiComponentBase { + + @Resource + private FormMapper formMapper; + + @Resource + private ProcessTaskMapper processTaskMapper; + + @Override + public String getToken() { + return "process/form/tag/list"; + } + + @Override + public String getName() { + return "nmtaf.listformtagapi.getname"; + } + + @Override + public String getConfig() { + return null; + } + + @Input({ + @Param(name = "processTaskId", type = ApiParamType.STRING, desc = "term.itsm.processtaskid"), + @Param(name = "formUuid", type = ApiParamType.STRING, desc = "term.framework.formuuid") + }) + @Output({ + @Param(name = "tbodyList", explode = String[].class, desc = "common.tbodylist") + }) + @Description(desc = "nmtaf.listformtagapi.getname") + @Override + public Object myDoService(JSONObject jsonObj) throws Exception { + FormVersionVo formVersionVo = null; + Long processTaskId = jsonObj.getLong("processTaskId"); + if (processTaskId != null) { + ProcessTaskFormVo processTaskForm = processTaskMapper.getProcessTaskFormByProcessTaskId(processTaskId); + if (processTaskForm != null) { + formVersionVo = new FormVersionVo(); + formVersionVo.setFormUuid(processTaskForm.getFormUuid()); + formVersionVo.setFormName(processTaskForm.getFormName()); + formVersionVo.setFormConfigStr(processTaskForm.getFormContent()); + } + } else { + String formUuid = jsonObj.getString("formUuid"); + FormVo form = formMapper.getFormByUuid(formUuid); + if (form == null) { + throw new FormNotFoundException(formUuid); + } + formVersionVo = formMapper.getActionFormVersionByFormUuid(formUuid); + if (formVersionVo == null) { + throw new FormActiveVersionNotFoundExcepiton(form.getName()); + } + } + Set tagSet = new HashSet<>(); + if (formVersionVo != null) { + List formCustomExtendAttributeList = formVersionVo.getFormCustomExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formCustomExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formCustomExtendAttributeList) { + tagSet.add(formAttributeVo.getTag()); + } + } + } + return TableResultUtil.getResult(new ArrayList<>(tagSet)); + } + +} diff --git a/src/main/java/neatlogic/module/process/api/process/ProcessConditionList.java b/src/main/java/neatlogic/module/process/api/process/ProcessConditionList.java index aa49601b6..4aba5eaa0 100644 --- a/src/main/java/neatlogic/module/process/api/process/ProcessConditionList.java +++ b/src/main/java/neatlogic/module/process/api/process/ProcessConditionList.java @@ -24,6 +24,7 @@ import neatlogic.framework.process.constvalue.ConditionProcessTaskOptions; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import neatlogic.module.process.service.ProcessTaskService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -39,6 +40,9 @@ public class ProcessConditionList extends PrivateApiComponentBase { @Resource private FormMapper formMapper; + @Resource + private ProcessTaskService processTaskService; + @Override public String getToken() { return "process/condition/list"; @@ -54,10 +58,15 @@ public class ProcessConditionList extends PrivateApiComponentBase { return null; } - @Input({@Param(name = "formUuid", type = ApiParamType.STRING, desc = "term.framework.formuuid"), + @Input({ + @Param(name = "processTaskId", type = ApiParamType.STRING, desc = "term.itsm.processtaskid"), + @Param(name = "formUuid", type = ApiParamType.STRING, desc = "term.framework.formuuid"), @Param(name = "tag", type = ApiParamType.STRING, desc = "common.tag"), - @Param(name = "isAll", type = ApiParamType.INTEGER, rule = "0,1", desc = "term.process.isreturnallattr")}) - @Output({@Param(explode = ConditionParamVo[].class, desc = "nmpap.processconditionlist.getname")}) + @Param(name = "isAll", type = ApiParamType.INTEGER, rule = "0,1", desc = "term.process.isreturnallattr") + }) + @Output({ + @Param(explode = ConditionParamVo[].class, desc = "nmpap.processconditionlist.getname") + }) @Description(desc = "nmpap.processconditionlist.getname") @Override public Object myDoService(JSONObject jsonObj) throws Exception { @@ -95,20 +104,26 @@ public class ProcessConditionList extends PrivateApiComponentBase { resultArray.add(conditionParamVo); } } + List formAttributeList = null; + String tag = jsonObj.getString("tag"); + Long processTaskId = jsonObj.getLong("processTaskId"); + if (processTaskId != null) { + formAttributeList = processTaskService.getFormAttributeListByProcessTaskIdAngTagNew(processTaskId, tag); + } else { + // 表单条件 + String formUuid = jsonObj.getString("formUuid"); + if (StringUtils.isNotBlank(formUuid)) { + FormVo form = formMapper.getFormByUuid(formUuid); + if (form == null) { + throw new FormNotFoundException(formUuid); + } + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + formAttributeList = formCrossoverService.getFormAttributeListNew(formUuid, form.getName(), tag); - // 表单条件 - String formUuid = jsonObj.getString("formUuid"); - if (StringUtils.isNotBlank(formUuid)) { - FormVo form = formMapper.getFormByUuid(formUuid); - if (form == null) { - throw new FormNotFoundException(formUuid); } - - String tag = jsonObj.getString("tag"); - IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); -// List formAttrList = formCrossoverService.getFormAttributeList(formUuid, form.getName(), ConditionProcessComponent.FORM_EXTEND_ATTRIBUTE_TAG); - List formAttrList = formCrossoverService.getFormAttributeListNew(formUuid, form.getName(), tag); - for (FormAttributeVo formAttributeVo : formAttrList) { + } + if (CollectionUtils.isNotEmpty(formAttributeList)) { + for (FormAttributeVo formAttributeVo : formAttributeList) { IFormAttributeHandler formHandler = FormAttributeHandlerFactory.getHandler(formAttributeVo.getHandler()); if (formHandler == null) { continue; diff --git a/src/main/java/neatlogic/module/process/api/process/ProcessFormGetApi.java b/src/main/java/neatlogic/module/process/api/process/ProcessFormGetApi.java new file mode 100644 index 000000000..bec876f1b --- /dev/null +++ b/src/main/java/neatlogic/module/process/api/process/ProcessFormGetApi.java @@ -0,0 +1,129 @@ +/*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.api.process; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.dependency.constvalue.FrameworkFromType; +import neatlogic.framework.dependency.core.DependencyManager; +import neatlogic.framework.exception.type.ParamNotExistsException; +import neatlogic.framework.form.dao.mapper.FormMapper; +import neatlogic.framework.form.dto.FormVersionVo; +import neatlogic.framework.form.dto.FormVo; +import neatlogic.framework.form.exception.FormActiveVersionNotFoundExcepiton; +import neatlogic.framework.form.exception.FormNotFoundException; +import neatlogic.framework.form.exception.FormVersionNotFoundException; +import neatlogic.framework.process.dto.ProcessTaskFormVo; +import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; +import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import neatlogic.module.process.dao.mapper.processtask.ProcessTaskMapper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service + +@OperationType(type = OperationTypeEnum.SEARCH) +public class ProcessFormGetApi extends PrivateApiComponentBase { + + @Resource + private FormMapper formMapper; + + @Resource + private ProcessTaskMapper processTaskMapper; + + @Override + public String getToken() { + return "process/form/get"; + } + + @Override + public String getName() { + return "获取表单信息"; + } + + @Override + public String getConfig() { + return null; + } + + @Override + @Input({ + @Param(name = "processTaskId", type = ApiParamType.STRING, desc = "term.itsm.processtaskid"), + @Param(name = "uuid", type = ApiParamType.STRING, desc = "表单uuid"), + @Param(name = "currentVersionUuid", type = ApiParamType.STRING, desc = "选择表单版本uuid"), + }) + @Output({@Param(explode = FormVo.class)}) + @Description(desc = "获取表单信息") + public Object myDoService(JSONObject jsonObj) throws Exception { + Long processTaskId = jsonObj.getLong("processTaskId"); + if (processTaskId != null) { + ProcessTaskFormVo processTaskForm = processTaskMapper.getProcessTaskFormByProcessTaskId(processTaskId); + if (processTaskForm != null) { + FormVo formVo = new FormVo(); + formVo.setUuid(processTaskForm.getFormUuid()); + formVo.setName(processTaskForm.getFormName()); + formVo.setIsActive(1); + formVo.setReferenceCount(1); + formVo.setFormConfig(JSONObject.parseObject(processTaskForm.getFormContent())); + return formVo; + } + return null; + } else { + String currentVersionUuid = jsonObj.getString("currentVersionUuid"); + String uuid = jsonObj.getString("uuid"); + if (StringUtils.isNotBlank(currentVersionUuid)) { + FormVersionVo formVersion = formMapper.getFormVersionByUuid(currentVersionUuid); + if (formVersion == null) { + throw new FormVersionNotFoundException(currentVersionUuid); + } + FormVo formVo = formMapper.getFormByUuid(formVersion.getFormUuid()); + if (formVo == null) { + throw new FormNotFoundException(formVersion.getFormUuid()); + } + formVo.setCurrentVersionUuid(currentVersionUuid); + formVo.setFormConfig(formVersion.getFormConfig()); + List formVersionList = formMapper.getFormVersionSimpleByFormUuid(formVersion.getFormUuid()); + formVo.setVersionList(formVersionList); + int count = DependencyManager.getDependencyCount(FrameworkFromType.FORM, formVo.getUuid()); + formVo.setReferenceCount(count); + return formVo; + } else if (StringUtils.isNotBlank(uuid)) { + FormVo formVo = formMapper.getFormByUuid(uuid); + if (formVo == null) { + throw new FormNotFoundException(uuid); + } + FormVersionVo formVersion = formMapper.getActionFormVersionByFormUuid(uuid); + if (formVersion == null) { + throw new FormActiveVersionNotFoundExcepiton(uuid); + } + formVo.setCurrentVersionUuid(formVersion.getUuid()); + formVo.setFormConfig(formVersion.getFormConfig()); + List formVersionList = formMapper.getFormVersionSimpleByFormUuid(uuid); + formVo.setVersionList(formVersionList); + int count = DependencyManager.getDependencyCount(FrameworkFromType.FORM, formVo.getUuid()); + formVo.setReferenceCount(count); + return formVo; + } else { + throw new ParamNotExistsException("uuid", "currentVersionUuid"); + } + } + } + +} diff --git a/src/main/java/neatlogic/module/process/api/process/ProcessGetApi.java b/src/main/java/neatlogic/module/process/api/process/ProcessGetApi.java index 42d52bbdb..f83fe676a 100644 --- a/src/main/java/neatlogic/module/process/api/process/ProcessGetApi.java +++ b/src/main/java/neatlogic/module/process/api/process/ProcessGetApi.java @@ -1,22 +1,23 @@ package neatlogic.module.process.api.process; +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.auth.core.AuthAction; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.process.auth.PROCESS_MODIFY; +import neatlogic.framework.process.dto.ProcessTaskVo; +import neatlogic.framework.process.dto.ProcessVo; +import neatlogic.framework.process.exception.process.ProcessNotFoundEditTargetException; import neatlogic.framework.process.stephandler.core.ProcessMessageManager; import neatlogic.framework.process.util.ProcessConfigUtil; -import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; -import neatlogic.framework.process.auth.PROCESS_MODIFY; - +import neatlogic.module.process.dao.mapper.SelectContentByHashMapper; import neatlogic.module.process.dao.mapper.process.ProcessMapper; +import neatlogic.module.process.dao.mapper.processtask.ProcessTaskMapper; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import com.alibaba.fastjson.JSONObject; - -import neatlogic.framework.auth.core.AuthAction; -import neatlogic.framework.common.constvalue.ApiParamType; -import neatlogic.framework.process.dto.ProcessVo; -import neatlogic.framework.process.exception.process.ProcessNotFoundEditTargetException; - import javax.annotation.Resource; @Service @@ -27,6 +28,12 @@ public class ProcessGetApi extends PrivateApiComponentBase { @Resource private ProcessMapper processMapper; + @Resource + private ProcessTaskMapper processTaskMapper; + + @Resource + private SelectContentByHashMapper selectContentByHashMapper; + @Override public String getToken() { return "process/get"; @@ -43,7 +50,8 @@ public class ProcessGetApi extends PrivateApiComponentBase { } @Input({ - @Param(name = "uuid", type = ApiParamType.STRING, isRequired = true, desc = "term.itsm.processuuid") + @Param(name = "uuid", type = ApiParamType.STRING, desc = "term.itsm.processuuid"), + @Param(name = "processTaskId", type = ApiParamType.LONG, desc = "term.itsm.processtaskid") }) @Output({ @Param(explode = ProcessVo.class) @@ -51,15 +59,39 @@ public class ProcessGetApi extends PrivateApiComponentBase { @Description(desc = "nmpap.processgetapi.getname") @Override public Object myDoService(JSONObject jsonObj) throws Exception { - String uuid = jsonObj.getString("uuid"); - ProcessVo processVo = processMapper.getProcessByUuid(uuid); - if (processVo == null) { - throw new ProcessNotFoundEditTargetException(uuid); + Long processTaskId = jsonObj.getLong("processTaskId"); + if (processTaskId != null) { + ProcessTaskVo processTaskVo = processTaskMapper.getProcessTaskBaseInfoByIdIncludeIsDeleted(processTaskId); + if (processTaskVo != null) { + String configStr = selectContentByHashMapper.getProcessTaskConfigStringByHash(processTaskVo.getConfigHash()); + ProcessVo processVo = processMapper.getProcessByUuid(processTaskVo.getProcessUuid()); + if (processVo == null) { + processVo = new ProcessVo(); + processVo.setUuid(processTaskVo.getProcessUuid()); + processVo.setName(""); + processVo.setIsActive(1); + } + processVo.setName(processVo.getName() + "【工单:" + processTaskVo.getTitle()+ "】"); + processVo.setConfig(configStr); + ProcessMessageManager.setOperationType(OperationTypeEnum.SEARCH); + processVo.setConfig(ProcessConfigUtil.regulateProcessConfig(processVo.getConfig())); + processVo.setReferenceCount(1); + return processVo; + } + } else { + String uuid = jsonObj.getString("uuid"); + if (StringUtils.isNotBlank(uuid)) { + ProcessVo processVo = processMapper.getProcessByUuid(uuid); + if (processVo == null) { + throw new ProcessNotFoundEditTargetException(uuid); + } + ProcessMessageManager.setOperationType(OperationTypeEnum.SEARCH); + processVo.setConfig(ProcessConfigUtil.regulateProcessConfig(processVo.getConfig())); + int count = processMapper.getProcessReferenceCount(uuid); + processVo.setReferenceCount(count); + return processVo; + } } - ProcessMessageManager.setOperationType(OperationTypeEnum.SEARCH); - processVo.setConfig(ProcessConfigUtil.regulateProcessConfig(processVo.getConfig())); - int count = processMapper.getProcessReferenceCount(uuid); - processVo.setReferenceCount(count); - return processVo; + return null; } } diff --git a/src/main/java/neatlogic/module/process/api/process/ProcessParamList.java b/src/main/java/neatlogic/module/process/api/process/ProcessParamList.java index 9d15e17e7..6f59c65cf 100644 --- a/src/main/java/neatlogic/module/process/api/process/ProcessParamList.java +++ b/src/main/java/neatlogic/module/process/api/process/ProcessParamList.java @@ -5,23 +5,25 @@ import com.alibaba.fastjson.JSONObject; import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.common.constvalue.ParamType; -import neatlogic.framework.crossover.CrossoverServiceFactory; -import neatlogic.framework.form.dto.FormVo; -import neatlogic.framework.form.exception.FormNotFoundException; -import neatlogic.framework.form.service.IFormCrossoverService; -import neatlogic.framework.process.condition.core.ProcessTaskConditionFactory; import neatlogic.framework.condition.core.IConditionHandler; +import neatlogic.framework.crossover.CrossoverServiceFactory; import neatlogic.framework.dto.ConditionParamVo; import neatlogic.framework.form.attribute.core.FormAttributeHandlerFactory; import neatlogic.framework.form.attribute.core.IFormAttributeHandler; import neatlogic.framework.form.dao.mapper.FormMapper; import neatlogic.framework.form.dto.FormAttributeVo; +import neatlogic.framework.form.dto.FormVo; +import neatlogic.framework.form.exception.FormNotFoundException; +import neatlogic.framework.form.service.IFormCrossoverService; import neatlogic.framework.process.auth.PROCESS_BASE; +import neatlogic.framework.process.condition.core.ProcessTaskConditionFactory; import neatlogic.framework.process.constvalue.ProcessFieldType; import neatlogic.framework.process.constvalue.ProcessTaskParams; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import neatlogic.module.process.service.ProcessTaskService; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -36,6 +38,9 @@ public class ProcessParamList extends PrivateApiComponentBase { @Resource private FormMapper formMapper; + @Resource + private ProcessTaskService processTaskService; + @Override public String getToken() { return "process/param/list"; @@ -52,6 +57,7 @@ public class ProcessParamList extends PrivateApiComponentBase { } @Input({ + @Param(name = "processTaskId", type = ApiParamType.STRING, desc = "term.itsm.processtaskid"), @Param(name = "formUuid", type = ApiParamType.STRING, desc = "term.framework.formuuid"), @Param(name = "tag", type = ApiParamType.STRING, desc = "common.tag"), @Param(name = "isAll", type = ApiParamType.INTEGER, rule = "0,1", desc = "term.process.isreturnallattr") @@ -91,19 +97,26 @@ public class ProcessParamList extends PrivateApiComponentBase { // param.setType("common"); // resultArray.add(param); - // 表单条件 - String formUuid = jsonObj.getString("formUuid"); - if (StringUtils.isNotBlank(formUuid)) { - FormVo form = formMapper.getFormByUuid(formUuid); - if (form == null) { - throw new FormNotFoundException(formUuid); + List formAttributeList = null; + String tag = jsonObj.getString("tag"); + Long processTaskId = jsonObj.getLong("processTaskId"); + if (processTaskId != null) { + formAttributeList = processTaskService.getFormAttributeListByProcessTaskIdAngTagNew(processTaskId, tag); + } else { + // 表单条件 + String formUuid = jsonObj.getString("formUuid"); + if (StringUtils.isNotBlank(formUuid)) { + FormVo form = formMapper.getFormByUuid(formUuid); + if (form == null) { + throw new FormNotFoundException(formUuid); + } + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + formAttributeList = formCrossoverService.getFormAttributeListNew(formUuid, form.getName(), tag); } + } + if (CollectionUtils.isNotEmpty(formAttributeList)) { Integer isAll = jsonObj.getInteger("isAll"); - String tag = jsonObj.getString("tag"); - IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); - List formAttrList = formCrossoverService.getFormAttributeListNew(formUuid, form.getName(), tag); -// List formAttrList = formMapper.getFormAttributeList(new FormAttributeVo(formUuid)); - for (FormAttributeVo formAttributeVo : formAttrList) { + for (FormAttributeVo formAttributeVo : formAttributeList) { IFormAttributeHandler formHandler = FormAttributeHandlerFactory.getHandler(formAttributeVo.getHandler()); if(formHandler == null){ continue; -- Gitee