fix[project]: 任务列表、数据查询二次查询修改

This commit is contained in:
2026-03-19 10:25:39 +08:00
parent db8c865c88
commit 3f84b63832
3 changed files with 77 additions and 2 deletions

View File

@@ -173,4 +173,34 @@ public class SpdmTaskListReq {
*/
private String tag10;
/**
* 利元亨定制,支持查询难度系数
*/
private String diffcult;
/**
* 利元亨定制,应达成进度
*/
private String shouldProgress;
/**
* 利元亨定制,实际达成进度
*/
private String actualProgress;
/**
* 利元亨定制,原因
*/
private String reason;
/**
* 利元亨定制,仿真准确度
*/
private String confidence;
/**
* 利元亨定制,风险系数
*/
private String riskFactor;
}

View File

@@ -1157,6 +1157,36 @@ public class TaskServiceImpl implements ITaskService {
}
}
/**
* 将String列表转换为Long列表
* @param stringList 原始字符串列表
* @return 转换后的Long列表自动过滤无效值无空指针异常
*/
public static List<Long> convertStringListToLongList(List<String> stringList) {
// 1. 判空避免传入null导致空指针
if (stringList == null || stringList.isEmpty()) {
return new ArrayList<>();
}
// 2. 流式转换:过滤无效值 + 安全转换
return stringList.stream()
// 过滤掉null和空字符串
.filter(str -> str != null && !str.trim().isEmpty())
// 尝试转换为Long转换失败则过滤掉
.map(str -> {
try {
return Long.valueOf(str.trim()); // trim()处理字符串前后空格
} catch (NumberFormatException e) {
// 转换失败时返回null后续过滤
return null;
}
})
// 过滤掉转换失败的null值
.filter(num -> num != null)
// 收集为Long列表
.collect(Collectors.toList());
}
@Override
public SdmResponse list(SpdmTaskListReq req) {
@@ -1205,9 +1235,9 @@ public class TaskServiceImpl implements ITaskService {
}
if (StringUtils.isNotBlank(req.getSubmitterName())) {
List<String> submitterNameList = Arrays.stream(req.getSubmitterName().split(",")).toList();
Map<Long, String> finalUserIdToNickNameMap = userIdToNickNameMap;
List<Long> submitterUserIdList = convertStringListToLongList(submitterNameList);
allTaskList = allTaskList.stream().filter(task -> task.getCreator() != null
&& submitterNameList.contains(finalUserIdToNickNameMap.get(task.getCreator()))).toList();
&& submitterUserIdList.contains(task.getCreator())).toList();
}
// 3. 节点标签过滤

View File

@@ -783,6 +783,12 @@
<if test="req.tag10 != null and req.tag10 != ''">
and tag10 = #{req.tag10}
</if>
<if test="req.diffcult != null and req.diffcult != ''">
and diffcult = #{req.diffcult}
</if>
<if test="req.confidence != null and req.confidence != ''">
and confidence = #{req.confidence}
</if>
<if test="(req.exeStatusList != null and req.exeStatusList.size > 0) or (req.todayTmrTasks != null and req.todayTmrTasks != '')">
and (
<choose>
@@ -906,6 +912,15 @@
<if test="req.expStatusValue != null and req.expStatusValue != ''">
and expStatus = #{req.expStatusValue}
</if>
<if test="req.tag10 != null and req.tag10 != ''">
and tag10 = #{req.tag10}
</if>
<if test="req.diffcult != null and req.diffcult != ''">
and diffcult = #{req.diffcult}
</if>
<if test="req.confidence != null and req.confidence != ''">
and confidence = #{req.confidence}
</if>
<if test="(req.exeStatusList != null and req.exeStatusList.size > 0) or (req.todayTmrTasks != null and req.todayTmrTasks != '')">
and (
<choose>