From 56e0b23e1e087c3fed0f86a8e1b7abf9aa8b8f93 Mon Sep 17 00:00:00 2001 From: LokerL Date: Fri, 13 Sep 2024 19:20:40 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=AF=8F=E6=97=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=89=8D=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OilStatisticsController.java | 6 + .../oil/mapper/ThDeviceReportMapper.java | 7 + .../service/IOilThDeviceReportService.java | 2 + .../impl/OilThDeviceReportService.java | 5 + .../mybatis/oil/ThDeviceReportMapper.xml | 18 ++ ruoyi-ui/src/api/statistics/daily.js | 9 + ruoyi-ui/src/api/statistics/reportCenter.js | 1 - ruoyi-ui/src/utils/excel.js | 20 ++ .../src/views/dataStatistics/daily/index.vue | 176 ++++++++++++++++++ 9 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 ruoyi-ui/src/api/statistics/daily.js create mode 100644 ruoyi-ui/src/utils/excel.js 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 4917f63..44efe2d 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 @@ -158,4 +158,10 @@ public class OilStatisticsController extends BaseController { LocalDate lastYearDate = date.minus(1, ChronoUnit.YEARS); return lastYearDate.format(formatter); } + + @GetMapping("/dailyData") + public AjaxResult dailyData(String day) { + List> dailyReportDataOverview = oilThDeviceReportService.dailyReportDataOverview(day); + return success(dailyReportDataOverview); + } } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java index 2b64dd8..394ef2f 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java @@ -64,4 +64,11 @@ public interface ThDeviceReportMapper { */ @MapKey("month") List> monthReportDataOverviewDeviceDs(@Param("deptId") Long deptId, @Param("month") String month); + + /** + * 每日数据 + * @param day 日期 2024-08-30 + */ + @MapKey("day") + List> dailyReportDataOverview(@Param("day") String day); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java index 68d3ec8..809c6dc 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java @@ -7,4 +7,6 @@ public interface IOilThDeviceReportService { List> monthReportDataOverview(Long deptId, String month); List> monthReportDataOverviewDeviceDs(Long deptId, String month); + + List> dailyReportDataOverview(String day); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java index 5787db3..bdd02be 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java @@ -26,4 +26,9 @@ public class OilThDeviceReportService implements IOilThDeviceReportService { return camelCaseMapListKey(thDeviceReportMapper.monthReportDataOverviewDeviceDs(deptId, month)); } + @Override + public List> dailyReportDataOverview(String day) { + return camelCaseMapListKey(thDeviceReportMapper.dailyReportDataOverview(day)); + } + } diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml index 4b6e7d3..1d90452 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml @@ -159,4 +159,22 @@ GROUP BY d.sn, p.dept_name, pp.dept_name ORDER BY pp.dept_name, p.dept_name + + diff --git a/ruoyi-ui/src/api/statistics/daily.js b/ruoyi-ui/src/api/statistics/daily.js new file mode 100644 index 0000000..7f903ec --- /dev/null +++ b/ruoyi-ui/src/api/statistics/daily.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +export function getDailyData(params) { + return request({ + url: '/statistics/dailyData', + params: params, + method: 'get', + }) +} diff --git a/ruoyi-ui/src/api/statistics/reportCenter.js b/ruoyi-ui/src/api/statistics/reportCenter.js index ae93f32..9e4a0bd 100644 --- a/ruoyi-ui/src/api/statistics/reportCenter.js +++ b/ruoyi-ui/src/api/statistics/reportCenter.js @@ -1,7 +1,6 @@ import request from '@/utils/request' export function reportCenterApi(params) { - console.log(params); return request({ url: '/statistics/reportCenter', params: params, diff --git a/ruoyi-ui/src/utils/excel.js b/ruoyi-ui/src/utils/excel.js new file mode 100644 index 0000000..2cef1b5 --- /dev/null +++ b/ruoyi-ui/src/utils/excel.js @@ -0,0 +1,20 @@ +import * as XLSX from "xlsx"; + + +export function exportExcel(dom, fileName="导出文件") { + const xlsxParam = { raw: true };//转换成excel时,使用原始的格式 + let table; + if (!dom) { + return; + } + // dom是字符串 + if (typeof dom === "string") { + table = document.querySelector(dom).cloneNode(true); + } else { + table = dom.cloneNode(true); + } + let wb = XLSX.utils.table_to_book(table, xlsxParam); + + // 生成excel + XLSX.writeFile(wb, `${fileName.endsWith(".xlsx") ? fileName : fileName + ".xlsx"}`); +} diff --git a/ruoyi-ui/src/views/dataStatistics/daily/index.vue b/ruoyi-ui/src/views/dataStatistics/daily/index.vue index e69de29..c9e6d57 100644 --- a/ruoyi-ui/src/views/dataStatistics/daily/index.vue +++ b/ruoyi-ui/src/views/dataStatistics/daily/index.vue @@ -0,0 +1,176 @@ + + + + +