查看能力申请详情时返回催办相关信息

This commit is contained in:
wangliwen 2022-12-05 09:20:37 +08:00
parent 5c3f32f313
commit 1a2d443bc0
2 changed files with 46 additions and 0 deletions

View File

@ -56,4 +56,14 @@ public class HistoryDetailDTO {
@ApiModelProperty(value = "受理人部门名称")
private String assigneeDeptName;
/**
* 催办功能增加字段
*/
@ApiModelProperty(value = "该流程的节点当前是否允许催办")
private Boolean allowReminders;
@ApiModelProperty(value = "该流程的节点当前是否已经进行过催办")
private Boolean doneReminders;
@ApiModelProperty(value = "该流程的节点需几天后进行催办")
private Integer nextRemindersDays;
}

View File

@ -377,6 +377,42 @@ public class TAbilityApplicationController {
}
}
}
/**
* 处理催办条件与催办信息
*/
Optional<Task> nowTask = taskService.createTaskQuery()
.processInstanceId(index_.getProcessInstanceId())
.orderByTaskCreateTime()
.desc()
.active()
.list()
.stream()
.findFirst(); // 尝试获取当前task
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
} else { // 进行过催办
long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数
if (between <= interval) { // 间隔天数小于限制天数
index_.setAllowReminders(Boolean.FALSE); // 不允许催办
index_.setDoneReminders(Boolean.TRUE); // 存在催办记录
index_.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数
} else {
index_.setAllowReminders(Boolean.TRUE); // 不允许催办
index_.setDoneReminders(Boolean.TRUE); // 存在催办记录
index_.setNextRemindersDays(0); // 距离下次催办天数为0
}
}
} else {
index_.setAllowReminders(Boolean.FALSE);
index_.setDoneReminders(Boolean.FALSE);
index_.setNextRemindersDays(0);
}
return index_;
}).collect(Collectors.toList());