Commit b0ee7052 authored by KeYong's avatar KeYong

修改bug

parent 96f5032c
...@@ -108,6 +108,10 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -108,6 +108,10 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/ */
List<SpeIndexVo> getSpeIndex(Long id); List<SpeIndexVo> getSpeIndex(Long id);
Map<String, Object> judgeIsTrend(Long id);
List<SpeIndexVo> getYaoCeSpeIndex(Long id);
/** /**
* 按照组态格式获取系统详情 * 按照组态格式获取系统详情
* *
......
...@@ -443,8 +443,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -443,8 +443,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override @Override
public List<SpeIndexVo> getSpeIndex(Long id, int flag) { public List<SpeIndexVo> getSpeIndex(Long id, int flag) {
// 因此处代码其他地方有调用 增加表示判断 flag == 1 为 消防点位图处需要iot编码所用 // 因此处代码其他地方有调用 增加表示判断 flag == 1 为 消防点位图处需要iot编码所用
Map<String, Object> obj = fireFightingSystemMapper.judgeIsTrend(id);
if (flag == 1) { if (flag == 1) {
List<SpeIndexVo> speIndexVos = makeStatus(fireFightingSystemMapper.getSpeIndex(id)); List<SpeIndexVo> speIndexVos = new ArrayList<>();
if (String.valueOf(obj.get("isTrend")).equals("1")) {
speIndexVos = makeYaoCeStatus(fireFightingSystemMapper.getYaoCeSpeIndex(id));
} else {
speIndexVos = makeStatus(fireFightingSystemMapper.getSpeIndex(id));
}
if (!ValidationUtil.isEmpty(speIndexVos)) { if (!ValidationUtil.isEmpty(speIndexVos)) {
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getBaseMapper().selectById(id); EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getBaseMapper().selectById(id);
if (!ValidationUtil.isEmpty(equipmentSpecific)) { if (!ValidationUtil.isEmpty(equipmentSpecific)) {
...@@ -456,6 +462,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -456,6 +462,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
return speIndexVos; return speIndexVos;
} }
if (String.valueOf(obj.get("isTrend")).equals("1")) {
return makeYaoCeStatus(fireFightingSystemMapper.getYaoCeSpeIndex(id));
}
return makeStatus(fireFightingSystemMapper.getSpeIndex(id)); return makeStatus(fireFightingSystemMapper.getSpeIndex(id));
} }
...@@ -769,6 +778,25 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -769,6 +778,25 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return statusList; return statusList;
} }
private List<SpeIndexVo> makeYaoCeStatus(List<SpeIndexVo> list) {
if (list == null || list.size() == 0) {
return new ArrayList<>();
}
List<SpeIndexVo> statusList = new ArrayList<>();
SpeIndexVo spe = new SpeIndexVo();
spe.setKey(EquipmentSpeIndexEnum.YXZT.getCode());
SpeIndexVo latestVo = list.get(0);
org.springframework.beans.BeanUtils.copyProperties(latestVo, spe);
spe.setName("当前状态");
Map<String, String> map = getStatus(list);
spe.setValue(map.get("runStatus"));
spe.setColor(map.get("color"));
statusList.clear();
statusList.add(spe);
statusList.addAll(list);
return statusList;
}
/** /**
* 判断 装备状态 * 判断 装备状态
* *
......
...@@ -620,6 +620,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -620,6 +620,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} else if (nowValue.compareTo(maxValue) > 0) { } else if (nowValue.compareTo(maxValue) > 0) {
body = "当前数值 " + nowValue + " 超过最高报警阈值 " + maxValue; body = "当前数值 " + nowValue + " 超过最高报警阈值 " + maxValue;
} }
messageBody.put("messageBody", equipmentSpecificIndex.getEquipmentSpecificName() + "-" + body);
String bodyMain = String.format("%s,- 当前数值%s,%s ,请及时查看处理。", String bodyMain = String.format("%s,- 当前数值%s,%s ,请及时查看处理。",
equipmentSpecificIndex.getEquipmentSpecificName() + "-" + equipmentSpecificIndex.getLocation(), equipmentSpecificIndex.getEquipmentSpecificName() + "-" + equipmentSpecificIndex.getLocation(),
nowValue, nowValue,
...@@ -649,7 +650,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -649,7 +650,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// } // }
// log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model))); // log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
alarmFlag = true; alarmFlag = true;
messageBody.put("messageBody", equipmentSpecificIndex.getEquipmentSpecificName() + "-" + body);
} }
return alarmFlag; return alarmFlag;
} }
...@@ -1020,7 +1020,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1020,7 +1020,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
* @return * @return
*/ */
private List<EquipmentSpecificAlarm> addEquipmentSpecificAlarm(List<EquipmentSpecificAlarm> equipmentSpecificAlarms, private List<EquipmentSpecificAlarm> addEquipmentSpecificAlarm(List<EquipmentSpecificAlarm> equipmentSpecificAlarms,
EquipmentSpecificIndex equipmentSpecificIndex, EquipmentSpecificAlarm equipmentSpecificAlarm) { EquipmentSpecificIndex equipmentSpecificIndex, EquipmentSpecificAlarm equipmentSpecificAlarm, Map<String, String> messageBody) {
BeanUtils.copyProperties(equipmentSpecificIndex, equipmentSpecificAlarm); BeanUtils.copyProperties(equipmentSpecificIndex, equipmentSpecificAlarm);
equipmentSpecificAlarm.setId(null); equipmentSpecificAlarm.setId(null);
equipmentSpecificAlarm.setFrequency(1); equipmentSpecificAlarm.setFrequency(1);
...@@ -1040,6 +1040,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1040,6 +1040,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarm.setEmergencyLevelDescribe(equipmentSpecificIndex.getEmergencyLevelDescribe()); equipmentSpecificAlarm.setEmergencyLevelDescribe(equipmentSpecificIndex.getEmergencyLevelDescribe());
equipmentSpecificAlarm.setBizOrgCode(equipmentSpecificIndex.getBizOrgCode()); equipmentSpecificAlarm.setBizOrgCode(equipmentSpecificIndex.getBizOrgCode());
equipmentSpecificAlarm.setBizOrgName(equipmentSpecificIndex.getBizOrgName()); equipmentSpecificAlarm.setBizOrgName(equipmentSpecificIndex.getBizOrgName());
equipmentSpecificAlarm.setMessageBody(!ObjectUtils.isEmpty(messageBody) ? messageBody.get("messageBody") : "");
//调整为按照设备归属(可归属公司或者部门 //调整为按照设备归属(可归属公司或者部门
Map<String,Object> mapd= iEquipmentSpecificSerivce.getStationCode(equipmentSpecificIndex.getEquipmentSpecificId()); Map<String,Object> mapd= iEquipmentSpecificSerivce.getStationCode(equipmentSpecificIndex.getEquipmentSpecificId());
...@@ -1060,10 +1061,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1060,10 +1061,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// NB装备告警 // NB装备告警
private List<EquipmentSpecificAlarm> getNbEquipAlarmList(List<EquipmentSpecificAlarm> indexAlarms, private List<EquipmentSpecificAlarm> getNbEquipAlarmList(List<EquipmentSpecificAlarm> indexAlarms,
EquipmentSpecificIndex equipmentSpecificIndex, EquipmentSpecificAlarm equipmentSpecificAlarm) { EquipmentSpecificIndex equipmentSpecificIndex, EquipmentSpecificAlarm equipmentSpecificAlarm, Map<String, String> messageBody) {
List<EquipmentSpecificAlarm> equipmentSpecificAlarmList = new ArrayList<>(); List<EquipmentSpecificAlarm> equipmentSpecificAlarmList = new ArrayList<>();
if (ValidationUtil.isEmpty(indexAlarms)) { // 告警表为空,新增告警数据 if (ValidationUtil.isEmpty(indexAlarms)) { // 告警表为空,新增告警数据
addEquipmentSpecificAlarm(equipmentSpecificAlarmList, equipmentSpecificIndex, equipmentSpecificAlarm); addEquipmentSpecificAlarm(equipmentSpecificAlarmList, equipmentSpecificIndex, equipmentSpecificAlarm, messageBody);
if (!checkStateIsNormal(equipmentSpecificAlarm, equipmentSpecificIndex)) { if (!checkStateIsNormal(equipmentSpecificAlarm, equipmentSpecificIndex)) {
return equipmentSpecificAlarmList; return equipmentSpecificAlarmList;
} else { } else {
...@@ -1347,11 +1348,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1347,11 +1348,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpcIndex.getEquipmentSpecificId(), equipmentSpcIndex.getEquipmentIndexId()); equipmentSpcIndex.getEquipmentSpecificId(), equipmentSpcIndex.getEquipmentIndexId());
// NB设备告警 // NB设备告警
if (verifyNB(equipmentSpcIndex.getNameKey())) { if (verifyNB(equipmentSpcIndex.getNameKey())) {
return getNbEquipAlarmList(indexAlarms, equipmentSpcIndex, equipmentSpecificAlarm); return getNbEquipAlarmList(indexAlarms, equipmentSpcIndex, equipmentSpecificAlarm, messageBody);
} }
// 报警表新增信息 // 报警表新增信息
if (ObjectUtils.isEmpty(indexAlarms) && (TrueOrFalseEnum.real.value.equals(equipmentSpcIndex.getValue()))) { if (ObjectUtils.isEmpty(indexAlarms) && (TrueOrFalseEnum.real.value.equals(equipmentSpcIndex.getValue()))) {
equipmentSpecificAlarms = addEquipmentSpecificAlarm(equipmentSpecificAlarms, equipmentSpcIndex, equipmentSpecificAlarm); equipmentSpecificAlarms = addEquipmentSpecificAlarm(equipmentSpecificAlarms, equipmentSpcIndex, equipmentSpecificAlarm, messageBody);
} else { } else {
// 报警表更新信息 // 报警表更新信息
for (EquipmentSpecificAlarm action : indexAlarms) { for (EquipmentSpecificAlarm action : indexAlarms) {
......
...@@ -68,7 +68,6 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -68,7 +68,6 @@ import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -76,14 +75,11 @@ import java.io.File; ...@@ -76,14 +75,11 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -1930,7 +1926,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1930,7 +1926,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
e.printStackTrace(); e.printStackTrace();
} }
List<DefectVo> res = new ArrayList(); List<DefectVo> res = new ArrayList();
if (0 < result.size()) { if (result != null && 0 < result.size()) {
for(Object object : result) { for(Object object : result) {
DefectVo vo = JSON.parseObject(JSON.toJSONString(object), DefectVo.class); DefectVo vo = JSON.parseObject(JSON.toJSONString(object), DefectVo.class);
res.add(vo); res.add(vo);
......
...@@ -796,4 +796,51 @@ ...@@ -796,4 +796,51 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1684921528">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_signal_classify" />
</preConditions>
<comment>更改属性值</comment>
<sql>
UPDATE wl_signal_classify wsc SET wsc.is_alarm = true, wsc.emergency_level_color = '#E8D639', wsc.emergency_level = '3', wsc.emergency_level_describe = '轻微' WHERE wsc.id IN (20220241, 20220243);
UPDATE wl_equipment_index wei
SET wei.emergency_level_color = (
SELECT
emergency_level_color
FROM
wl_signal_classify wsc
WHERE
upper( wsc.type_code ) = upper( wei.type_code )
),
wei.is_alarm = (
SELECT
is_alarm
FROM
wl_signal_classify wsc
WHERE
upper( wsc.type_code ) = upper( wei.type_code )
),
wei.emergency_level = (
SELECT
emergency_level
FROM
wl_signal_classify wsc
WHERE
upper( wsc.type_code ) = upper( wei.type_code )
),
wei.emergency_level_describe = (
SELECT
emergency_level_describe
FROM
wl_signal_classify wsc
WHERE
upper( wsc.type_code ) = upper( wei.type_code )
);
UPDATE wl_equipment_specific_index esi
SET esi.emergency_level_color = ( SELECT emergency_level_color FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id ),
esi.is_alarm = ( SELECT is_alarm FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id ),
esi.emergency_level = ( SELECT emergency_level FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id ),
esi.emergency_level_describe = ( SELECT emergency_level_describe FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id );
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -1385,7 +1385,7 @@ ...@@ -1385,7 +1385,7 @@
LEFT JOIN `wl_equipment_specific_alarm` wesa ON wesa.id = wlesal.equipment_specific_alarm_id LEFT JOIN `wl_equipment_specific_alarm` wesa ON wesa.id = wlesal.equipment_specific_alarm_id
LEFT JOIN `wl_equipment_specific` `wles` ON `wlesal`.`equipment_specific_id` = `wles`.`id` LEFT JOIN `wl_equipment_specific` `wles` ON `wlesal`.`equipment_specific_id` = `wles`.`id`
<where> <where>
wesa.`status` = 1 wesa.`status` = 1 AND wlesal.clean_time IS NULL
<if test="param.system != null and param.system != ''"> <if test="param.system != null and param.system != ''">
AND find_in_set( #{param.system}, `wlesal`.`system_codes` ) AND find_in_set( #{param.system}, `wlesal`.`system_codes` )
</if> </if>
......
...@@ -519,7 +519,7 @@ ...@@ -519,7 +519,7 @@
FROM FROM
p_point p p_point p
</select> </select>
<select id="getSpeIndex" resultType="com.yeejoin.equipmanage.common.vo.SpeIndexVo"> <select id="getYaoCeSpeIndex" resultType="com.yeejoin.equipmanage.common.vo.SpeIndexVo">
SELECT SELECT
* *
FROM FROM
...@@ -5799,5 +5799,73 @@ ...@@ -5799,5 +5799,73 @@
AND e.report_date >= DATE_FORMAT(#{startDate},'%y-%m-%d') AND e.report_date >= DATE_FORMAT(#{startDate},'%y-%m-%d')
AND e.report_date &lt;= DATE_FORMAT(#{endDate},'%y-%m-%d') AND e.report_date &lt;= DATE_FORMAT(#{endDate},'%y-%m-%d')
</select> </select>
<select id="judgeIsTrend" resultType="Map">
SELECT
wei.is_trend AS isTrend
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.id = #{id}
AND wei.is_iot = true
</select>
<select id="getSpeIndex" resultType="com.yeejoin.equipmanage.common.vo.SpeIndexVo">
SELECT
*
FROM
(
SELECT
eqin.name_key AS `key`,
eqin.`name` AS `name`,
eqin.type_code,
spein.update_date AS updateDate,
spein.equipment_specific_id as equipmentSpecificId,
IF (
eqin.unit IS NULL,
IF (
(
ISNULL(spein.value_label)
OR spein.value_label = ''
),
spein.`value`,
spein.value_label
),
concat(
IF (
(
ISNULL(spein.value_label)
OR spein.value_label = ''
),
spein.`value`,
spein.value_label
),
' ',
eqin.unit
)
) AS `value`,
spein.emergency_level_color AS color,
spein.is_alarm AS isAlarm,
spein.emergency_level AS emergencyLevel,
spein.emergency_level_describe AS emergencyLevelDescribe,
IF(SUM(IF(wesa.equipment_specific_index_value = 'true', 1, 0 ) ) > 0, 'true', 'false' ) AS indexValue,
spein.equipment_index_name AS indexName,
wes.qr_code AS qrCode
FROM
wl_equipment_specific_index AS spein
LEFT JOIN wl_equipment_index AS eqin ON spein.equipment_index_id = eqin.id
LEFT JOIN wl_equipment_specific AS wes ON wes.id = spein.equipment_specific_id
LEFT JOIN wl_equipment_specific_alarm wesa ON wesa.equipment_specific_id = wes.id
WHERE
spein.equipment_specific_id = #{id}
ORDER BY
eqin.sort_num
) AS dat
WHERE
`key` IS NOT NULL
AND `key` != ''
ORDER BY
dat.updateDate DESC
</select>
</mapper> </mapper>
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