1、修改现场对接接口
This commit is contained in:
@@ -324,5 +324,17 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
return nodeService.getChildrenDataList(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据节点id查询所有算例
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getRunListByNodeId")
|
||||
@Operation(summary = "根据节点id查询所有算例", description = "根据节点id查询所有算例")
|
||||
public SdmResponse getRunListByNodeId(@RequestBody @Validated SpdmQueryRunListReq req) {
|
||||
return nodeService.getRunListByNodeId(req);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpdmQueryRunListReq {
|
||||
|
||||
/**
|
||||
* 节点id
|
||||
*/
|
||||
private List<String> nodeIdList;
|
||||
|
||||
/**
|
||||
* 当前节点的tag标签
|
||||
*/
|
||||
@Pattern(
|
||||
regexp = "^(tag1|tag2|tag3|tag4|tag5|tag6|tag7|tag8|tag9|tag10)$",
|
||||
message = "queryTag只能传入tag1|tag2|tag3|tag4|tag5|tag6|tag7|tag8|tag9|tag10其中一个值"
|
||||
)
|
||||
@NotBlank(message = "queryTag不能为空")
|
||||
private String queryTag;
|
||||
|
||||
}
|
||||
@@ -79,4 +79,6 @@ public interface INodeService extends IService<SimulationNode> {
|
||||
|
||||
SdmResponse getChildrenDataList(SpdmQueryChildrenDataReq req);
|
||||
|
||||
SdmResponse getRunListByNodeId(SpdmQueryRunListReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@ import com.sdm.common.entity.enums.FilePermissionEnum;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.UpdatePermissionReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.utils.FilesUtil;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
@@ -101,6 +104,9 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
@Resource
|
||||
private SimulationNodeMapper nodeMapper;
|
||||
|
||||
@Autowired
|
||||
SysUserFeignClientImpl sysUserFeignClient;
|
||||
|
||||
/**
|
||||
* 判断字符串是否可以安全转换为Long类型
|
||||
*
|
||||
@@ -165,6 +171,13 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
|
||||
@Override
|
||||
public SdmResponse getProcessData(GetProcessDataReq req) {
|
||||
UserQueryReq userQueryReq = new UserQueryReq();
|
||||
userQueryReq.setUserId(ThreadLocalContext.getUserId());
|
||||
userQueryReq.setTenantId(ThreadLocalContext.getTenantId());
|
||||
SdmResponse<CIDUserResp> cidUserRespSdmResponse = sysUserFeignClient.queryUserDetail(userQueryReq);
|
||||
if (cidUserRespSdmResponse.getData() != null) {
|
||||
req.setJobNo(cidUserRespSdmResponse.getData().getUsername());
|
||||
}
|
||||
return lyricIntegrateService.getProcessData(req);
|
||||
}
|
||||
|
||||
@@ -223,8 +236,32 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
spdmAddDemandReq.setProgress(0);
|
||||
spdmAddDemandReq.setBeginTime(emulation.getPlanStartTime());
|
||||
spdmAddDemandReq.setEndTime(emulation.getClosedTime());
|
||||
spdmAddDemandReq.setProjectId(emulation.getProject());
|
||||
spdmAddDemandReq.setPhaseId(emulation.getProjectStage());
|
||||
|
||||
List<String> projectCodeList = todoInfoList.stream().map(LyricVTodoEmulationInfoDM::getProject).filter(StringUtils::isNotBlank).toList();
|
||||
List<SimulationNode> allNodeList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(projectCodeList)) {
|
||||
List<SimulationNode> allProjectNodeList = nodeService.lambdaQuery().in(SimulationNode::getNodeCode, projectCodeList).list();
|
||||
if (CollectionUtils.isNotEmpty(allNodeList)) {
|
||||
List<String> projectIdList = allProjectNodeList.stream().map(SimulationNode::getUuid).toList();
|
||||
allNodeList = nodeService.lambdaQuery().in(SimulationNode::getTag1,projectIdList).list();
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(allNodeList)) {
|
||||
String projectNode = emulation.getProject();
|
||||
String phaseNode = emulation.getProjectStage();
|
||||
String workspaceNode = emulation.getStationNum();
|
||||
Optional<SimulationNode> projectOptional = allNodeList.stream().filter(node -> node.getNodeCode().equals(projectNode)
|
||||
&& NodeTypeEnum.PROJECT.getValue().equals(node.getNodeType())).findFirst();
|
||||
Optional<SimulationNode> phaseOptional = allNodeList.stream().filter(node -> node.getNodeCode().equals(phaseNode)
|
||||
&& NodeTypeEnum.PHASE.getValue().equals(node.getNodeType())).findFirst();
|
||||
Optional<SimulationNode> workspaceOptional = allNodeList.stream().filter(node -> node.getNodeCode().equals(workspaceNode)
|
||||
&& NodeTypeEnum.WORKSPACE.getValue().equals(node.getNodeType())).findFirst();
|
||||
// 转换为project的uuid
|
||||
projectOptional.ifPresent(simulationNode -> spdmAddDemandReq.setProjectId(simulationNode.getUuid()));
|
||||
phaseOptional.ifPresent(simulationNode -> spdmAddDemandReq.setPhaseId(simulationNode.getUuid()));
|
||||
workspaceOptional.ifPresent(simulationNode -> spdmAddDemandReq.setNodeId(simulationNode.getUuid()));
|
||||
}
|
||||
spdmAddDemandReq.setCreateTime(curDateStr);
|
||||
spdmAddDemandReq.setDemandSource(SYNC_PROJECT_SOURCE);
|
||||
// 需求的额外属性
|
||||
SpdmDemandExtraReq extraReq1 = new SpdmDemandExtraReq();
|
||||
@@ -377,6 +414,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
extraReq42.setPropertyName("turnDownReason");
|
||||
extraReq42.setPropertyValue(emulation.getTurnDownReason());
|
||||
extras.add(extraReq42);
|
||||
extras = extras.stream().filter(extra -> StringUtils.isNotBlank(extra.getPropertyValue())).toList();
|
||||
|
||||
// 需求的成员
|
||||
// 仿真负责人
|
||||
@@ -435,11 +473,13 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
SdmResponse updatePermissionResponse = dataFeignClient.updatePermission(updatePermissionReq);
|
||||
log.info("手动同步需求时,更新用户权限的返回值为:{}", updatePermissionResponse);
|
||||
demandMapper.addDemandMember(allMemberList);
|
||||
for (SpdmDemandExtraReq extra : extras) {
|
||||
extra.setCreateTime(curDateStr);
|
||||
extra.setCreator(jobNumber);
|
||||
if (CollectionUtils.isNotEmpty(extras)) {
|
||||
for (SpdmDemandExtraReq extra : extras) {
|
||||
extra.setCreateTime(curDateStr);
|
||||
extra.setCreator(jobNumber);
|
||||
}
|
||||
demandMapper.addDemandExtra(extras);
|
||||
}
|
||||
demandMapper.addDemandExtra(extras);
|
||||
CreateDirReq createDirReq = new CreateDirReq();
|
||||
createDirReq.setUuId(uuid);
|
||||
createDirReq.setParentUuId(null);
|
||||
@@ -1117,6 +1157,13 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String jobNumber = ThreadLocalContext.getJobNumber();
|
||||
UserQueryReq userQueryReq = new UserQueryReq();
|
||||
userQueryReq.setUserId(ThreadLocalContext.getUserId());
|
||||
userQueryReq.setTenantId(ThreadLocalContext.getTenantId());
|
||||
SdmResponse<CIDUserResp> cidUserRespSdmResponse = sysUserFeignClient.queryUserDetail(userQueryReq);
|
||||
if (cidUserRespSdmResponse.getData() != null) {
|
||||
jobNumber = cidUserRespSdmResponse.getData().getUsername();
|
||||
}
|
||||
HkUploadFileReq uploadFileReq = new HkUploadFileReq();
|
||||
uploadFileReq.setFilePower("2456236750149124114");
|
||||
uploadFileReq.setWaterMarkFlag(false);
|
||||
@@ -1354,7 +1401,7 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
|
||||
return null;
|
||||
}
|
||||
for (SpdmProjectNodeEditReq node : addNodeList) {
|
||||
createDir(node.getUuid(), node.getNodeType(), req.getUuid(), node.getNodeName());
|
||||
createDir(node.getUuid(), node.getNodeType(), node.getPid(), node.getNodeName());
|
||||
}
|
||||
// 更新文件权限
|
||||
Long userId = ThreadLocalContext.getUserId();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sdm.project.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdm.common.common.ResultCode;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
@@ -513,12 +514,22 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
// preTag = entry.getKey() = "tag1"
|
||||
String preTag = entry.getKey();
|
||||
log.info("preTag为:{}", preTag);
|
||||
try {
|
||||
// entry.getValue() = "uuid1,uuid2"
|
||||
setTagProperty(addNode, preTag, entry.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
if (NodeTypeEnum.WORKSPACE.getValue().equals(currentNodeType) && "tag4".equals(preTag)) {
|
||||
try {
|
||||
// entry.getValue() = "uuid1,uuid2"
|
||||
setTagProperty(addNode, preTag, addNode.getPid());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
// entry.getValue() = "uuid1,uuid2"
|
||||
setTagProperty(addNode, preTag, entry.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(addNode.getUuid())) {
|
||||
@@ -567,20 +578,11 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
if (nodeMapper.addNodeBatch(addNodeList) <= 0) {
|
||||
return null;
|
||||
}
|
||||
if (projectOptional.isPresent()) {
|
||||
SpdmProjectNodeEditReq projectNode = projectOptional.get();
|
||||
// 创建项目节点的文件夹
|
||||
createDir(projectNode.getUuid(), projectNode.getNodeType(), null, projectNode.getNodeName());
|
||||
} else {
|
||||
List<ProjectNodePo> projectNodePoList = mapper.queryNodeListByNodeId(addNodeList.get(0).getPid());
|
||||
if (CollectionUtils.isEmpty(projectNodePoList)) {
|
||||
log.error("根据nodeId:{},未查询到项目节点", addNodeList.get(0).getPid());
|
||||
return null;
|
||||
}
|
||||
ProjectNodePo projectNodePo = projectNodePoList.get(0);
|
||||
String projectUuid = projectNodePo.getUuid();
|
||||
for (SpdmProjectNodeEditReq node : addNodeList) {
|
||||
createDir(node.getUuid(), node.getNodeType(), projectUuid, node.getNodeName());
|
||||
for (SpdmProjectNodeEditReq spdmProjectNodeEditReq : addNodeList) {
|
||||
if (NodeTypeEnum.PROJECT.getValue().equals(spdmProjectNodeEditReq.getNodeType())) {
|
||||
createDir(spdmProjectNodeEditReq.getUuid(), spdmProjectNodeEditReq.getNodeType(), null, spdmProjectNodeEditReq.getNodeName());
|
||||
}else {
|
||||
createDir(spdmProjectNodeEditReq.getUuid(), spdmProjectNodeEditReq.getNodeType(), spdmProjectNodeEditReq.getPid(), spdmProjectNodeEditReq.getNodeName());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(allNodeManagerList) && nodeMapper.addNodeMemberBatch(allNodeManagerList) <= 0) {
|
||||
@@ -2314,4 +2316,66 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return getChildrenNodeList(Collections.singletonList(nodeId),req.getNodeType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getRunListByNodeId(SpdmQueryRunListReq req) {
|
||||
List<String> nodeIdList = req.getNodeIdList();
|
||||
if (CollectionUtils.isEmpty(nodeIdList)) {
|
||||
return SdmResponse.failed("nodeIdList不能为空");
|
||||
}
|
||||
String queryTag = req.getQueryTag();
|
||||
// 1. 根据nodeId和tag,查询所有task
|
||||
LambdaQueryChainWrapper<SimulationTask> simulationTaskWrapper = simulationTaskService.lambdaQuery();
|
||||
switch (queryTag) {
|
||||
case "tag1" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag1,nodeIdList);
|
||||
break;
|
||||
case "tag2" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag2,nodeIdList);
|
||||
break;
|
||||
case "tag3" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag3,nodeIdList);
|
||||
break;
|
||||
case "tag4" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag4,nodeIdList);
|
||||
break;
|
||||
case "tag5" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag5,nodeIdList);
|
||||
break;
|
||||
case "tag6" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag6,nodeIdList);
|
||||
break;
|
||||
case "tag7" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag7,nodeIdList);
|
||||
break;
|
||||
case "tag8" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag8,nodeIdList);
|
||||
break;
|
||||
case "tag9" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag9,nodeIdList);
|
||||
break;
|
||||
case "tag10" :
|
||||
simulationTaskWrapper.in(SimulationTask::getTag10,nodeIdList);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
List<SimulationTask> tasklist = simulationTaskWrapper.list();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("total", 0);
|
||||
if (CollectionUtils.isEmpty(tasklist)) {
|
||||
jsonObject.put("list", new ArrayList<String>());
|
||||
return SdmResponse.success(jsonObject);
|
||||
}
|
||||
List<String> taskIdList = tasklist.stream().map(SimulationTask::getUuid).toList();
|
||||
List<SimulationRun> runList = simulationRunService.lambdaQuery().in(SimulationRun::getTaskId,taskIdList).list();
|
||||
if (CollectionUtils.isEmpty(runList)) {
|
||||
jsonObject.put("list", new ArrayList<String>());
|
||||
return SdmResponse.success(jsonObject);
|
||||
}
|
||||
// 2. 查询task下所有run
|
||||
jsonObject.put("total", runList.size());
|
||||
jsonObject.put("list", runList.stream().map(SimulationRun::getUuid).distinct().toList());
|
||||
return SdmResponse.success(jsonObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user