fix:项目编号同名校验

This commit is contained in:
2026-04-14 10:26:08 +08:00
parent d7f79f8154
commit 5c731420cb
3 changed files with 27 additions and 9 deletions

View File

@@ -234,13 +234,19 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
stopWatch.start("项目/阶段名称重名校验");
for (SpdmProjectNodeEditReq addNode : addNodeList) {
// 项目/阶段名称重名校验
if (CollectionUtils.isNotEmpty(this.lambdaQuery().eq(SimulationNode::getNodeName, addNode.getNodeName())
.eq(SimulationNode::getTenantId, tenantId)
.eq(SimulationNode::getNodeType, NodeTypeEnum.PROJECT.getValue()).list())) {
if (NodeTypeEnum.PROJECT.getValue().equals(addNode.getNodeType())) {
if (NodeTypeEnum.PROJECT.getValue().equals(addNode.getNodeType())) {
if (CollectionUtils.isNotEmpty(this.lambdaQuery().eq(SimulationNode::getNodeName, addNode.getNodeName())
.eq(SimulationNode::getTenantId, tenantId)
.eq(SimulationNode::getNodeType, NodeTypeEnum.PROJECT.getValue()).list())) {
return SdmResponse.failed("同名项目已存在,请检查");
}
if (CollectionUtils.isNotEmpty(this.lambdaQuery().eq(SimulationNode::getNodeCode, addNode.getNodeCode())
.eq(SimulationNode::getTenantId, tenantId)
.eq(SimulationNode::getNodeType, NodeTypeEnum.PROJECT.getValue()).list())) {
return SdmResponse.failed("项目编号已存在,请检查");
}
}
if (StringUtils.isNotBlank(addNode.getEndTime()) && StringUtils.isNotBlank(addNode.getBeginTime())) {
if (DateUtils.parse(addNode.getEndTime(), DateUtils.PATTERN_DEFAULT).before(DateUtils.parse(addNode.getBeginTime(), DateUtils.PATTERN_DEFAULT))) {
return SdmResponse.failed("计划结束时间不能早于计划开始时间");
@@ -351,14 +357,21 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
if (CollectionUtils.isNotEmpty(editNodeList)) {
for (SpdmNodeDetailReq editNode : editNodeList) {
// 项目/阶段名称重名校验
if (CollectionUtils.isNotEmpty(this.lambdaQuery().eq(SimulationNode::getNodeName, editNode.getNodeName())
.eq(SimulationNode::getNodeType, NodeTypeEnum.PROJECT.getValue())
.eq(SimulationNode::getTenantId, tenantId)
.ne(SimulationNode::getUuid, editNode.getUuid()).list())) {
if (NodeTypeEnum.PROJECT.getValue().equals(editNode.getNodeType())) {
if (NodeTypeEnum.PROJECT.getValue().equals(editNode.getNodeType())) {
if (CollectionUtils.isNotEmpty(this.lambdaQuery().eq(SimulationNode::getNodeName, editNode.getNodeName())
.eq(SimulationNode::getNodeType, NodeTypeEnum.PROJECT.getValue())
.eq(SimulationNode::getTenantId, tenantId)
.ne(SimulationNode::getUuid, editNode.getUuid()).list())) {
return SdmResponse.failed("同名项目已存在,请检查");
}
if (CollectionUtils.isNotEmpty(this.lambdaQuery().eq(SimulationNode::getNodeCode, editNode.getNodeCode())
.eq(SimulationNode::getTenantId, tenantId)
.eq(SimulationNode::getNodeType, NodeTypeEnum.PROJECT.getValue())
.ne(SimulationNode::getUuid, editNode.getUuid()).list())) {
return SdmResponse.failed("项目编号已存在,请检查");
}
}
if (StringUtils.isNotBlank(editNode.getEndTime()) && StringUtils.isNotBlank(editNode.getBeginTime())) {
if (DateUtils.parse(editNode.getEndTime(), DateUtils.PATTERN_DEFAULT).before(DateUtils.parse(editNode.getBeginTime(), DateUtils.PATTERN_DEFAULT))) {
return SdmResponse.failed("计划结束时间不能早于计划开始时间");

View File

@@ -3132,6 +3132,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public SdmResponse modifyWithApprove(ModifyProjectNode req) {
log.info("modifyWithApprove executing");
Long tenantId = ThreadLocalContext.getTenantId();

View File

@@ -1762,6 +1762,8 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
deleteFolder(new File(TEMP_REPORT_PATH + randomId));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void generateNewReport(SpdmReportReq req, HttpServletResponse response) {
log.info("生成自动化报告参数为:{}", req);
String randomId = RandomUtil.generateString(16);
@@ -1953,6 +1955,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
}
@Override
@Transactional(rollbackFor = Exception.class)
public SdmResponse editReport(EditReportReq req) {
log.info("编辑报告参数为:{}", req);
Long userId = ThreadLocalContext.getUserId();
@@ -2381,6 +2384,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
}
@Override
@Transactional(rollbackFor = Exception.class)
public void editReportAndDownload(EditReportReq req, HttpServletResponse response) {
log.info("编辑报告参数为:{}", req);
Long userId = ThreadLocalContext.getUserId();