修改:知识库列表审批人批量查询返回

This commit is contained in:
yangyang01000846
2025-11-18 16:17:16 +08:00
parent 83e579f8ad
commit 3cc72ef110
14 changed files with 278 additions and 8 deletions

View File

@@ -0,0 +1,16 @@
package com.sdm.common.entity.req.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "批量查询CID电子流状态请求参数")
@Data
public class FlowStatusParam {
// `spdm_baseline`.`simulation_approve_flow`.templateId
private String flowId;
// `spdm_baseline`.`simulation_approve_flow`.cidFlowId
private String processInstanceId;
// `spdm_baseline`.`simulation_approve_flow`.tenantId
private String tenantId;
}

View File

@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
@Slf4j
@@ -16,6 +17,7 @@ public class ApproveFeignClientImpl implements IApproveFeignClient {
@Autowired
private IApproveFeignClient approveFeignClient;
@Override
public SdmResponse launchApproval( LaunchApproveReq approveReq) {
@@ -32,4 +34,21 @@ public class ApproveFeignClientImpl implements IApproveFeignClient {
}
return response;
}
@Override
public SdmResponse queryBatchApproveFlowStatus(List<String> flowIds) {
SdmResponse response=null ;
try {
response = approveFeignClient.queryBatchApproveFlowStatus(flowIds);
if(response==null||!response.isSuccess()){
log.error("queryBatchApproveFlowStatus failed response:{}", JSONObject.toJSONString(Optional.ofNullable(response)));
return SdmResponse.failed("批量查询失败");
}
} catch (Exception e) {
log.error("queryBatchApproveFlowStatus error response:{}", JSONObject.toJSONString(Optional.ofNullable(response)));
return SdmResponse.failed("批量查询异常");
}
return response;
}
}

View File

@@ -5,8 +5,17 @@ import com.sdm.common.entity.req.system.LaunchApproveReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(name = "system",contextId = "systemApproveClient")
public interface IApproveFeignClient {
@PostMapping("/systemApprove/launchApprove")
public SdmResponse launchApproval( @RequestBody LaunchApproveReq approveReq);
// 批量查询审批电子流详情配置可配当前限制500条/次
@PostMapping("/systemApprove/queryBatchApproveFlowStatus")
public SdmResponse queryBatchApproveFlowStatus(@RequestBody List<String> flowIds);
}

View File

@@ -0,0 +1,56 @@
package com.sdm.common.utils;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sdm.common.log.CoreLogger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CidApproveUtil {
private static final ObjectMapper objectMapper = new ObjectMapper();
/**
* 将原始 Object 数据转换为 Map<flowId, List<Map对应电子流各节点详情的信息>>
* @param data 原始数据(格式为外层数组,内部包含一个 key-value 对象)
* @return 转换后的 Mapkey 为 uuid 字符串value 为节点信息列表
*/
public static Map<String, List<Map<String, Object>>> convertApproveFlowInfos(Object data) {
Map<String, List<Map<String, Object>>> result = new HashMap<>();
try {
// 1. 将 data 转换为最外层的 JSON 数组List<Object>
List<Object> outerList = objectMapper.convertValue(
data,new TypeReference<List<Object>>() {}
);
// 2. 取数组的第一个元素(唯一的对象),转换为 Map<String, Object>
if (outerList == null || outerList.isEmpty()) {
CoreLogger.warn("convertApproveFlowInfos param null,param:{}", JSON.toJSONString(data));
return result;
}
Object firstElement = outerList.get(0);
Map<String, Object> innerMap = objectMapper.convertValue(
firstElement,
new TypeReference<Map<String, Object>>() {}
);
// 3. 遍历 innerMap将每个 value 转换为 List<Map<String, Object>>
result = new java.util.HashMap<>();
for (Map.Entry<String, Object> entry : innerMap.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
// 将 value节点数组转换为 List<Map>
List<Map<String, Object>> nodeList = objectMapper.convertValue(
value,
new TypeReference<List<Map<String, Object>>>() {}
);
result.put(key, nodeList);
}
} catch (IllegalArgumentException e) {
CoreLogger.warn("convertApproveFlowInfos error,param:{},errMsg:{}",
JSON.toJSONString(data),JSON.toJSONString(e.getMessage()));
}
return result;
}
}