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 @@