1、利元亨现场问题修改4

This commit is contained in:
2026-03-06 15:29:45 +08:00
parent 9491e7a7a6
commit afc4a6f4a5
3 changed files with 123 additions and 104 deletions

View File

@@ -740,6 +740,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
// 批量创建文件夹
if (CollectionUtils.isNotEmpty(createDirItemList)) {
// project的uuidcreateDirItemList中每一项project的uuid都一样取第一个即可
for (BatchCreateDirItem batchCreateDirItem : createDirItemList) {
String projectNodeId = createDirItemList.get(0).getParentDirNodeInfo().getUuId();
if (StringUtils.isBlank(projectNodeId)) {
log.error("projectNodeId为空createDirItemList{}", createDirItemList);
@@ -801,7 +802,6 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
} else {
demandAttachFileMetadataInfoId = demandAttachFileMetadataInfoResp.getId();
}
for (BatchCreateDirItem batchCreateDirItem : createDirItemList) {
BatchCreateNormalDirReq batchCreateNormalDirReq = new BatchCreateNormalDirReq();
// 2026-02-03 这里要挂在【需求附件】文件夹下了
batchCreateNormalDirReq.setParentId(demandAttachFileMetadataInfoId);
@@ -820,7 +820,6 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
}
}
// 批量更新权限
if (CollectionUtils.isNotEmpty(updatePermissionList)) {
List<BatchUpdatePermissionReq.FilePermissionItem> filePermissions = new ArrayList<>();
@@ -2673,7 +2672,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
String curDateStr;
Date createTime = lyricVProjectToDM.getCreateTime();
if (ObjectUtils.isNotEmpty(createTime)) {
curDateStr = new SimpleDateFormat("yyyy-MM-ddTHH:mm:ss").format(createTime).replace("T"," ");
curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime);
}else {
curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
}

View File

@@ -177,6 +177,10 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
private static final String NODE_TYPE_PHASE = NodeTypeEnum.PHASE.getValue();
private static final List<TaskNodeTag> EMPTY_TAG_LIST = Collections.emptyList();
// 通过标识判断是否走查询现场视图逻辑0不查询1查询
@Value("${lyricFlag:1}")
private int lyricFlag;
@Autowired
private CacheManager cacheManager;
@@ -602,9 +606,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
summaryWorkspaceNode(projectNodePo,projectNodePo.getChildren());
}
// 对工位进行排序,-M工位顺序排第一个
if (lyricFlag == 1) {
for (ProjectNodePo projectNodePo : realTopProjectNodeList) {
sortWorkspaceNode(projectNodePo);
}
}
return SdmResponse.success(realTopProjectNodeList.stream().flatMap(item -> item.getChildren().stream().filter(Objects::nonNull)).toList());
}
@@ -623,32 +629,35 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
return;
}
// 对工位进行排序,-M工位顺序排第一个
workspaceNodeList = workspaceNodeList.stream().sorted(Comparator.comparing(NodeAllBase::getNodeCode)).collect(Collectors.toList());
// 利元亨定制
// workspaceNodeList.sort((o1, o2) -> {
// String[] workspaceNode1 = o1.getNodeCode().split("-");
// String[] workspaceNode2 = o2.getNodeCode().split("-");
//
// if (workspaceNode1.length != 2 || workspaceNode2.length != 2) {
// return o1.getNodeCode().compareTo(o2.getNodeCode());
// }
//
// int prefix1 = Integer.parseInt(workspaceNode1[0]);
// int prefix2 = Integer.parseInt(workspaceNode2[0]);
// if (prefix1 != prefix2) {
// return Integer.compare(prefix1, prefix2);
// }
//
// int suffix1 = Integer.parseInt(workspaceNode1[1]);
// int suffix2 = Integer.parseInt(workspaceNode2[1]);
// return Integer.compare(suffix1, suffix2);
// });
workspaceNodeList.sort((o1, o2) -> {
String[] workspaceNode1 = o1.getNodeCode().split("-");
String[] workspaceNode2 = o2.getNodeCode().split("-");
if (o1.getNodeCode().contains("-M") || o2.getNodeCode().contains("-M")) {
return 0;
}
if (workspaceNode1.length != 2 || workspaceNode2.length != 2) {
return o1.getNodeCode().compareTo(o2.getNodeCode());
}
int prefix1 = Integer.parseInt(workspaceNode1[0]);
int prefix2 = Integer.parseInt(workspaceNode2[0]);
if (prefix1 != prefix2) {
return Integer.compare(prefix1, prefix2);
}
int suffix1 = Integer.parseInt(workspaceNode1[1]);
int suffix2 = Integer.parseInt(workspaceNode2[1]);
return Integer.compare(suffix1, suffix2);
});
NodeAllBase specialWorkspaceNode = workspaceNodeList.stream().filter(workspaceNode -> workspaceNode.getNodeCode().contains("-M")).findFirst().orElse(null);
log.info("specialWorkspaceNode为{}",specialWorkspaceNode);
if (specialWorkspaceNode != null) {
moveTargetToFirst(workspaceNodeList,specialWorkspaceNode.getUuid());
}
projectNodePo.setChildren(workspaceNodeList);
}
public static void moveTargetToFirst(List<NodeAllBase> nodeList, String targetId) {

View File

@@ -68,6 +68,7 @@ import org.apache.commons.lang3.ObjectUtils;
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.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -171,6 +172,10 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
// 临时文件存储目录
private final String tempFileDir = System.getProperty("user.dir") + "/csv_uploads/";
// 通过标识判断是否走查询现场视图逻辑0不查询1查询
@Value("${lyricFlag:1}")
private int lyricFlag;
private int getCurrentNodeDepth(NodeAllBase eachNode) {
String tag1 = eachNode.getTag1();
String tag2 = eachNode.getTag2();
@@ -602,9 +607,11 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
generateTaskTree(projectNodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList);
}
// 对工位进行排序,-M工位顺序排第一个
if (lyricFlag == 1) {
for (ProjectNodePo projectNodePo : realTopProjectNodeList) {
sortWorkspaceNode(projectNodePo);
}
}
return SdmResponse.success(realTopProjectNodeList.stream().flatMap(item -> item.getChildren().stream().filter(Objects::nonNull)).toList());
}
@@ -614,25 +621,6 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
return;
}
List<NodeAllBase> workspaceNodeList = children.stream().filter(node -> NodeTypeEnum.WORKSPACE.getValue().equals(node.getNodeType())).collect(Collectors.toList());
// 利元亨定制
// workspaceNodeList.sort((o1, o2) -> {
// String[] workspaceNode1 = o1.getNodeCode().split("-");
// String[] workspaceNode2 = o2.getNodeCode().split("-");
//
// if (workspaceNode1.length != 2 || workspaceNode2.length != 2) {
// return o1.getNodeCode().compareTo(o2.getNodeCode());
// }
//
// int prefix1 = Integer.parseInt(workspaceNode1[0]);
// int prefix2 = Integer.parseInt(workspaceNode2[0]);
// if (prefix1 != prefix2) {
// return Integer.compare(prefix1, prefix2);
// }
//
// int suffix1 = Integer.parseInt(workspaceNode1[1]);
// int suffix2 = Integer.parseInt(workspaceNode2[1]);
// return Integer.compare(suffix1, suffix2);
// });
if (CollectionUtils.isEmpty(workspaceNodeList)) {
for (NodeAllBase child : children) {
if (child instanceof ProjectNodePo) {
@@ -666,12 +654,35 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
}
}
// 对工位进行排序,-M工位顺序排第一个
workspaceNodeList = workspaceNodeList.stream().sorted(Comparator.comparing(NodeAllBase::getNodeCode)).collect(Collectors.toList());
workspaceNodeList.sort((o1, o2) -> {
if (o1.getNodeCode().contains("-M") || o2.getNodeCode().contains("-M")) {
return 0;
}
String[] workspaceNode1 = o1.getNodeCode().split("-");
String[] workspaceNode2 = o2.getNodeCode().split("-");
if (workspaceNode1.length != 2 || workspaceNode2.length != 2) {
return o1.getNodeCode().compareTo(o2.getNodeCode());
}
int prefix1 = Integer.parseInt(workspaceNode1[0]);
int prefix2 = Integer.parseInt(workspaceNode2[0]);
if (prefix1 != prefix2) {
return Integer.compare(prefix1, prefix2);
}
int suffix1 = Integer.parseInt(workspaceNode1[1]);
int suffix2 = Integer.parseInt(workspaceNode2[1]);
return Integer.compare(suffix1, suffix2);
});
NodeAllBase specialWorkspaceNode = workspaceNodeList.stream().filter(workspaceNode -> workspaceNode.getNodeCode().contains("-M")).findFirst().orElse(null);
log.info("specialWorkspaceNode为{}",specialWorkspaceNode);
if (specialWorkspaceNode != null) {
moveTargetToFirst(workspaceNodeList,specialWorkspaceNode.getUuid());
}
projectNodePo.setChildren(workspaceNodeList);
}
public static void moveTargetToFirst(List<NodeAllBase> nodeList, String targetId) {