提交 b69f7b2d authored 作者: Matrix's avatar Matrix

[核查模块] 增加获取当前时间周期与下次任务之间时间的接口

上级 cfabf572
...@@ -43,6 +43,7 @@ import org.springframework.http.ResponseEntity; ...@@ -43,6 +43,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
...@@ -154,6 +155,19 @@ public class DeviceCheckController { ...@@ -154,6 +155,19 @@ public class DeviceCheckController {
} }
} }
@ApiOperation(value = "获取下一次自动核查任务执行的具体时间", notes = "获取下一次自动核查任务执行的具体时间")
@GetMapping("/task/next")
public Map<String, LocalDate> getNextTaskTime() {
return ImmutableMap.of("nextTaskTime", ccService.getNextTaskDate());
}
@ApiOperation(value = "获取当前自动核查的核查周期", notes = "monthly-月度,quarterly-季度,yearly-年度")
@GetMapping("/task/current")
public Map<String, String> getCurrentTaskPeriod() {
String periodName = ccService.getCurrentTaskPeriod().getCronExpression().name();
return ImmutableMap.of("currentTaskPeriod", periodName);
}
@ApiOperation(value = "发起自动核查", notes = "发起自动核查") @ApiOperation(value = "发起自动核查", notes = "发起自动核查")
@PostMapping("/auto") @PostMapping("/auto")
public ResultObj<Map<String, List<Integer>>> startAutoCheck() { public ResultObj<Map<String, List<Integer>>> startAutoCheck() {
......
...@@ -324,7 +324,8 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine ...@@ -324,7 +324,8 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
*/ */
@Override @Override
public DeviceCheckPeriod getCurrentTaskPeriod() { public DeviceCheckPeriod getCurrentTaskPeriod() {
return periodDao.findTopByOrderByIdDesc(); DeviceCheckPeriod tcp = periodDao.findTopByOrderByIdDesc();
return tcp == null ? new DeviceCheckPeriod(TaskPeriod.yearly) : tcp;
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论