Commit 46110d9e authored by KeYong's avatar KeYong

点图优化代码

parent e4520eab
...@@ -83,4 +83,7 @@ public class EquipmentAlarmReportDay extends BaseEntity { ...@@ -83,4 +83,7 @@ public class EquipmentAlarmReportDay extends BaseEntity {
@ApiModelProperty(value = "指标最新值") @ApiModelProperty(value = "指标最新值")
private String value; private String value;
@ApiModelProperty(value = "是否告警:0-否;1-是")
private Integer isAlarm;
} }
...@@ -268,9 +268,8 @@ public class EquipmentStateUtil { ...@@ -268,9 +268,8 @@ public class EquipmentStateUtil {
public static String judgeEquipState(EquipmentSpecificIndex index) { public static String judgeEquipState(EquipmentSpecificIndex index) {
if (TrueOrFalseEnum.real.value.toUpperCase().equals(String.valueOf(index.getValue()).toUpperCase())) { if (TrueOrFalseEnum.real.value.toUpperCase().equals(String.valueOf(index.getValue()).toUpperCase())) {
return StringUtils.isNotEmpty(index.getEmergencyLevelColor()) ? index.getEmergencyLevelColor() : "#49AA19"; return index.getEmergencyLevelColor();
} else {
return "#49AA19";
} }
return "";
} }
} }
...@@ -542,7 +542,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -542,7 +542,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
SpeIndexVo latestVo = statusList.get(0); SpeIndexVo latestVo = statusList.get(0);
BeanUtils.copyProperties(latestVo, spe); BeanUtils.copyProperties(latestVo, spe);
spe.setName("当前状态"); spe.setName("当前状态");
spe.setValue(getStatus(statusList)); Map<String, String> map = getStatus(statusList);
spe.setValue(map.get("runStatus"));
spe.setColor(map.get("color"));
statusList.clear(); statusList.clear();
statusList.add(spe); statusList.add(spe);
statusList.addAll(newList); statusList.addAll(newList);
...@@ -555,12 +557,28 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -555,12 +557,28 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @param statusList * @param statusList
* @return * @return
*/ */
private String getStatus(List<SpeIndexVo> statusList) { private Map<String, String> getStatus(List<SpeIndexVo> statusList) {
Map<String, String> map = new HashMap<>();
SpeIndexVo indexVo = statusList.get(0); SpeIndexVo indexVo = statusList.get(0);
int i = 0;
for (SpeIndexVo x : statusList) {
if (StringUtil.isNotEmpty(x.getIndexValue())) {
i = i + 1;
}
}
if (0 == i) {
map.put("runStatus", "无");
map.put("color", "");
return map;
}
if (StringUtil.isNotEmpty(indexVo.getIndexValue()) && TrueOrFalseEnum.real.value.toUpperCase().equals(indexVo.getIndexValue().toUpperCase())) { if (StringUtil.isNotEmpty(indexVo.getIndexValue()) && TrueOrFalseEnum.real.value.toUpperCase().equals(indexVo.getIndexValue().toUpperCase())) {
return indexVo.getIndexName(); map.put("runStatus", indexVo.getIndexName());
map.put("color", indexVo.getColor());
return map;
} }
return "运行"; map.put("runStatus", "运行");
map.put("color", "");
return map;
} }
@Override @Override
......
...@@ -400,17 +400,19 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -400,17 +400,19 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
wrapper.eq(EquipmentAlarmReportDay::getReportDate, sdf.format(x.getReportDate())).eq(EquipmentAlarmReportDay::getIndexId, x.getIndexId()) wrapper.eq(EquipmentAlarmReportDay::getReportDate, sdf.format(x.getReportDate())).eq(EquipmentAlarmReportDay::getIndexId, x.getIndexId())
.eq(EquipmentAlarmReportDay::getEquipmentSpecificId, x.getEquipmentSpecificId()); .eq(EquipmentAlarmReportDay::getEquipmentSpecificId, x.getEquipmentSpecificId());
List<EquipmentAlarmReportDay> reportDayList = iEquipmentAlarmReportDayService.list(wrapper); List<EquipmentAlarmReportDay> reportDayList = iEquipmentAlarmReportDayService.list(wrapper);
if (reportDayList.isEmpty()) { if (1 == x.getIsAlarm()) {
x.setReportDate(new Date()); if (reportDayList.isEmpty()) {
x.setFrequency(1); x.setReportDate(new Date());
iEquipmentAlarmReportDayService.save(x); x.setFrequency(1);
} else { iEquipmentAlarmReportDayService.save(x);
EquipmentAlarmReportDay reportDay = reportDayList.get(0); } else {
reportDay.setLastReportDate(new Date()); EquipmentAlarmReportDay reportDay = reportDayList.get(0);
reportDay.setValue(x.getValue()); reportDay.setLastReportDate(new Date());
reportDay.setFrequency(reportDay.getFrequency() + 1); reportDay.setValue(x.getValue());
reportDay.setIndexTrueNum(reportDay.getIndexTrueNum() == null ? x.getIndexTrueNum() : reportDay.getIndexTrueNum() + x.getIndexTrueNum()); reportDay.setFrequency(reportDay.getFrequency() + 1);
iEquipmentAlarmReportDayService.updateById(reportDay); reportDay.setIndexTrueNum(reportDay.getIndexTrueNum() == null ? x.getIndexTrueNum() : reportDay.getIndexTrueNum() + x.getIndexTrueNum());
iEquipmentAlarmReportDayService.updateById(reportDay);
}
} }
}); });
mqttSendGateway.sendToMqtt(TopicEnum.EQXXTJ.getTopic(), ""); mqttSendGateway.sendToMqtt(TopicEnum.EQXXTJ.getTopic(), "");
...@@ -770,7 +772,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -770,7 +772,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (TrueOrFalseEnum.real.value.toUpperCase().equals(index.getValue().toUpperCase())) { if (TrueOrFalseEnum.real.value.toUpperCase().equals(index.getValue().toUpperCase())) {
topicObject.put("color", equipmentStateVo.getColor()); topicObject.put("color", equipmentStateVo.getColor());
} else { } else {
topicObject.put("color", "#49AA19"); topicObject.put("color", "");
} }
Map<String, Object> map = JSON.parseObject(JSON.toJSONString(equipmentStateVo)); Map<String, Object> map = JSON.parseObject(JSON.toJSONString(equipmentStateVo));
map.put(canvasTopic, topicObject); map.put(canvasTopic, topicObject);
...@@ -889,6 +891,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -889,6 +891,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentAlarmReportDay.setIndexName(equipmentSpecificIndex.getEquipmentSpecificIndexName()); equipmentAlarmReportDay.setIndexName(equipmentSpecificIndex.getEquipmentSpecificIndexName());
equipmentAlarmReportDay.setIndexType(equipmentSpecificIndex.getNameKey()); equipmentAlarmReportDay.setIndexType(equipmentSpecificIndex.getNameKey());
equipmentAlarmReportDay.setValue(equipmentSpecificIndex.getValue()); equipmentAlarmReportDay.setValue(equipmentSpecificIndex.getValue());
equipmentAlarmReportDay.setIsAlarm(equipmentSpecificIndex.getIsAlarm());
return equipmentAlarmReportDay; return equipmentAlarmReportDay;
} }
...@@ -1230,7 +1233,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1230,7 +1233,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
/** /**
* 发送数据至换流站 * 发送数据至换流站
* @param equipmentSpecificIndex * @param
*/ */
private void sendEquipSpecIndexToAutosysTopic(EquipmentSpecificIndex equipmentSpeIndex){ private void sendEquipSpecIndexToAutosysTopic(EquipmentSpecificIndex equipmentSpeIndex){
......
...@@ -325,7 +325,7 @@ ...@@ -325,7 +325,7 @@
wl_signal_classify sc wl_signal_classify sc
WHERE WHERE
es.realtime_iot_index_id = ei.id es.realtime_iot_index_id = ei.id
AND upper(sc.type_code) = ei.type_code AND upper(ei.type_code) = upper(sc.type_code)
AND find_in_set( AND find_in_set(
es.id, es.id,
( (
......
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