From 5c341d813332e9232a5ed1b6b9a2a4f236105f30 Mon Sep 17 00:00:00 2001 From: LokerL Date: Fri, 13 Sep 2024 10:21:03 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=9C=88=E5=BA=A6=E6=95=B0?= =?UTF-8?q?=E6=8D=AE-=E6=95=B0=E6=8D=AE=E8=AF=A6=E6=83=85=E5=89=8D?= =?UTF-8?q?=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OilStatisticsController.java | 28 ++ ruoyi-ui/src/api/statistics/monthData.js | 8 + .../dataStatistics/monthData/data-detail.vue | 252 +++++++++++++++++- 3 files changed, 277 insertions(+), 11 deletions(-) diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java index ec80d96..4917f63 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java @@ -130,4 +130,32 @@ public class OilStatisticsController extends BaseController { resultMap.put("monthReportDataOverviewDeviceDs", monthReportDataOverviewDeviceDs); return success(resultMap); } + + @GetMapping("/monthData/dataDetail") + public AjaxResult dataDetail(Long deptId, String month) { + // 本月ds均值 + List> currentMonthDs = oilThDeviceReportService.monthReportDataOverviewDeviceDs(deptId, month); + // 上月ds均值 + List> preMonthDs = oilThDeviceReportService.monthReportDataOverviewDeviceDs(deptId, getPreviousMonth(month)); + // 去年同月ds均值 + List> lastYearDs = oilThDeviceReportService.monthReportDataOverviewDeviceDs(deptId, getLastYearMonth(month)); + + Map resultMap = new HashMap<>(); + resultMap.put("currentMonthDs", currentMonthDs); + resultMap.put("preMonthDs", preMonthDs); + resultMap.put("lastYearDs", lastYearDs); + return success(resultMap); + } + + /** + * 获取去年同月 + * @param month 2024-09 + * @return 2023-09 + */ + private String getLastYearMonth(String month) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); + LocalDate date = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDate lastYearDate = date.minus(1, ChronoUnit.YEARS); + return lastYearDate.format(formatter); + } } diff --git a/ruoyi-ui/src/api/statistics/monthData.js b/ruoyi-ui/src/api/statistics/monthData.js index 8914817..71b7596 100644 --- a/ruoyi-ui/src/api/statistics/monthData.js +++ b/ruoyi-ui/src/api/statistics/monthData.js @@ -23,3 +23,11 @@ export function dataOverview(params) { method: 'get', }) } + +export function getDataDetail(params) { + return request({ + url: '/statistics/monthData/dataDetail', + params: params, + method: 'get', + }) +} diff --git a/ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue b/ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue index fc939fc..24d04a7 100644 --- a/ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue +++ b/ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue @@ -1,23 +1,253 @@