Commit e4297db6 authored by KeYong's avatar KeYong

修改物联报表附件

parent edfe5a18
package com.yeejoin.equipmanage.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author keyong
* @title: ReportAlarmDto
* <pre>
* @description: TODO
* </pre>
* @date 2024/5/11 9:56
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReportAlarmDto {
private String equipmentSpecificId;
private String specificName;
private String location;
private String equipmentSpecificIndexName;
private String alamContent;
private BigDecimal alarmNum;
private String createDate;
private String updateDate;
private String type;
}
......@@ -11,6 +11,7 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipSpecificAlarmDTO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIotAlarmVO;
import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.vo.EquipAlarmLineVo;
import com.yeejoin.equipmanage.dto.ReportAlarmDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -235,5 +236,5 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
void clearAlarmData(@Param("equipmentSpecificId") Long equipmentSpecificId);
List<Map<String, Object>> getAlarmDetailByDate(@Param("bizOrgCode") String bizOrgCode, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sysId") Long sysId);
List<ReportAlarmDto> getAlarmDetailByDate(@Param("bizOrgCode") String bizOrgCode, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sysId") Long sysId);
}
......@@ -30,6 +30,7 @@ import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.controller.EquipmentDetailController;
import com.yeejoin.equipmanage.dto.ReportAlarmDto;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
......@@ -63,6 +64,7 @@ import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.lang.String.valueOf;
......@@ -1602,7 +1604,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 系统循环数据填充
ArrayList<Map<String, Object>> systemList = new ArrayList<>();
List<Map<String, Object>> attachAlarmList = new ArrayList<>();
List<ReportAlarmDto> attachAlarmList = new ArrayList<>();
if (!CollectionUtils.isEmpty(system)) {
// 换流站信息
if (!ObjectUtils.isEmpty(system.get(0).get("stationName"))){
......@@ -1622,7 +1624,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String startTime = StringUtil.isNotEmpty(startDate) ? org.apache.commons.lang3.StringUtils.trimToNull(startDate).substring(0, 10) + " 00:00:00" : null;
String endTime = StringUtil.isNotEmpty(endDate) ? org.apache.commons.lang3.StringUtils.trimToNull(endDate).substring(0, 10) + " 23:59:59" : null;
// 附件告警数据
List<Map<String, Object>> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startTime, endTime, Long.valueOf(String.valueOf(sys.get("id"))));
List<ReportAlarmDto> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startTime, endTime, Long.valueOf(String.valueOf(sys.get("id"))));
attachAlarmList.addAll(sysAlarmList);
// 系统名称
......@@ -1723,6 +1725,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map.put("datalist", systemList);
}
}
if (!CollectionUtils.isEmpty(attachAlarmList)) {
Map<String, List<ReportAlarmDto>> listMap = attachAlarmList.stream().collect(Collectors.groupingBy(ReportAlarmDto::getEquipmentSpecificId));
List<ReportAlarmDto> dtos = new ArrayList<>();
for (List<ReportAlarmDto> list : listMap.values()) {
dtos.addAll(list);
}
attachAlarmList = dtos;
}
map.put("attachAlarmList", attachAlarmList);
}else {
return null;
......@@ -1817,7 +1827,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map.put("time", startDate + "至" + endDate);
// 系统循环数据填充
ArrayList<Map<String, Object>> dataList = new ArrayList<>();
List<Map<String, Object>> attachAlarmList = new ArrayList<>();
List<ReportAlarmDto> attachAlarmList = new ArrayList<>();
for (Map<String, Object> system : systemList) {
HashMap<String, Object> systemData = new HashMap<>();
List<Map> collect = indicatorConfiguration.stream().
......@@ -1827,7 +1837,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String startTime = StringUtil.isNotEmpty(startDate) ? org.apache.commons.lang3.StringUtils.trimToNull(startDate).substring(0, 10) + " 00:00:00" : null;
String endTime = StringUtil.isNotEmpty(endDate) ? org.apache.commons.lang3.StringUtils.trimToNull(endDate).substring(0, 10) + " 23:59:59" : null;
// 附件告警数据
List<Map<String, Object>> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startTime, endTime, Long.valueOf(String.valueOf(system.get("id"))));
List<ReportAlarmDto> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startTime, endTime, Long.valueOf(String.valueOf(system.get("id"))));
attachAlarmList.addAll(sysAlarmList);
// 系统名称
......@@ -1944,6 +1954,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map.put("data", dataList);
}
}
if (!CollectionUtils.isEmpty(attachAlarmList)) {
Map<String, List<ReportAlarmDto>> listMap = attachAlarmList.stream().collect(Collectors.groupingBy(ReportAlarmDto::getEquipmentSpecificId));
List<ReportAlarmDto> dtos = new ArrayList<>();
for (List<ReportAlarmDto> list : listMap.values()) {
dtos.addAll(list);
}
attachAlarmList = dtos;
}
map.put("attachAlarmList", attachAlarmList);
}else {
return null;
......@@ -2024,7 +2042,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 系统循环数据填充
ArrayList<Map<String, Object>> dataList = new ArrayList<>();
List<Map<String, Object>> attachAlarmList = new ArrayList<>();
List<ReportAlarmDto> attachAlarmList = new ArrayList<>();
for (Map<String, Object> system : systemList) {
HashMap<String, Object> systemData = new HashMap<>();
List<Map> collect = indicatorConfiguration.stream().
......@@ -2034,7 +2052,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String startTime = StringUtil.isNotEmpty(startDate) ? org.apache.commons.lang3.StringUtils.trimToNull(startDate).substring(0, 10) + " 00:00:00" : null;
String endTime = StringUtil.isNotEmpty(endDate) ? org.apache.commons.lang3.StringUtils.trimToNull(endDate).substring(0, 10) + " 23:59:59" : null;
// 附件告警数据
List<Map<String, Object>> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startTime, endTime, Long.valueOf(String.valueOf(system.get("id"))));
List<ReportAlarmDto> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startTime, endTime, Long.valueOf(String.valueOf(system.get("id"))));
attachAlarmList.addAll(sysAlarmList);
// 系统名称
......@@ -2152,12 +2170,18 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map.put("data", dataList);
}
}
if (!CollectionUtils.isEmpty(attachAlarmList)) {
Map<String, List<ReportAlarmDto>> listMap = attachAlarmList.stream().collect(Collectors.groupingBy(ReportAlarmDto::getEquipmentSpecificId));
List<ReportAlarmDto> dtos = new ArrayList<>();
for (List<ReportAlarmDto> list : listMap.values()) {
dtos.addAll(list);
}
attachAlarmList = dtos;
}
map.put("attachAlarmList", attachAlarmList);
}else {
return null ;
}
return map;
}
......
......@@ -1601,15 +1601,17 @@
DELETE FROM wl_equipment_alarm_report_day WHERE equipment_specific_id = #{equipmentSpecificId};
</delete>
<select id="getAlarmDetailByDate" resultType="Map">
<select id="getAlarmDetailByDate" resultType="com.yeejoin.equipmanage.dto.ReportAlarmDto">
SELECT
wlesa.equipment_specific_id,
wlesa.equipment_specific_id AS equipmentSpecificId,
wlesa.equipment_specific_name AS specificName,
wlesa.location AS location,
wlesa.equipment_specific_index_name,
wlesa.equipment_specific_index_name AS equipmentSpecificIndexName,
concat(wlesa.equipment_specific_name, wlesa.equipment_specific_index_name) AS alamContent,
IFNULL(SUM(wlesa.frequency), 0) AS alarmNum,
DATE_FORMAT(wlesa.update_date, '%Y-%m-%d %H:%i:%s') AS createDate
wlesa.type AS type,
DATE_FORMAT(wlesa.update_date, '%Y-%m-%d %H:%i:%s') AS updateDate,
DATE_FORMAT(wlesa.create_date, '%Y-%m-%d %H:%i:%s') AS createDate
FROM
`wl_equipment_specific_alarm` `wlesa`
<where>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment