From 6da28ea4f40d34b26dc6984ccd4c4ebbb0c107c6 Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Thu, 06 Nov 2025 06:10:49 +0000
Subject: [PATCH] 跨0点外出提交异常问题修改;对应换休修改;

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
index efc1284..e30a80f 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
@@ -1167,10 +1167,8 @@
             Map<String, String> robotParamMap = dictDetailRepository.findByDictName(Constant.WECOM_ROBOT_PARAM).stream().collect(Collectors.toMap(DictDetail::getLabel, DictDetail::getValue));
             if (robotParamMap.containsKey(Constant.REMIND_REPORT_WEBHOOK_KEY) && robotParamMap.containsKey(Constant.REMIND_REPORT_MSG)) {
                 // 发送消息
-                WxCpDefaultConfigImpl wxCpDefaultConfig = new WxCpDefaultConfigImpl();
-                wxCpDefaultConfig.setWebhookKey(robotParamMap.get(Constant.REMIND_REPORT_WEBHOOK_KEY));
-                wxCpService.setWxCpConfigStorage(wxCpDefaultConfig);
-                wxCpService.getGroupRobotService().sendText(robotParamMap.get(Constant.REMIND_REPORT_MSG), Arrays.asList("@all"), Arrays.asList());
+                String webhookUrl = wxCpService.getWxCpConfigStorage().getApiUrl("/cgi-bin/webhook/send?key=") + robotParamMap.get(Constant.REMIND_REPORT_WEBHOOK_KEY);
+                wxCpService.getGroupRobotService().sendText(webhookUrl, robotParamMap.get(Constant.REMIND_REPORT_MSG), Arrays.asList("@all"), Arrays.asList());
             }
         } catch (WxErrorException wxErrorException) {
             wxErrorException.printStackTrace();
@@ -1223,10 +1221,8 @@
             Map<String, String> robotParamMap = dictDetailRepository.findByDictName(Constant.WECOM_ROBOT_PARAM).stream().collect(Collectors.toMap(DictDetail::getLabel, DictDetail::getValue));
             if (robotParamMap.containsKey(Constant.REMIND_REPORT_WEBHOOK_KEY) && robotParamMap.containsKey(Constant.REMIND_REPORT_SUCCESS_MSG)) {
                 // 发送周报生成成功消息
-                WxCpDefaultConfigImpl wxCpDefaultConfig = new WxCpDefaultConfigImpl();
-                wxCpDefaultConfig.setWebhookKey(robotParamMap.get(Constant.REMIND_REPORT_WEBHOOK_KEY));
-                wxCpService.setWxCpConfigStorage(wxCpDefaultConfig);
-                wxCpService.getGroupRobotService().sendText(robotParamMap.get(Constant.REMIND_REPORT_SUCCESS_MSG), Arrays.asList("@all"), Arrays.asList());
+                String webhookUrl = wxCpService.getWxCpConfigStorage().getApiUrl("/cgi-bin/webhook/send?key=") + robotParamMap.get(Constant.REMIND_REPORT_WEBHOOK_KEY);
+                wxCpService.getGroupRobotService().sendText(webhookUrl, robotParamMap.get(Constant.REMIND_REPORT_SUCCESS_MSG), Arrays.asList("@all"), Arrays.asList());
             }
         } catch (WxErrorException wxErrorException) {
             wxErrorException.printStackTrace();
@@ -1386,6 +1382,9 @@
                         // 制作项目周报数据
                         Map<String, List<Record>> filterRecordMap = daliyMongoDtoList.stream().map(item -> {
                             Record record = recordInfo.getRecords().stream().filter(r -> {
+                                if (ObjectUtils.isEmpty(r.getValues().get("项目名称")) || StringUtils.isBlank(r.getValues().get("项目名称").toString())) {
+                                    return false;
+                                }
                                 LocalDate createDate = Instant.ofEpochMilli(Long.parseLong(r.getValues().get("提交日期").toString())).atZone(ZoneId.systemDefault()).toLocalDate();
                                 RecordOption projectNameRecord = ((List<?>) r.getValues().get("项目名称")).stream().map(o -> RecordOption.fromJson(gson.toJson(o))).findFirst().orElseGet(RecordOption::new);
                                 RecordCellUserValue submitterRecord = ((List<?>) r.getValues().get("提交人")).stream().map(o -> RecordCellUserValue.fromJson(gson.toJson(o))).findFirst().orElseGet(RecordCellUserValue::new);
@@ -1430,6 +1429,8 @@
                             record.setValues(values);
                             return record;
                         }).collect(Collectors.groupingBy(record -> StringUtils.isNotBlank(record.getRecordId()) ? "EDIT" : "CREATE"));
+                        // 待删除记录
+                        List<Record> recordDeleteList = recordInfo.getRecords().stream().filter(r -> ObjectUtils.isEmpty(r.getValues().get("项目名称")) || StringUtils.isBlank(r.getValues().get("项目名称").toString())).collect(Collectors.toList());
 
                         // 创建新纪录
                         List<Record> recordCreateList = filterRecordMap.getOrDefault("CREATE", Collections.emptyList());
@@ -1454,6 +1455,12 @@
                             // 提交记录
                             wxCpOaWeDocSmartsheetService.recordEdit(recordEditRequest);
                         }
+
+                        // 删除记录(仅限空数据)
+                        if (recordDeleteList.size() > 0) {
+                            List<String> recordIdDeleteList = recordDeleteList.stream().map(r -> r.getRecordId()).collect(Collectors.toList());
+                            wxCpOaWeDocSmartsheetService.recordDelete(reportParamMap.get(Constant.WEEKLY_REPORT_DOC_ID), weeklyReportProjectSheet.getSheetId(), recordIdDeleteList);
+                        }
                     } else {
                         System.out.println("项目周报子表不存在");
                     }

--
Gitblit v1.9.3