能力申请每个任务节点加入催办信息与状态

This commit is contained in:
wangliwen 2022-12-05 16:08:46 +08:00
parent 7e332201c4
commit 19e6f7d5a4
1 changed files with 30 additions and 15 deletions

View File

@ -384,6 +384,15 @@ public class TAbilityApplicationController {
AtomicReference<Boolean> doneReminders = new AtomicReference<>(Boolean.FALSE); // 是否已执行过催办
AtomicReference<Integer> nextRemindersDays = new AtomicReference<>(0); // 下次催办多少天后
final Optional<Task> nowTaskRoot = taskService.createTaskQuery()
.processInstanceId(tAbilityApplicationDTOList.get(0).getInstanceId())
.orderByTaskCreateTime()
.desc()
.active()
.list()
.stream()
.findFirst(); // 尝试获取当前task
taskHandleDetailInfo = taskHandleDetailInfo.stream().map(index_ -> { // 补充审核人部门名称
if (StringUtils.isNumeric(index_.getAssignee())) {
SysUserDTO userDTO = sysUserService.get(Long.valueOf(index_.getAssignee()));
@ -399,6 +408,7 @@ public class TAbilityApplicationController {
*/
Optional<Task> nowTask = taskService.createTaskQuery()
.processInstanceId(index_.getProcessInstanceId())
.taskId(index_.getTaskId()) // 每个任务
.orderByTaskCreateTime()
.desc()
.active()
@ -413,16 +423,20 @@ public class TAbilityApplicationController {
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)); // 距离下次催办天数为
if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
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);
if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
allowReminders.set(Boolean.TRUE);
doneReminders.set(Boolean.FALSE);
nextRemindersDays.set(0);
}
index_.setAllowReminders(Boolean.TRUE); // 允许催办
index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录
index_.setNextRemindersDays(0); // 距离下次催办天数为0
@ -430,25 +444,26 @@ public class TAbilityApplicationController {
} 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));
if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
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);
if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
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);