From 31a9707d0a9bba96c1a67f26c89ff956a519125f Mon Sep 17 00:00:00 2001 From: LokerL Date: Tue, 29 Oct 2024 17:01:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E7=94=9F=E6=88=90-=E5=8E=82=E7=95=8C=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E5=89=8D=E5=90=8E=E7=AB=AF=EF=BC=8C=E9=83=A8=E5=88=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oil/controller/OilReportController.java | 62 + .../oil/domain/monitor/ThDeviceDeal.java | 136 ++ .../oil/mapper/ThDeviceDealMapper.java | 16 + .../project/oil/mapper/ThDeviceMapper.java | 7 + .../oil/mapper/ThDeviceReportMapper.java | 2 + .../oil/service/IOilThDeviceDealService.java | 9 + .../service/IOilThDeviceReportService.java | 2 + .../oil/service/IOilThDeviceService.java | 3 + .../impl/OilThDeviceDealServiceImpl.java | 18 + .../impl/OilThDeviceReportService.java | 5 + .../service/impl/OilThDeviceServiceImpl.java | 6 + .../resources/mybatis/oil/ThDeviceDeal.xml | 41 + .../resources/mybatis/oil/ThDeviceMapper.xml | 17 + .../mybatis/oil/ThDeviceReportMapper.xml | 36 + ruoyi-ui/src/api/report/index.js | 17 + .../src/views/reportGenerate/bound/index.vue | 1303 +++++------------ 16 files changed, 734 insertions(+), 946 deletions(-) create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDeviceDeal.java create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceDealService.java create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java create mode 100644 RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml create mode 100644 ruoyi-ui/src/api/report/index.js diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java new file mode 100644 index 0000000..e5ca76a --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java @@ -0,0 +1,62 @@ +package com.ruoyi.project.oil.controller; + +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.project.oil.service.IOilThDeviceDealService; +import com.ruoyi.project.oil.service.IOilThDeviceService; +import com.ruoyi.project.oil.service.impl.OilThDeviceReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/report") +public class OilReportController extends BaseController { + + @Autowired + IOilThDeviceService oilThDeviceService; + + @Autowired + IOilThDeviceDealService oilThDeviceDealService; + @Autowired + private OilThDeviceReportService oilThDeviceReportService; + + private int getDeviceCount(Long deptId, String year, Integer status) { + Map deviceCountMap = new HashMap<>(); + deviceCountMap.put("deptId", deptId); + deviceCountMap.put("year", year); + if (status != null) { + deviceCountMap.put("status", status); + } + return oilThDeviceService.countDevice(deviceCountMap); + } + + @GetMapping("/getBoundDashboardData") + public AjaxResult getBoundDashboardData(Long deptId, String year) { + Map resultMap = new HashMap<>(); + // 设备总数 + int deviceCount = getDeviceCount(deptId, year, null); + // 正常设备数 + int normalDeviceCount = getDeviceCount(deptId, year, 1); + // 异常设备数 + int abnormalDeviceCount = getDeviceCount(deptId, year, 0); + // 全年解决报警次数 +// int alarmSolveCountYear = oilThDeviceDealService.countThDeviceDealByYear(year); + resultMap.put("deviceCount", deviceCount); + resultMap.put("normalDeviceCount", normalDeviceCount); + resultMap.put("abnormalDeviceCount", abnormalDeviceCount); +// resultMap.put("alarmSolveCountYear", alarmSolveCountYear); + return AjaxResult.success(resultMap); + } + + @GetMapping("/getBoundTableData") + public AjaxResult getBoundTableData(Long deptId, String year) { + List> result = oilThDeviceReportService.selectOverLimitCountByYearAndDeptId(deptId, year); + return AjaxResult.success(result); + } +} diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDeviceDeal.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDeviceDeal.java new file mode 100644 index 0000000..b6b4e06 --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDeviceDeal.java @@ -0,0 +1,136 @@ +package com.ruoyi.project.oil.domain.monitor; + +import com.ruoyi.framework.web.domain.BaseEntity; + +import java.util.Date; + + +public class ThDeviceDeal extends BaseEntity { + private static final long serialVersionUID = 1L; + /** 表id */ + private Long id; + + /** 报警id */ + private Long reportId; + + /** 处理人id */ + private String dealUser; + + /** 处理方式 */ + private String dealWay; + + /** 处理时间 */ + private Date dealTime; + + /** 创建者 */ + private String createBy; + + /** 创建时间 */ + private Date createTime; + + /** 报警原因 */ + private String reason; + + /** 图片地址 */ + private String fileUrl; + + /** 1:正在处理 2:处理完成 */ + private Integer status; + + /** 备注 */ + private String remark; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getReportId() { + return reportId; + } + + public void setReportId(Long reportId) { + this.reportId = reportId; + } + + public String getDealUser() { + return dealUser; + } + + public void setDealUser(String dealUser) { + this.dealUser = dealUser; + } + + public String getDealWay() { + return dealWay; + } + + public void setDealWay(String dealWay) { + this.dealWay = dealWay; + } + + public Date getDealTime() { + return dealTime; + } + + public void setDealTime(Date dealTime) { + this.dealTime = dealTime; + } + + @Override + public String getCreateBy() { + return createBy; + } + + @Override + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + @Override + public Date getCreateTime() { + return createTime; + } + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + @Override + public String getRemark() { + return remark; + } + + @Override + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java new file mode 100644 index 0000000..73acd7c --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java @@ -0,0 +1,16 @@ +package com.ruoyi.project.oil.mapper; + + +import org.apache.ibatis.annotations.Param; + +import java.util.Map; + +/** + * @author Lenovo + * @description 针对表【th_device_deal】的数据库操作Mapper + * @createDate 2024-10-29 15:40:41 + * @Entity com.ruoyi.oil.domain.monitor.ThDeviceDeal + */ +public interface ThDeviceDealMapper { + int countThDeviceDealByYear(@Param("year") String year); +} diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceMapper.java index 62a594d..4f80736 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.project.oil.mapper; import com.ruoyi.project.oil.domain.monitor.ThDevice; import java.util.List; +import java.util.Map; /** * @author Lenovo @@ -28,6 +29,12 @@ public interface ThDeviceMapper { */ List selectDeviceList(ThDevice thDevice); + /** + * 设备统计 + * @return 设备统计 + */ + int countDevice(Map params); + } 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 72dea74..f03879d 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 @@ -78,4 +78,6 @@ public interface ThDeviceReportMapper { @MapKey("sn") List> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate); + @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/IOilThDeviceDealService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceDealService.java new file mode 100644 index 0000000..032ef2c --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceDealService.java @@ -0,0 +1,9 @@ +package com.ruoyi.project.oil.service; + +public interface IOilThDeviceDealService { + + /** + * 根据年份查询设备处理数量 + */ + int countThDeviceDealByYear(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 c4ab0b1..48d6047 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 @@ -13,4 +13,6 @@ public interface IOilThDeviceReportService { List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate); List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate); + + List> selectOverLimitCountByYearAndDeptId(Long deptId, String year); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceService.java index 817ca1c..37d054d 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceService.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceService.java @@ -56,4 +56,7 @@ public interface IOilThDeviceService { * @return 按月度统计的ds平均值 */ List> selectAllAvgByMonth(Long deptId, String month); + + + int countDevice(Map params); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java new file mode 100644 index 0000000..183bb5f --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java @@ -0,0 +1,18 @@ +package com.ruoyi.project.oil.service.impl; + +import com.ruoyi.project.oil.mapper.ThDeviceDealMapper; +import com.ruoyi.project.oil.service.IOilThDeviceDealService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class OilThDeviceDealServiceImpl implements IOilThDeviceDealService { + + @Autowired + private ThDeviceDealMapper thDeviceDealMapper; + + @Override + public int countThDeviceDealByYear(String year) { + return thDeviceDealMapper.countThDeviceDealByYear(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 65bafc5..81ad6b3 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 @@ -41,4 +41,9 @@ public class OilThDeviceReportService implements IOilThDeviceReportService { return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate)); } + @Override + public List> selectOverLimitCountByYearAndDeptId(Long deptId, String year) { + return camelCaseMapListKey(thDeviceReportMapper.selectOverLimitCountByYearAndDeptId(deptId, year)); + } + } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceServiceImpl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceServiceImpl.java index d7f16cb..cdf2732 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceServiceImpl.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceServiceImpl.java @@ -91,4 +91,10 @@ public class OilThDeviceServiceImpl implements IOilThDeviceService { return result; } + + @Override + public int countDevice(Map params) { + return thDeviceMapper.countDevice(params); + } + } diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml new file mode 100644 index 0000000..9bf1bb6 --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceMapper.xml index f8d3dbf..619eae9 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceMapper.xml @@ -120,4 +120,21 @@ #{deptId} + + 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 61525f2..ed2860b 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml @@ -210,4 +210,40 @@ 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/report/index.js b/ruoyi-ui/src/api/report/index.js new file mode 100644 index 0000000..4582bec --- /dev/null +++ b/ruoyi-ui/src/api/report/index.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +export function getBoundTableData(params) { + return request({ + url: '/report/getBoundTableData', + params: params, + method: 'get', + }) +} + +export function getBoundDashboardData(params) { + return request({ + url: '/report/getBoundDashboardData', + params: params, + method: 'get', + }) +} diff --git a/ruoyi-ui/src/views/reportGenerate/bound/index.vue b/ruoyi-ui/src/views/reportGenerate/bound/index.vue index 9e16304..dbd8522 100644 --- a/ruoyi-ui/src/views/reportGenerate/bound/index.vue +++ b/ruoyi-ui/src/views/reportGenerate/bound/index.vue @@ -1,959 +1,370 @@ - - + - \ No newline at end of file +} + From 2346ffc7c14b43251db9a5ee665270d9bea51953 Mon Sep 17 00:00:00 2001 From: LokerL Date: Tue, 29 Oct 2024 17:06:15 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E7=94=9F=E6=88=90-=E5=8E=82=E7=95=8C=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0PDF=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/reportGenerate/bound/index.vue | 164 +++++++----------- 1 file changed, 60 insertions(+), 104 deletions(-) diff --git a/ruoyi-ui/src/views/reportGenerate/bound/index.vue b/ruoyi-ui/src/views/reportGenerate/bound/index.vue index dbd8522..75b6f3a 100644 --- a/ruoyi-ui/src/views/reportGenerate/bound/index.vue +++ b/ruoyi-ui/src/views/reportGenerate/bound/index.vue @@ -1,5 +1,5 @@