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..dbcd15b --- /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/OilMonitorMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java index 943fbdd..0fa096c 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java @@ -114,5 +114,5 @@ public interface OilMonitorMapper { Integer querryDealTotal(@Param("reportId") Long reportId); - + Integer countThDeviceDealByYear(@Param("year") String year); } 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..c38a008 --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java @@ -0,0 +1,9 @@ +package com.ruoyi.project.oil.mapper; + + +import org.apache.ibatis.annotations.Param; + + +public interface ThDeviceDealMapper { + int selectThDeviceDealByYear(@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..984031b --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java @@ -0,0 +1,19 @@ +package com.ruoyi.project.oil.service.impl; + +import com.ruoyi.project.oil.mapper.OilMonitorMapper; +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 OilMonitorMapper oilMonitorMapper; + + @Override + public int countThDeviceDealByYear(String year) { + return oilMonitorMapper.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/OilMonitorMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml index 8603449..0413d70 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml @@ -471,4 +471,9 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea + + \ 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..695aab0 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,42 @@ 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..358add0 100644 --- a/ruoyi-ui/src/views/reportGenerate/bound/index.vue +++ b/ruoyi-ui/src/views/reportGenerate/bound/index.vue @@ -1,959 +1,286 @@ - - + - \ No newline at end of file +} +