Commit 46110d9e authored by KeYong's avatar KeYong

点图优化代码

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