From 7e332201c4d30e97fc4752e026bc0f6fb0ddf4c3 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 5 Dec 2022 15:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E6=9C=AA=E5=82=AC=E5=8A=9E=E8=BF=87?= =?UTF-8?q?=E7=9A=84=E4=BB=BB=E5=8A=A1=20=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=B7=B2=E8=B6=85=E8=BF=87=E9=A2=84=E7=BD=AE=E5=A4=A9?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/service/ActHistoryService.java | 16 +++++-- .../TAbilityApplicationController.java | 43 +++++++++++++++---- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index ade7d463..cce261f9 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -46,6 +46,7 @@ import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.InputStream; import java.time.LocalDate; +import java.time.ZoneId; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -398,9 +399,18 @@ public class ActHistoryService { if (nowTask.isPresent()) { // 存在正在进行的任务 LocalDate localDate = tRemindersService.selectRemindersTime(nowTask.get().getId()); if (localDate == null) { // 未进行过催办 - index.setAllowReminders(Boolean.TRUE); // 允许催办 - index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 - index.setNextRemindersDays(0); // 距离下次催办天数为0 + LocalDate taskCreateDate = nowTask.get().getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + long between = ChronoUnit.DAYS.between(taskCreateDate, LocalDate.now()); + if (between <= interval) { + logger.info("该任务未到允许催办的日期"); + index.setAllowReminders(Boolean.FALSE); // 不允许催办 + index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 + index.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数为 + } else { + index.setAllowReminders(Boolean.TRUE); // 允许催办 + index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 + index.setNextRemindersDays(0); // 距离下次催办天数为0 + } } else { // 进行过催办 long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数 if (between <= interval) { // 间隔天数小于限制天数 diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java index 988aa0ee..c4c9d9aa 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java @@ -60,6 +60,7 @@ import java.math.RoundingMode; import java.net.URLEncoder; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.concurrent.atomic.AtomicReference; @@ -206,9 +207,21 @@ public class TAbilityApplicationController { if (nowTask.isPresent()) { // 存在正在进行的任务 LocalDate localDate = tRemindersService.selectRemindersTime(nowTask.get().getId()); if (localDate == null) { // 未进行过催办 - index.setAllowReminders(Boolean.TRUE); // 允许催办 - index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 - index.setNextRemindersDays(0); // 距离下次催办天数为0 + LocalDate taskCreateDate = nowTask.get().getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + long between = ChronoUnit.DAYS.between(taskCreateDate, LocalDate.now()); + if (between <= interval) { + logger.info("该任务未到允许催办的日期"); + index.setAllowReminders(Boolean.FALSE); // 不允许催办 + index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 + index.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数为 + } else { + index.setAllowReminders(Boolean.TRUE); // 允许催办 + index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 + index.setNextRemindersDays(0); // 距离下次催办天数为0 + } +// index.setAllowReminders(Boolean.TRUE); // 允许催办 +// index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 +// index.setNextRemindersDays(0); // 距离下次催办天数为0 } else { // 进行过催办 long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数 if (between <= interval) { // 间隔天数小于限制天数 @@ -396,12 +409,24 @@ public class TAbilityApplicationController { logger.info("该流程最新task:" + nowTask.get().getId()); LocalDate localDate = tRemindersService.selectRemindersTime(nowTask.get().getId()); if (localDate == null) { // 最新流程未进行过催办 - allowReminders.set(Boolean.TRUE); - doneReminders.set(Boolean.FALSE); - nextRemindersDays.set(0); - index_.setAllowReminders(Boolean.TRUE); // 允许催办 - index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录 - index_.setNextRemindersDays(0); // 距离下次催办天数为0 + LocalDate taskCreateDate = nowTask.get().getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + long between = ChronoUnit.DAYS.between(taskCreateDate, LocalDate.now()); + if (between <= interval) { + logger.info("该任务未到允许催办的日期"); + index_.setAllowReminders(Boolean.FALSE); // 不允许催办 + index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录 + index_.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数为 + allowReminders.set(Boolean.FALSE); + doneReminders.set(Boolean.FALSE); + nextRemindersDays.set((int) (interval - between)); + } else { + allowReminders.set(Boolean.TRUE); + doneReminders.set(Boolean.FALSE); + nextRemindersDays.set(0); + index_.setAllowReminders(Boolean.TRUE); // 允许催办 + index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录 + index_.setNextRemindersDays(0); // 距离下次催办天数为0 + } } else { // 进行过催办 long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数 if (between <= interval) { // 间隔天数小于限制天数