diff --git a/src/main/java/neatlogic/module/process/api/form/FormAttributeCheckApi.java b/src/main/java/neatlogic/module/process/api/form/FormAttributeCheckApi.java
index 2d6b54b9b62593210643de37f30be0c54fc9f127..f7e1991f67051b61a92453a240751334b90533e3 100644
--- a/src/main/java/neatlogic/module/process/api/form/FormAttributeCheckApi.java
+++ b/src/main/java/neatlogic/module/process/api/form/FormAttributeCheckApi.java
@@ -89,17 +89,17 @@ public class FormAttributeCheckApi extends PrivateApiComponentBase {
}
worktimeUuid = processTaskVo.getWorktimeUuid();
ProcessTaskFormVo processTaskFormVo = processTaskMapper.getProcessTaskFormByProcessTaskId(processTaskId);
- if(processTaskFormVo == null || StringUtils.isBlank(processTaskFormVo.getFormContentHash())) {
+ if(processTaskFormVo == null || StringUtils.isBlank(processTaskFormVo.getFormContent())) {
return false;
}
- String formContent = selectContentByHashMapper.getProcessTaskFromContentByHash(processTaskFormVo.getFormContentHash());
- if(StringUtils.isBlank(formContent)) {
- return false;
- }
+// String formContent = selectContentByHashMapper.getProcessTaskFromContentByHash(processTaskFormVo.getFormContentHash());
+// if(StringUtils.isBlank(formContent)) {
+// return false;
+// }
formVersionVo = new FormVersionVo();
formVersionVo.setFormUuid(processTaskFormVo.getFormUuid());
formVersionVo.setFormName(processTaskFormVo.getFormName());
- formVersionVo.setFormConfig(JSONObject.parseObject(formContent));
+ formVersionVo.setFormConfig(JSONObject.parseObject(processTaskFormVo.getFormContent()));
}else if(StringUtils.isNotBlank(channelUuid)){
ChannelVo channelVo = channelMapper.getChannelByUuid(channelUuid);
diff --git a/src/main/java/neatlogic/module/process/api/form/ProcessTaskFormPasswordDecryptApi.java b/src/main/java/neatlogic/module/process/api/form/ProcessTaskFormPasswordDecryptApi.java
new file mode 100644
index 0000000000000000000000000000000000000000..81650603f4748f7e15749e49d5e8051d4bb5beb4
--- /dev/null
+++ b/src/main/java/neatlogic/module/process/api/form/ProcessTaskFormPasswordDecryptApi.java
@@ -0,0 +1,163 @@
+/*
+ * 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.form;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import neatlogic.framework.asynchronization.threadlocal.UserContext;
+import neatlogic.framework.auth.core.AuthAction;
+import neatlogic.framework.common.constvalue.ApiParamType;
+import neatlogic.framework.form.attribute.core.FormAttributeDataConversionHandlerFactory;
+import neatlogic.framework.form.attribute.core.IFormAttributeDataConversionHandler;
+import neatlogic.framework.form.dto.FormAttributeParentVo;
+import neatlogic.framework.form.dto.FormAttributeVo;
+import neatlogic.framework.process.auth.PROCESS_BASE;
+import neatlogic.framework.process.dto.ProcessTaskFormAttributeDataVo;
+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.$;
+import neatlogic.framework.util.FormUtil;
+import neatlogic.module.process.dao.mapper.processtask.ProcessTaskMapper;
+import neatlogic.module.process.service.ProcessTaskService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+@Service
+@AuthAction(action = PROCESS_BASE.class)
+@OperationType(type = OperationTypeEnum.SEARCH)
+public class ProcessTaskFormPasswordDecryptApi extends PrivateApiComponentBase {
+
+ @Resource
+ private ProcessTaskMapper processTaskMapper;
+
+ @Resource
+ private ProcessTaskService processTaskService;
+
+ @Override
+ public String getName() {
+ return "nmpaf.processtaskformpassworddecryptapi.getname";
+ }
+
+ @Input({
+ @Param(name = "processTaskId", type = ApiParamType.LONG, isRequired = true, desc = "term.itsm.processtaskid"),
+ @Param(name = "formAttributeUuid", type = ApiParamType.STRING, isRequired = true, desc = "nmpaf.processtaskformpassworddecryptapi.formattributeuuid"),
+ @Param(name = "otherParamConfig", type = ApiParamType.JSONOBJECT, isRequired = true, desc = "nmpaf.processtaskformpassworddecryptapi.otherparamconfig")
+ })
+ @Output({
+ @Param(name = "password", type = ApiParamType.STRING, desc = "common.password"),
+ @Param(name = "error", type = ApiParamType.STRING, desc = "common.errormsg")
+ })
+ @Description(desc = "nmpaf.processtaskformpassworddecryptapi.getname")
+ @Override
+ public Object myDoService(JSONObject paramObj) throws Exception {
+ JSONObject resultObj = new JSONObject();
+ Long processTaskId = paramObj.getLong("processTaskId");
+ ProcessTaskFormVo processTaskFormVo = processTaskMapper.getProcessTaskFormByProcessTaskId(processTaskId);
+ if (processTaskFormVo == null || StringUtils.isBlank(processTaskFormVo.getFormContent())) {
+ return resultObj;
+ }
+ String formAttributeUuid = paramObj.getString("formAttributeUuid");
+ FormAttributeVo formAttributeVo = null;
+ List allFormAttributeList = FormUtil.getAllFormAttributeList(processTaskFormVo.getFormContent());
+ for (FormAttributeVo formAttribute : allFormAttributeList) {
+ if (Objects.equals(formAttribute.getUuid(), formAttributeUuid)) {
+ formAttributeVo = formAttribute;
+ break;
+ }
+ }
+ if (formAttributeVo == null) {
+ resultObj.put("error", $.t("nffe.formattributenotfoundexception.formattributenotfoundexception_a", formAttributeUuid));
+ return resultObj;
+ }
+ boolean flag = false;
+ JSONObject config = formAttributeVo.getConfig();
+ if (MapUtils.isNotEmpty(config)) {
+ JSONArray viewAuthorityList = config.getJSONArray("viewPasswordAuthorityList");
+ if (CollectionUtils.isNotEmpty(viewAuthorityList)) {
+ String userUuid = UserContext.get().getUserUuid();
+ List teamUuidList = UserContext.get().getTeamUuidList();
+ List roleUuidList = UserContext.get().getRoleUuidList();
+ for (int i = 0; i < viewAuthorityList.size(); i++) {
+ String viewAuthority = viewAuthorityList.getString(i);
+ if (StringUtils.isNotBlank(viewAuthority)) {
+ String[] split = viewAuthority.split("#");
+ if (Objects.equals(split[0], "user")) {
+ if (Objects.equals(split[1], userUuid)) {
+ flag = true;
+ break;
+ }
+ } else if (Objects.equals(split[0], "team")) {
+ if (teamUuidList.contains(split[1])) {
+ flag = true;
+ break;
+ }
+ } else if (Objects.equals(split[0], "role")) {
+ if (roleUuidList.contains(split[1])) {
+ flag = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!flag) {
+ resultObj.put("error", $.t("nmpaf.processtaskformpassworddecryptapi.nopermissiontoviewpassword"));
+ return resultObj;
+ }
+ List parentList = new ArrayList<>();
+ FormAttributeParentVo parent = formAttributeVo.getParent();
+ while (parent != null) {
+ parentList.add(0, parent);
+ parent = parent.getParent();
+ }
+ FormAttributeVo formAttributeVo2 = null;
+ if (CollectionUtils.isNotEmpty(parentList)) {
+ for (FormAttributeVo formAttribute : allFormAttributeList) {
+ if (Objects.equals(formAttribute.getUuid(), parentList.get(0).getUuid())) {
+ formAttributeVo2 = formAttribute;
+ break;
+ }
+ }
+ } else {
+ formAttributeVo2 = formAttributeVo;
+ }
+ ProcessTaskFormAttributeDataVo processTaskFormAttributeData = processTaskService.getProcessTaskFormAttributeDataByProcessTaskIdAndAttributeUuid(processTaskId, formAttributeVo2.getUuid());
+ IFormAttributeDataConversionHandler formAttributeDataConversionHandler = FormAttributeDataConversionHandlerFactory.getHandler(formAttributeVo2.getHandler());
+ if (formAttributeDataConversionHandler != null) {
+ JSONObject otherParamConfig = paramObj.getJSONObject("otherParamConfig");
+ String result = formAttributeDataConversionHandler.passwordDecryption(processTaskFormAttributeData.getDataObj(), formAttributeVo2.getConfig(), formAttributeUuid, otherParamConfig);
+ resultObj.put("password", result);
+ }
+ return resultObj;
+ }
+
+ @Override
+ public String getToken() {
+ return "processtask/form/password/decrypt";
+ }
+}
diff --git a/src/main/java/neatlogic/module/process/api/processtask/ProcessTaskDraftGetApi.java b/src/main/java/neatlogic/module/process/api/processtask/ProcessTaskDraftGetApi.java
index 2b8435a2b235bddac0ce298128fb237a39eac22e..036b952ce70da493a49df784fbd28621ca626878 100644
--- a/src/main/java/neatlogic/module/process/api/processtask/ProcessTaskDraftGetApi.java
+++ b/src/main/java/neatlogic/module/process/api/processtask/ProcessTaskDraftGetApi.java
@@ -258,10 +258,10 @@ public class ProcessTaskDraftGetApi extends PrivateApiComponentBase {
Map formAttributeDataMap = new HashMap<>();
// 获取旧工单表单信息
ProcessTaskFormVo processTaskFormVo = processTaskMapper.getProcessTaskFormByProcessTaskId(fromProcessTaskId);
- if (processTaskFormVo != null && StringUtils.isNotBlank(processTaskFormVo.getFormContentHash())) {
- String formContent = selectContentByHashMapper.getProcessTaskFromContentByHash(processTaskFormVo.getFormContentHash());
- if (StringUtils.isNotBlank(formContent)) {
- JSONObject formConfig = JSON.parseObject(formContent);
+ if (processTaskFormVo != null && StringUtils.isNotBlank(processTaskFormVo.getFormContent())) {
+// String formContent = selectContentByHashMapper.getProcessTaskFromContentByHash(processTaskFormVo.getFormContentHash());
+// if (StringUtils.isNotBlank(formContent)) {
+ JSONObject formConfig = JSON.parseObject(processTaskFormVo.getFormContent());
FormVersionVo fromFormVersion = new FormVersionVo();
fromFormVersion.setFormConfig(formConfig);
String mainSceneUuid = formConfig.getString("uuid");
@@ -279,7 +279,7 @@ public class ProcessTaskDraftGetApi extends PrivateApiComponentBase {
for (ProcessTaskFormAttributeDataVo processTaskFormAttributeDataVo : processTaskFormAttributeDataList) {
formAttributeDataMap.put(processTaskFormAttributeDataVo.getAttributeUuid(), processTaskFormAttributeDataVo.getDataObj());
}
- }
+// }
}
resultObj.put("labelUuidMap", labelUuidMap);
resultObj.put("labelHandlerMap", labelHandlerMap);
diff --git a/src/main/java/neatlogic/module/process/audithandler/handler/FormAuditHandler.java b/src/main/java/neatlogic/module/process/audithandler/handler/FormAuditHandler.java
index e180d7c4e2ad8bfcd7cd31490957d273b017e74b..7271dc78d31e7c62652db7eba8a3b8e7b31ead20 100644
--- a/src/main/java/neatlogic/module/process/audithandler/handler/FormAuditHandler.java
+++ b/src/main/java/neatlogic/module/process/audithandler/handler/FormAuditHandler.java
@@ -80,14 +80,14 @@ public class FormAuditHandler implements IProcessTaskStepAuditDetailHandler {
}
Long processTaskId = processTaskFormAttributeDataList.get(0).getProcessTaskId();
ProcessTaskFormVo processTaskForm = processTaskMapper.getProcessTaskFormByProcessTaskId(processTaskId);
- if (processTaskForm == null || StringUtils.isBlank(processTaskForm.getFormContentHash())) {
+ if (processTaskForm == null || StringUtils.isBlank(processTaskForm.getFormContent())) {
return 0;
}
- String formContent = selectContentByHashMapper.getProcessTaskFromContentByHash(processTaskForm.getFormContentHash());
+// String formContent = selectContentByHashMapper.getProcessTaskFromContentByHash(processTaskForm.getFormContentHash());
FormVersionVo formVersionVo = new FormVersionVo();
formVersionVo.setFormUuid(processTaskForm.getFormUuid());
formVersionVo.setFormName(processTaskForm.getFormName());
- formVersionVo.setFormConfig(JSONObject.parseObject(formContent));
+ formVersionVo.setFormConfig(JSONObject.parseObject(processTaskForm.getFormContent()));
String mainSceneUuid = formVersionVo.getFormConfig().getString("uuid");
formVersionVo.setSceneUuid(mainSceneUuid);
List mainSceneFormAttributeList = formVersionVo.getFormAttributeList();
diff --git a/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.java b/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.java
index ec41da2744d14a88f008be3611351841f8d8da09..a272b1027dadee482bc7fb8b0147362df1408d2c 100644
--- a/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.java
+++ b/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.java
@@ -35,7 +35,7 @@ public interface SelectContentByHashMapper extends ISelectContentByHashCrossover
String getProcessTaskFromContentByHash(String hash);
- String getProcessTaskFromContentByProcessTaskId(Long processTaskId);
+// String getProcessTaskFromContentByProcessTaskId(Long processTaskId);
// int getProcessTaskFromContentCountByHash(String hash);
diff --git a/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.xml b/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.xml
index 921697248e75c33cf5b77cd40f2b2da53384a0d0..70675caf123aa29f5f381afbf7580409a0a71205 100644
--- a/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.xml
+++ b/src/main/java/neatlogic/module/process/dao/mapper/SelectContentByHashMapper.xml
@@ -71,12 +71,12 @@
SELECT `content` FROM `processtask_form_content` WHERE `hash` = #{value}
-