Merge remote-tracking branch 'origin/main'
This commit is contained in:
1
1-sql/2026-04-15/sys_dept_user.sql
Normal file
1
1-sql/2026-04-15/sys_dept_user.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE spdm_baseline.sys_dept_user ADD simulationType varchar(255) NULL COMMENT '仿真类型';
|
||||
@@ -25,6 +25,9 @@ public class SysDeptUserResp {
|
||||
@Schema(description = "阶段")
|
||||
private String stage;
|
||||
|
||||
@Schema(description = "仿真类型")
|
||||
private String simulationType;
|
||||
|
||||
@Schema(description = "部门负责人用户ID")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long userId;
|
||||
|
||||
@@ -8,7 +8,8 @@ public enum NodeMemberTypeEnum {
|
||||
|
||||
MANAGER("项目经理", 0),
|
||||
ATTENTION("项目关注人", 1),
|
||||
PINNED("项目置顶人", 2);
|
||||
PINNED("项目置顶人", 2),
|
||||
PARTICIPANT("项目参与人", 3);
|
||||
|
||||
|
||||
private final String name;
|
||||
|
||||
@@ -118,10 +118,10 @@ public interface SimulationNodeMapper extends BaseMapper<SimulationNode> {
|
||||
|
||||
|
||||
List<SpdmNodeVo> 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<String> 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<String> projectIdList);
|
||||
|
||||
List<SpdmNodeMemberVo> getNodeMemberListByMemberType(@Param("nodeIdList") List<String> nodeIdList,@Param("userId") Long userId,@Param("memberType") Integer memberType);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -522,6 +522,54 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联任务与需求的需求类型(demandType)
|
||||
* @param newTaskList 任务列表
|
||||
*/
|
||||
private void relateDemandType(List<TaskNodePo> newTaskList) {
|
||||
// 1. 任务列表为空直接返回
|
||||
if (CollectionUtils.isEmpty(newTaskList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 提取有效demandId
|
||||
List<String> demandIdList = newTaskList.stream()
|
||||
.map(TaskNodePo::getDemandId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
log.info("relateDemandType 查询需求ID列表:{}", demandIdList);
|
||||
if (CollectionUtils.isEmpty(demandIdList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 查询需求信息
|
||||
List<SpdmDemandVo> demandList = demandMapper.getDemandListById(demandIdList);
|
||||
if (CollectionUtils.isEmpty(demandList)) {
|
||||
log.info("relateDemandType 根据ID未查询到对应需求信息");
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. 转成 Map:uuid -> demandType
|
||||
Map<String, String> 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<TaskNodeTag> 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());
|
||||
|
||||
@@ -975,6 +975,14 @@
|
||||
<bind name="searchKey3" value="'%' + nodeName + '%'"/>
|
||||
and sn.nodeName like #{searchKey3}
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size > 0">
|
||||
or sn.uuid in
|
||||
(
|
||||
<foreach collection='projectIdList' item='projectId' index='index' separator=','>
|
||||
#{projectId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
order by IFNULL(pin.pinnedType, 0) desc, pin.pinnedTime desc, sn.create_time desc
|
||||
limit #{pos},#{limit}
|
||||
</select>
|
||||
@@ -1017,6 +1025,14 @@
|
||||
<bind name="searchKey3" value="'%' + nodeName + '%'"/>
|
||||
and sn.nodeName like #{searchKey3}
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size > 0">
|
||||
or sn.uuid in
|
||||
(
|
||||
<foreach collection='projectIdList' item='projectId' index='index' separator=','>
|
||||
#{projectId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getNodeMemberListByMemberType" resultType="com.sdm.project.model.vo.SpdmNodeMemberVo">
|
||||
|
||||
@@ -821,9 +821,9 @@
|
||||
</foreach>
|
||||
))
|
||||
</if>
|
||||
<if test="req.toDoMarkerList != null and req.toDoMarkerList.size > 0">
|
||||
<if test="toDoMarkerList != null and toDoMarkerList.size > 0">
|
||||
and (
|
||||
<foreach collection='req.toDoMarkerList' item='toDoMarker' open='' close='' separator=' OR '>
|
||||
<foreach collection='toDoMarkerList' item='toDoMarker' open='' close='' separator=' OR '>
|
||||
toDoMarker LIKE CONCAT('%', #{toDoMarker}, '%')
|
||||
</foreach>
|
||||
)
|
||||
@@ -1209,10 +1209,6 @@
|
||||
<bind name="searchKey1" value="'%' + req.taskName + '%'"/>
|
||||
and st.task_name like #{searchKey1}
|
||||
</if>
|
||||
<if test="req.name != null and req.name != ''">
|
||||
<bind name="searchKey2" value="'%' + req.name + '%'"/>
|
||||
and st.task_name like #{searchKey2}
|
||||
</if>
|
||||
<if test="req.taskCode != null and req.taskCode != ''">
|
||||
<bind name="searchKey3" value="'%' + req.taskCode + '%'"/>
|
||||
and st.task_code like #{searchKey3}
|
||||
|
||||
@@ -44,6 +44,10 @@ public class SysDeptUser implements Serializable {
|
||||
@TableField("stage")
|
||||
private String stage;
|
||||
|
||||
@Schema(description = "仿真类型")
|
||||
@TableField("simulationType")
|
||||
private String simulationType;
|
||||
|
||||
@Schema(description = "部门负责人用户ID")
|
||||
@TableField("userId")
|
||||
private Long userId;
|
||||
|
||||
@@ -21,6 +21,9 @@ public class DeptOperateReq {
|
||||
@Schema(description = "阶段")
|
||||
private String stage;
|
||||
|
||||
@Schema(description = "仿真类型")
|
||||
private String simulationType;
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Integer id;
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@ public class HpcSolverResp {
|
||||
|
||||
private String hpcGroup;
|
||||
|
||||
private List<SimulationAppRepository> appInfos;
|
||||
private List<SimulationAppResp> appInfos;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 应用配置表
|
||||
* </p>
|
||||
*
|
||||
* @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<SimulationHpcCommandPlaceholderReq> commandConfigs;
|
||||
|
||||
}
|
||||
@@ -51,6 +51,7 @@ public class ISysDeptUserServiceImpl extends ServiceImpl<SysDeptUserMapper, SysD
|
||||
deptUser.setTenantId(ThreadLocalContext.getTenantId());
|
||||
deptUser.setCreator(ThreadLocalContext.getUserId());
|
||||
deptUser.setDeptId(IdWorker.getId(deptUser));
|
||||
deptUser.setSimulationType(deptAddReq.getSimulationType());
|
||||
this.save(deptUser);
|
||||
return SdmResponse.success();
|
||||
}
|
||||
@@ -73,6 +74,7 @@ public class ISysDeptUserServiceImpl extends ServiceImpl<SysDeptUserMapper, SysD
|
||||
deptUser.setDeptName(normalizedDeptName);
|
||||
deptUser.setDiscipline(normalizedSubject);
|
||||
deptUser.setStage(StringUtils.isNotBlank(normalizedStage) ? normalizedStage : null);
|
||||
deptUser.setSimulationType(deptEditReq.getSimulationType());
|
||||
if (deptEditReq.getUserId() != null) {
|
||||
deptUser.setUserId(deptEditReq.getUserId());
|
||||
}
|
||||
|
||||
@@ -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<List<SimulationHpcCommandAllResp>> hpcCommandResp) {
|
||||
String uuid = appBean.uuid;
|
||||
List<SimulationHpcCommandAllResp> data = hpcCommandResp.getData();
|
||||
Map<String, List<SimulationHpcCommandAllResp>> 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<SimulationHpcCommandPlaceholderReq> remotePlaceholderReqList = resp.getPlaceholderReqList();
|
||||
// hpc的命令
|
||||
appBean.hpcCommand=remoteCommandReq.getCommand();
|
||||
List<HpcCommandConfigDto> 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<String> uuidList = appList.stream()
|
||||
.map(SimulationAppRepository::getUuid)
|
||||
.collect(Collectors.toList());
|
||||
SdmResponse<List<SimulationHpcCommandAllResp>> hpcCommandResp = simulationHpcCommandFeignClient.getHpcCommandConfigs(uuidList);
|
||||
if(!hpcCommandResp.isSuccess()){
|
||||
log.error("dealHpcConfigForHpc error,hpcCommandResp:{}", JSONObject.toJSONString(hpcCommandResp));
|
||||
throw new RuntimeException("查询动态命令失败");
|
||||
}
|
||||
List<SimulationHpcCommandAllResp> data = hpcCommandResp.getData();
|
||||
// uuid 配置
|
||||
Map<String, List<SimulationHpcCommandAllResp>> remoteMap = data.stream()
|
||||
.collect(Collectors.groupingBy(SimulationHpcCommandAllResp::getAppUuid));
|
||||
|
||||
Map<String, List<SimulationAppRepository>> 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<SimulationAppRepository> list = entry.getValue();
|
||||
HpcSolverResp hpcSolverResp = new HpcSolverResp();
|
||||
hpcSolverResp.setHpcGroup(hpcGroup);
|
||||
hpcSolverResp.setAppInfos(list);
|
||||
// 处理动态参数配置
|
||||
List<SimulationAppResp> 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<HpcCommandConfigDto> commandConfigs = appBean.commandConfigs;
|
||||
// simulation_hpc_command
|
||||
@@ -514,5 +512,49 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu
|
||||
}
|
||||
}
|
||||
|
||||
// hpc类型的应用的配置
|
||||
private void dealHpcConfig(AppCenterItemBean appBean, SdmResponse<List<SimulationHpcCommandAllResp>> hpcCommandResp) {
|
||||
String uuid = appBean.uuid;
|
||||
List<SimulationHpcCommandAllResp> data = hpcCommandResp.getData();
|
||||
Map<String, List<SimulationHpcCommandAllResp>> 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<SimulationHpcCommandPlaceholderReq> remotePlaceholderReqList = resp.getPlaceholderReqList();
|
||||
// hpc的命令
|
||||
appBean.hpcCommand=remoteCommandReq.getCommand();
|
||||
List<HpcCommandConfigDto> 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<String, List<SimulationHpcCommandAllResp>> 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<SimulationHpcCommandPlaceholderReq> remotePlaceholderList = resp.getPlaceholderReqList();
|
||||
simulationAppResp.setSimulationHpcCommand(remoteCommand);
|
||||
simulationAppResp.setCommandConfigs(remotePlaceholderList);
|
||||
}else {
|
||||
log.warn("dealHpcConfigForHpc remoteMap not contains uuid:{}",uuid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user