Commit 243de086 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 46d38213 7b6da3fa
package com.yeejoin.amos.boot.module.jxiop.api.dto; package com.yeejoin.amos.boot.module.jxiop.api.dto;
import lombok.Data; import lombok.Data;
import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
...@@ -42,8 +43,17 @@ public class IndexDto { ...@@ -42,8 +43,17 @@ public class IndexDto {
private String displayName; private String displayName;
private String pictureName; private String pictureName;
private String title; private String title;
private String timeString="";
//对于创建时间进行处理用于列表排序 //对于创建时间进行处理用于列表排序
public String getTimeString(){ public String getTimeString(){
return getCreatedTime().replace("-","").replace(" ","").replace(":",""); String timeString = "";
if(!ObjectUtils.isEmpty(getCreatedTime())){
timeString =getCreatedTime().replace("-","").replace(" ","").replace(":","");
} }
return timeString;
}
public void setTimeString(String timeString){
this.timeString = timeString;
}
} }
...@@ -9,6 +9,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -9,6 +9,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -151,5 +153,5 @@ public class StationBasic extends BaseEntity { ...@@ -151,5 +153,5 @@ public class StationBasic extends BaseEntity {
private String boosterGatewayId; private String boosterGatewayId;
//地图偏移量 //地图偏移量
@TableField(value = "title_pos",typeHandler = FastjsonTypeHandler.class) @TableField(value = "title_pos",typeHandler = FastjsonTypeHandler.class)
private List<Double> titlePos; private List<BigDecimal> titlePos;
} }
...@@ -34,7 +34,8 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato ...@@ -34,7 +34,8 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato
Object getIndicatoralueTotal(String gateway,String indicator); Object getIndicatoralueTotal(String gateway,String indicator);
List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId); List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId,
@Param("equipmentNum") String equipmentNum);
List<Map<String, String>> getBoosterStationInfo(@Param("gatewayId") String gatewayId); List<Map<String, String>> getBoosterStationInfo(@Param("gatewayId") String gatewayId);
......
...@@ -86,7 +86,14 @@ ...@@ -86,7 +86,14 @@
equipment_specific_name as equipmentSpecificName, equipment_specific_name as equipmentSpecificName,
gateway_id as gatewayId gateway_id as gatewayId
from fan_config_power from fan_config_power
where gateway_id = #{gatewayId} <where>
<if test="equipmentNum != null and equipmentNum != ''">
and equipment_number = #{equipmentNum}
</if>
<if test="gatewayId != null and gatewayId != ''">
and gateway_id = #{gatewayId}
</if>
</where>
</select> </select>
<select id="getBoosterStationInfo" resultType="java.util.Map"> <select id="getBoosterStationInfo" resultType="java.util.Map">
......
...@@ -61,7 +61,7 @@ import static com.alibaba.fastjson.JSON.parseArray; ...@@ -61,7 +61,7 @@ import static com.alibaba.fastjson.JSON.parseArray;
@EnableScheduling @EnableScheduling
@Slf4j @Slf4j
public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private final static List<String> fanStatesList = Arrays.asList("报警状态","停机状态","故障状态","待机状态","维护状态","正常发电状态"); private final static List<String> fanStatesList = Arrays.asList("报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "正常发电状态");
@Autowired @Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper; private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
...@@ -278,7 +278,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -278,7 +278,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1)); Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId()); String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId());
List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class); List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class);
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId()); List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId(), null);
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|")); String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames); String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class); List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
...@@ -323,7 +323,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -323,7 +323,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
filter(indexDto -> fanStatesList.contains(indexDto.getEquipmentIndexName())&&indexDto.getValue().equals("true")).collect(Collectors.toList()); filter(indexDto -> fanStatesList.contains(indexDto.getEquipmentIndexName())&&indexDto.getValue().equals("true")).collect(Collectors.toList());
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1)); Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
List<IndexDto> equipNumList=indexDtoList.stream().filter(indexDto -> !ObjectUtils.isEmpty(indexDto.getEquipmentNumber())).collect(Collectors.collectingAndThen(Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(IndexDto::getEquipmentNumber))),ArrayList::new)); List<IndexDto> equipNumList=indexDtoList.stream().filter(indexDto -> !ObjectUtils.isEmpty(indexDto.getEquipmentNumber())).collect(Collectors.collectingAndThen(Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(IndexDto::getEquipmentNumber))),ArrayList::new));
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId()); List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId(), null);
List<String > equipmentSpecificNames=fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.toList()); List<String > equipmentSpecificNames=fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.toList());
// String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames); // String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
// List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class); // List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
...@@ -359,7 +359,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -359,7 +359,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1)); Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId()); String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId());
List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class); List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class);
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId()); List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId(), null);
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|")); String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames); String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class); List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
...@@ -407,17 +407,49 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -407,17 +407,49 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
public IndexDto getFanBasicInfoByEquipNum(String equipNum, String stationId) { public IndexDto getFanBasicInfoByEquipNum(String equipNum, String stationId) {
IndexDto indexDto = new IndexDto();
StationBasic stationBasic = getOneByStationNumber(stationId); StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentSpecificName, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentNumber = '%s' order by time desc limit 1", stationBasic.getFanGatewayId(), equipNum); String sql = String.format("SELECT equipmentNumber, equipmentSpecificName, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true' order by time desc limit 1", stationBasic.getFanGatewayId(), equipNum);
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class); List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
if (CollectionUtils.isNotEmpty(influxDBList)) { if (CollectionUtils.isNotEmpty(influxDBList)) {
String equipmentSpecificName = influxDBList.get(0).getEquipmentSpecificName(); String equipmentSpecificName = influxDBList.get(0).getEquipmentSpecificName();
influxDBList.get(0).setEquipmentSpecificName(equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#"))); influxDBList.get(0).setEquipmentSpecificName(equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#")));
String s = StringUtils.substringAfterLast(equipmentSpecificName, "#"); String s = StringUtils.substringAfterLast(equipmentSpecificName, "#");
influxDBList.get(0).setFanName(s); influxDBList.get(0).setFanName(s);
return influxDBList.get(0); indexDto = influxDBList.get(0);
} else {
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId(), equipNum);
if (CollectionUtils.isEmpty(fanConfigPower)) {
throw new BadRequest("fan_config_power表数据未维护该风机");
}
String equipmentSpecificName = fanConfigPower.get(0).get("equipmentSpecificName");
String substring = equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#"));
indexDto.setEquipmentSpecificName(substring);
indexDto.setFanName(StringUtils.substringAfterLast(equipmentSpecificName, "#"));
indexDto.setEquipmentIndexName("正常运行");
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
List<String> powList = powerNum.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
Date currentDayStartTime = DateUtils.dateAddMinutes(new Date(), -15);
String time = "";
try {
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
String timeSql = String.format("select distinct equipmentNumber from \"indicators_%s\" where time >= '%s'", stationBasic.getFanGatewayId(), time);
List<IndexDto> timeSqlList = influxDButils.getListData(timeSql, IndexDto.class);
List<String> timeList = timeSqlList.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(powList)) {
indexDto.setEquipmentIndexName("限功率");
} else if (!timeList.contains(equipNum)) {
indexDto.setEquipmentIndexName("通讯中断");
} }
return new IndexDto(); }
return indexDto;
} }
/** /**
...@@ -977,7 +1009,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -977,7 +1009,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList); DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
ColModel colModelStationName = new ColModel("stationName", "stationName", "名称", "名称", "dataGrid", "stationName"); ColModel colModelStationName = new ColModel("stationName", "stationName", "名称", "名称", "dataGrid", "stationName");
ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc"); ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc");
ColModel colModelAlarmGroupName= new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid", "alarmGroupName"); ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid", "alarmGroupName");
ColModel colModelEventTime = new ColModel("eventTime", "eventTime", "事件发生时间", "事件发生时间", "dataGrid", "eventTime"); ColModel colModelEventTime = new ColModel("eventTime", "eventTime", "事件发生时间", "事件发生时间", "dataGrid", "eventTime");
ColModel colModelEventMovement = new ColModel("eventMovement", "eventMovement", "事件动作描述", "事件动作描述", "dataGrid", "eventMovement"); ColModel colModelEventMovement = new ColModel("eventMovement", "eventMovement", "事件动作描述", "事件动作描述", "dataGrid", "eventMovement");
List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime, colModelEventMovement); List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime, colModelEventMovement);
...@@ -1089,23 +1121,24 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1089,23 +1121,24 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> { xianData.forEach(item -> {
if ("220kVⅠ母PT".equals(item.getFrontModule())) { if ("220kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("220" + item.getDisplayName(), item.getValue()); resultMap.put("220" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue()));
} else if ("35kVⅠ母PT".equals(item.getFrontModule())) { } else if ("35kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("35" + item.getDisplayName(), item.getValue()); resultMap.put("35" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue()));
} }
}); });
String xyxSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '夏雩线' and (displayName = 'Ia' or displayName = 'P' or displayName = 'Q' or displayName = 'Ux' ", gatewayId); String xyxSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '夏雩线' and (displayName = 'Ia' or displayName = 'P' or displayName = 'Q' or displayName = 'Ux')", gatewayId);
List<IndicatorsDto> xyxSqlData = influxDButils.getListData(xyxSql, IndicatorsDto.class); List<IndicatorsDto> xyxSqlData = influxDButils.getListData(xyxSql, IndicatorsDto.class);
xyxSqlData.forEach(item -> resultMap.put("xyx" + item.getDisplayName(), item.getValue())); xyxSqlData.forEach(item -> resultMap.put("xyx" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue())));
String dlbjSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '电量表计'", gatewayId); String dlbjSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '电量表计'", gatewayId);
List<IndicatorsDto> dlbjSqlData = influxDButils.getListData(dlbjSql, IndicatorsDto.class); List<IndicatorsDto> dlbjSqlData = influxDButils.getListData(dlbjSql, IndicatorsDto.class);
// 正向总有功正向总无功需要计算
dlbjSqlData.forEach(item -> { dlbjSqlData.forEach(item -> {
if ("正向总有功".equals(item.getDisplayName())) { if ("正向总有功".equals(item.getDisplayName())) {
resultMap.put("2000S1", item.getValue()); resultMap.put("2000S1", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValue())/1000))));
} else if ("正向总无功".equals(item.getDisplayName())) { } else if ("正向总无功".equals(item.getDisplayName())) {
resultMap.put("2000S2", item.getValue()); resultMap.put("2000S2", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValue())/1000))));
} }
}); });
...@@ -1117,13 +1150,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1117,13 +1150,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultMap.put("value4", "0.0"); resultMap.put("value4", "0.0");
zb1SqlData.forEach(item -> { zb1SqlData.forEach(item -> {
if ("档位".equals(item.getDisplayName())) { if ("档位".equals(item.getDisplayName())) {
resultMap.put("value4", item.getValue()); resultMap.put("value4", ObjectUtils.isEmpty(item.getValue())?"0":String.format("%.0f",Double.parseDouble(item.getValue())));
} else if ("油面温1".equals(item.getDisplayName())) { } else if ("油面温1".equals(item.getDisplayName())) {
resultMap.put("value1", item.getValue()); resultMap.put("value1", ObjectUtils.isEmpty(item.getValue())?"0.0":String.format("%.1f",Double.parseDouble(item.getValue())));
} else if ("油面温2".equals(item.getDisplayName())) { } else if ("油面温2".equals(item.getDisplayName())) {
resultMap.put("value2", item.getValue()); resultMap.put("value2", ObjectUtils.isEmpty(item.getValue())?"0.0":String.format("%.1f",Double.parseDouble(item.getValue())));
} else if ("绕组温度".equals(item.getDisplayName())) { } else if ("绕组温度".equals(item.getDisplayName())) {
resultMap.put("value3", item.getValue()); resultMap.put("value3", ObjectUtils.isEmpty(item.getValue())?"0.0":String.format("%.1f",Double.parseDouble(item.getValue())));
} }
}); });
...@@ -1160,13 +1193,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1160,13 +1193,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
stringStringHashMap.put("value3", "0.0"); stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> { listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) { if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", item.getValue()); stringStringHashMap.put("value1", keepTwoDecimalPlaces(item.getValue()));
} }
if (item.getDisplayName().equals("P")) { if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", item.getValue()); stringStringHashMap.put("value2", keepTwoDecimalPlaces(item.getValue()));
} }
if (item.getDisplayName().equals("Q")) { if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", item.getValue()); stringStringHashMap.put("value3", keepTwoDecimalPlaces(item.getValue()));
} }
}); });
resultList.add(stringStringHashMap); resultList.add(stringStringHashMap);
...@@ -1187,7 +1220,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1187,7 +1220,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultPage.setTotal(finallyResultList.size()); resultPage.setTotal(finallyResultList.size());
try { try {
log.info("消息内容:{}", JSON.toJSONString(resultPage)); log.info("消息内容:{}", JSON.toJSONString(resultPage));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, "major", "data"), JSON.toJSONString(resultPage).getBytes(),0,false); emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, "major", "data"), JSON.toJSONString(resultPage).getBytes(), 0, false);
} catch (MqttException e) { } catch (MqttException e) {
log.info("消息发送失败"); log.info("消息发送失败");
e.printStackTrace(); e.printStackTrace();
...@@ -1416,6 +1449,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1416,6 +1449,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return statusMaps; return statusMaps;
} }
public String keepTwoDecimalPlaces(String value) {
String s = "0.00";
if (!ObjectUtils.isEmpty(value)) {
try {
s = String.format("%.2f", Double.parseDouble(value));
} catch (Exception ex) {
}
}
return s;
}
} }
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