1、需求列表 bugfix

This commit is contained in:
2026-02-05 19:30:44 +08:00
parent 040943b89f
commit 957319eab8
3 changed files with 48 additions and 33 deletions

View File

@@ -28,13 +28,13 @@ public interface SimulationDemandMapper extends BaseMapper<SimulationDemand> {
List<SpdmDemandVo> getDemandList(@Param("tenantId") Long tenantId,@Param("req") SpdmDemandListReq req);
List<SpdmDemandVo> getDemandListNoPermission(@Param("req") SpdmDemandListReq req);
List<SpdmDemandVo> getDemandListNoPermission(@Param("tenantId") Long tenantId, @Param("req") SpdmDemandListReq req);
List<SpdmDemandMemberVo> getMemberList(@Param("demandIdList") List<String> demandIdList, @Param("memberType") Integer memberType);
SpdmDemandVo getDemandByName(@Param("tenantId") Long tenantId,@Param("demandName") String demandName);
SpdmDemandVo getDemandByNameNoPermission(@Param("demandName") String demandName);
SpdmDemandVo getDemandByNameNoPermission(@Param("tenantId") Long tenantId,@Param("demandName") String demandName);
List<SpdmDemandExtraVo> getDemandExtraList(@Param("demandIdList") List<String> demandIdList);

View File

@@ -623,14 +623,22 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
}
List<SpdmDemandMemberVo> eachDemandMemberList;
List<String> nodeIdList = new ArrayList<>();
List<String> projectIdList = demandList.stream().map(SpdmDemandVo::getProjectId).toList();
List<String> projectIdList = demandList.stream().map(SpdmDemandVo::getProjectId).filter(StringUtils::isNotBlank).toList();
List<String> phaseIdList = demandList.stream().map(SpdmDemandVo::getPhaseId).filter(StringUtils::isNotBlank).toList();
List<String> machineIdList = demandList.stream().map(SpdmDemandVo::getMachineId).filter(StringUtils::isNotBlank).toList();
List<String> workspaceIdList = demandList.stream().map(SpdmDemandVo::getWorkspaceId).filter(StringUtils::isNotBlank).toList();
if (CollectionUtils.isNotEmpty(projectIdList)) {
nodeIdList.addAll(projectIdList);
}
List<String> phaseIdList = demandList.stream().map(SpdmDemandVo::getPhaseId).toList();
if (CollectionUtils.isNotEmpty(phaseIdList)) {
nodeIdList.addAll(phaseIdList);
}
if (CollectionUtils.isNotEmpty(machineIdList)) {
nodeIdList.addAll(machineIdList);
}
if (CollectionUtils.isNotEmpty(workspaceIdList)) {
nodeIdList.addAll(workspaceIdList);
}
Map<String, List<SpdmNodeVo>> nodeMap = Map.of();
if (CollectionUtils.isNotEmpty(nodeIdList)) {
List<SpdmNodeVo> nodeList = nodeMapper.getNodeListByIds(nodeIdList);
@@ -1206,7 +1214,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
req.setCreateTime(curDateStr);
req.setUuid(RandomUtil.generateString(32));
SpdmDemandVo demandByName = mapper.getDemandByNameNoPermission(req.getDemandName());
SpdmDemandVo demandByName = mapper.getDemandByNameNoPermission(tenantId,req.getDemandName());
if (ObjectUtils.isNotEmpty(demandByName)) {
return SdmResponse.failed("需求名称:" + demandByName.getDemandName() + "已存在,请修改");
}
@@ -1719,9 +1727,10 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
@Override
public SdmResponse listNoPermission(SpdmDemandListReq req) {
Long tenantId = ThreadLocalContext.getTenantId();
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", new ArrayList<>());
List<SpdmDemandVo> demandList = mapper.getDemandListNoPermission(req);
List<SpdmDemandVo> demandList = mapper.getDemandListNoPermission(tenantId,req);
if (CollectionUtils.isEmpty(demandList)) {
log.error("未查询到需求");
return SdmResponse.success(jsonObject);
@@ -1894,14 +1903,22 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
}
List<SpdmDemandMemberVo> eachDemandMemberList;
List<String> nodeIdList = new ArrayList<>();
List<String> projectIdList = demandList.stream().map(SpdmDemandVo::getProjectId).toList();
List<String> projectIdList = demandList.stream().map(SpdmDemandVo::getProjectId).filter(StringUtils::isNotBlank).toList();
List<String> phaseIdList = demandList.stream().map(SpdmDemandVo::getPhaseId).filter(StringUtils::isNotBlank).toList();
List<String> machineIdList = demandList.stream().map(SpdmDemandVo::getMachineId).filter(StringUtils::isNotBlank).toList();
List<String> workspaceIdList = demandList.stream().map(SpdmDemandVo::getWorkspaceId).filter(StringUtils::isNotBlank).toList();
if (CollectionUtils.isNotEmpty(projectIdList)) {
nodeIdList.addAll(projectIdList);
}
List<String> phaseIdList = demandList.stream().map(SpdmDemandVo::getPhaseId).toList();
if (CollectionUtils.isNotEmpty(phaseIdList)) {
nodeIdList.addAll(phaseIdList);
}
if (CollectionUtils.isNotEmpty(machineIdList)) {
nodeIdList.addAll(machineIdList);
}
if (CollectionUtils.isNotEmpty(workspaceIdList)) {
nodeIdList.addAll(workspaceIdList);
}
Map<String, List<SpdmNodeVo>> nodeMap = Map.of();
if (CollectionUtils.isNotEmpty(nodeIdList)) {
List<SpdmNodeVo> nodeList = nodeMapper.getNodeListByIds(nodeIdList);

View File

@@ -194,31 +194,29 @@
</select>
<select id="getDemandListNoPermission" resultType="com.sdm.project.model.vo.SpdmDemandVo">
select * from simulation_demand
<trim prefix="WHERE" suffixOverrides ="and">
<if test="req.demandName != null and req.demandName != ''">
<bind name="searchKey1" value="'%' + req.demandName + '%'"/>
demand_name like #{searchKey1} and
</if>
<if test="req.projectId != null and req.projectId != ''">
project_id = #{req.projectId} and
</if>
<if test="req.phaseId != null and req.phaseId != ''">
phase_id = #{req.phaseId} and
</if>
<if test="req.demandType != null and req.demandType != ''">
demand_type = #{req.demandType} and
</if>
<if test="req.simType != null and req.simType != ''">
sim_type = #{req.simType} and
</if>
<if test='req.sortOrder != null and req.sortOrder == "0"'>
order by create_time
</if>
<if test='req.sortOrder != null and req.sortOrder == "1"'>
order by create_time desc
</if>
</trim>
select * from simulation_demand where tenant_id = #{tenantId}
<if test="req.demandName != null and req.demandName != ''">
<bind name="searchKey1" value="'%' + req.demandName + '%'"/>
and demand_name like #{searchKey1}
</if>
<if test="req.projectId != null and req.projectId != ''">
and project_id = #{req.projectId}
</if>
<if test="req.phaseId != null and req.phaseId != ''">
and phase_id = #{req.phaseId}
</if>
<if test="req.demandType != null and req.demandType != ''">
and demand_type = #{req.demandType}
</if>
<if test="req.simType != null and req.simType != ''">
and sim_type = #{req.simType}
</if>
<if test='req.sortOrder != null and req.sortOrder == "0"'>
order by create_time
</if>
<if test='req.sortOrder != null and req.sortOrder == "1"'>
order by create_time desc
</if>
</select>
</mapper>