From bf684bacbba3c32e9b60346cbd45e1433956a694 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 1 Dec 2022 15:17:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=BD=E5=8A=9B=E7=94=B3=E8=AF=B7=E5=82=AC?= =?UTF-8?q?=E5=8A=9E=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/service/ActHistoryService.java | 4 +- .../TAbilityApplicationController.java | 63 +++++++++++++++---- .../dto/TAbilityApplicationDTO.java | 11 ++++ .../service/impl/TRemindersServiceImpl.java | 10 --- 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index d5b1df4a..ade7d463 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -397,7 +397,7 @@ public class ActHistoryService { .orderByTaskCreateTime().desc().active().list().stream().findFirst(); // 尝试获取当前task if (nowTask.isPresent()) { // 存在正在进行的任务 LocalDate localDate = tRemindersService.selectRemindersTime(nowTask.get().getId()); - if (localDate == null) {// 未进行过催办 + if (localDate == null) { // 未进行过催办 index.setAllowReminders(Boolean.TRUE); // 允许催办 index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 index.setNextRemindersDays(0); // 距离下次催办天数为0 @@ -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); // 存在催办记录 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 67931a3c..fe7742c3 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 @@ -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 page = tAbilityApplicationService.page(params); List 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 dtos = - tAbilityApplicationService.getByInstanceId(inStanceId + ""); + List 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 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); @@ -489,7 +526,7 @@ public class TAbilityApplicationController { @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query", dataType = "INTEGER"), @ApiImplicitParam(name = "pageSize", value = "页数大小", paramType = "query", dataType = "INTEGER") }) - public Result getFundStatement (@ApiIgnore @RequestParam Map params) { + public Result getFundStatement(@ApiIgnore @RequestParam Map params) { return new Result().ok(tAbilityApplicationService.getFundStatement(params)); } @@ -557,14 +594,14 @@ public class TAbilityApplicationController { @GetMapping("/getDistrictFundStatement") @ApiOperation("获取区市资金报表") @LogOperation("获取区市资金报表") - public Result getDistrictFundStatement (Map params) { + public Result getDistrictFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getDistrictFundStatement(params)); } @GetMapping("/getComponentFundStatement") @ApiOperation("获取组件节约资金列表") @LogOperation("获取组件节约资金列表") - public Result getComponentFundStatement (Map params) { + public Result getComponentFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getComponentFundStatement(params)); } @@ -572,7 +609,7 @@ public class TAbilityApplicationController { @GetMapping("/getResourceFundStatement") @ApiOperation("获取应用资源节约资金列表") @LogOperation("获取应用资源节约资金列表") - public Result getResourceFundStatement (Map params) { + public Result getResourceFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getResourceFundStatement(params)); } @@ -580,7 +617,7 @@ public class TAbilityApplicationController { @GetMapping("/getInfrastructureFundStatement") @ApiOperation("获取基础设施节约资金列表") @LogOperation("获取基础设施节约资金列表") - public Result getInfrastructureFundStatement (Map params) { + public Result getInfrastructureFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getInfrastructureFundStatement(params)); } @@ -588,7 +625,7 @@ public class TAbilityApplicationController { @GetMapping("/getProvideDeptFundStatement") @ApiOperation("获取提供部门节约资金列表") @LogOperation("获取提供部门节约资金列表") - public Result getProvideDeptFundStatement (Map params) { + public Result getProvideDeptFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getProvideDeptFundStatement(params)); } @@ -596,7 +633,7 @@ public class TAbilityApplicationController { @GetMapping("/getApplyDeptFundStatement") @ApiOperation("获取申请部门节约资金列表") @LogOperation("获取申请部门节约资金列表") - public Result getApplyDeptFundStatement (Map params) { + public Result getApplyDeptFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getApplyDeptFundStatement(params)); } @@ -604,7 +641,7 @@ public class TAbilityApplicationController { @GetMapping("/getProvideDistrictFundStatement") @ApiOperation("获取提供区市节约资金列表") @LogOperation("获取提供区市节约资金列表") - public Result getProvideDistrictFundStatement (Map params) { + public Result getProvideDistrictFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getProvideDistrictFundStatement(params)); } @@ -612,7 +649,7 @@ public class TAbilityApplicationController { @GetMapping("/getApplyDistrictFundStatement") @ApiOperation("获取申请区市节约资金列表") @LogOperation("获取申请区市节约资金列表") - public Result getApplyDistrictFundStatement (Map params) { + public Result getApplyDistrictFundStatement(Map params) { return new Result().ok(tAbilityApplicationService.getApplyDistrictFundStatement(params)); } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationDTO.java b/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationDTO.java index 6ae34e8f..ac0d0f76 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/dto/TAbilityApplicationDTO.java @@ -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; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java index dec619f6..ce73e477 100644 --- a/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java @@ -49,16 +49,6 @@ public class TRemindersServiceImpl extends CrudServiceImpl