🐞 fix: 报告生成-厂界在线部分细节调整

This commit is contained in:
LokerL 2024-11-01 15:10:00 +08:00
parent 0050fd0d27
commit 13a54ebcb6
7 changed files with 43 additions and 125 deletions

View File

@ -46,11 +46,11 @@ public class OilReportController extends BaseController {
// 异常设备数
int abnormalDeviceCount = getDeviceCount(deptId, year, 0);
// 全年解决报警次数
// int alarmSolveCountYear = oilThDeviceDealService.countThDeviceDealByYear(year);
int alarmSolveCountYear = oilThDeviceDealService.countThDeviceDealByYear(year);
resultMap.put("deviceCount", deviceCount);
resultMap.put("normalDeviceCount", normalDeviceCount);
resultMap.put("abnormalDeviceCount", abnormalDeviceCount);
// resultMap.put("alarmSolveCountYear", alarmSolveCountYear);
resultMap.put("alarmSolveCountYear", alarmSolveCountYear);
return AjaxResult.success(resultMap);
}

View File

@ -114,5 +114,5 @@ public interface OilMonitorMapper {
Integer querryDealTotal(@Param("reportId") Long reportId);
Integer countThDeviceDealByYear(@Param("year") String year);
}

View File

@ -3,14 +3,7 @@ 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);
int selectThDeviceDealByYear(@Param("year") String year);
}

View File

@ -1,5 +1,6 @@
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;
@ -9,10 +10,10 @@ import org.springframework.stereotype.Service;
public class OilThDeviceDealServiceImpl implements IOilThDeviceDealService {
@Autowired
private ThDeviceDealMapper thDeviceDealMapper;
private OilMonitorMapper oilMonitorMapper;
@Override
public int countThDeviceDealByYear(String year) {
return thDeviceDealMapper.countThDeviceDealByYear(year);
return oilMonitorMapper.countThDeviceDealByYear(year);
}
}

View File

@ -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 count(*) from th_device_deal where report_id=#{reportId}
</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>

View File

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.oil.mapper.ThDeviceDealMapper">
<parameterMap id="BaseParameterMap" type="com.ruoyi.project.oil.domain.monitor.ThDeviceDeal">
<parameter property="id" jdbcType="BIGINT" />
<parameter property="reportId" jdbcType="BIGINT" />
<parameter property="dealUser" jdbcType="VARCHAR" />
<parameter property="dealWay" jdbcType="VARCHAR" />
<parameter property="dealTime" jdbcType="TIMESTAMP" />
<parameter property="createBy" jdbcType="VARCHAR" />
<parameter property="createTime" jdbcType="TIMESTAMP" />
<parameter property="reason" jdbcType="VARCHAR" />
<parameter property="fileUrl" jdbcType="VARCHAR" />
<parameter property="status" jdbcType="INTEGER" />
<parameter property="remark" jdbcType="VARCHAR" />
</parameterMap>
<resultMap id="ThDeviceDealResultMap" type="com.ruoyi.project.oil.domain.monitor.ThDeviceDeal">
<id property="id" column="ID" jdbcType="BIGINT" />
<result property="reportId" column="REPORT_ID" jdbcType="BIGINT" />
<result property="dealUser" column="DEAL_USER" jdbcType="VARCHAR" />
<result property="dealWay" column="DEAL_WAY" jdbcType="VARCHAR" />
<result property="dealTime" column="DEAL_TIME" jdbcType="TIMESTAMP" />
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR" />
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP" />
<result property="reason" column="REASON" jdbcType="VARCHAR" />
<result property="fileUrl" column="FILE_URL" jdbcType="VARCHAR" />
<result property="status" column="STATUS" jdbcType="INTEGER" />
<result property="remark" column="REMARK" jdbcType="VARCHAR" />
</resultMap>
<select id="countThDeviceDealByYear" parameterType="map" resultType="int">
SELECT COUNT(1) FROM th_device_deal
WHERE to_char(create_time, 'yyyy') = #{year}
</select>
</mapper>

View File

@ -42,7 +42,7 @@
<el-col
v-for="item in group"
:key="item.label"
:span="8"
:span="24/rowTagNum"
style="display: flex; justify-content: center"
>
<div class="card">
@ -107,59 +107,8 @@ export default {
dept: null,
year: "",
total: 0,
tableData: [
{
deptName: "企业1",
sn: "SN001",
position: "位置1",
month1: 1,
month2: 2,
month3: 3,
month4: 4,
month5: 5,
month6: 6,
month7: 7,
month8: 8,
month9: 9,
month10: 10,
month11: 11,
month12: 12,
},
{
deptName: "企业2",
sn: "SN002",
position: "位置2",
month1: 1,
month2: 2,
month3: 3,
month4: 4,
month5: 5,
month6: 6,
month7: 7,
month8: 8,
month9: 9,
month10: 10,
month11: 11,
month12: 12,
},
{
deptName: "企业3",
sn: "SN003",
position: "位置3",
month1: 1,
month2: 2,
month3: 3,
month4: 4,
month5: 5,
month6: 6,
month7: 7,
month8: 8,
month9: 9,
month10: 10,
month11: 11,
month12: 12,
},
],
tableData: [],
rowTagNum: 4,
dashboardTag: [
{
label: "设备总数",
@ -171,26 +120,26 @@ export default {
key: "normalDeviceCount",
icon: "el-icon-help",
},
{
label: "异常设备数",
key: "abnormalDeviceCount",
icon: "el-icon-s-help",
},
// {
// label: "",
// key: "abnormalDeviceCount",
// icon: "el-icon-s-help",
// },
// {
// label: "",
// key: "alarmDeviceCount",
// icon: "el-icon-message-solid",
// },
// {
// label: "",
// key: "alarmCountYear",
// icon: "el-icon-s-marketing",
// },
// {
// label: "",
// key: "alarmSolveCountYear",
// icon: "el-icon-folder-checked",
// },
{
label: "全年报警次数",
key: "alarmCountYear",
icon: "el-icon-s-marketing",
},
{
label: "全年解决报警次数",
key: "alarmSolveCountYear",
icon: "el-icon-folder-checked",
},
// {
// label: "",
// key: "alarmUnsolvedCountYear",
@ -243,7 +192,7 @@ export default {
}
return newArr;
}
return splitArray(this.dashboardTag, 3);
return splitArray(this.dashboardTag, this.rowTagNum);
},
},
methods: {
@ -272,6 +221,17 @@ export default {
}).then((res) => {
if (res.code === 200) {
this.tableData = res.data;
console.log(this.tableData);
this.dashboardData.alarmCountYear = res.data.reduce((prev, cur) => {
for (let key in cur) {
if (key.includes("month")) {
prev += cur[key];
}
}
return prev;
},
0
);
}
});
@ -308,7 +268,7 @@ export default {
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
align-items: flex-end;
.card-content__title {
font-size: 14px;