From 2abd8ade56a04050c51e566e9af367bc828db0f8 Mon Sep 17 00:00:00 2001 From: LokerL Date: Sun, 15 Dec 2024 17:21:58 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=8A=A5=E8=AD=A6=E5=88=86?= =?UTF-8?q?=E6=9E=90-=E5=8E=82=E7=95=8C=E5=9C=A8=E7=BA=BF=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD1=EF=BC=9A=E4=B8=8B=E5=8F=91=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=9D=83=E9=99=90=EF=BC=8C=E5=8A=9F=E8=83=BD2=EF=BC=9A?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oil/controller/OilAnalysisController.java | 6 +- .../controller/OilStatisticsController.java | 6 ++ .../oil/mapper/ThDeviceReportMapper.java | 4 +- .../service/IOilThDeviceReportService.java | 4 +- .../impl/OilThDeviceReportService.java | 8 +- .../mybatis/oil/ThDeviceReportMapper.xml | 6 ++ ruoyi-ui/src/api/oil/device.js | 11 ++- .../src/components/DeviceSelect/index.vue | 96 +++++++++++++++++++ .../src/views/dataAnalysis/bound/index.vue | 23 ++++- 9 files changed, 149 insertions(+), 15 deletions(-) create mode 100644 ruoyi-ui/src/components/DeviceSelect/index.vue diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java index c752cbd..8eb603c 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java @@ -20,9 +20,9 @@ public class OilAnalysisController extends BaseController { private IOilThDeviceReportService oilThDeviceReportService; @GetMapping("/factoryBoundaryOnline") - public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate) { - List> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate); - List> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate); + public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate, String deviceSn) { + List> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn); + List> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn); Map resultMap = new HashMap<>(); resultMap.put("alarmCount", alarmCount); resultMap.put("alarmCountDesc", alarmCountDesc); 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 e3351a1..18602a4 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 @@ -43,6 +43,12 @@ public class OilStatisticsController extends BaseController { return getDataTable(devices); } + @GetMapping(value = "/getDeviceListByDeptId") + public TableDataInfo getDeviceListByDeptId(Long deptId) { + List devices = oilThDeviceService.selectDeviceListByDeptId(deptId); + return getDataTable(devices); + } + @GetMapping("/getDeviceReport") public TableDataInfo getDeviceReport(ThDeviceReport thDeviceReport) { if ("page".equals(thDeviceReport.getRemark())) { 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 d8c48ff..dd186b2 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 @@ -76,10 +76,10 @@ public interface ThDeviceReportMapper { List> dailyReportDataOverview(@Param("day") String day); @MapKey("day") - List> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate); + List> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn); @MapKey("sn") - List> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate); + List> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn); @MapKey("sn") List> selectOverLimitCountByYearAndDeptId(@Param("deptId") Long deptId, @Param("year") String year); 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 14a45e2..c181b47 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 @@ -12,9 +12,9 @@ public interface IOilThDeviceReportService { List> dailyReportDataOverview(String day); - List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate); + List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn); - List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate); + List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn); List> selectOverLimitCountByYearAndDeptId(Long deptId, String year); 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 528dcfe..cc70bc2 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 @@ -37,13 +37,13 @@ public class OilThDeviceReportService implements IOilThDeviceReportService { } @Override - public List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate) { - return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate)); + public List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn) { + return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn)); } @Override - public List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate) { - return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate)); + public List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn) { + return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn)); } @Override 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 a987737..f64b94d 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml @@ -201,6 +201,9 @@ CONNECT BY PRIOR dept_id = parent_id)) AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD') + + AND d.sn = #{deviceSn} + GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD') ORDER BY day @@ -230,6 +233,9 @@ AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD') AND (d.zt = '一级报警' OR d.zt = '二级报警') + + AND d.sn = #{deviceSn} + GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name, d.zt ORDER BY count DESC diff --git a/ruoyi-ui/src/api/oil/device.js b/ruoyi-ui/src/api/oil/device.js index 45af4d5..b2e74c3 100644 --- a/ruoyi-ui/src/api/oil/device.js +++ b/ruoyi-ui/src/api/oil/device.js @@ -116,4 +116,13 @@ export function deviceBackAdd(data) { method: 'post', data: data }) -} \ No newline at end of file +} + +// 根据部门id查询设备列表 +export function getDeviceListByDeptId(query) { + return request({ + url: '/statistics/getDeviceListByDeptId', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/components/DeviceSelect/index.vue b/ruoyi-ui/src/components/DeviceSelect/index.vue new file mode 100644 index 0000000..2f2695b --- /dev/null +++ b/ruoyi-ui/src/components/DeviceSelect/index.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/ruoyi-ui/src/views/dataAnalysis/bound/index.vue b/ruoyi-ui/src/views/dataAnalysis/bound/index.vue index fc380de..36f3aaf 100644 --- a/ruoyi-ui/src/views/dataAnalysis/bound/index.vue +++ b/ruoyi-ui/src/views/dataAnalysis/bound/index.vue @@ -18,6 +18,14 @@ > + + +
@@ -37,6 +45,7 @@