diff --git a/zayac-admin-agent/src/main/java/com/zayac/admin/schedule/DailyReport.java b/zayac-admin-agent/src/main/java/com/zayac/admin/schedule/DailyReport.java index a20e3e3d..c8986f75 100644 --- a/zayac-admin-agent/src/main/java/com/zayac/admin/schedule/DailyReport.java +++ b/zayac-admin-agent/src/main/java/com/zayac/admin/schedule/DailyReport.java @@ -450,7 +450,7 @@ public class DailyReport { AgentDataVisualListReq agentDataVisualListReq = AgentDataVisualListReq.builder().monthDate(reportDate).build(); deptUsers.forEach(deptUser -> tasks - .add(processDeptUser(deptUser, ministerUser, agentDataVisualListReq, reportDate))); + .add(processDeptUser(deptUser, ministerUser, assistants, agentDataVisualListReq, reportDate))); CompletableFuture allTasks = CompletableFuture.allOf(tasks.toArray(new CompletableFuture[0])); allTasks.join(); @@ -525,6 +525,8 @@ public class DailyReport { assistants.forEach(assistant -> { if (assistant.getNeedNotify() == DisEnableStatusEnum.ENABLE) { telegramMessageService.sendMessage(assistant.getBotToken(), assistant.getReportIds(), message); + telegramMessageService.sendMessage(assistant.getBotToken(), assistant.getReportIds(), String + .format("1组新增:%s\n在岗人数:", totals.get(1))); log.info("Sent report to assistant: {}", assistant.getUsername()); } }); @@ -546,6 +548,7 @@ public class DailyReport { */ private CompletableFuture processDeptUser(UserWithRolesAndAccountsResp deptUser, UserWithRolesAndAccountsResp ministerUser, + List assistants, AgentDataVisualListReq agentDataVisualListReq, LocalDate reportDate) { return CompletableFuture.runAsync(() -> { @@ -578,16 +581,32 @@ public class DailyReport { return null; } }).filter(Objects::nonNull).collect(Collectors.toList()); - // 构造消息体 String message = telegramMessageService.buildDailyReportMessage(agentDataList); - if (StrUtil.isNotBlank(message) && deptUser.getNeedNotify() == DisEnableStatusEnum.ENABLE) { String botToken = StrUtil.isEmpty(deptUser.getBotToken()) ? ministerUser.getBotToken() : deptUser.getBotToken(); telegramMessageService.sendMessage(botToken, deptUser.getReportIds(), message); } + // 发送消息给助理 + if (!CollUtil.isEmpty(assistants)) { + assistants.forEach(assistant -> { + if (assistant.getNeedNotify() == DisEnableStatusEnum.ENABLE) { + if (message.contains("ky3tg107101")) { + var assistantMsg = message.replace("ky3tg107101", "心食谱\nky3tg107101"); + assistantMsg = assistantMsg.replace("ky3tg107105", "信息网\nky3tg107105"); + int index = assistantMsg.indexOf("ky3tg107108"); + if (index != -1) { + assistantMsg = assistantMsg.substring(0, index + 1); + } + telegramMessageService.sendMessage(assistant.getBotToken(), assistant + .getReportIds(), assistantMsg); + } + } + }); + } + }, asyncTaskExecutor).exceptionally(ex -> { log.error("Error collecting and processing data", ex); return null;