Sfoglia il codice sorgente

工作报告定时发送问题修复

fuyuchuan 9 mesi fa
parent
commit
c68e1dd8ed

+ 3 - 23
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java

@@ -502,13 +502,6 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
     @Override
     public void timedSending(LocalDateTime time) {
         log.info("定时报告任务开始---------------------------");
-        int messageCenterTotal = 0;
-        int messageCenterSuccess = 0;
-        int messageCenterFail = 0;
-
-        int dingTalkTotal = 0;
-        int dingTalkSuccess = 0;
-        int dingTalkFail = 0;
         LambdaQueryWrapper<PmWorkReport> reports = Wrappers.lambdaQuery();
         reports.eq(PmWorkReport::getReportStatus, 0)
                 .eq(PmWorkReport::getIsRegularlySend, 1)
@@ -523,7 +516,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
             LambdaQueryWrapper<PmWorkContent> reportContents = Wrappers.lambdaQuery();
             reportContents.in(PmWorkContent::getReportId, reportIds);
             List<PmWorkContent> pmWorkContentList = pmWorkContentMapper.selectList(reportContents);
-/*            for (PmWorkReport report : reportList) {
+            for (PmWorkReport report : reportList) {
                 Integer id = report.getId();
                 List<PmWorkContent> workContents = new ArrayList<>();
                 for (PmWorkContent content : pmWorkContentList) {
@@ -531,32 +524,21 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                     if (reportId.equals(id)) {
                         workContents.add(content);
                     }
-                }*/
-            for (PmWorkReport report : reportList) {
-                messageCenterTotal++;
-                Integer id = report.getId();
-                List<PmWorkContent> workContents = pmWorkContentList.stream()
-                        .filter(content -> content.getReportId().equals(id))
-                        .collect(Collectors.toList());
+                }
                 try {
                     dingTalkAndMessage.sendAsyncMessage(report);
-                    messageCenterSuccess++;
                 } catch (Exception e) {
                     log.error("定时报告" + report.getId() + "调用消息中心异常" + e);
-                    messageCenterFail++;
                 }
                 if (report.getSendDingTalk() == 1) {
-                    dingTalkTotal++;
                     try {
                         dingTalkAndMessage.sendDingTalkDailyReport(report, workContents);
-                        dingTalkSuccess++;
                     } catch (Exception e) {
                         log.error("定时报告" + report.getId() + "发送钉钉异常" + e);
-                        dingTalkFail++;
                     }
                 }
+
                 report.setReportStatus(1);
-                report.setSubmitDate(time);
                 pmWorkReportMapper.updateById(report);
                 receiveMessages(report.getCcTo(), report.getId());
             }
@@ -564,8 +546,6 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
             log.info("当前没有定时工作报告可发送");
         }
         log.info("定时报告任务结束---------------------------");
-        log.info("消息中心发送总数:{},成功:{},失败:{}", messageCenterTotal, messageCenterSuccess, messageCenterFail);
-        log.info("钉钉发送总数:{},成功:{},失败:{}", dingTalkTotal, dingTalkSuccess, dingTalkFail);
     }