Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-05 14:17:35 +08:00
commit 1bb9540e86
1 changed files with 34 additions and 0 deletions

View File

@ -21,11 +21,19 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;
@ -40,11 +48,17 @@ import java.util.Map;
@RequestMapping("reminders/treminders")
@Api(tags = "催办信息")
public class TRemindersController {
private static final Logger logger = LoggerFactory.getLogger(TRemindersController.class);
@Autowired
private TRemindersService tRemindersService;
@Autowired
private SysUserService sysUserService;
@Autowired
protected TaskService taskService;
@Value("${reminders.interval:7}") // 流程发起后多少天允许催办
private Integer interval;
@GetMapping("page")
@ApiOperation("分页")
@ -72,8 +86,28 @@ public class TRemindersController {
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody TRemindersDTO dto) {
Task task = taskService.createTaskQuery().taskId(dto.getProcessTaskId().toString()).includeProcessVariables().singleResult();
LocalDate taskCreateDate = task.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
long between = ChronoUnit.DAYS.between(taskCreateDate, LocalDate.now());
if (between <= interval) {
logger.info("该任务未到允许催办的日期");
return new Result().error("该任务未到允许催办的日期");
}
LocalDate localDate = tRemindersService.selectRemindersTime(dto.getProcessTaskId().toString());
if (localDate == null) { // 未进行过催办
logger.info("允许催办");
} else { // 进行过催办
between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数
if (between <= interval) { // 间隔天数小于限制天数
logger.info("该任务已催办但未到允许再次发起催办时间");
return new Result().error("该任务已催办但未到允许再次发起催办时间");
} else {
logger.info("允许催办");
}
}
UserDetail user = SecurityUser.getUser();
SysUserDTO userDTO = sysUserService.get(user.getId());
dto.setProcessTaskStats(1);
dto.setSponsor(userDTO);
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);