!92 czh-20260725-增强自我排除逻辑并统一fastjson2
* Merge branch 'master' of gitee.com:sz_30/supervison-java into feature/… * czh-20260725-增强自我排除逻辑并统一fastjson2 * czh-20260724-即时通API接口改为sendBatch * czh-20260724-增加即时通请求体日志 * czh-20260724-IM模块统一使用fastjson2 * czh-20260724-添加bundle到gitignore * czh-20260724-增补意见即时通推送和回显功能
This commit is contained in:
+26
-11
@@ -104,7 +104,7 @@ public class TaskApprovalOpinionServiceImpl extends ServiceImpl<TaskApprovalOpin
|
||||
: getBizTitle(opinion.getTaskTaskId(), opinion.getProcessInstId());
|
||||
String content = "所领导" + (oConvertUtils.isNotEmpty(loginUser.getRealname()) ? loginUser.getRealname() : loginUser.getUsername())
|
||||
+ "增补意见:" + opinionText;
|
||||
List<String> handlerNames = getDistinctHandlerNames(opinion.getProcessInstId(), loginUser.getUsername());
|
||||
List<String> handlerNames = getDistinctHandlerNames(opinion.getProcessInstId(), loginUser.getUsername(), loginUser.getRealname());
|
||||
pushResult.put("pushed", !handlerNames.isEmpty());
|
||||
pushResult.put("toUsers", handlerNames);
|
||||
pushResult.put("content", content);
|
||||
@@ -287,7 +287,7 @@ public class TaskApprovalOpinionServiceImpl extends ServiceImpl<TaskApprovalOpin
|
||||
return "";
|
||||
}
|
||||
|
||||
private List<String> getDistinctHandlerNames(String processInstId, String excludeUserName) {
|
||||
private List<String> getDistinctHandlerNames(String processInstId, String excludeUserId, String excludeRealName) {
|
||||
if (jdbcTemplate == null || oConvertUtils.isEmpty(processInstId)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -295,19 +295,34 @@ public class TaskApprovalOpinionServiceImpl extends ServiceImpl<TaskApprovalOpin
|
||||
List<Map<String, Object>> rows = jdbcTemplate.queryForList(
|
||||
"select distinct op_user_id, op_user_name from task_approval_opinion where process_inst_id = ?",
|
||||
processInstId);
|
||||
Set<String> names = new LinkedHashSet<>();
|
||||
Set<String> userIds = new LinkedHashSet<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
Object nameVal = row.get("op_user_name");
|
||||
Object idVal = row.get("op_user_id");
|
||||
if (nameVal != null) {
|
||||
String name = String.valueOf(nameVal).trim();
|
||||
String userId = idVal != null ? String.valueOf(idVal).trim() : "";
|
||||
if (!name.isEmpty() && !userId.equals(excludeUserName)) {
|
||||
names.add(name);
|
||||
}
|
||||
Object nameVal = row.get("op_user_name");
|
||||
if (idVal == null) {
|
||||
continue;
|
||||
}
|
||||
String userId = String.valueOf(idVal).trim();
|
||||
if (userId.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String name = nameVal != null ? String.valueOf(nameVal).trim() : "";
|
||||
|
||||
// 主判断:工号匹配则排除(最可靠)
|
||||
if (userId.equals(excludeUserId)) {
|
||||
log.info("【增补意见-即时通推送】排除本人(工号匹配), userId: {}, name: {}", userId, name);
|
||||
continue;
|
||||
}
|
||||
// 辅助判断:姓名匹配则排除(防止工号异常等边界情况)
|
||||
if (oConvertUtils.isNotEmpty(excludeRealName) && name.equals(excludeRealName)) {
|
||||
log.info("【增补意见-即时通推送】排除本人(姓名匹配), name: {}, userId: {}", name, userId);
|
||||
continue;
|
||||
}
|
||||
userIds.add(userId);
|
||||
}
|
||||
return names.stream().collect(Collectors.toList());
|
||||
log.info("【增补意见-即时通推送】查询经办人完成, processInstId: {}, DB记录数: {}, 排除后: {}",
|
||||
processInstId, rows.size(), userIds.size());
|
||||
return userIds.stream().collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
log.debug("查询经办人失败, processInstId={}", processInstId, e);
|
||||
return Collections.emptyList();
|
||||
|
||||
Reference in New Issue
Block a user