Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-01 15:17:31 +08:00
commit 37ca5ade65
4 changed files with 63 additions and 25 deletions

View File

@ -406,7 +406,7 @@ public class ActHistoryService {
if (between <= interval) { // 间隔天数小于限制天数
index.setAllowReminders(Boolean.FALSE); // 不允许催办
index.setDoneReminders(Boolean.TRUE); // 存在催办记录
index.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数为0
index.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数
} else {
index.setAllowReminders(Boolean.TRUE); // 不允许催办
index.setDoneReminders(Boolean.TRUE); // 存在催办记录

View File

@ -24,6 +24,7 @@ import io.renren.modules.processForm.dto.TAbilityApplicationV2DTO;
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
import io.renren.modules.processForm.excel.TAbilityApplicationExcel;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.reminders.service.TRemindersService;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.excel.census.config.CustomCellWriteHeightConfig;
import io.renren.modules.resource.excel.census.config.CustomCellWriteWeightConfig;
@ -57,7 +58,9 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
@ -98,6 +101,12 @@ public class TAbilityApplicationController {
@Value("${infrastructure.dept-can-apply-max}")
private Integer infrastructureMax;
@Value("${reminders.interval:7}") // 流程发起后多少天允许催办
private Integer interval;
@Autowired
private TRemindersService tRemindersService;
/**
* 根据能力资源id获取该能力申请使用分页
@ -142,14 +151,14 @@ public class TAbilityApplicationController {
PageData<TAbilityApplicationDTO> page = tAbilityApplicationService.page(params);
List<TAbilityApplicationDTO> list =
page.getList().stream().map(index -> {
String inStanceIdSql = String.format("SELECT DISTINCT instance_id FROM t_ability_application WHERE apply_flag = '%s' LIMIT 1", index.getApplyFlag());
Integer inStanceId =
jdbcTemplate.queryForObject(String.format("SELECT DISTINCT instance_id FROM t_ability_application WHERE apply_flag = '%s' LIMIT 1", index.getApplyFlag()), Integer.class);
jdbcTemplate.queryForObject(inStanceIdSql, Integer.class);
if (inStanceId == null) {
return index;
}
List<TAbilityApplicationDTO> dtos =
tAbilityApplicationService.getByInstanceId(inStanceId + "");
List<TAbilityApplicationDTO> dtos = tAbilityApplicationService.getByInstanceId(inStanceId + "");
if (!dtos.isEmpty()) {
dtos.stream()
.limit(1L)
@ -161,7 +170,6 @@ public class TAbilityApplicationController {
} else {
index.setSystem("视频资源申请:" + index.getSystem());
}
return;
}
});
}
@ -172,6 +180,35 @@ public class TAbilityApplicationController {
Boolean ended = jdbcTemplate.queryForObject(sql, Boolean.class);
index.setEnded(Boolean.TRUE.equals(ended));
}
/**
* 处理催办条件与催办信息
*/
Optional<Task> nowTask = taskService.createTaskQuery().processInstanceId(index.getInstanceId())
.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());
page.setList(list);

View File

@ -97,4 +97,15 @@ public class TAbilityApplicationDTO extends AuditingBaseDTO implements Serializa
@ApiModelProperty(value = "申请价格")
private BigDecimal applyPrice;
/**
* 催办功能增加字段
*/
@ApiModelProperty(value = "该流程的节点当前是否允许催办")
private Boolean allowReminders;
@ApiModelProperty(value = "该流程的节点当前是否已经进行过催办")
private Boolean doneReminders;
@ApiModelProperty(value = "该流程的节点需几天后进行催办")
private Integer nextRemindersDays;
}

View File

@ -49,16 +49,6 @@ public class TRemindersServiceImpl extends CrudServiceImpl<TRemindersDao, TRemin
@Value("${reminders.interval:7}") // 流程发起后多少天允许催办
private Integer interval;
// @Autowired
// private RestTemplate restTemplate;
// @Autowired
// private SysUserDao sysUserDao;
// @Autowired
// private SysNoticeUserService sysNoticeUserService;
// @Autowired
// private NoticeUntil noticeUntil;
// @Autowired
// private ActTaskService actTaskService;
@Autowired
protected HistoryService historyService;
@Autowired