From 77185be5c125a6715876c72c003bb88d83dee71a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 5 Dec 2022 09:52:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=BD=E5=8A=9B=E7=94=B3=E8=AF=B7=E7=9A=84?= =?UTF-8?q?=E5=82=AC=E5=8A=9E=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TAbilityApplicationController.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) 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 1357ab78..8c46b07d 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 @@ -62,6 +62,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -366,7 +367,9 @@ public class TAbilityApplicationController { taskHandleDetailInfo = taskHandleDetailInfo_; } } - + AtomicReference allowReminders = new AtomicReference<>(Boolean.FALSE); // 是否允许催办 + AtomicReference doneReminders = new AtomicReference<>(Boolean.FALSE); // 是否已执行过催办 + AtomicReference nextRemindersDays = new AtomicReference<>(0); // 下次催办多少天后 taskHandleDetailInfo = taskHandleDetailInfo.stream().map(index_ -> { // 补充审核人部门名称 if (StringUtils.isNumeric(index_.getAssignee())) { SysUserDTO userDTO = sysUserService.get(Long.valueOf(index_.getAssignee())); @@ -377,7 +380,6 @@ public class TAbilityApplicationController { } } } - /** * 处理催办条件与催办信息 */ @@ -389,37 +391,51 @@ public class TAbilityApplicationController { .list() .stream() .findFirst(); // 尝试获取当前task - if (nowTask.isPresent()) { // 存在正在进行的任务 + if (nowTask.isPresent() && nowTask.get().getId().equals(index_.getTaskId())) { // 存在正在进行的任务 LocalDate localDate = tRemindersService.selectRemindersTime(nowTask.get().getId()); - if (localDate == null) { // 未进行过催办 + 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 } else { // 进行过催办 long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数 if (between <= interval) { // 间隔天数小于限制天数 + allowReminders.set(Boolean.FALSE); + doneReminders.set(Boolean.TRUE); + nextRemindersDays.set((int) (interval - between)); index_.setAllowReminders(Boolean.FALSE); // 不允许催办 index_.setDoneReminders(Boolean.TRUE); // 存在催办记录 index_.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数 } else { + allowReminders.set(Boolean.TRUE); + doneReminders.set(Boolean.TRUE); + nextRemindersDays.set(0); index_.setAllowReminders(Boolean.TRUE); // 不允许催办 index_.setDoneReminders(Boolean.TRUE); // 存在催办记录 index_.setNextRemindersDays(0); // 距离下次催办天数为0 } } } else { + allowReminders.set(Boolean.FALSE); + doneReminders.set(Boolean.FALSE); + nextRemindersDays.set(0); index_.setAllowReminders(Boolean.FALSE); index_.setDoneReminders(Boolean.FALSE); index_.setNextRemindersDays(0); } - return index_; }).collect(Collectors.toList()); boolean finalBackToFirst = backToFirst; List finalTaskHandleDetailInfo = taskHandleDetailInfo; - return new HashMap() { + return new LinkedHashMap() { { + put("allowReminders", allowReminders.get()); + put("doneReminders", doneReminders.get()); + put("nextRemindersDays", nextRemindersDays.get()); put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id put("resourceOwnerDept", tAbilityApplicationDTOList.get(0).getResourceOwnerDept()); // 资源所属部门信息 put("resources", resourceDTOS);//申请的该部门的能力资源