修改:知识库项目,所属项目,分析方向名称数据补充

This commit is contained in:
yangyang01000846
2025-11-18 20:40:01 +08:00
parent 55116a83f3
commit 2d49fa2938
13 changed files with 321 additions and 3 deletions

View File

@@ -19,6 +19,7 @@ public class NumberConstants {
public static final int EIGHT = 8;
public static final int NINE = 9;
public static final int TEN = 10;
public static final int NINE_NINE_NINE_NINE = 9999;
// String 类型常量
public static final String ZERO_STR = "0";

View File

@@ -0,0 +1,95 @@
package com.sdm.common.entity.resp.project;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author author
* @since 2025-11-17
*/
@Data
public class SimulationNodeResp implements Serializable {
private static final long serialVersionUID = -1L;
private Integer id;
private String uuid;
private String ownRootNodeUuid;
private String nodeName;
private String nodeCode;
private String englishName;
private String nodeType;
private String nodeSubType;
private String nodeStatus;
private String parentId;
private String folderId;
private Integer nodeLevel;
private String beginTime;
private String endTime;
private String finishTime;
private Integer progress;
private Integer achieveStatus;
private String nodeVersion;
private Long tenantId;
private String description;
private String detailImgUrl;
private Long creator;
private String createTime;
private Long updater;
private String updateTime;
private Integer pid;
private String exeStatus;
private String tag1;
private String tag2;
private String tag3;
private String tag4;
private String tag5;
private String tag6;
private String tag7;
private String tag8;
private String tag9;
private String tag10;
}

View File

@@ -4,6 +4,7 @@ import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.project.DelNodeReq;
import com.sdm.common.entity.req.project.SpdmNodeListReq;
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
import com.sdm.common.entity.resp.project.SimulationNodeResp;
import com.sdm.common.feign.inter.project.ISimulationNodeFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -93,5 +94,20 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient
return response;
}
@Override
public SdmResponse<List<SimulationNodeResp>> querySimulationNodeByUuids(List<String> uuids) {
SdmResponse response;
try {
response = ISimulationNodeFeignClient.querySimulationNodeByUuids(uuids);
if (!response.isSuccess()) {
return SdmResponse.failed("查询失败");
}
} catch (Exception e) {
log.error("查询失败", e);
return SdmResponse.failed("查询失败");
}
return response;
}
}

View File

@@ -4,6 +4,7 @@ import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.project.DelNodeReq;
import com.sdm.common.entity.req.project.SpdmNodeListReq;
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
import com.sdm.common.entity.resp.project.SimulationNodeResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -39,5 +40,8 @@ public interface ISimulationNodeFeignClient {
@GetMapping("/node/list")
SdmResponse list(@RequestBody SpdmNodeListReq req);
// 根据uuids查询所有的node列表
@PostMapping(value = "/node/querySimulationNodeByUuids")
SdmResponse<List<SimulationNodeResp>> querySimulationNodeByUuids(@RequestBody List<String>uuids);
}

View File

@@ -46,7 +46,7 @@ public class CidApproveUtil {
);
result.put(key, nodeList);
}
} catch (IllegalArgumentException e) {
} catch (Exception e) {
CoreLogger.warn("convertApproveFlowInfos error,param:{},errMsg:{}",
JSON.toJSONString(data),JSON.toJSONString(e.getMessage()));
}

View File

@@ -0,0 +1,61 @@
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 ProjectUtil {
private static final ObjectMapper objectMapper = new ObjectMapper();
/**
* 将 com.sdm.project.controller.SimulationNodeController#list(com.sdm.common.entity.req.project.SpdmNodeListReq)
* 这个查询项目信息的接口返回数据转换成Map<uuid, Map(project信息)>
* key 为数据中的 uuidvalue 为对应对象的字段映射
*
* @param data 原始数据(包含 data 数组和 total 字段)
* @return 转换后的 Map<uuid, 字段映射>
* @throws Exception 解析异常
*/
public static Map<String, Map<String, Object>> convertProjectInfoMap(Object data) {
// 1. 将顶层数据转换为 Map<String, Object>,获取 "data" 字段的值
Map<String, Map<String, Object>> result = new HashMap<>();
try {
Map<String, Object> topLevelMap = objectMapper.convertValue(
data, new TypeReference<Map<String, Object>>() {}
);
Object dataArray = topLevelMap.get("data");
if (dataArray == null) {
// 若 data 字段为空,返回空 Map
return result;
}
// 2. 将 data 字段的值转换为 List<Map<String, Object>>(对象数组)
List<Map<String, Object>> dataList = objectMapper.convertValue(
dataArray,
new TypeReference<List<Map<String, Object>>>() {}
);
// 3. 遍历数组,以 uuid 为 key对象字段 Map 为 value 构建结果
result = new HashMap<>();
for (Map<String, Object> item : dataList) {
// 获取当前对象的 uuid确保 uuid 存在,避免空指针)
String uuid = (String) item.get("uuid");
if (uuid != null) {
result.put(uuid, item);
}
}
} catch (Exception e) {
CoreLogger.warn("convertProjectInfoMap error,param:{},errMsg:{}",
JSON.toJSONString(data),JSON.toJSONString(e.getMessage()));
}
return result;
}
}