From 107382136a6d0e607775bfe51817c00c65916d4d Mon Sep 17 00:00:00 2001 From: lidongyang <506508008@qq.com> Date: Wed, 15 Apr 2026 09:25:04 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix[project]:=20getTaskTree=E7=9A=84?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=85=B3=E8=81=94=E9=9C=80=E6=B1=82=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ProjectServiceImpl.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/project/src/main/java/com/sdm/project/service/impl/ProjectServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/ProjectServiceImpl.java index 3f47befe..6b1f2ecb 100644 --- a/project/src/main/java/com/sdm/project/service/impl/ProjectServiceImpl.java +++ b/project/src/main/java/com/sdm/project/service/impl/ProjectServiceImpl.java @@ -522,6 +522,54 @@ public class ProjectServiceImpl extends BaseService implements IProjectService { } } + /** + * 关联任务与需求的需求类型(demandType) + * @param newTaskList 任务列表 + */ + private void relateDemandType(List newTaskList) { + // 1. 任务列表为空直接返回 + if (CollectionUtils.isEmpty(newTaskList)) { + return; + } + + // 2. 提取有效demandId + List demandIdList = newTaskList.stream() + .map(TaskNodePo::getDemandId) + .filter(StringUtils::isNotBlank) + .distinct() + .toList(); + + log.info("relateDemandType 查询需求ID列表:{}", demandIdList); + if (CollectionUtils.isEmpty(demandIdList)) { + return; + } + + // 3. 查询需求信息 + List demandList = demandMapper.getDemandListById(demandIdList); + if (CollectionUtils.isEmpty(demandList)) { + log.info("relateDemandType 根据ID未查询到对应需求信息"); + return; + } + + // 4. 转成 Map:uuid -> demandType + Map demandDemandTypeMap = demandList.stream() + .filter(demand -> StringUtils.isNotBlank(demand.getDemandType())) + .collect(Collectors.toMap( + SpdmDemandVo::getUuid, + SpdmDemandVo::getDemandType, + (oldVal, newVal) -> oldVal + )); + + // 5. 批量设置 demandType + for (TaskNodePo taskNodePo : newTaskList) { + String demandId = taskNodePo.getDemandId(); + if (StringUtils.isNotBlank(demandId)) { + taskNodePo.setDemandType(demandDemandTypeMap.get(demandId)); + } + } + + } + @Override public SdmResponse getTaskTree(ProjectTreeTagReq req) { List idMapList = req.getIdMap(); @@ -560,6 +608,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService { if (CollectionUtils.isNotEmpty(taskTreeTaskList)) { log.info("查询到的任务为:{}", taskTreeTaskList.stream().map(TaskNodePo::getId).toList()); taskTreeTaskList.forEach(task -> task.setNodeType("task")); + relateDemandType(taskTreeTaskList); taskTreePerformanceList = mapper.getPerformanceListByNodeIdList(taskTreeTaskList.stream().map(TaskNodePo::getUuid).toList()); if (CollectionUtils.isNotEmpty(taskTreePerformanceList)) { log.info("查询到的指标为:{}", taskTreePerformanceList.stream().map(PerformanceNodePo::getId).toList()); From 6f918a8109219f3409b68e82d0ccbfc8e051f524 Mon Sep 17 00:00:00 2001 From: lidongyang <506508008@qq.com> Date: Wed, 15 Apr 2026 09:31:10 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix[project]:=20=E6=95=B0=E6=8D=AE=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=AF=BC=E5=87=BA=E4=BB=BB=E5=8A=A1bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/src/main/resources/mapper/SimulationTaskMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/src/main/resources/mapper/SimulationTaskMapper.xml b/project/src/main/resources/mapper/SimulationTaskMapper.xml index 617a8655..09d1e847 100644 --- a/project/src/main/resources/mapper/SimulationTaskMapper.xml +++ b/project/src/main/resources/mapper/SimulationTaskMapper.xml @@ -821,9 +821,9 @@ )) - + and ( - + toDoMarker LIKE CONCAT('%', #{toDoMarker}, '%') ) From f2281c5350038b806eff8494a9be094d2ac3c8cc Mon Sep 17 00:00:00 2001 From: yangyang Date: Wed, 15 Apr 2026 10:01:38 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9:=20hpc=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sdm/system/model/resp/HpcSolverResp.java | 2 +- .../system/model/resp/SimulationAppResp.java | 83 ++++++++++++++ .../impl/SimulationAppCenterServiceImpl.java | 104 ++++++++++++------ 3 files changed, 157 insertions(+), 32 deletions(-) create mode 100644 system/src/main/java/com/sdm/system/model/resp/SimulationAppResp.java diff --git a/system/src/main/java/com/sdm/system/model/resp/HpcSolverResp.java b/system/src/main/java/com/sdm/system/model/resp/HpcSolverResp.java index 4623f9d3..bf289dda 100644 --- a/system/src/main/java/com/sdm/system/model/resp/HpcSolverResp.java +++ b/system/src/main/java/com/sdm/system/model/resp/HpcSolverResp.java @@ -10,6 +10,6 @@ public class HpcSolverResp { private String hpcGroup; - private List appInfos; + private List appInfos; } diff --git a/system/src/main/java/com/sdm/system/model/resp/SimulationAppResp.java b/system/src/main/java/com/sdm/system/model/resp/SimulationAppResp.java new file mode 100644 index 00000000..14bb3cba --- /dev/null +++ b/system/src/main/java/com/sdm/system/model/resp/SimulationAppResp.java @@ -0,0 +1,83 @@ +package com.sdm.system.model.resp; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.sdm.common.entity.req.pbs.SimulationHpcCommandPlaceholderReq; +import com.sdm.common.entity.req.pbs.SimulationHpcCommandReq; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 应用配置表 + *

+ * + * @author author + * @since 2025-11-30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +//@Schema(description = "应用配置表") +public class SimulationAppResp implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID,自增") + private Integer id; + + @Schema(description = "应用唯一ID") + private String uuid; + + @Schema(description = "应用名称") + private String appName; + + @Schema(description = "应用类型 1:本地应用 2:云应用 3:hpc求解应用 4:web应用") + private Integer appType; + + @Schema(description = "应用启动路径") + private String appPath; + + @Schema(description = "应用状态 0:禁用 1:可用") + private Integer appStatus; + + @Schema(description = "应用图标") + private String appImage; + + @Schema(description = "应用版本") + private String appVersion; + + @Schema(description = "应用供应商") + private String appVendor; + + @Schema(description = "本地应用所属机器机器码") + private String machineCode; + + @Schema(description = "应用描述") + private String comment; + + @Schema(description = "租户id") + private Long tenantId; + + @Schema(description = "创建人") + private Long creator; + + @Schema(description = "应用创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "HPC_PACK,OPEN_PBS") + private String hpcGroup; + + @Schema(description = "HPC的命令") + private SimulationHpcCommandReq simulationHpcCommand; + + @Schema(description = "HPC求解命令的配置参数") + private List commandConfigs; + +} \ No newline at end of file diff --git a/system/src/main/java/com/sdm/system/service/impl/SimulationAppCenterServiceImpl.java b/system/src/main/java/com/sdm/system/service/impl/SimulationAppCenterServiceImpl.java index ba1ff77a..085a1214 100644 --- a/system/src/main/java/com/sdm/system/service/impl/SimulationAppCenterServiceImpl.java +++ b/system/src/main/java/com/sdm/system/service/impl/SimulationAppCenterServiceImpl.java @@ -1,5 +1,6 @@ package com.sdm.system.service.impl; +import com.alibaba.fastjson2.JSONObject; import com.sdm.common.common.SdmResponse; import com.sdm.common.common.ThreadLocalContext; import com.sdm.common.entity.bo.DataPageInfo; @@ -19,11 +20,13 @@ import com.sdm.system.model.entity.AppCenterItemBean; import com.sdm.system.model.entity.AppConfigureBean; import com.sdm.system.model.entity.AppItemStatisticInfo; import com.sdm.system.model.resp.HpcSolverResp; +import com.sdm.system.model.resp.SimulationAppResp; import com.sdm.system.service.ISimulatinoAppCenterService; import com.sdm.system.service.ISimulationAppRepositoryService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -233,36 +236,6 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu return response; } - // hpc类型的应用的配置 - private void dealHpcConfig(AppCenterItemBean appBean, SdmResponse> hpcCommandResp) { - String uuid = appBean.uuid; - List data = hpcCommandResp.getData(); - Map> remoteMap = data.stream() - .collect(Collectors.groupingBy(SimulationHpcCommandAllResp::getAppUuid)); - // 对应uuid - if(remoteMap.containsKey(uuid)){ - log.info("dealHpcConfig data size:{}",remoteMap.size()); - SimulationHpcCommandAllResp resp = remoteMap.get(uuid).get(0); - SimulationHpcCommandReq remoteCommandReq = resp.getCommandReq(); - List remotePlaceholderReqList = resp.getPlaceholderReqList(); - // hpc的命令 - appBean.hpcCommand=remoteCommandReq.getCommand(); - List commandConfigs = new ArrayList<>(); - for(SimulationHpcCommandPlaceholderReq remote : remotePlaceholderReqList){ - HpcCommandConfigDto dto = new HpcCommandConfigDto(); - dto.setKeyEnName(remote.getKeyEnName()); - dto.setKeyCnName(remote.getKeyCnName()); - dto.setValueType(remote.getValueType()); - dto.setIsDisplay(remote.getIsDisplay()); - dto.setFeatchType(remote.getFeatchType()); - dto.setDefaultValue(remote.getDefaultValue()); - dto.setFileRegular(remote.getFileRegular()); - commandConfigs.add(dto); - } - appBean.commandConfigs = commandConfigs; - } - } - /** * 通过类型查询应用 * @param type @@ -444,6 +417,20 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu log.warn("queryHpcApplication null"); return SdmResponse.success(results); } + // 查询所有的uuid + List uuidList = appList.stream() + .map(SimulationAppRepository::getUuid) + .collect(Collectors.toList()); + SdmResponse> hpcCommandResp = simulationHpcCommandFeignClient.getHpcCommandConfigs(uuidList); + if(!hpcCommandResp.isSuccess()){ + log.error("dealHpcConfigForHpc error,hpcCommandResp:{}", JSONObject.toJSONString(hpcCommandResp)); + throw new RuntimeException("查询动态命令失败"); + } + List data = hpcCommandResp.getData(); + // uuid 配置 + Map> remoteMap = data.stream() + .collect(Collectors.groupingBy(SimulationHpcCommandAllResp::getAppUuid)); + Map> groupByHpcGroupMap = appList.stream() .collect(java.util.stream.Collectors.groupingBy(SimulationAppRepository::getHpcGroup)); // 遍历分组(key = hpcGroup,value = 当前分组的应用列表) @@ -454,12 +441,23 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu List list = entry.getValue(); HpcSolverResp hpcSolverResp = new HpcSolverResp(); hpcSolverResp.setHpcGroup(hpcGroup); - hpcSolverResp.setAppInfos(list); + // 处理动态参数配置 + List appInfos =new ArrayList<>(); + for(SimulationAppRepository repository : list){ + SimulationAppResp simulationAppResp = new SimulationAppResp(); + BeanUtils.copyProperties(repository,simulationAppResp); + String uuid = repository.getUuid(); + // uuid,simulationAppResp,hpcCommandResp + dealHpcConfigForHpc(uuid,simulationAppResp,remoteMap); + appInfos.add(simulationAppResp); + } + hpcSolverResp.setAppInfos(appInfos); results.add(hpcSolverResp); } return SdmResponse.success(results); } + private void insertOrUpdateHpcCommandConfigs(AppCenterItemBean appBean,boolean isUpdate) { List commandConfigs = appBean.commandConfigs; // simulation_hpc_command @@ -514,5 +512,49 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu } } + // hpc类型的应用的配置 + private void dealHpcConfig(AppCenterItemBean appBean, SdmResponse> hpcCommandResp) { + String uuid = appBean.uuid; + List data = hpcCommandResp.getData(); + Map> remoteMap = data.stream() + .collect(Collectors.groupingBy(SimulationHpcCommandAllResp::getAppUuid)); + // 对应uuid + if(remoteMap.containsKey(uuid)){ + log.info("dealHpcConfig data size:{}",remoteMap.size()); + SimulationHpcCommandAllResp resp = remoteMap.get(uuid).get(0); + SimulationHpcCommandReq remoteCommandReq = resp.getCommandReq(); + List remotePlaceholderReqList = resp.getPlaceholderReqList(); + // hpc的命令 + appBean.hpcCommand=remoteCommandReq.getCommand(); + List commandConfigs = new ArrayList<>(); + for(SimulationHpcCommandPlaceholderReq remote : remotePlaceholderReqList){ + HpcCommandConfigDto dto = new HpcCommandConfigDto(); + dto.setKeyEnName(remote.getKeyEnName()); + dto.setKeyCnName(remote.getKeyCnName()); + dto.setValueType(remote.getValueType()); + dto.setIsDisplay(remote.getIsDisplay()); + dto.setFeatchType(remote.getFeatchType()); + dto.setDefaultValue(remote.getDefaultValue()); + dto.setFileRegular(remote.getFileRegular()); + commandConfigs.add(dto); + } + appBean.commandConfigs = commandConfigs; + } + } + + + private void dealHpcConfigForHpc(String uuid, SimulationAppResp simulationAppResp, Map> remoteMap) { + // 对应uuid + if(remoteMap.containsKey(uuid)){ + log.info("dealHpcConfigForHpc data size:{}",remoteMap.size()); + SimulationHpcCommandAllResp resp = remoteMap.get(uuid).get(0); + SimulationHpcCommandReq remoteCommand = resp.getCommandReq(); + List remotePlaceholderList = resp.getPlaceholderReqList(); + simulationAppResp.setSimulationHpcCommand(remoteCommand); + simulationAppResp.setCommandConfigs(remotePlaceholderList); + }else { + log.warn("dealHpcConfigForHpc remoteMap not contains uuid:{}",uuid); + } + } } From ed7cd909122e20dd01b28b9d0d19b480a27c2eb1 Mon Sep 17 00:00:00 2001 From: lidongyang <506508008@qq.com> Date: Wed, 15 Apr 2026 11:54:05 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix[project]:=20=E6=89=80=E6=9C=89=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=9F=A5=E8=AF=A2=20bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/common/NodeMemberTypeEnum.java | 3 +- .../sdm/project/dao/SimulationNodeMapper.java | 4 +- .../project/service/impl/NodeServiceImpl.java | 37 ++++++++++++++++--- .../resources/mapper/SimulationNodeMapper.xml | 16 ++++++++ .../resources/mapper/SimulationTaskMapper.xml | 4 -- 5 files changed, 51 insertions(+), 13 deletions(-) diff --git a/project/src/main/java/com/sdm/project/common/NodeMemberTypeEnum.java b/project/src/main/java/com/sdm/project/common/NodeMemberTypeEnum.java index 12d29884..d5188c18 100644 --- a/project/src/main/java/com/sdm/project/common/NodeMemberTypeEnum.java +++ b/project/src/main/java/com/sdm/project/common/NodeMemberTypeEnum.java @@ -8,7 +8,8 @@ public enum NodeMemberTypeEnum { MANAGER("项目经理", 0), ATTENTION("项目关注人", 1), - PINNED("项目置顶人", 2); + PINNED("项目置顶人", 2), + PARTICIPANT("项目参与人", 3); private final String name; diff --git a/project/src/main/java/com/sdm/project/dao/SimulationNodeMapper.java b/project/src/main/java/com/sdm/project/dao/SimulationNodeMapper.java index 4459bdb9..a2aa8793 100644 --- a/project/src/main/java/com/sdm/project/dao/SimulationNodeMapper.java +++ b/project/src/main/java/com/sdm/project/dao/SimulationNodeMapper.java @@ -118,10 +118,10 @@ public interface SimulationNodeMapper extends BaseMapper { List getNodeListByUserId(@Param("nodeType") String nodeType, @Param("nodeSubType") String nodeSubType, @Param("exeStatus") String exeStatus, @Param("nodeCode") String nodeCode, - @Param("manager") String manager, @Param("nodeName") String nodeName, @Param("tenantId") Long tenantId, @Param("pos") int pos, @Param("limit") int limit, @Param("userId") Long userId,@Param("type") Integer type); + @Param("manager") String manager, @Param("nodeName") String nodeName, @Param("tenantId") Long tenantId, @Param("pos") int pos, @Param("limit") int limit, @Param("userId") Long userId,@Param("type") Integer type,@Param("projectIdList") List projectIdList); int getNodeListCountByUserId(@Param("nodeType") String nodeType, @Param("nodeSubType") String nodeSubType, @Param("exeStatus") String exeStatus, @Param("nodeCode") String nodeCode, - @Param("manager") String manager, @Param("nodeName") String nodeName, @Param("tenantId") Long tenantId, @Param("userId") Long userId,@Param("type") Integer type); + @Param("manager") String manager, @Param("nodeName") String nodeName, @Param("tenantId") Long tenantId, @Param("userId") Long userId,@Param("type") Integer type,@Param("projectIdList") List projectIdList); List getNodeMemberListByMemberType(@Param("nodeIdList") List nodeIdList,@Param("userId") Long userId,@Param("memberType") Integer memberType); diff --git a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java index 3f13e78c..0e41c916 100644 --- a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java +++ b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java @@ -538,8 +538,33 @@ public class NodeServiceImpl extends ServiceImpl projectIdList = Optional.ofNullable( + simulationTaskMemberService.lambdaQuery() + .eq(SimulationTaskMember::getUserId, userId) + .list() + ) + .filter(CollectionUtils::isNotEmpty) + .stream() + .flatMap(List::stream) + .map(SimulationTaskMember::getTaskId) + .distinct() + .filter(StringUtils::isNotBlank) // 防止taskId为空 + .toList() + .stream() + .filter(StringUtils::isNotBlank) + .map(taskIds -> taskService.lambdaQuery() + .in(SimulationTask::getUuid, taskIds) + .list() + ) + .filter(CollectionUtils::isNotEmpty) + .flatMap(List::stream) + .map(SimulationTask::getTag1) + .filter(StringUtils::isNotBlank) + .distinct() + .toList(); nodeList = nodeMapper.getNodeListByUserId(req.getNodeType(), req.getNodeSubType(), req.getExeStatus(), req.getNodeCode(), req.getManager(), req.getNodeName(), - tenantId, pos, limit,userId,type); + tenantId, pos, limit,userId,type,projectIdList); // 设置关注标签 if (CollectionUtils.isNotEmpty(nodeList)) { List nodeIdList = nodeList.stream().map(SpdmNodeVo::getUuid).toList(); @@ -554,15 +579,15 @@ public class NodeServiceImpl extends ServiceImpl node.setAttentionFlag(1)); - total = nodeMapper.getNodeListCountByUserId(req.getNodeType(), req.getNodeSubType(), req.getExeStatus(), req.getNodeCode(), req.getManager(), req.getNodeName(), tenantId,userId,type); + total = nodeMapper.getNodeListCountByUserId(req.getNodeType(), req.getNodeSubType(), req.getExeStatus(), req.getNodeCode(), req.getManager(), req.getNodeName(), tenantId,userId,type,Collections.emptyList()); }else { nodeList = nodeMapper.getNodeListByUserId(req.getNodeType(), req.getNodeSubType(), req.getExeStatus(), req.getNodeCode(), req.getManager(), req.getNodeName(), - tenantId, pos, limit,userId,type); + tenantId, pos, limit,userId,type,Collections.emptyList()); // 设置关注标签 if (CollectionUtils.isNotEmpty(nodeList)) { List nodeIdList = nodeList.stream().map(SpdmNodeVo::getUuid).toList(); @@ -577,7 +602,7 @@ public class NodeServiceImpl extends ServiceImpl and sn.nodeName like #{searchKey3}
+ + or sn.uuid in + ( + + #{projectId} + + ) + order by IFNULL(pin.pinnedType, 0) desc, pin.pinnedTime desc, sn.create_time desc limit #{pos},#{limit} @@ -1017,6 +1025,14 @@ and sn.nodeName like #{searchKey3}
+ + or sn.uuid in + ( + + #{projectId} + + ) +