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) { // 间隔天数小于限制天数