Browse Source

推送消息中心代码优化

fuyuchuan 2 days ago
parent
commit
bc011bcfe9
1 changed files with 11 additions and 0 deletions
  1. 11 0
      flow-im/flow-im-entity/src/main/java/com/flow/job/SendUskyJob.java

+ 11 - 0
flow-im/flow-im-entity/src/main/java/com/flow/job/SendUskyJob.java

@@ -90,6 +90,12 @@ public class SendUskyJob {
             List<String> userNames = unSend.stream().map(Notify::getSender).collect(Collectors.toList());
             Map<String, String> userNamesMap = unSendUser(userNames).stream()
                     .collect(Collectors.toMap(User::getUsername, User::getName));
+            log.info("查询到的用户映射: {}", userNames);
+
+            if (!userNamesMap.containsKey(send.getSender())) {
+                log.error("用户 {} 的真实姓名未找到", send.getSender());
+                continue;
+            }
 
             JSONObject sendJson = new JSONObject()
                     .put("infoTypeName", "OA审批")
@@ -132,11 +138,16 @@ public class SendUskyJob {
 
     // 查询未发送消息的用户名与真实姓名
     public List<User> unSendUser(List<String> userNames) {
+
+        System.out.println(userNames);
+
         // 构建IN子句的参数占位符
         String inClause = userNames.stream()
                 .map(name -> "?")
                 .collect(Collectors.joining(", "));
 
+        System.out.println(inClause);
+
         String sql = "SELECT username, name FROM sys_user WHERE username IN (" + inClause + ")";
         return jdbcTemplate.query(
                 sql,