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 b27fd35dfc87e866c6f4f86de4457f576457d08f..de7cc534ab6a26dd0d70e086c5c9ca619d259d4a 100644 --- a/src/main/java/neatlogic/module/process/api/processtask/ProcessTaskDraftGetApi.java +++ b/src/main/java/neatlogic/module/process/api/processtask/ProcessTaskDraftGetApi.java @@ -202,6 +202,8 @@ public class ProcessTaskDraftGetApi extends PrivateApiComponentBase { JSONObject fromProcessTaskFormAttrDataMap = getFromFormAttributeDataMap(fromProcessTaskId); JSONObject labelUuidMap = fromProcessTaskFormAttrDataMap.getJSONObject("labelUuidMap"); JSONObject labelHandlerMap = fromProcessTaskFormAttrDataMap.getJSONObject("labelHandlerMap"); + JSONObject keyUuidMap = fromProcessTaskFormAttrDataMap.getJSONObject("keyUuidMap"); + JSONObject keyHandlerMap = fromProcessTaskFormAttrDataMap.getJSONObject("keyHandlerMap"); JSONObject formAttributeDataMap = fromProcessTaskFormAttrDataMap.getJSONObject("formAttributeDataMap"); //获取目标表单值 FormVersionVo toFormVersion = new FormVersionVo(); @@ -209,15 +211,26 @@ public class ProcessTaskDraftGetApi extends PrivateApiComponentBase { String mainSceneUuid = toProcessTaskFormConfig.getString("uuid"); toFormVersion.setSceneUuid(mainSceneUuid); for (FormAttributeVo formAttributeVo : toFormVersion.getFormAttributeList()) { - String fromFormAttributeHandler = labelHandlerMap.getString(formAttributeVo.getLabel()); + String fromFormAttributeHandler = keyHandlerMap.getString(formAttributeVo.getKey()); if (Objects.equals(fromFormAttributeHandler, formAttributeVo.getHandler())) { - String fromFormAttributeUuid = labelUuidMap.getString(formAttributeVo.getLabel()); + String fromFormAttributeUuid = keyUuidMap.getString(formAttributeVo.getKey()); if (StringUtils.isNotBlank(fromFormAttributeUuid)) { Object data = formAttributeDataMap.get(fromFormAttributeUuid); if (data != null) { resultObj.put(formAttributeVo.getUuid(), data); } } + } else { + fromFormAttributeHandler = labelHandlerMap.getString(formAttributeVo.getLabel()); + if (Objects.equals(fromFormAttributeHandler, formAttributeVo.getHandler())) { + String fromFormAttributeUuid = labelUuidMap.getString(formAttributeVo.getLabel()); + if (StringUtils.isNotBlank(fromFormAttributeUuid)) { + Object data = formAttributeDataMap.get(fromFormAttributeUuid); + if (data != null) { + resultObj.put(formAttributeVo.getUuid(), data); + } + } + } } } @@ -239,6 +252,8 @@ public class ProcessTaskDraftGetApi extends PrivateApiComponentBase { if (StringUtils.isNotBlank(formContent)) { Map labelUuidMap = new HashMap<>(); Map labelHandlerMap = new HashMap<>(); + Map keyUuidMap = new HashMap<>(); + Map keyHandlerMap = new HashMap<>(); JSONObject formConfig = JSON.parseObject(formContent); FormVersionVo fromFormVersion = new FormVersionVo(); fromFormVersion.setFormConfig(formConfig); @@ -248,6 +263,10 @@ public class ProcessTaskDraftGetApi extends PrivateApiComponentBase { for (FormAttributeVo formAttributeVo : fromFormAttributeList) { labelUuidMap.put(formAttributeVo.getLabel(), formAttributeVo.getUuid()); labelHandlerMap.put(formAttributeVo.getLabel(), formAttributeVo.getHandler()); + if (StringUtils.isNotBlank(formAttributeVo.getKey())) { + keyUuidMap.put(formAttributeVo.getKey(), formAttributeVo.getUuid()); + keyHandlerMap.put(formAttributeVo.getKey(), formAttributeVo.getHandler()); + } } Map formAttributeDataMap = new HashMap<>(); List processTaskFormAttributeDataList = processTaskService.getProcessTaskFormAttributeDataListByProcessTaskId(fromProcessTaskId); @@ -256,6 +275,8 @@ public class ProcessTaskDraftGetApi extends PrivateApiComponentBase { } resultObj.put("labelUuidMap", labelUuidMap); resultObj.put("labelHandlerMap", labelHandlerMap); + resultObj.put("keyUuidMap", keyUuidMap); + resultObj.put("keyHandlerMap", keyHandlerMap); resultObj.put("formAttributeDataMap", formAttributeDataMap); } } diff --git a/src/main/java/neatlogic/module/process/service/ProcessStepHandlerUtil.java b/src/main/java/neatlogic/module/process/service/ProcessStepHandlerUtil.java index 96babe1bf8767b3ad23e739bd532d013d9333a08..3d374f7bdf6957ac24d1bad5079b3f115887350c 100644 --- a/src/main/java/neatlogic/module/process/service/ProcessStepHandlerUtil.java +++ b/src/main/java/neatlogic/module/process/service/ProcessStepHandlerUtil.java @@ -887,6 +887,15 @@ public class ProcessStepHandlerUtil implements IProcessStepHandlerUtil, IProcess for (int i = 0; i < formAttributeDataList.size(); i++) { JSONObject formAttributeDataObj = formAttributeDataList.getJSONObject(i); String attributeUuid = formAttributeDataObj.getString("attributeUuid"); + if (StringUtils.isBlank(attributeUuid)) { + String attributeKey = formAttributeDataObj.getString("key"); + if (StringUtils.isNotBlank(attributeKey)) { + Optional first = mainSceneFormAttributeList.stream().filter(e -> Objects.equals(e.getKey(), attributeKey)).findFirst(); + if (first.isPresent()) { + attributeUuid = first.get().getUuid(); + } + } + } Object data = formAttributeDataObj.get("dataList"); formAttributeDataMap.put(attributeUuid, data); }