This commit is contained in:
2026-03-27 09:09:11 +08:00
30 changed files with 1948 additions and 338 deletions

View File

@@ -33,6 +33,10 @@ public class SimulationRunKeyResult implements Serializable {
@ApiModelProperty(value = "所属Run UUID", required = true)
private String runId;
@TableField("taskId")
@ApiModelProperty(value = "所属Task UUID", required = true)
private String taskId;
@TableField("keyResultType")
@ApiModelProperty(value = "关键性能结果类型 1-图片/动画 2-曲线 3-报告 4-数值")
private Integer keyResultType;

View File

@@ -2,6 +2,8 @@ package com.sdm.project.model.req;
import lombok.Data;
import java.util.List;
@Data
public class DemandQryReq {
/**
@@ -9,16 +11,16 @@ public class DemandQryReq {
*/
private String isMoldMaking;
/**
* 物料号
* 物料号列表
*/
private String materialNo;
private List<String> materialNoList;
/**
* 项目号对应simulation_node的nodeCode
* 项目号列表对应simulation_node的nodeCode
*/
private String projectCode;
private List<String> projectCodeList;
/**
* 工作空间编码对应simulation_node的nodeCode
* 工作空间编码列表对应simulation_node的nodeCode
*/
private String workspaceCode;
private List<String> workspaceCodeList;
}

View File

@@ -18,5 +18,8 @@ public class SpdmTaskRunReq {
@Schema(description = "流程模板id")
private String templateId;
@Schema(description = "指定启动节点")
private String targetNodeId;
}

View File

@@ -202,4 +202,9 @@ public class SpdmDemandVo extends BaseEntity {
@Schema(description= "关联的待办的结果文件路径")
private List<String> reportFileUrlList;
/**
* 执行人user_id列表逗号分隔
*/
private String eUserIds;
}

View File

@@ -1549,27 +1549,57 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
.distinct()
.collect(Collectors.toList());
// 收集所有eUserIds逗号分隔的字符串拆解成列表
List<Long> eUserIds = demandVoList.stream()
.map(SpdmDemandVo::getEUserIds)
.filter(StringUtils::isNotBlank)
.flatMap(eUserIdsStr -> Arrays.stream(eUserIdsStr.split(",")))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.distinct()
.map(Long::valueOf)
.collect(Collectors.toList());
// 合并所有需要查询的用户ID
Set<Long> allUserIds = new HashSet<>();
allUserIds.addAll(pUserIds);
allUserIds.addAll(eUserIds);
// 批量查询用户信息
Map<Long, List<CIDUserResp>> userMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(pUserIds)) {
Map<Long, CIDUserResp> userMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(allUserIds)) {
SdmResponse<List<CIDUserResp>> cidUserResp = sysUserFeignClient.listUserByIds(
UserQueryReq.builder().userIds(pUserIds).build()
UserQueryReq.builder().userIds(new ArrayList<>(allUserIds)).build()
);
if (cidUserResp.isSuccess() && CollectionUtils.isNotEmpty(cidUserResp.getData())) {
userMap = cidUserResp.getData().stream().collect(Collectors.groupingBy(CIDUserResp::getUserId));
userMap = cidUserResp.getData().stream()
.collect(Collectors.toMap(CIDUserResp::getUserId, u -> u, (u1, u2) -> u1));
}
}
// 遍历设置pMemberList和文件信息
// 遍历设置pMemberList、eMemberList和文件信息
for (SpdmDemandVo demandVo : demandVoList) {
// 设置pMemberList
if (StringUtils.isNotBlank(demandVo.getPUserId())) {
Long userId = Long.valueOf(demandVo.getPUserId());
if (CollectionUtils.isNotEmpty(userMap.get(userId))) {
demandVo.setPMemberList(userMap.get(userId));
CIDUserResp user = userMap.get(userId);
if (user != null) {
demandVo.setPMemberList(Collections.singletonList(user));
}
}
// 设置eMemberList
if (StringUtils.isNotBlank(demandVo.getEUserIds())) {
List<CIDUserResp> eMemberList = Arrays.stream(demandVo.getEUserIds().split(","))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.map(Long::valueOf)
.map(userMap::get)
.filter(Objects::nonNull)
.collect(Collectors.toList());
demandVo.setEMemberList(eMemberList);
}
// 设置文件信息
QueryDirReq dirReq = new QueryDirReq();
dirReq.setCurrent(1);

View File

@@ -1136,8 +1136,14 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
simulationRunKeyResult.setUpdater(ThreadLocalContext.getUserId());
// 外围调用不关心dirId只传keyResultType-关键结果类型所以需要根据算例id和keyResultType获取到上传到哪个结果目录下
if (req.getDirId() == null) {
setDirId(req);
log.info("[addSimulationKeyResult] keyResultType:{},dirId:{}", req.getKeyResultType(), req.getDirId());
if (StringUtils.isNotBlank(req.getRunId())) {
setDirId(req);
log.info("[addSimulationKeyResult] run keyResultType:{},dirId:{}", req.getKeyResultType(), req.getDirId());
} else if (StringUtils.isNotBlank(req.getTaskId())) {
// 如果是任务下的关键结果 前端拿不到dirId 不会传 需要后端识别
req.setDirId(getParentDirId(req.getTaskId(), fileBizTypeService.getFileName(String.valueOf(req.getFileTypeDictValue()))));
log.info("[addSimulationKeyResult] task keyResultType:{},dirId:{}", req.getKeyResultType(), req.getDirId());
}
}
// 上传文件
if (req.getFile() != null) {
@@ -1464,12 +1470,23 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
@Override
public SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req) {
PageHelper.startPage(req.getCurrent(), req.getSize());
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.lambdaQuery()
.eq(ObjectUtils.isNotEmpty(req.getRunId()),SimulationRunKeyResult::getRunId, req.getRunId())
.eq(ObjectUtils.isNotEmpty(req.getKeyResultType()),SimulationRunKeyResult::getKeyResultType, req.getKeyResultType())
.eq(ObjectUtils.isNotEmpty(req.getFileId()),SimulationRunKeyResult::getFileId, req.getFileId())
.orderByAsc(SimulationRunKeyResult::getFileId)
.list();
LambdaQueryWrapper<SimulationRunKeyResult> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(req.getRunId())) {
queryWrapper.eq(SimulationRunKeyResult::getRunId, req.getRunId());
}
if (StringUtils.isNotBlank(req.getTaskId())) {
queryWrapper.eq(SimulationRunKeyResult::getTaskId, req.getTaskId());
}
if (ObjectUtils.isNotEmpty(req.getKeyResultType())) {
queryWrapper.eq(SimulationRunKeyResult::getKeyResultType, req.getKeyResultType());
}
if (ObjectUtils.isNotEmpty(req.getFileId())) {
queryWrapper.eq(SimulationRunKeyResult::getFileId, req.getFileId());
}
queryWrapper.orderByAsc(SimulationRunKeyResult::getFileId);
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.getBaseMapper().selectList(queryWrapper);
PageInfo<SimulationRunKeyResult> page = new PageInfo<>(runKeyResults);
// 批量查询文件信息并回设name
@@ -2512,7 +2529,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
variables.put("userName", ThreadLocalContext.getUserName());
variables.put("tenantId", ThreadLocalContext.getTenantId());
// 启动流程实例 多次执行会生成多个流程实例id更新算例run表、同时更新flowable流程参数的流程实例id
SdmResponse<ProcessInstanceResp> sdmResponse = flowableFeignClient.startByProcessDefinitionId(simulationRun.getProcessDefinitionId(), variables);
SdmResponse<ProcessInstanceResp> sdmResponse = flowableFeignClient.startByProcessDefinitionId(simulationRun.getProcessDefinitionId(),req.getTargetNodeId(), variables);
if (sdmResponse.getData() != null) {
this.lambdaUpdate()
.set(SimulationRun::getFlowInstanceId, sdmResponse.getData().getProcessInstanceId())
@@ -2936,6 +2953,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
simulationRunKeyResult.setId(null);
simulationRunKeyResult.setUuid(RandomUtil.generateString(32));
simulationRunKeyResult.setRunId(null);
simulationRunKeyResult.setTaskId(simulationRun.getTaskId());
simulationRunKeyResult.setFileId(response.getData());
taskKeyResultList.add(simulationRunKeyResult);
}
@@ -3041,6 +3059,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
// 同时生成一份keyResult到表里因为任务下的曲线预览也需要展示物理量和单位
SimulationRunKeyResult simulationRunKeyResult = new SimulationRunKeyResult();
simulationRunKeyResult.setUuid(RandomUtil.generateString(32));
simulationRunKeyResult.setTaskId(req.getUuid());
simulationRunKeyResult.setXQuantityType(sourceFile.getXQuantityType());
simulationRunKeyResult.setXUnits(sourceFile.getXUnits());
simulationRunKeyResult.setYQuantityType(sourceFile.getYQuantityType());

View File

@@ -191,16 +191,20 @@
is_mold.property_value AS isMoldMaking,
sdm.user_id AS pUserId,
project_node.nodeCode AS projectCode,
workspace_node.nodeCode AS workspaceCode
workspace_node.nodeCode AS workspaceCode,
euser.eUserIds AS eUserIds
FROM simulation_demand sd
INNER JOIN simulation_demand_extra is_mold ON sd.uuid = is_mold.demand_id AND is_mold.property_name = 'isMoldMaking'
<if test="req.isMoldMaking != null">
AND is_mold.property_value = #{req.isMoldMaking}
</if>
<choose>
<when test="req.materialNo != null and req.materialNo != ''">
<when test="req.materialNoList != null and req.materialNoList.size() > 0">
INNER JOIN simulation_demand_extra mold_material ON sd.uuid = mold_material.demand_id AND mold_material.property_name = 'materialNo'
AND mold_material.property_value = #{req.materialNo}
AND mold_material.property_value IN
<foreach collection="req.materialNoList" item="materialNo" open="(" separator="," close=")">
#{materialNo}
</foreach>
</when>
<otherwise>
LEFT JOIN simulation_demand_extra mold_material ON sd.uuid = mold_material.demand_id AND mold_material.property_name = 'materialNo'
@@ -208,23 +212,35 @@
</choose>
LEFT JOIN simulation_demand_member sdm ON sd.uuid = sdm.demand_id AND sdm.type = 0
<choose>
<when test="req.projectCode != null and req.projectCode != ''">
<when test="req.projectCodeList != null and req.projectCodeList.size() > 0">
INNER JOIN simulation_node project_node ON sd.project_id = project_node.uuid
AND project_node.nodeCode = #{req.projectCode}
AND project_node.nodeCode IN
<foreach collection="req.projectCodeList" item="projectCode" open="(" separator="," close=")">
#{projectCode}
</foreach>
</when>
<otherwise>
LEFT JOIN simulation_node project_node ON sd.project_id = project_node.uuid
</otherwise>
</choose>
<choose>
<when test="req.workspaceCode != null and req.workspaceCode != ''">
<when test="req.workspaceCodeList != null and req.workspaceCodeList.size() > 0">
INNER JOIN simulation_node workspace_node ON sd.workspace_id = workspace_node.uuid
AND workspace_node.nodeCode = #{req.workspaceCode}
AND workspace_node.nodeCode IN
<foreach collection="req.workspaceCodeList" item="workspaceCode" open="(" separator="," close=")">
#{workspaceCode}
</foreach>
</when>
<otherwise>
LEFT JOIN simulation_node workspace_node ON sd.workspace_id = workspace_node.uuid
</otherwise>
</choose>
LEFT JOIN (
SELECT t.demand_id, GROUP_CONCAT(DISTINCT tm.user_id) AS eUserIds
FROM simulation_task t
INNER JOIN simulation_task_member tm ON t.uuid = tm.task_id AND tm.type = 1
GROUP BY t.demand_id
) euser ON sd.uuid = euser.demand_id
</select>
<select id="getDemandListNoPermission" resultType="com.sdm.project.model.vo.SpdmDemandVo">