Commit 90fda53a authored by litengwei's avatar litengwei

物理报表问题修复

parent edfe5a18
......@@ -105,8 +105,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
String indicator = String.valueOf(collect.get(0).get("index"));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
}
});
}
......@@ -136,8 +136,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
String indicator = String.valueOf(collect.get(0).get("index"));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
}
});
}
......
......@@ -1682,7 +1682,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
Map<String, Object> summarize = fireFightingSystemMapper.selectMonthSummarize(startDate.substring(0, 7), String.valueOf(sys.get("id")));
if (!ObjectUtils.isEmpty(summarize)) {
systemData.put("summarize", ObjectUtils.isEmpty(summarize.get("summary_info")) ? "" : String.valueOf(summarize.get("summary_info")));
} else {
systemData.put("summarize", "");
}
......@@ -1691,10 +1690,16 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String[] split = indicator.split(",");
List<String> indicatorList = Arrays.asList(split);
List<Map<String, Object>> pieChartList = fireFightingSystemMapper.selectMonthPieChart(String.valueOf(sys.get("code")), startDate, endDate);
List<Map<String, Object>> pieChartListTwo = fireFightingSystemMapper.selectMonthPieChartTwo(String.valueOf(sys.get("code")), startDate, endDate, indicatorList);
List<Map<String, Object>> pieChartListTwo = fireFightingSystemMapper.selectMonthPieChartTwo(String.valueOf(sys.get("code")), startDate, endDate, new ArrayList<>());
List<Map<String, Object>> selectMonthPolyline = fireFightingSystemMapper.selectMonthPolyline(String.valueOf(sys.get("code")), startDate, endDate, new ArrayList<>());
List<Map<String, Object>> selectMonthPolyline = fireFightingSystemMapper.selectMonthPolyline(String.valueOf(sys.get("code")), startDate, endDate, indicatorList);
log.info("===========rrrrrrrrrr,{}",JSONObject.toJSONString(pieChartList));
log.info("===========ssssssssss,{}",JSONObject.toJSONString(pieChartListTwo));
log.info("===========aaaaaaaaaa,{}",JSONObject.toJSONString(selectMonthPolyline));
String pieChart = ChartsUtils.pieChart(pieChartList, "故障设备类型占比");
systemData.put("bing1", pieChart);
......@@ -1866,7 +1871,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// listItem.put("alarmEquipNum", ObjectUtils.isEmpty(weekItem.get("alarmEquipNum")) ? "" : String.valueOf(weekItem.get("alarmEquipNum")));
// 7日告警条数
if (!ObjectUtils.isEmpty(weekItem.get("type_code")) && !ObjectUtils.isEmpty(weekItem.get("code"))) {
Integer integer = fireFightingSystemMapper.selectAlarms(valueOf(system.get("id")), valueOf(weekItem.get("type_code")), valueOf(weekItem.get("code")), startDate, endDate, indicatorList);
Integer integer = fireFightingSystemMapper.selectAlarms(valueOf(system.get("id")), valueOf(weekItem.get("type_code")), valueOf(weekItem.get("code")), startDate, endDate, new ArrayList<>());
listItem.put("trueNum", String.valueOf(integer));
} else {
listItem.put("trueNum", String.valueOf(0));
......@@ -1891,7 +1896,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
// 总结
Map<String, Object> summarize = fireFightingSystemMapper.selectWeekSummarize(valueOf(system.get("id")), startDate, endDate, indicatorList);
Map<String, Object> summarize = fireFightingSystemMapper.selectWeekSummarize(valueOf(system.get("id")), startDate, endDate, new ArrayList<>());
// if (!ObjectUtils.isEmpty(summarize.get("contant"))) {
// systemData.put("summarize", String.valueOf(summarize.get("contant")));
// } else {
......@@ -1935,7 +1940,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String pieChart2 = ChartsUtils.pieChart(weekEchart, "故障设备类型占比");
systemData.put("pictureCenter", pieChart2);
List<Map<String, Object>> linesEchart = fireFightingSystemMapper.selectWeekLinesEchart(valueOf(system.get("code")), startDate, endDate, indicatorList);
List<Map<String, Object>> linesEchart = fireFightingSystemMapper.selectWeekLinesEchart(valueOf(system.get("code")), startDate, endDate, new ArrayList<>());
String lines = ChartsUtils.manyLineChart(linesEchart, "报警趋势", "日期", "报警数量", "week");
systemData.put("lines", lines);
......@@ -1956,6 +1961,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public String iotWeekReport(String bizOrgCode, String startDate, String endDate) {
Map<String, Object> dataMap = getWeekData(bizOrgCode, startDate, endDate);
log.info("===========ddddddd,{}",JSONObject.toJSONString(dataMap));
if (dataMap == null) {
return null;
}
......@@ -2068,8 +2074,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 日告警设备数
listItem.put("alarmEquipNum", ObjectUtils.isEmpty(weekItem.get("alarmEquipNum")) ? "" : String.valueOf(weekItem.get("alarmEquipNum")));
// 日告警条数
log.info("==========sbco={}", weekItem.get("type_code").toString());
log.info("==========sbCC={}", weekItem.get("code").toString());
if (!ObjectUtils.isEmpty(weekItem.get("type_code")) && !ObjectUtils.isEmpty(weekItem.get("code"))) {
Integer integer = fireFightingSystemMapper.selectAlarms(valueOf(system.get("id")), valueOf(weekItem.get("type_code")), valueOf(weekItem.get("code")), startDate, endDate, indicatorList);
Integer integer = fireFightingSystemMapper.selectAlarms(valueOf(system.get("id")), valueOf(weekItem.get("type_code")), valueOf(weekItem.get("code")), startDate, endDate, new ArrayList<>());
listItem.put("trueNum", String.valueOf(integer));
} else {
listItem.put("trueNum", String.valueOf(0));
......@@ -2077,6 +2085,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// if (Integer.parseInt(listItem.get("trueNum").toString()) == 0) {
// continue;
// }
if (!ObjectUtils.isEmpty(weekItem.get("type_code")) && String.valueOf(weekItem.get("type_code")).endsWith("Fault")){
if (!ObjectUtils.isEmpty(binMap) && !ObjectUtils.isEmpty(listItem.get("name")) && binMap.containsKey(String.valueOf(listItem.get("name")))){
int newValue = Integer.parseInt(String.valueOf(listItem.get("alarmEquipNum")));
......@@ -2112,7 +2121,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
// 总结
Map<String, Object> summarize = fireFightingSystemMapper.selectDaySummarize(valueOf(system.get("id")), startDate, endDate, indicatorList);
Map<String, Object> summarize = fireFightingSystemMapper.selectDaySummarize(valueOf(system.get("id")), startDate, endDate, new ArrayList<>());
// if (!ObjectUtils.isEmpty(summarize.get("contant"))) {
// systemData.put("summarize", String.valueOf(summarize.get("contant")));
// } else {
......@@ -2124,6 +2133,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// echarts 图表
List<Map<String, Object>> mapList = fireFightingSystemMapper.selectDayEquipEchart(valueOf(system.get("code")), startDate, endDate);
log.info("77777777777777,{}" ,JSONObject.toJSONString(alarmMapList));
String pieChart1 = ChartsUtils.pieChart(alarmMapList, "故障设备类型占比");
// List<Map<String, Object>> dayEcharts = fireFightingSystemMapper.selectDayEchart(valueOf(system.get("id")), startDate, indicatorList);
......@@ -2164,6 +2175,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public String iotDayReport(String bizOrgCode, String startDate, String endDate) {
Map<String, Object> dataMap = getDayData(bizOrgCode, startDate, endDate);
log.info("===========ddddddd,{}",JSONObject.toJSONString(dataMap));
if (dataMap == null){
return null;
}
......
......@@ -495,8 +495,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
indexStateList.add(createIndexStateVo(equipmentSpeIndex));
// 添加指标报告
saveEquipmentAlarmReportDay(equipmentSpeIndex);
// 火眼数据构造告警指标逻辑
equipmentSpeIndex = handleTemperatureAlarm(equipmentSpeIndex, iotDatalist);
......@@ -523,6 +522,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
handlingAlarms(equipmentSpeIndex, alarmFlag);
}
// 添加指标报告
saveEquipmentAlarmReportDay(equipmentSpeIndex, alarmFlag);
// 指标告警处理
if (equipmentSpeIndex.getIsAlarm() != null && 1 == equipmentSpeIndex.getIsAlarm()) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpeIndex, messageBodyMap));
......@@ -760,8 +762,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
indexStateList.add(createIndexStateVo(equipmentSpeIndex));
// 添加指标报告
saveEquipmentAlarmReportDay(equipmentSpeIndex);
// 火眼数据构造告警指标逻辑
equipmentSpeIndex = handleTemperatureAlarm(equipmentSpeIndex, iotDatalist);
......@@ -788,6 +789,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
handlingAlarms(equipmentSpeIndex, alarmFlag);
}
// 添加指标报告
saveEquipmentAlarmReportDay(equipmentSpeIndex, alarmFlag);
// 指标告警处理
if (equipmentSpeIndex.getIsAlarm() != null && 1 == equipmentSpeIndex.getIsAlarm()) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpeIndex, messageBodyMap));
......@@ -1021,8 +1025,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 推送数据到组态大屏
pushDataToIntegrationPage(equipmentSpecificIndexList);
// 添加指标报告
saveEquipmentAlarmReportDay(equipmentSpeIndex);
// 火眼数据构造告警指标逻辑
equipmentSpecificIndex = handleTemperatureAlarm(equipmentSpeIndex, iotDatalist);
......@@ -1048,6 +1051,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
handlingAlarms(equipmentSpecificIndex, alarmFlag);
}
// 添加指标报告
saveEquipmentAlarmReportDay(equipmentSpeIndex, alarmFlag);
// 指标告警处理
if (equipmentSpecificIndex.getIsAlarm() != null && 1 == equipmentSpecificIndex.getIsAlarm() && !equipmentSpecificIndex.getEquipmentIndexKey().equals(pressurePumpStart)) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpecificIndex, messageBodyMap));
......@@ -1540,7 +1546,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
}
private EquipmentAlarmReportDay addEquipAlarmReportRecord(EquipmentSpecificIndex equipmentSpecificIndex) {
private EquipmentAlarmReportDay addEquipAlarmReportRecord(EquipmentSpecificIndex equipmentSpecificIndex, boolean flag) {
EquipmentAlarmReportDay equipmentAlarmReportDay = new EquipmentAlarmReportDay();
equipmentAlarmReportDay.setOrgCode(equipmentSpecificIndex.getOrgCode());
equipmentAlarmReportDay.setReportDate(new Date());
......@@ -1552,8 +1558,14 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentAlarmReportDay.setEquipmentDetailId(equipmentSpecificIndex.getEquipmentDetailId());
equipmentAlarmReportDay.setEquipmentId(equipmentSpecificIndex.getEquipmentId());
equipmentAlarmReportDay.setEquipmentCode(equipmentSpecificIndex.getEquipmentCode());
equipmentAlarmReportDay
.setIndexTrueNum(TrueOrFalseEnum.real.value.equals(equipmentSpecificIndex.getValue()) ? 1L : 0L);
if(flag) {
equipmentAlarmReportDay
.setIndexTrueNum(1L);
} else {
equipmentAlarmReportDay
.setIndexTrueNum(TrueOrFalseEnum.real.value.equals(equipmentSpecificIndex.getValue()) ? 1L : 0L);
}
equipmentAlarmReportDay.setAlarmType(equipmentSpecificIndex.getTypeCode());
equipmentAlarmReportDay.setAlarmTypeName(equipmentSpecificIndex.getTypeName());
equipmentAlarmReportDay.setIndexId(equipmentSpecificIndex.getEquipmentIndexId());
......@@ -2017,9 +2029,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
*
* @param equipmentSpecificIndex
*/
private void saveEquipmentAlarmReportDay(EquipmentSpecificIndex equipmentSpecificIndex) {
private void saveEquipmentAlarmReportDay(EquipmentSpecificIndex equipmentSpecificIndex, boolean flag) {
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_PATTERN);
EquipmentAlarmReportDay equipmentAlarmReportDay = addEquipAlarmReportRecord(equipmentSpecificIndex);
EquipmentAlarmReportDay equipmentAlarmReportDay = addEquipAlarmReportRecord(equipmentSpecificIndex, flag);
LambdaQueryWrapper<EquipmentAlarmReportDay> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EquipmentAlarmReportDay::getReportDate, sdf.format(equipmentAlarmReportDay.getReportDate()))
.eq(EquipmentAlarmReportDay::getIndexId, equipmentAlarmReportDay.getIndexId())
......
......@@ -4145,7 +4145,7 @@
</select>
<select id="selectWeekReportList" resultType="java.util.Map">
select * from (
SELECT temp.name,temp.num,temp.normalNum,temp1.type_name , temp1.monitoringData,temp1.acquisition,temp1.normal,
IFNULL(temp1.alarmEquipNum,0) AS alarmEquipNum, temp1.type_code,temp.code
FROM
......@@ -4163,12 +4163,6 @@
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code
and FIND_IN_SET(a.system_id,report.system_ids)
and( report.index_type LIKE CONCAT('%','FireAlarm','%')
or report.index_type LIKE CONCAT('%','Fault','%')
or report.index_type LIKE CONCAT('%','Shield','%')
or report.index_type LIKE CONCAT('%','Open','%')
or report.index_type LIKE CONCAT('%','OilLeak','%')
or report.index_type LIKE CONCAT('%','Alarm','%') )
and report.index_true_num > 0 and report.report_date >= #{startDate} and
report.report_date &lt;= #{endDate}) as exepctionNum
FROM(
......@@ -4176,7 +4170,7 @@
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
(select count(1) from wl_equipment_specific s where FIND_IN_SET( #{systemId}, s.system_id ) AND equipment.is_iot = 1 and s.equipment_code = equipment.code ) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
......@@ -4240,7 +4234,8 @@
)temp1 on temp.system_id = temp1.systemId and temp.code = temp1.code
group by code, type_code
ORDER BY temp.name
ORDER BY temp.name ) d where type_code is not null
</select>
<select id="selectAlarms" resultType="java.lang.Integer">
SELECT
......@@ -4256,7 +4251,7 @@
</foreach>
and report.report_date BETWEEN #{startDate} and #{endDate}
and system_id = #{systemId}
and FIND_IN_SET( #{systemId}, system_id)
and index_type = #{indexType}
and report.equipment_code = #{equipmentCode}
</select>
......
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