Commit 9f7b27a4ba56b1a7f68970e02f2d9a492b7c4043
1 parent
652ffd0e
debug 抽取数据增强到按照指定时间段抽取
Showing
1 changed file
with
17 additions
and
5 deletions
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/debug/DebugController.java
@@ -40,14 +40,26 @@ public class DebugController { | @@ -40,14 +40,26 @@ public class DebugController { | ||
40 | @GetMapping("/run/publicReportData") | 40 | @GetMapping("/run/publicReportData") |
41 | @ControllerMethod("公共池报表数据准备") | 41 | @ControllerMethod("公共池报表数据准备") |
42 | public Message<Void> publicReportData(@RequestParam(required = false) Long groupId, | 42 | public Message<Void> publicReportData(@RequestParam(required = false) Long groupId, |
43 | - @RequestParam(required = false)Date date) { | 43 | + @RequestParam Date start,@RequestParam Date end) { |
44 | + if (end.after(new Date())){ | ||
45 | + end = new Date(); | ||
46 | + } | ||
47 | + if (start.after(end)){ | ||
48 | + throw new RuntimeException("开始时间大于结束时间"); | ||
49 | + } | ||
44 | if (Objects.isNull(groupId)) { | 50 | if (Objects.isNull(groupId)) { |
45 | groupId = 2L; | 51 | groupId = 2L; |
46 | } | 52 | } |
47 | - if (Objects.isNull(date)) { | ||
48 | - publicReportBizService.extracting(LocalDate.now().minusDays(1),groupId); | ||
49 | - } else { | ||
50 | - publicReportBizService.extracting(DateUtil.date2LocalDate(date),groupId); | 53 | + LocalDate dateStart = DateUtil.date2LocalDate(start); |
54 | + LocalDate dateEnd = DateUtil.date2LocalDate(end); | ||
55 | + log.info("入参dateStart: {}, dateEnd: {}",dateStart,dateEnd); | ||
56 | + if (dateStart.isBefore(dateEnd)){ | ||
57 | + while (dateStart.isBefore(dateEnd) || dateStart.isEqual(dateEnd)){ | ||
58 | + publicReportBizService.extracting(dateStart,groupId); | ||
59 | + dateStart = dateStart.plusDays(1); | ||
60 | + } | ||
61 | + }else { | ||
62 | + publicReportBizService.extracting(dateStart,groupId); | ||
51 | } | 63 | } |
52 | return success(); | 64 | return success(); |
53 | } | 65 | } |