Merge remote-tracking branch 'origin/main'
This commit is contained in:
5
1-sql/2026-01-27/project/simulation_demand.sql
Normal file
5
1-sql/2026-01-27/project/simulation_demand.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE simulation_demand CHANGE node_id workspace_id varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '工位id';
|
||||
ALTER TABLE simulation_demand MODIFY COLUMN workspace_id varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '工位id';
|
||||
ALTER TABLE simulation_demand MODIFY COLUMN phase_id varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '阶段id';
|
||||
ALTER TABLE simulation_demand MODIFY COLUMN project_id varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '项目id';
|
||||
ALTER TABLE simulation_demand ADD machine_id varchar(255) NULL COMMENT '机台id';
|
||||
@@ -65,8 +65,11 @@ public class SimulationDemand implements Serializable {
|
||||
@TableField("phase_id")
|
||||
private String phaseId;
|
||||
|
||||
@TableField("node_id")
|
||||
private String nodeId;
|
||||
@TableField("machine_id")
|
||||
private String machineId;
|
||||
|
||||
@TableField("workspace_id")
|
||||
private String workspaceId;
|
||||
|
||||
@TableField("tenant_id")
|
||||
private Long tenantId;
|
||||
|
||||
@@ -111,11 +111,17 @@ public class SpdmAddDemandReq extends BaseEntity {
|
||||
*/
|
||||
private String nodeId;
|
||||
|
||||
/**
|
||||
* 机台id
|
||||
*/
|
||||
private String machineId;
|
||||
|
||||
/**
|
||||
* 工位id
|
||||
*/
|
||||
private String workspaceId;
|
||||
|
||||
|
||||
/**
|
||||
* 3D负责人
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,8 @@ public class SpdmProjectNodeEditReq extends BaseEntity {
|
||||
*/
|
||||
private String pid;
|
||||
|
||||
private String referenceId;
|
||||
|
||||
/**
|
||||
* 当前节点id
|
||||
*/
|
||||
|
||||
@@ -90,23 +90,44 @@ public class SpdmDemandVo extends BaseEntity {
|
||||
private List<SpdmDemandExtraVo> extras;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
* 项目id
|
||||
*/
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 阶段id
|
||||
*/
|
||||
private String phaseId;
|
||||
|
||||
/**
|
||||
* 阶段名称
|
||||
*/
|
||||
private String phaseId;
|
||||
|
||||
private String phaseName;
|
||||
|
||||
/**
|
||||
* 学科名称
|
||||
* 机台id
|
||||
*/
|
||||
private String nodeId;
|
||||
private String machineId;
|
||||
|
||||
/**
|
||||
* 机台名称
|
||||
*/
|
||||
private String machineName;
|
||||
|
||||
/**
|
||||
* 工位id
|
||||
*/
|
||||
private String workspaceId;
|
||||
|
||||
/**
|
||||
* 工位名称
|
||||
*/
|
||||
private String workspaceName;
|
||||
|
||||
private String demandType;
|
||||
|
||||
|
||||
@@ -572,6 +572,12 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
if (StringUtils.isNotBlank(spdmDemandVo.getPhaseId())) {
|
||||
spdmDemandVo.setPhaseName(CollectionUtils.isNotEmpty(nodeMap.get(spdmDemandVo.getPhaseId())) ? nodeMap.get(spdmDemandVo.getPhaseId()).get(0).getNodeName() : "");
|
||||
}
|
||||
if (StringUtils.isNotBlank(spdmDemandVo.getMachineId())) {
|
||||
spdmDemandVo.setMachineName(CollectionUtils.isNotEmpty(nodeMap.get(spdmDemandVo.getMachineId())) ? nodeMap.get(spdmDemandVo.getMachineId()).get(0).getNodeName() : "");
|
||||
}
|
||||
if (StringUtils.isNotBlank(spdmDemandVo.getWorkspaceId())) {
|
||||
spdmDemandVo.setWorkspaceName(CollectionUtils.isNotEmpty(nodeMap.get(spdmDemandVo.getWorkspaceId())) ? nodeMap.get(spdmDemandVo.getWorkspaceId()).get(0).getNodeName() : "");
|
||||
}
|
||||
eachDemandMemberList = demandMemberMap.get(spdmDemandVo.getUuid());
|
||||
if (CollectionUtils.isEmpty(eachDemandMemberList)) {
|
||||
continue;
|
||||
|
||||
@@ -378,23 +378,40 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
return;
|
||||
}
|
||||
|
||||
// 填充需求的项目ID
|
||||
allNodeList.stream()
|
||||
.filter(node -> NodeTypeEnum.PROJECT.getValue().equals(node.getNodeType())
|
||||
&& node.getNodeCode().equals(todo.getProject()))
|
||||
.findFirst()
|
||||
.ifPresent(node -> req.setProjectId(node.getUuid()));
|
||||
|
||||
// 填充需求的阶段ID
|
||||
allNodeList.stream()
|
||||
.filter(node -> NodeTypeEnum.PHASE.getValue().equals(node.getNodeType())
|
||||
&& node.getNodeCode().equals(todo.getProjectStage()))
|
||||
.findFirst()
|
||||
.ifPresent(node -> req.setPhaseId(node.getUuid()));
|
||||
|
||||
allNodeList.stream()
|
||||
// 填充需求的工位ID
|
||||
Optional<SimulationNode> workspaceNodeOptional = allNodeList.stream()
|
||||
.filter(node -> NodeTypeEnum.WORKSPACE.getValue().equals(node.getNodeType())
|
||||
&& node.getNodeCode().equals(todo.getStationNum()))
|
||||
.findFirst()
|
||||
.ifPresent(node -> req.setNodeId(node.getUuid()));
|
||||
.findFirst();
|
||||
if (workspaceNodeOptional.isPresent()) {
|
||||
SimulationNode workspaceNode = workspaceNodeOptional.get();
|
||||
req.setWorkspaceId(workspaceNode.getUuid());
|
||||
if (StringUtils.isBlank(workspaceNode.getParentId())) {
|
||||
log.info("工位:{}的parentId为空,无法查询机台节点", workspaceNode.getUuid());
|
||||
return;
|
||||
}
|
||||
// 填充需求的机台ID
|
||||
SimulationNode machineNode = nodeService.lambdaQuery().eq(SimulationNode::getUuid, workspaceNode.getParentId()).one();
|
||||
if (ObjectUtils.isEmpty(machineNode)) {
|
||||
log.info("根据工位parentId:{},未查询到机台节点", workspaceNode.getParentId());
|
||||
return;
|
||||
}
|
||||
req.setMachineId(machineNode.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -649,6 +649,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
if (CollectionUtils.isNotEmpty(allExtraList) && nodeMapper.addNodeExtraBatch(allExtraList) <= 0) {
|
||||
return null;
|
||||
}
|
||||
addNodeList.forEach(addNode -> addNode.setReferenceId(addNode.getPid()));
|
||||
addNodeList.forEach(addNode -> addNode.setPid(addNode.getUuid()));
|
||||
return addNodeList;
|
||||
}
|
||||
@@ -2671,9 +2672,17 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
// 预构建节点映射,避免重复遍历
|
||||
Map<String, SpdmProjectNodeEditReq> projectNodeMap = buildProjectNodeMap(allNodeList);
|
||||
|
||||
// 过滤出所有机台类型节点
|
||||
List<SpdmProjectNodeEditReq> workspaceNodeList = allNodeList.stream().filter(node -> NodeTypeEnum.WORKSPACE.getValue().equals(node.getNodeType())).toList();
|
||||
Map<String, String> workspaceNodeMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(workspaceNodeList)) {
|
||||
workspaceNodeMap = workspaceNodeList.stream().filter(workspaceNode -> StringUtils.isNotBlank(workspaceNode.getReferenceId()))
|
||||
.collect(Collectors.toMap(SpdmProjectNodeEditReq::getUuid,SpdmProjectNodeEditReq::getReferenceId));
|
||||
}
|
||||
|
||||
// 5. 处理待办事项,构建创建需求所需数据
|
||||
SyncTodoProcessResult processResult = processTodoItems(
|
||||
todoInfoList, projectNodeMap, currentUserId, currentTimeStr, tenantId);
|
||||
todoInfoList, projectNodeMap, currentUserId, currentTimeStr, tenantId, workspaceNodeMap);
|
||||
|
||||
// 6. 批量创建文件夹
|
||||
SdmResponse dirCreateResponse = batchCreateDemandDirs(
|
||||
@@ -2755,16 +2764,17 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
Map<String, SpdmProjectNodeEditReq> projectNodeMap,
|
||||
Long currentUserId,
|
||||
String currentTimeStr,
|
||||
Long tenantId) {
|
||||
Long tenantId,
|
||||
Map<String, String> workspaceNodeMap) {
|
||||
List<DirNodeInfo> demandDirNodeList = new ArrayList<>();
|
||||
List<UpdatePermissionReq> permissionReqList = new ArrayList<>();
|
||||
|
||||
// 筛选出所有工位节点
|
||||
for (LyricVTodoEmulationInfoDM todoItem : todoInfoList) {
|
||||
try {
|
||||
String demandUuid = RandomUtil.generateString(32);
|
||||
|
||||
// 1. 构建基础需求信息
|
||||
SpdmAddDemandReq demandAddReq = buildDemandAddReq(todoItem, demandUuid, projectNodeMap, currentTimeStr);
|
||||
SpdmAddDemandReq demandAddReq = buildDemandAddReq(todoItem, demandUuid, projectNodeMap, currentTimeStr,workspaceNodeMap);
|
||||
|
||||
// 2. 构建成员信息和权限信息
|
||||
List<SpdmDemandRelateMemberReq> memberList = buildDemandMemberList(
|
||||
@@ -2791,7 +2801,8 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
private SpdmAddDemandReq buildDemandAddReq(LyricVTodoEmulationInfoDM todoItem,
|
||||
String demandUuid,
|
||||
Map<String, SpdmProjectNodeEditReq> projectNodeMap,
|
||||
String currentTimeStr) {
|
||||
String currentTimeStr,
|
||||
Map<String, String> workspaceNodeMap) {
|
||||
SpdmAddDemandReq demandAddReq = new SpdmAddDemandReq();
|
||||
|
||||
// 基础属性
|
||||
@@ -2811,8 +2822,10 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
// 节点信息
|
||||
demandAddReq.setProjectId(getNodeUuid(projectNodeMap, NodeTypeEnum.PROJECT.getValue(), todoItem.getProject()));
|
||||
demandAddReq.setPhaseId(getNodeUuid(projectNodeMap, NodeTypeEnum.PHASE.getValue(), todoItem.getProjectStage()));
|
||||
demandAddReq.setNodeId(getNodeUuid(projectNodeMap, NodeTypeEnum.WORKSPACE.getValue(), todoItem.getStationNum()));
|
||||
|
||||
demandAddReq.setWorkspaceId(getNodeUuid(projectNodeMap, NodeTypeEnum.WORKSPACE.getValue(), todoItem.getStationNum()));
|
||||
if (StringUtils.isNotBlank(demandAddReq.getWorkspaceId()) && MapUtils.isNotEmpty(workspaceNodeMap)) {
|
||||
demandAddReq.setMachineId(workspaceNodeMap.get(demandAddReq.getWorkspaceId()));
|
||||
}
|
||||
return demandAddReq;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
<insert id="addDemand" useGeneratedKeys="true" keyProperty="req.id">
|
||||
insert into simulation_demand (uuid,demand_name,demand_code,demand_type,sim_type,demand_status,achieve_status,progress,approval_status,
|
||||
begin_time,end_time,finish_time,project_id,phase_id,node_id,tenant_id,creator,create_time,demandSource,description) values
|
||||
begin_time,end_time,finish_time,project_id,phase_id,workspace_id,tenant_id,creator,create_time,demandSource,description,machine_id) values
|
||||
(#{req.uuid},#{req.demandName},#{req.demandCode},#{req.demandType},#{req.simType},#{req.demandStatus},#{req.achieveStatus},#{req.progress},#{req.approvalStatus},
|
||||
#{req.beginTime},#{req.endTime},'',#{req.projectId},#{req.phaseId},#{req.nodeId},#{tenantId},#{jobNumber},#{req.createTime},#{req.demandSource},#{req.description})
|
||||
#{req.beginTime},#{req.endTime},'',#{req.projectId},#{req.phaseId},#{req.workspaceId},#{tenantId},#{jobNumber},#{req.createTime},#{req.demandSource},#{req.description},#{req.machineId})
|
||||
</insert>
|
||||
|
||||
<insert id="addDemandMember">
|
||||
|
||||
Reference in New Issue
Block a user