# Conflicts:
#	project/src/main/java/com/sdm/project/controller/SimulationNodeController.java
#	project/src/main/java/com/sdm/project/service/INodeService.java
#	project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java
This commit is contained in:
2025-11-19 11:34:36 +08:00
40 changed files with 636 additions and 35 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

@@ -21,5 +21,5 @@ public class CapPoolTask extends BaseEntity {
private String section;
private String chamber;
private String performanceGroup;
private String flowTemplateName;
private String flowTemplate;
}

View File

@@ -23,7 +23,7 @@ public class TaskBase extends BaseEntity {
private int noticeStatus;
private int approveStatus;
private int confirmStatus;
private String flowTemplateName;
private String flowTemplate;
private String description;
private int type;
private String code;

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

@@ -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

@@ -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

@@ -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

@@ -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 (Exception e) {
CoreLogger.warn("convertApproveFlowInfos error,param:{},errMsg:{}",
JSON.toJSONString(data),JSON.toJSONString(e.getMessage()));
}
return result;
}
}

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;
}
}

View File

@@ -2,8 +2,6 @@ package com.sdm.data.model.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -188,4 +186,16 @@ public class FileMetadataInfo implements Serializable {
@TableField(value = "cidFlowId")
private String cidFlowId;
@Schema(description= "cidFlowReviewer:cid审核电子流程里面的评审人,只有列表展示使用")
@TableField(value = "cidFlowReviewer", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
private String cidFlowReviewer;
@Schema(description= "projectName:所属项目,只有列表展示使用")
@TableField(value = "projectName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
private String projectName;
@Schema(description= "分析方向,只有列表展示使用")
@TableField(value = "analysisDirectionName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
private String analysisDirectionName;
}

View File

@@ -13,17 +13,23 @@ import com.sdm.common.entity.req.data.CreateDirReq;
import com.sdm.common.entity.req.data.DelDirReq;
import com.sdm.common.entity.req.data.RenameDirReq;
import com.sdm.common.entity.req.data.UploadFilesReq;
import com.sdm.common.entity.req.project.SpdmNodeListReq;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import com.sdm.common.entity.req.system.UserListReq;
import com.sdm.common.entity.req.system.UserQueryReq;
import com.sdm.common.entity.resp.PageDataResp;
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
import com.sdm.common.entity.resp.project.SimulationNodeResp;
import com.sdm.common.entity.resp.system.CIDUserResp;
import com.sdm.common.feign.impl.project.SimulationNodeFeignClientImpl;
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
import com.sdm.common.feign.inter.project.ISimulationNodeFeignClient;
import com.sdm.common.feign.inter.system.IApproveFeignClient;
import com.sdm.common.log.CoreLogger;
import com.sdm.common.utils.CidApproveUtil;
import com.sdm.common.utils.CidSysUserUtil;
import com.sdm.common.utils.PageUtils;
import com.sdm.common.utils.ProjectUtil;
import com.sdm.data.model.bo.ApprovalFileDataContentsModel;
import com.sdm.data.model.entity.FileMetadataExtension;
import com.sdm.data.model.entity.FileMetadataInfo;
@@ -38,6 +44,7 @@ import com.sdm.data.service.impl.dataFileHandle.ApproveStrategyFactory;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.assertj.core.util.DateUtil;
@@ -95,7 +102,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
private IFielPermissionDictService filePermissionDictService;
@Autowired
SysUserFeignClientImpl sysUserFeignClient;
private SysUserFeignClientImpl sysUserFeignClient;
@Autowired
private IMinioService minioService;
@@ -115,6 +122,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
@Autowired
private IApproveFeignClient approveFeignClient;
@Autowired
private ISimulationNodeFeignClient isSimulationNodeFeignClient;
@Override
public String getType() {
return type;
@@ -646,6 +656,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
.in(FileMetadataInfo::getApproveType,fileDatdList)
.list();
setCreatorNames(files);
setCidInfos(files);
setProjectName(files);
setAnalysisDirectionName(files);
PageDataResp<List<FileMetadataInfo>> page = new PageDataResp<>();
page.setData(files);
page.setTotal(pageDataResp.getTotal());
@@ -697,6 +710,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
.list();
// 创建人赋值
setCreatorNames(list);
setCidInfos(list);
setProjectName(list);
setAnalysisDirectionName(list);
PageInfo<FileMetadataInfo> page = new PageInfo<>(list);
return PageUtils.getJsonObjectSdmResponse(list, page);
}
@@ -1771,7 +1787,6 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
SdmResponse<List<CIDUserResp>> userListSdmRsp = sysUserFeignClient.listUserByIds(
UserQueryReq.builder().userIds(creatorIds).build()
);
// 批量设置 creatorName
if (userListSdmRsp.isSuccess() && CollectionUtils.isNotEmpty(userListSdmRsp.getData())) {
Map<Long, CIDUserResp> cidUserMap = CidSysUserUtil.getCidUserToMap(userListSdmRsp.getData());
@@ -1792,6 +1807,131 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
}
}
private void setCidInfos(List<FileMetadataInfo> list) {
try {
if (ObjectUtils.isNotEmpty(list)) {
// 提取评审的cidFlowId,当前不可能超过500无需分批
List<String> cidFlowIds = list.stream()
.map(FileMetadataInfo::getCidFlowId)
.filter(Objects::nonNull)
.distinct()
.toList();
// 查询电子流详情
SdmResponse sdmResponse = approveFeignClient.queryBatchApproveFlowStatus(cidFlowIds);
// JSONArray array
Object data = sdmResponse.getData();
// 批量设置
if (sdmResponse.isSuccess() && !Objects.isNull(data)) {
Map<String, List<Map<String, Object>>> flowInfosMap = CidApproveUtil.convertApproveFlowInfos(data);
if(MapUtils.isNotEmpty(flowInfosMap)){
list.forEach(fileMetadataInfo -> {
String cidFlowId = fileMetadataInfo.getCidFlowId();
List<Map<String, Object>> flowInfos = flowInfosMap.get(cidFlowId);
fileMetadataInfo.setCidFlowReviewer(getCidFlowReviewer(flowInfos));
});
}
}
}
} catch (Exception e) {
log.error("setCidInfos error:{}",e.getMessage());
}
}
private void setProjectName(List<FileMetadataInfo> list) {
try {
if (ObjectUtils.isNotEmpty(list)) {
// 提取Id,当前不可能超过500无需分批
List<String> projectIds = list.stream()
.map(FileMetadataInfo::getProjectId)
.filter(Objects::nonNull)
.distinct()
.toList();
// 查询电子流详情
SpdmNodeListReq spdmNodeListReq = new SpdmNodeListReq();
spdmNodeListReq.setCurrent(NumberConstants.ONE);
spdmNodeListReq.setSize(NumberConstants.NINE_NINE_NINE_NINE);
spdmNodeListReq.setNodeType(NodeTypeEnum.PROJECT.getValue());
SdmResponse sdmResponse = isSimulationNodeFeignClient.list(spdmNodeListReq);
Object data = sdmResponse.getData();
// 批量设置
if (sdmResponse.isSuccess() && !Objects.isNull(data)) {
Map<String, Map<String, Object>> projectInfoMap = ProjectUtil.convertProjectInfoMap(data);
if(MapUtils.isNotEmpty(projectInfoMap)){
list.forEach(fileMetadataInfo -> {
String projectId = fileMetadataInfo.getProjectId();
Map<String, Object> project = projectInfoMap.get(projectId);
if(!Objects.isNull(project)){
fileMetadataInfo.setProjectName(Objects.isNull(project.get("nodeName"))?
"":project.get("nodeName").toString());
}
});
}
}
}
} catch (Exception e) {
log.error("setProjectName error:{}",e.getMessage());
}
}
private void setAnalysisDirectionName(List<FileMetadataInfo> list) {
try {
if (ObjectUtils.isNotEmpty(list)) {
// 提取Id,当前不可能超过1000无需分批
List<String> analyIds = list.stream()
.map(FileMetadataInfo::getAnalysisDirectionId)
.filter(Objects::nonNull)
.distinct()
.toList();
// 查询电子流详情
SdmResponse<List<SimulationNodeResp>> sdmResponse = isSimulationNodeFeignClient.querySimulationNodeByUuids(analyIds);
List<SimulationNodeResp> datas = sdmResponse.getData();
// 批量设置
if (sdmResponse.isSuccess() && CollectionUtils.isNotEmpty(datas)) {
Map<String, List<SimulationNodeResp>> simulationNodeMap = datas.stream()
.collect(Collectors.groupingBy(SimulationNodeResp::getUuid));
if(MapUtils.isNotEmpty(simulationNodeMap)){
list.forEach(fileMetadataInfo -> {
String analysisDirectionId = fileMetadataInfo.getAnalysisDirectionId();
List<SimulationNodeResp> simulationNodeResps = simulationNodeMap.get(analysisDirectionId);
if(CollectionUtils.isNotEmpty(simulationNodeResps)){
fileMetadataInfo.setAnalysisDirectionName(Objects.isNull(simulationNodeResps.get(0).getNodeName())?
"":simulationNodeResps.get(0).getNodeName());
}
});
}
}
}
} catch (Exception e) {
log.error("setAnalysisDirectionName error:{}",e.getMessage());
}
}
// 从审批详情里拼接审批人
private String getCidFlowReviewer(List<Map<String, Object>> flowInfos) {
try {
if (CollectionUtils.isEmpty(flowInfos)) {
CoreLogger.warn("getCidFlowReviewer flowInfos null");
return "";
}
StringBuilder sb = new StringBuilder();
flowInfos.forEach(flowInfo -> {
// flowInfo非空nodeType非空且非0发起人nodeUserName非空
if (!Objects.isNull(flowInfo) && !Objects.isNull(flowInfo.get("nodeType")) &&
!Objects.equals(NumberConstants.ZERO, flowInfo.get("nodeType")) && !Objects.isNull(flowInfo.get("nodeUserName"))) {
sb.append(flowInfo.get("nodeUserName")).append(",");
}
});
String resultStr = sb.toString();
resultStr = resultStr.substring(0, resultStr.length() - 1);
return resultStr;
} catch (Exception e) {
CoreLogger.error("getCidFlowReviewer error,param:{},errMsg:{}", JSONObject.toJSONString(flowInfos), e.getMessage());
return "";
}
}
}

View File

@@ -31,7 +31,7 @@ public class TaskRunsRsp {
private long resultTaskId;
private int isBase;
private Long updater;
private String flowTemplateName;
private String flowTemplate;
private String createTime;
private List<RspInfo> children = new ArrayList<>();

View File

@@ -787,7 +787,7 @@ public class PbsServiceImpl implements PbsService {
taskInfo.setEnglishName(task.getEnglishName());
taskInfo.setUpdater(task.getUpdater());
taskInfo.setNodeId(node.getId());
taskInfo.setFlowTemplateName(task.getFlowTemplateName());
taskInfo.setFlowTemplate(task.getFlowTemplate());
List<PbsRun> runs = pbsMapper.getPbsRunByTaskId(task.getId());
List<TaskRunsRsp.RspInfo> runInfos = new ArrayList<>();
if (!CollectionUtils.isEmpty(runs)) {

View File

@@ -6,6 +6,7 @@ import com.sdm.common.entity.req.project.DelNodeReq;
import com.sdm.common.entity.req.project.RenameNodeReq;
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 com.sdm.project.model.req.*;
import com.sdm.project.service.INodeService;
@@ -233,4 +234,15 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
return nodeService.addTaskForData(req);
}
/**
* 根据List<uuid> 查询所有的 simulation_node 信息
* @param
* @return SimulationNode集合
*/
@PostMapping(value = "/querySimulationNodeByUuids")
@Operation(summary = "根据uuids查询所有的node列表", description = "根据uuids查询所有的node列表")
public SdmResponse<List<SimulationNodeResp>> querySimulationNodeByUuids(@RequestBody List<String>uuids) {
return nodeService.querySimulationNodeByUuids(uuids);
}
}

View File

@@ -1,6 +1,7 @@
package com.sdm.project.dao;
import com.sdm.common.entity.resp.project.SimulationNodeResp;
import com.sdm.project.model.bo.*;
import com.sdm.project.model.po.*;
import com.sdm.project.model.req.ProjectTreeReq;
@@ -173,4 +174,6 @@ public interface SimulationProjectMapper {
List<RunNodePo> getRunListByNodeIdList(@Param("taskIdList") List<String> taskIdList);
List<SimulationNodeResp> querySimulationNodeByUuids(@Param("list")List<String> uuids);
}

View File

@@ -206,7 +206,7 @@ public class ProjectNode extends BaseEntity {
private String group;
@JsonProperty(value = "bCapacity")
private String bCapacity;
private String flowTemplateName;
private String flowTemplate;
private String englishName;
private List<String> analyseSoftwareList;

View File

@@ -229,7 +229,7 @@ public class TaskNode extends BaseEntity {
private String group;
@JsonProperty(value = "bCapacity")
private String bCapacity;
private String flowTemplateName;
private String flowTemplate;
@JsonProperty(value = "tag1")
private List<String> tag1;

View File

@@ -46,9 +46,9 @@ public class SimulationRun implements Serializable {
@TableField("taskId")
private String taskId;
@ApiModelProperty(value = "流程模板名称")
@TableField("templateName")
private String templateName;
@ApiModelProperty(value = "流程模板id")
@TableField("flowTemplate")
private String flowTemplate;
@ApiModelProperty(value = "Run状态 0:未执行 1执行中 2完成 3失败")
@TableField("status")
@@ -62,9 +62,13 @@ public class SimulationRun implements Serializable {
@TableField("currentStep")
private Integer currentStep;
@ApiModelProperty(value = "当前的流程步骤名称")
@TableField("currentStepName")
private String currentStepName;
@ApiModelProperty(value = "Run执行结果 0:gray 1:red 2:yellow 3:green")
@TableField("result")
private Integer result;
@TableField("achieveStatus")
private Integer achieveStatus;
@ApiModelProperty(value = "run描述信息")
@TableField("description")
@@ -81,9 +85,14 @@ public class SimulationRun implements Serializable {
@TableField("isPersonalTemplate")
private String isPersonalTemplate;
@ApiModelProperty(value = "租户id")
@TableField("tenantId")
private Long tenantId;
@ApiModelProperty(value = "英文名")
@TableField("englishName")
private Long englishName;
@TableField("tag1")
private String tag1;

View File

@@ -155,8 +155,8 @@ public class SimulationTask implements Serializable {
private String bCapacity;
@ApiModelProperty(value = "任务流程模板")
@TableField("flowTemplateName")
private String flowTemplateName;
@TableField("flowTemplate")
private String flowTemplate;
@TableField("englishName")
private String englishName;

View File

@@ -154,7 +154,7 @@ public class TaskNodePo extends NodeAllBase {
// private String group;
private String groupName;
private String bCapacity;
private String flowTemplateName;
private String flowTemplate;
private String englishName;
private String description;

View File

@@ -15,9 +15,9 @@ public class SpdmAddTaskRunReq {
@Schema(description = "备注")
private String description;
@NotBlank(message = "templateName不能为空")
@Schema(description = "流程模板名称")
private String templateName;
@NotBlank(message = "flowTemplate不能为空")
@Schema(description = "流程模板id")
private String flowTemplate;
// @NotNull(message = "totalStep不能为空")
@Schema(description = "总步骤")

View File

@@ -263,7 +263,7 @@ public class TaskEditNodeReq extends BaseEntity {
private String group;
@JsonProperty(value = "bCapacity")
private String bCapacity;
private String flowTemplateName;
private String flowTemplate;
private String englishName;
private String performanceType;

View File

@@ -100,7 +100,7 @@ public class SpdmNewTaskVo extends BaseEntity {
private String groupName;
@JsonProperty(value = "bCapacity")
private String bCapacity;
private String flowTemplateName;
private String flowTemplate;
private String englishName;

View File

@@ -101,7 +101,7 @@ public class SpdmTaskVo extends BaseEntity {
private String groupName;
@JsonProperty(value = "bCapacity")
private String bCapacity;
private String flowTemplateName;
private String flowTemplate;
private String englishName;

View File

@@ -7,6 +7,7 @@ import com.sdm.common.entity.req.project.DelNodeReq;
import com.sdm.common.entity.req.project.RenameNodeReq;
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.project.model.entity.SimulationNode;
import com.sdm.project.model.req.*;
import org.springframework.stereotype.Service;
@@ -57,4 +58,7 @@ public interface INodeService extends IService<SimulationNode> {
SdmResponse addNodeForData(SpdmAddNodeReq req);
SdmResponse addTaskForData(SpdmTaskReq req);
SdmResponse<List<SimulationNodeResp>> querySimulationNodeByUuids(List<String> uuids);
}

View File

@@ -16,12 +16,14 @@ import com.sdm.common.entity.req.project.SpdmNodeListReq;
import com.sdm.common.entity.req.system.QueryGroupDetailReq;
import com.sdm.common.entity.req.system.UserQueryReq;
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
import com.sdm.common.entity.resp.project.SimulationNodeResp;
import com.sdm.common.entity.resp.system.CIDUserResp;
import com.sdm.common.entity.resp.system.SysUserGroupDetailResp;
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
import com.sdm.common.feign.impl.system.SysConfigFeignClientImpl;
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
import com.sdm.common.feign.inter.data.IDataFeignClient;
import com.sdm.common.log.CoreLogger;
import com.sdm.common.utils.DateUtils;
import com.sdm.common.utils.RandomUtil;
import com.sdm.project.dao.SimulationDemandMapper;
@@ -49,6 +51,7 @@ import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -96,6 +99,9 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
@Autowired
private SysConfigFeignClientImpl sysConfigFeignClient;
@Value("${node.batch.queryCounts:1000}")
private Integer queryCounts;
private HashMap<String, String> idMap = new HashMap<>();
@Autowired
@@ -218,8 +224,10 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
public SdmResponse list(SpdmNodeListReq req) {
int pos = (req.getCurrent() - 1) * req.getSize();
int limit = req.getSize();
Long tenantId = ThreadLocalContext.getTenantId();
List<SpdmNodeVo> nodeList = nodeMapper.getNodeList(req.getNodeType(), req.getNodeSubType(), req.getProgressStatus(), req.getNodeCode(), req.getManager(), req.getNodeName(),
ThreadLocalContext.getTenantId(), pos, limit);
tenantId, pos, limit);
CoreLogger.info("getNodeList param:{},tenantId:{}", JSONObject.toJSONString(req), tenantId);
if (CollectionUtils.isEmpty(nodeList)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", nodeList);
@@ -1333,4 +1341,17 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
}
}
@Override
public SdmResponse<List<SimulationNodeResp>> querySimulationNodeByUuids(List<String> uuids) {
if(CollectionUtils.isEmpty(uuids)){
return SdmResponse.failed("参数为空");
}
if(uuids.size()>queryCounts){
return SdmResponse.failed("单次批量查询不允许超过"+queryCounts);
}
List<SimulationNodeResp> simulationNodeResps = mapper.querySimulationNodeByUuids(uuids);
return SdmResponse.success(simulationNodeResps);
}
}

View File

@@ -490,7 +490,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
simulationRun.setDescription(req.getDescription());
simulationRun.setTotalStep(req.getTotalStep());
simulationRun.setParentId(req.getParentId());
simulationRun.setTemplateName(req.getTemplateName());
simulationRun.setFlowTemplate(req.getFlowTemplate());
simulationRun.setCreator(userId);
simulationRun.setUpdater(userId);
simulationRun.setTenantId(tenantId);

View File

@@ -35,11 +35,11 @@
<insert id="batchAddSimulationTask" useGeneratedKeys="true" keyProperty="id">
insert into simulation_task (uuid,task_name,task_code,task_pool_name,task_pool_version,node_id,days,standard,fold_id,status,achieve_status,begin_time,end_time,progress,exe_status,confidence,analyse_target,analyse_software,description,difficult,tenant_id
,creator,create_time,department,sectionName,groupName,bCapacity,flowTemplateName,englishName,demand_id,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10) values
,creator,create_time,department,sectionName,groupName,bCapacity,flowTemplate,englishName,demand_id,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10) values
<foreach collection='list' item='it' index='index' separator=','>
(#{it.uuid},#{it.taskName},#{it.taskCode},'','',#{it.nodeId},#{it.days},#{it.standard},'',1,0,
#{it.beginTime},#{it.endTime},0,1,#{it.confidence},#{it.analyseTarget},#{it.analyseSoftwares},#{it.description},#{it.difficult},#{it.tenantId},
#{it.creator},#{it.createTime},#{it.department},#{it.section},#{it.group},#{it.bCapacity},#{it.flowTemplateName},#{it.englishName},#{it.demandId},#{it.tag1,typeHandler=com.sdm.project.handler.ListStringTypeHandler},#{it.tag2,typeHandler=com.sdm.project.handler.ListStringTypeHandler},
#{it.creator},#{it.createTime},#{it.department},#{it.section},#{it.group},#{it.bCapacity},#{it.flowTemplate},#{it.englishName},#{it.demandId},#{it.tag1,typeHandler=com.sdm.project.handler.ListStringTypeHandler},#{it.tag2,typeHandler=com.sdm.project.handler.ListStringTypeHandler},
#{it.tag3,typeHandler=com.sdm.project.handler.ListStringTypeHandler},#{it.tag4,typeHandler=com.sdm.project.handler.ListStringTypeHandler},
#{it.tag5,typeHandler=com.sdm.project.handler.ListStringTypeHandler},#{it.tag6,typeHandler=com.sdm.project.handler.ListStringTypeHandler},
#{it.tag7,typeHandler=com.sdm.project.handler.ListStringTypeHandler},#{it.tag8,typeHandler=com.sdm.project.handler.ListStringTypeHandler},
@@ -186,8 +186,8 @@
update_time = #{taskNode.updateTime},
</if>
<if test="taskNode.flowTemplateName != null and taskNode.flowTemplateName != ''">
flowTemplateName = #{taskNode.flowTemplateName},
<if test="taskNode.flowTemplate != null and taskNode.flowTemplate != ''">
flowTemplate = #{taskNode.flowTemplate},
</if>
<if test="taskNode.englishName != null and taskNode.englishName != ''">
@@ -646,6 +646,16 @@
)
</select>
<select id="querySimulationNodeByUuids" resultType="com.sdm.common.entity.resp.project.SimulationNodeResp">
select uuid,ownRootNodeUuid,nodeName,nodeCode,englishName,nodeType,nodeSubType,nodeStatus,parentId,folderId,nodeLevel,beginTime,endTime,finishTime,progress,
achieveStatus,nodeVersion,tenantId,description,detailImgUrl,creator,create_time,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10
from simulation_node where uuid in (
<foreach collection='list' item='udid' index='index' separator=','>
#{udid}
</foreach>
)
</select>
<!-- <select id="getTaskList" resultType="com.sdm.project.entity.vo.SpdmTaskVo">-->
<!-- select * from simulation_task where tenant_id = #{tenantId}-->
<!-- <if test="taskName != null and taskName != ''">-->

View File

@@ -10,6 +10,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 系统评审
@@ -48,6 +50,16 @@ public class SystemApproveController implements IApproveFeignClient {
return approveServer.queryApproveFlowStatus(flowId);
}
/**
* 根据flowId批量查询审批详情
* @param flowIds
* @return
*/
@PostMapping("queryBatchApproveFlowStatus")
public SdmResponse queryBatchApproveFlowStatus(@RequestBody List<String> flowIds) {
return approveServer.queryBatchApproveFlowStatus(flowIds);
}
@PostMapping("/stopApprove")
public SdmResponse stopApproval(@RequestParam ("flowId") String flowId) {
return approveServer.stopCidApprovalFlow(flowId);

View File

@@ -1,8 +1,11 @@
package com.sdm.system.dao;
import com.sdm.common.entity.req.system.FlowStatusParam;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface SimulationApproveMapper {
@@ -19,4 +22,16 @@ public interface SimulationApproveMapper {
@Select("SELECT * FROM simulation_approve_flow WHERE cidFlowId=#{flowId} LIMIT 1")
LaunchApproveReq querySimulationApproveFlowByCidFlowId(@Param("flowId") String flowId);
@Select({
"<script>",
"SELECT templateId AS flowId, cidFlowId AS processInstanceId, tenantId AS tenantId",
"FROM simulation_approve_flow",
"WHERE cidFlowId IN",
"<foreach collection='flowIds' item='flowId' open='(' close=')' separator=','>",
" #{flowId}",
"</foreach>",
"</script>"
})
List<FlowStatusParam> queryBatchFlowStatusFromSpdmDb(@Param("flowIds")List<String> flowIds);
}

View File

@@ -4,6 +4,8 @@ package com.sdm.system.service;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import java.util.List;
/**
* <p>
* 系统提交评审服务
@@ -56,6 +58,8 @@ public interface ISimulatinoApprovalService {
*/
SdmResponse queryApproveFlowStatus(String flowId);
SdmResponse queryBatchApproveFlowStatus(List<String> flowIds);
/**
* 查询流程实例详情
* @param flowId

View File

@@ -5,7 +5,9 @@ import com.alibaba.fastjson2.JSONObject;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.common.ThreadLocalContext;
import com.sdm.common.entity.constants.NumberConstants;
import com.sdm.common.entity.req.system.FlowStatusParam;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import com.sdm.common.log.CoreLogger;
import com.sdm.common.utils.HttpClientUtil;
import com.sdm.system.dao.SimulationApproveMapper;
import com.sdm.system.model.entity.ApproveTemplateBean;
@@ -13,6 +15,7 @@ import com.sdm.system.service.ISimulatinoApprovalService;
import com.sdm.system.service.impl.approvalNotice.ApproveNoticeStrategy;
import com.sdm.system.service.impl.approvalNotice.ApproveNoticeStrategyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -29,7 +32,6 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
@Autowired
private HttpClientUtil httpClientUtil;
@Autowired
private SimulationApproveMapper approveMapper;
@@ -51,6 +53,13 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
@Value("${cid.flow.group}")
private String groupName;
// 单次批量查询cid流程的条数,默认500
@Value("${cid.flow.batchCount:500}")
private Integer cidBatchCounts;
@Value("${cid.flow.batchInterfacePath:/spdm-flow/listFlowNodeDetail}")
private String batchInterfacePath;
@Autowired
private ApproveNoticeStrategyFactory approveNoticeStrategyFactory;
@@ -118,6 +127,37 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
return array;
}
/**
* 批量获取Cid评审流程状态
* @param url
* @param flowParamDtoList
* @return
*/
private JSONArray queryBatchCidApproveFlowStatus( String url,List<FlowStatusParam> flowParamDtoList)
{
JSONObject paramJson = new JSONObject();
paramJson.put("flowParamDtoList",flowParamDtoList);
JSONArray array = null;
try {
String resultString = httpClientUtil.doPostJson(url, paramJson.toJSONString());
if (resultString != null && !resultString.isEmpty()) {
JSONObject resultJson = JSONObject.parseObject(resultString);
if (resultJson != null && resultJson.containsKey("success")) {
boolean success = resultJson.getBoolean("success");
if (success) {
array = resultJson.getJSONArray("data");
}
}
}
}
catch (Exception e)
{
CoreLogger.error("queryBatchCidApproveFlowStatus error,params:{},errMsg:{}",JSONObject.toJSONString(flowParamDtoList),e.getMessage());
e.printStackTrace();
}
return array;
}
/**
* 停止CID评审流程
* @param cidFlowId
@@ -242,6 +282,30 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
return sdmResponse;
}
@Override
public SdmResponse queryBatchApproveFlowStatus(List<String> flowIds) {
SdmResponse sdmResponse ;
if(CollectionUtils.isEmpty(flowIds)){
sdmResponse= SdmResponse.failed("参数null非法");
return sdmResponse;
}
if(flowIds.size()>cidBatchCounts){
sdmResponse= SdmResponse.failed("单次查询数据不允许超过"+cidBatchCounts+"");
return sdmResponse;
}
List<FlowStatusParam> flowStatusParamList= approveMapper.queryBatchFlowStatusFromSpdmDb(flowIds);
String url = cidUrl+batchInterfacePath;
JSONArray array = queryBatchCidApproveFlowStatus(url, flowStatusParamList);
if(array != null){
sdmResponse = SdmResponse.success();
sdmResponse.setData(array);
}
else{
sdmResponse = SdmResponse.failed("获取评审流程状态信息失败");
}
return sdmResponse;
}
/**
* 接收CID审批流状态
* @param cidFlowId

View File

@@ -158,4 +158,7 @@ cid:
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
stopApproveFlow: /spdm-flow/stopFlow
group: SPDM
# 单次批量查询cid审批流详情的条数
batchCount: 500
# 批量查询的cid 接口配合上面url使用
batchInterfacePath: /spdm-flow/listFlowNodeDetail

View File

@@ -158,6 +158,10 @@ cid:
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
stopApproveFlow: /spdm-flow/stopFlow
group: SPDM
# 单次批量查询cid审批流详情的条数
batchCount: 500
# 批量查询的cid 接口配合上面url使用
batchInterfacePath: /spdm-flow/listFlowNodeDetail
# 0单机处理可以指向本地1负载均衡轮询
serverType: 0

View File

@@ -169,4 +169,8 @@ cid:
queryFlowTemplate: /spdm-flow/listProcessByGroup
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
stopApproveFlow: /spdm-flow/stopFlow
group: SPDM
group: SPDM
# 单次批量查询cid审批流详情的条数
batchCount: 500
# 批量查询的cid 接口配合上面url使用
batchInterfacePath: /spdm-flow/listFlowNodeDetail

View File

@@ -160,4 +160,9 @@ cid:
listRoles: /spdm-role/listRoles
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
listTenant: /spdm-tenant/listTenant
flow:
# 单次批量查询cid审批流详情的条数
batchCount: 500
# 批量查询的cid 接口配合上面url使用
batchInterfacePath: /spdm-flow/listFlowNodeDetail

View File

@@ -117,5 +117,9 @@ public class SimulationTask implements Serializable {
@TableField("tenant_id")
private String tenantId;
@TableField("flowTemplate")
private String flowTemplate;
@TableField("englishName")
private String englishName;
}

View File

@@ -7,7 +7,7 @@
progress,exe_status,notice_status,approve_status,confirm_status,flow_template_name,description,type,code,creator,company) values
<foreach collection='bases' item='base' index='index' separator =','>
(#{base.id},#{base.taskName},#{base.englishName},#{base.taskPoolName},#{base.days},#{base.standard},#{base.taskPath},#{base.workRate},#{base.status},#{base.planBeginTime},#{base.planEndTime},
#{base.finishTime},#{base.progress},#{base.exeStatus},#{base.noticeStatus},#{base.approveStatus},#{base.confirmStatus},#{base.flowTemplateName},#{base.description},#{base.type},#{base.code},#{base.creator},#{company})
#{base.finishTime},#{base.progress},#{base.exeStatus},#{base.noticeStatus},#{base.approveStatus},#{base.confirmStatus},#{base.flowTemplate},#{base.description},#{base.type},#{base.code},#{base.creator},#{company})
</foreach>
</insert>