Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-05 09:53:06 +08:00
commit b1989791b0
1 changed files with 22 additions and 6 deletions

View File

@ -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<Boolean> allowReminders = new AtomicReference<>(Boolean.FALSE); // 是否允许催办
AtomicReference<Boolean> doneReminders = new AtomicReference<>(Boolean.FALSE); // 是否已执行过催办
AtomicReference<Integer> 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<HistoryDetailDTO> finalTaskHandleDetailInfo = taskHandleDetailInfo;
return new HashMap<String, Object>() {
return new LinkedHashMap<String, Object>() {
{
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);//申请的该部门的能力资源