fix[project]: 任务列表、数据查询二次查询修改
This commit is contained in:
@@ -173,4 +173,34 @@ public class SpdmTaskListReq {
|
|||||||
*/
|
*/
|
||||||
private String tag10;
|
private String tag10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 利元亨定制,支持查询难度系数
|
||||||
|
*/
|
||||||
|
private String diffcult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 利元亨定制,应达成进度
|
||||||
|
*/
|
||||||
|
private String shouldProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 利元亨定制,实际达成进度
|
||||||
|
*/
|
||||||
|
private String actualProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 利元亨定制,原因
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 利元亨定制,仿真准确度
|
||||||
|
*/
|
||||||
|
private String confidence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 利元亨定制,风险系数
|
||||||
|
*/
|
||||||
|
private String riskFactor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
@Override
|
||||||
public SdmResponse list(SpdmTaskListReq req) {
|
public SdmResponse list(SpdmTaskListReq req) {
|
||||||
@@ -1205,9 +1235,9 @@ public class TaskServiceImpl implements ITaskService {
|
|||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(req.getSubmitterName())) {
|
if (StringUtils.isNotBlank(req.getSubmitterName())) {
|
||||||
List<String> submitterNameList = Arrays.stream(req.getSubmitterName().split(",")).toList();
|
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
|
allTaskList = allTaskList.stream().filter(task -> task.getCreator() != null
|
||||||
&& submitterNameList.contains(finalUserIdToNickNameMap.get(task.getCreator()))).toList();
|
&& submitterUserIdList.contains(task.getCreator())).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 节点标签过滤
|
// 3. 节点标签过滤
|
||||||
|
|||||||
@@ -783,6 +783,12 @@
|
|||||||
<if test="req.tag10 != null and req.tag10 != ''">
|
<if test="req.tag10 != null and req.tag10 != ''">
|
||||||
and tag10 = #{req.tag10}
|
and tag10 = #{req.tag10}
|
||||||
</if>
|
</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 != '')">
|
<if test="(req.exeStatusList != null and req.exeStatusList.size > 0) or (req.todayTmrTasks != null and req.todayTmrTasks != '')">
|
||||||
and (
|
and (
|
||||||
<choose>
|
<choose>
|
||||||
@@ -906,6 +912,15 @@
|
|||||||
<if test="req.expStatusValue != null and req.expStatusValue != ''">
|
<if test="req.expStatusValue != null and req.expStatusValue != ''">
|
||||||
and expStatus = #{req.expStatusValue}
|
and expStatus = #{req.expStatusValue}
|
||||||
</if>
|
</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 != '')">
|
<if test="(req.exeStatusList != null and req.exeStatusList.size > 0) or (req.todayTmrTasks != null and req.todayTmrTasks != '')">
|
||||||
and (
|
and (
|
||||||
<choose>
|
<choose>
|
||||||
|
|||||||
Reference in New Issue
Block a user