Merge branch 'main' of http://39.101.199.1:8888/gongjiale/gangkou
This commit is contained in:
commit
be16d6a901
|
@ -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<String, Object> 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<String, Object> 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<Map<String, Object>> result = oilThDeviceReportService.selectOverLimitCountByYearAndDeptId(deptId, year);
|
||||||
|
return AjaxResult.success(result);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -114,5 +114,5 @@ public interface OilMonitorMapper {
|
||||||
|
|
||||||
Integer querryDealTotal(@Param("reportId") Long reportId);
|
Integer querryDealTotal(@Param("reportId") Long reportId);
|
||||||
|
|
||||||
|
Integer countThDeviceDealByYear(@Param("year") String year);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.ruoyi.project.oil.mapper;
|
||||||
import com.ruoyi.project.oil.domain.monitor.ThDevice;
|
import com.ruoyi.project.oil.domain.monitor.ThDevice;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Lenovo
|
* @author Lenovo
|
||||||
|
@ -28,6 +29,12 @@ public interface ThDeviceMapper {
|
||||||
*/
|
*/
|
||||||
List<ThDevice> selectDeviceList(ThDevice thDevice);
|
List<ThDevice> selectDeviceList(ThDevice thDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备统计
|
||||||
|
* @return 设备统计
|
||||||
|
*/
|
||||||
|
int countDevice(Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,4 +78,6 @@ public interface ThDeviceReportMapper {
|
||||||
@MapKey("sn")
|
@MapKey("sn")
|
||||||
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||||
|
|
||||||
|
@MapKey("sn")
|
||||||
|
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(@Param("deptId") Long deptId, @Param("year") String year);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.ruoyi.project.oil.service;
|
||||||
|
|
||||||
|
public interface IOilThDeviceDealService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据年份查询设备处理数量
|
||||||
|
*/
|
||||||
|
int countThDeviceDealByYear(String year);
|
||||||
|
}
|
|
@ -13,4 +13,6 @@ public interface IOilThDeviceReportService {
|
||||||
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate);
|
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate);
|
||||||
|
|
||||||
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate);
|
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate);
|
||||||
|
|
||||||
|
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(Long deptId, String year);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,4 +56,7 @@ public interface IOilThDeviceService {
|
||||||
* @return 按月度统计的ds平均值
|
* @return 按月度统计的ds平均值
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> selectAllAvgByMonth(Long deptId, String month);
|
List<Map<String, Object>> selectAllAvgByMonth(Long deptId, String month);
|
||||||
|
|
||||||
|
|
||||||
|
int countDevice(Map<String, Object> params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,4 +41,9 @@ public class OilThDeviceReportService implements IOilThDeviceReportService {
|
||||||
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate));
|
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(Long deptId, String year) {
|
||||||
|
return camelCaseMapListKey(thDeviceReportMapper.selectOverLimitCountByYearAndDeptId(deptId, year));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,4 +91,10 @@ public class OilThDeviceServiceImpl implements IOilThDeviceService {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countDevice(Map<String, Object> params) {
|
||||||
|
return thDeviceMapper.countDevice(params);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
<select id="querryDealTotal" resultType="java.lang.Integer">
|
<select id="querryDealTotal" resultType="java.lang.Integer">
|
||||||
select count(*) from th_device_deal where report_id=#{reportId}
|
select count(*) from th_device_deal where report_id=#{reportId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countThDeviceDealByYear" parameterType="string" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(1) FROM th_device_deal
|
||||||
|
WHERE to_char(create_time, 'yyyy') = #{year}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -120,4 +120,21 @@
|
||||||
#{deptId}
|
#{deptId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countDevice" parameterType="map" resultType="int">
|
||||||
|
select count(1) from th_device d
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != ''">
|
||||||
|
AND d.dept_id IN (SELECT dept_id
|
||||||
|
FROM sys_dept START WITH dept_id = #{deptId}
|
||||||
|
CONNECT BY PRIOR dept_id = parent_id)
|
||||||
|
</if>
|
||||||
|
<if test="year != null and year != ''">
|
||||||
|
AND to_char(d.create_time, 'yyyy') = #{year}
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND d.status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -210,4 +210,42 @@
|
||||||
GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name, d.zt
|
GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name, d.zt
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 选择 某年year,每个deptId下的所有设备的每个月的超限次数(ds不在dbz和gbz范围内的行) -->
|
||||||
|
<select id="selectOverLimitCountByYearAndDeptId" parameterType="map" resultType="map">
|
||||||
|
SELECT d.sn,
|
||||||
|
td.address,
|
||||||
|
p.dept_name as "p",
|
||||||
|
pp.dept_name as "pp",
|
||||||
|
ppp.dept_name as "ppp",
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '01' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month1,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '02' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month2,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '03' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month3,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '04' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month4,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '05' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month5,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '06' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month6,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '07' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month7,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '08' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month8,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '09' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month9,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '10' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month10,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '11' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month11,
|
||||||
|
SUM(CASE WHEN TO_CHAR(d.report_time, 'MM') = '12' AND (TO_NUMBER(d.ds) > TO_NUMBER(d.gbz) OR TO_NUMBER(d.ds) < TO_NUMBER(d.dbz)) THEN 1 ELSE 0 END) AS month12
|
||||||
|
FROM th_device_report d
|
||||||
|
LEFT JOIN th_device td ON d.sn = td.sn
|
||||||
|
LEFT JOIN sys_dept p ON td.dept_id = p.dept_id
|
||||||
|
LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id
|
||||||
|
LEFT JOIN sys_dept ppp ON pp.parent_id = ppp.dept_id
|
||||||
|
WHERE d.sn IN (SELECT d.sn
|
||||||
|
FROM th_device d
|
||||||
|
LEFT JOIN sys_dept p ON d.dept_id = p.dept_id
|
||||||
|
WHERE d.dept_id IN (SELECT dept_id
|
||||||
|
FROM sys_dept START WITH dept_id = #{deptId}
|
||||||
|
CONNECT BY PRIOR dept_id = parent_id)
|
||||||
|
AND TO_CHAR(d.create_time, 'yyyy') = #{year}
|
||||||
|
)
|
||||||
|
AND TO_CHAR(d.report_time, 'YYYY') = #{year}
|
||||||
|
GROUP BY d.sn, td.address, p.dept_name, pp.dept_name, ppp.dept_name
|
||||||
|
ORDER BY p.dept_name, pp.dept_name, ppp.dept_name, d.sn
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -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',
|
||||||
|
})
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue