Commit be23e7d0 authored by chenzhao's avatar chenzhao

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

parents a69432c3 1f1ba4de
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="getHealthScoreInfo" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfo" resultType="java.math.BigDecimal">
SELECT SELECT
round(avg( a.avgHealthIndex ), 2) AS healthIndex CEILING(avg( a.avgHealthIndex )) AS healthIndex
FROM FROM
( (
SELECT SELECT
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal">
SELECT SELECT
round(IFNULL( HEALTH_INDEX , 100 ), 2) AS healthIndex CEILING(IFNULL( HEALTH_INDEX , 100 )) AS healthIndex
FROM FROM
${tableName} ${tableName}
<where> <where>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<select id="getHealthListInfo" resultType="java.util.Map"> <select id="getHealthListInfo" resultType="java.util.Map">
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
DATE_ADD( a.date, INTERVAL - 1 DAY ) as date DATE_ADD( a.date, INTERVAL - 1 DAY ) as date
FROM FROM
( (
...@@ -141,7 +141,8 @@ ...@@ -141,7 +141,8 @@
count(1) as num count(1) as num
FROM FROM
${tableName} a ${tableName} a
where a.DISPOSOTION_STATE == '未处置' where (a.DISPOSOTION_STATE = '未处置')
or (a.DISPOSOTION_STATE = '已处置' and a.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )
group by ARAE, group by ARAE,
WARNING_NAME WARNING_NAME
</select> </select>
...@@ -190,11 +191,16 @@ ...@@ -190,11 +191,16 @@
STATION AS station, STATION AS station,
WARNING_NAME AS warningName, WARNING_NAME AS warningName,
count( 1 ) AS num, count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_fan_warning_record wr WHERE wr.DISPOSOTION_STATE = '未处置' AND wr.STATION = STATION ) AS allNum ( SELECT count( 1 ) FROM idx_biz_fan_warning_record wr WHERE
((wr.DISPOSOTION_STATE = '未处置')
or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
AND wr.STATION = STATION
) AS allNum
FROM FROM
idx_biz_fan_warning_record idx_biz_fan_warning_record
WHERE WHERE
DISPOSOTION_STATE = '未处置' ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
GROUP BY GROUP BY
STATION, STATION,
WARNING_NAME UNION ALL WARNING_NAME UNION ALL
...@@ -202,11 +208,16 @@ ...@@ -202,11 +208,16 @@
STATION AS station, STATION AS station,
WARNING_NAME AS warningName, WARNING_NAME AS warningName,
count( 1 ) AS num, count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_pv_warning_record wr WHERE wr.DISPOSOTION_STATE = '未处置' AND wr.STATION = STATION ) AS allNum ( SELECT count( 1 ) FROM idx_biz_pv_warning_record wr WHERE
((wr.DISPOSOTION_STATE = '未处置')
or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
AND wr.STATION = STATION
) AS allNum
FROM FROM
idx_biz_pv_warning_record idx_biz_pv_warning_record
WHERE WHERE
DISPOSOTION_STATE = '未处置' ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
GROUP BY GROUP BY
STATION, STATION,
WARNING_NAME WARNING_NAME
...@@ -271,8 +282,10 @@ ...@@ -271,8 +282,10 @@
FROM FROM
idx_biz_fan_warning_record idx_biz_fan_warning_record
<where> <where>
((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
GATEWAY_ID = #{stationCode} and GATEWAY_ID = #{stationCode}
</if> </if>
</where> </where>
UNION ALL UNION ALL
...@@ -281,8 +294,10 @@ ...@@ -281,8 +294,10 @@
FROM FROM
idx_biz_pv_warning_record idx_biz_pv_warning_record
<where> <where>
((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
GATEWAY_ID = #{stationCode} and GATEWAY_ID = #{stationCode}
</if> </if>
</where> </where>
) a ) a
...@@ -307,7 +322,8 @@ ...@@ -307,7 +322,8 @@
FROM FROM
${tableName} a ${tableName} a
<where> <where>
a.DISPOSOTION_STATE = '未处置' ((a.DISPOSOTION_STATE = '未处置')
or (a.DISPOSOTION_STATE = '已处置' and a.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and a.ARAE like concat('%', #{areaCode}, '%') and a.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -330,7 +346,9 @@ ...@@ -330,7 +346,9 @@
count( 1 ) AS num, count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_pv_warning_record ( SELECT count( 1 ) FROM idx_biz_pv_warning_record
<where> <where>
DISPOSOTION_STATE = '未处置' AND wr.POINT_NAME = POINT_NAME ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
AND wr.POINT_NAME = POINT_NAME
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and ARAE like concat('%', #{areaCode}, '%') and ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -340,7 +358,8 @@ ...@@ -340,7 +358,8 @@
FROM FROM
idx_biz_pv_warning_record wr idx_biz_pv_warning_record wr
<where> <where>
wr.DISPOSOTION_STATE = '未处置' ((wr.DISPOSOTION_STATE = '未处置')
or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and wr.ARAE like concat('%', #{areaCode}, '%') and wr.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -354,7 +373,9 @@ ...@@ -354,7 +373,9 @@
count( 1 ) AS num, count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_fan_warning_record ( SELECT count( 1 ) FROM idx_biz_fan_warning_record
<where> <where>
DISPOSOTION_STATE = '未处置' AND wr.POINT_NAME = POINT_NAME ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
AND wr.POINT_NAME = POINT_NAME
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and ARAE like concat('%', #{areaCode}, '%') and ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -364,7 +385,8 @@ ...@@ -364,7 +385,8 @@
FROM FROM
idx_biz_fan_warning_record wr idx_biz_fan_warning_record wr
<where> <where>
wr.DISPOSOTION_STATE = '未处置' ((wr.DISPOSOTION_STATE = '未处置')
or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and wr.ARAE like concat('%', #{areaCode}, '%') and wr.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
idx_biz_fan_warning_record idx_biz_fan_warning_record
) a ) a
<where> <where>
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND DATE_FORMAT( a.disposotionDate, '%Y-%m-%d' ) = CURRENT_DATE)) ((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND a.disposotionDate > DATE_ADD( now(), INTERVAL - 3 DAY )))
<if test="arae != '' and arae != null"> <if test="arae != '' and arae != null">
AND a.arae like concat('%', #{arae}, '%') AND a.arae like concat('%', #{arae}, '%')
</if> </if>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
idx_biz_fan_warning_record idx_biz_fan_warning_record
) a ) a
<where> <where>
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND DATE_FORMAT( a.disposotionDate, '%Y-%m-%d' ) = CURRENT_DATE)) ((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND a.disposotionDate > DATE_ADD( now(), INTERVAL - 3 DAY )))
<if test="arae != '' and arae != null"> <if test="arae != '' and arae != null">
AND a.arae like concat('%', #{arae}, '%') AND a.arae like concat('%', #{arae}, '%')
</if> </if>
......
...@@ -72,16 +72,6 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio ...@@ -72,16 +72,6 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio
} }
/**
* 列表查询 示例
*/
public List<StationBasicDto> queryForStationBasicList() {
return this.queryForList("", false);
}
private CompanyModel addCompanyModel(CompanyModel companyModel) { private CompanyModel addCompanyModel(CompanyModel companyModel) {
FeignClientResult<CompanyModel> Model = Privilege.companyClient.create(companyModel); FeignClientResult<CompanyModel> Model = Privilege.companyClient.create(companyModel);
CompanyModel user = new CompanyModel(); CompanyModel user = new CompanyModel();
......
package com.yeejoin.amos.boot.module.jxiop.biz.tasks;
import com.yeejoin.amos.boot.module.jxiop.api.dto.DeviceDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationDataTaskImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @description: 定时获取场站最新数据
* @author: tw
* @createDate: 2023/7/3
*/
@Component
@EnableScheduling
public class StationDataTask {
@Autowired
StationDataTaskImpl stationDataTask;
//定时获取场站指标最新数据
// @Scheduled(cron = "${station.task.cron}")
// public void getStationDataTask(){
// //获取所有场站信息
// List<StationTaksDto> list=stationDataTask.getListStationBasic();
// for (StationTaksDto stationTaksDto : list) {
// //获取分机
// List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
// if(listDeviceDto!=null&&listDeviceDto.size()>0){
// for (DeviceDto deviceDto : listDeviceDto) {
// List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
// }
// }
// }
// }
}
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
IFNULL(SCCJ, '') as source, IFNULL(SCCJ, '') as source,
'' as stationName, '' as stationName,
IFNULL(QRCODE_COLOR, 'green') as qrCodeColor, IFNULL(QRCODE_COLOR, 'green') as qrCodeColor,
IFNULL(UPDATE_TIME, '') AS recDate IFNULL(UPDATE_STAMP, '') AS recDate
FROM FROM
sjgl_zsj_zsbtz sjgl_zsj_zsbtz
where SBBM = #{objectId} where SBBM = #{objectId}
......
...@@ -222,24 +222,24 @@ public class DemoController extends BaseController { ...@@ -222,24 +222,24 @@ public class DemoController extends BaseController {
equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> { equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> {
ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get(); ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get();
esEquipments.setEquipmentIndexName(equipmentsJxiopDocMysql.getEquipmentIndexName()); esEquipments.setEquipmentIndexName(equipmentsJxiopDocMysql.getEquipmentIndexName());
esEquipments.setEquipmentNumber(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getEquipmentNumber())?"":equipmentsJxiopDocMysql.getEquipmentNumber()); esEquipments.setEquipmentNumber(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getEquipmentNumber()) ? "" : equipmentsJxiopDocMysql.getEquipmentNumber());
esEquipments.setIsAlarm(equipmentsJxiopDocMysql.getIsAlarm()); esEquipments.setIsAlarm(equipmentsJxiopDocMysql.getIsAlarm());
esEquipments.setDataType(equipmentsJxiopDocMysql.getDataType()); esEquipments.setDataType(equipmentsJxiopDocMysql.getDataType());
esEquipments.setGatewayId(equipmentsJxiopDocMysql.getGatewayId()); esEquipments.setGatewayId(equipmentsJxiopDocMysql.getGatewayId());
esEquipments.setAddress(equipmentsJxiopDocMysql.getAddress()); esEquipments.setAddress(equipmentsJxiopDocMysql.getAddress());
esEquipments.setEquipmentSpecificName(equipmentsJxiopDocMysql.getEquipmentSpecificName()); esEquipments.setEquipmentSpecificName(equipmentsJxiopDocMysql.getEquipmentSpecificName());
//更新显示名称 //更新显示名称
esEquipments.setDisplayName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getDisplayName())?"":equipmentsJxiopDocMysql.getDisplayName()); esEquipments.setDisplayName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getDisplayName()) ? "" : equipmentsJxiopDocMysql.getDisplayName());
//更新排序号 //更新排序号
esEquipments.setTraceId(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getTraceId())?"":equipmentsJxiopDocMysql.getTraceId()); esEquipments.setTraceId(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getTraceId()) ? "" : equipmentsJxiopDocMysql.getTraceId());
//更新单位 //更新单位
esEquipments.setUnit(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getUnit())?"":equipmentsJxiopDocMysql.getUnit()); esEquipments.setUnit(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getUnit()) ? "" : equipmentsJxiopDocMysql.getUnit());
//更新frontModule //更新frontModule
esEquipments.setFrontModule(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getFrontModule())?"":equipmentsJxiopDocMysql.getFrontModule()); esEquipments.setFrontModule(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getFrontModule()) ? "" : equipmentsJxiopDocMysql.getFrontModule());
//更新systemType //更新systemType
esEquipments.setSystemType(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getSystemType())?"":equipmentsJxiopDocMysql.getSystemType()); esEquipments.setSystemType(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getSystemType()) ? "" : equipmentsJxiopDocMysql.getSystemType());
//更新图片名称 //更新图片名称
esEquipments.setPictureName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getPictureName())?"":equipmentsJxiopDocMysql.getPictureName()); esEquipments.setPictureName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getPictureName()) ? "" : equipmentsJxiopDocMysql.getPictureName());
equipmentsRepository.save(esEquipments); equipmentsRepository.save(esEquipments);
}); });
...@@ -254,31 +254,35 @@ public class DemoController extends BaseController { ...@@ -254,31 +254,35 @@ public class DemoController extends BaseController {
List<Object> pointImportDtoList = EasyExcel.read(inputStream).head(PointImportDto.class).sheet(0).headRowNumber(1).doReadSync(); List<Object> pointImportDtoList = EasyExcel.read(inputStream).head(PointImportDto.class).sheet(0).headRowNumber(1).doReadSync();
pointImportDtoList.forEach(o -> { pointImportDtoList.forEach(o -> {
PointImportDto pointImportDto = (PointImportDto) o; PointImportDto pointImportDto = (PointImportDto) o;
List<EquipmentsJxiopDocMysql> equipmentsJxiopDocMysqlList = equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().eq("gateway_id", pointImportDto.getGatewayId()).eq("equipment_index_name",pointImportDto.getEquipmentIndexName())); List<EquipmentsJxiopDocMysql> equipmentsJxiopDocMysqlList = equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().eq("gateway_id", pointImportDto.getGatewayId()).eq("equipment_index_name", pointImportDto.getEquipmentIndexName()));
if(!ObjectUtils.isEmpty(equipmentsJxiopDocMysqlList)){ if (!ObjectUtils.isEmpty(equipmentsJxiopDocMysqlList)) {
equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> { equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> {
ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get(); ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get();
//更新模块 //更新模块
equipmentsJxiopDocMysql.setFrontModule(pointImportDto.getFrontModule()); if (equipmentsJxiopDocMysql.getFrontModule().contains(pointImportDto.getFrontModule())) {
esEquipments.setFrontModule(pointImportDto.getFrontModule()); equipmentsJxiopDocMysql.setFrontModule(equipmentsJxiopDocMysql.getFrontModule() + "," + pointImportDto.getFrontModule());
//更新类型 esEquipments.setFrontModule(equipmentsJxiopDocMysql.getFrontModule() + "," + pointImportDto.getFrontModule());
equipmentsJxiopDocMysql.setSystemType(pointImportDto.getSystemType()); }
esEquipments.setSystemType(pointImportDto.getSystemType()); //更新类型
//更新排序号 if (equipmentsJxiopDocMysql.getSystemType().contains(pointImportDto.getSystemType())) {
equipmentsJxiopDocMysql.setTraceId(pointImportDto.getTraceId()); equipmentsJxiopDocMysql.setSystemType(equipmentsJxiopDocMysql.getSystemType()+","+pointImportDto.getSystemType());
esEquipments.setTraceId(pointImportDto.getTraceId()); esEquipments.setSystemType(equipmentsJxiopDocMysql.getSystemType()+","+pointImportDto.getSystemType());
//更新显示名称 }
equipmentsJxiopDocMysql.setDisplayName(pointImportDto.getDisplayName()); //更新排序号
esEquipments.setDisplayName(pointImportDto.getDisplayName()); equipmentsJxiopDocMysql.setTraceId(pointImportDto.getTraceId());
//更新单位 如果单位为空或者单位超过周期性数据存储长度则丢弃单位更新操作 esEquipments.setTraceId(pointImportDto.getTraceId());
if(!ObjectUtils.isEmpty(pointImportDto.getUnit())&&(pointImportDto.getUnit().toCharArray().length<24)){ //更新显示名称
equipmentsJxiopDocMysql.setUnit(pointImportDto.getUnit()); equipmentsJxiopDocMysql.setDisplayName(pointImportDto.getDisplayName());
esEquipments.setUnit(pointImportDto.getUnit()); esEquipments.setDisplayName(pointImportDto.getDisplayName());
} //更新单位 如果单位为空或者单位超过周期性数据存储长度则丢弃单位更新操作
equipmentsJxiopDocMysqlMapper.updateById(equipmentsJxiopDocMysql); if (!ObjectUtils.isEmpty(pointImportDto.getUnit()) && (pointImportDto.getUnit().toCharArray().length < 24)) {
equipmentsRepository.save(esEquipments); equipmentsJxiopDocMysql.setUnit(pointImportDto.getUnit());
}); esEquipments.setUnit(pointImportDto.getUnit());
} }
equipmentsJxiopDocMysqlMapper.updateById(equipmentsJxiopDocMysql);
equipmentsRepository.save(esEquipments);
});
}
}); });
} catch (Exception e) { } catch (Exception e) {
......
...@@ -403,7 +403,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -403,7 +403,7 @@ public class MonitorFanIdxController extends BaseController {
result.setCurrent(1); result.setCurrent(1);
result.setTotal(statusMonitoring.size()); result.setTotal(statusMonitoring.size());
try { try {
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, frontModule, stringStringEntry.getKey()), JSON.toJSONString(result).getBytes(), 0, false); emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, frontModule, stringStringEntry.getKey()), JSON.toJSONString(result).getBytes(), 1, true);
} catch (MqttException e) { } catch (MqttException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -408,26 +408,32 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -408,26 +408,32 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
if(Boolean.TRUE.toString().equalsIgnoreCase(elecStatus)&&"8.0".equals(fanStatus)&&power>0&&!isWarn) if(Boolean.TRUE.toString().equalsIgnoreCase(elecStatus)&&"8.0".equals(fanStatus)&&power>0&&!isWarn)
{ {
equipMap.put(entry.getKey(), "正常运行"); equipMap.put(entry.getKey(), "正常运行");
}else if(Boolean.TRUE.toString().equalsIgnoreCase(warnStatus))
{
equipMap.put(entry.getKey(), "报警运行");
} }
else if("9.0".equals(fault22)) else if("9.0".equals(fault22))
{ {
equipMap.put(entry.getKey(), "限功率"); equipMap.put(entry.getKey(), "限功率");
}else if(Boolean.TRUE.toString().equalsIgnoreCase(standbyStatus)&&"3.0".equals(fanStatus)) }
else if(Boolean.TRUE.toString().equalsIgnoreCase(warnStatus))
{
equipMap.put(entry.getKey(), "报警运行");
}
else if(Boolean.TRUE.toString().equalsIgnoreCase(standbyStatus)&&"3.0".equals(fanStatus))
{ {
equipMap.put(entry.getKey(), "待机状态"); equipMap.put(entry.getKey(), "待机状态");
}else if(Boolean.TRUE.toString().equalsIgnoreCase(stopStatus)&&"1.0".equals(fanStatus)) }
else if(Boolean.TRUE.toString().equalsIgnoreCase(stopStatus)&&"1.0".equals(fanStatus))
{ {
equipMap.put(entry.getKey(), "停机状态"); equipMap.put(entry.getKey(), "停机状态");
}else if(Boolean.TRUE.toString().equalsIgnoreCase(stopStatus)&&Boolean.TRUE.toString().equalsIgnoreCase(faultStatus)) }
else if(Boolean.TRUE.toString().equalsIgnoreCase(stopStatus)&&Boolean.TRUE.toString().equalsIgnoreCase(faultStatus))
{ {
equipMap.put(entry.getKey(), "故障状态"); equipMap.put(entry.getKey(), "故障状态");
}else if(Boolean.TRUE.toString().equalsIgnoreCase(mainStatus)&&"2.0".equals(fanStatus)) }
else if(Boolean.TRUE.toString().equalsIgnoreCase(mainStatus)&&"2.0".equals(fanStatus))
{ {
equipMap.put(entry.getKey(), "维护状态"); equipMap.put(entry.getKey(), "维护状态");
}else if(fdjSpeed>0&&min!=null&&min>=10) }
else if(fdjSpeed>0&&min!=null&&min>=10)
{ {
equipMap.put(entry.getKey(), "通讯中断"); equipMap.put(entry.getKey(), "通讯中断");
} }
...@@ -600,6 +606,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -600,6 +606,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipNum)); queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipNum));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap); List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
if(ObjectUtils.isEmpty(frontModule)){
equipNumList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
}
if (CollectionUtils.isNotEmpty(equipNumList) && !ObjectUtils.isEmpty(equipNumList.get(0).getValueF())) { if (CollectionUtils.isNotEmpty(equipNumList) && !ObjectUtils.isEmpty(equipNumList.get(0).getValueF())) {
return equipNumList.get(0).getValueF().toString(); return equipNumList.get(0).getValueF().toString();
} else { } else {
...@@ -1093,14 +1102,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1093,14 +1102,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (String s : collect.keySet()) { for (String s : collect.keySet()) {
Map<String, Object> statusMap = new HashMap<>(); Map<String, Object> statusMap = new HashMap<>();
if (frontModule.equals("前光")) { if (frontModule.equals("前光")) {
likeCodtion.remove(CommonConstans.QueryStringDisplayNameKeyword);
likeCodtion.remove(CommonConstans.QueryStringDisplayName + ".keyword"); likeCodtion.put(CommonConstans.QueryStringSystemTypeKeyword, "模拟量");
likeCodtion.put(CommonConstans.QueryStringSystemType + ".keyword", "模拟量");
List<ESEquipments> value = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeCodtion); List<ESEquipments> value = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeCodtion);
for (ESEquipments indicatorsDto : value) { for (ESEquipments indicatorsDto : value) {
Double aDouble = Double.valueOf(indicatorsDto.getValue()); Double aDouble = Double.valueOf(indicatorsDto.getValue());
statusMap.put(indicatorsDto.getDisplayName() + "Value", String.format(CommonConstans.Twodecimalplaces, aDouble)); statusMap.put(indicatorsDto.getDisplayName().split("\\(")[0] + "Value", String.format(CommonConstans.Twodecimalplaces, aDouble));
} }
} }
List<ESEquipments> indicatorsDtos = collect.get(s); List<ESEquipments> indicatorsDtos = collect.get(s);
...@@ -1371,22 +1379,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1371,22 +1379,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, String> likeMap = new HashMap<>(); Map<String, String> likeMap = new HashMap<>();
queryCodtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); queryCodtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCodtion.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList("模拟量")); queryCodtion.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList("模拟量"));
likeMap.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, map.get("boosterName")); likeMap.put(CommonConstans.QueryStringFrontMoudle, map.get("boosterName"));
if ("1主变高压侧".equals(map.get("boosterName")) || "1主变低压侧".equals(map.get("boosterName"))) { if ("1主变高压侧".equals(map.get("boosterName")) || "1主变低压侧".equals(map.get("boosterName"))) {
likeMap.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, map.get("压侧")); likeMap.put(CommonConstans.QueryStringFrontMoudle, "压侧");
List<ESEquipments> listData = commonServiceImpl.getListDataByCondtionsAndLike(queryCodtion, null, ESEquipments.class, likeMap); List<ESEquipments> listData = commonServiceImpl.getListDataByCondtions(queryCodtion, null, ESEquipments.class, likeMap);
// 主变高压侧 // 主变高压侧
Map<String, String> zbGYC = listData.stream().filter(t -> t.getFrontModule().contains("1主变高压侧")).collect(Collectors.toMap(ESEquipments::getDisplayName, ESEquipments::getValue)); Map<String, String> zbGYC = listData.stream().filter(t -> t.getFrontModule().contains("1主变高压侧")).collect(Collectors.toMap(ESEquipments::getDisplayName, ESEquipments::getValue));
List<Map<String, String>> zbList = new ArrayList<>(); List<Map<String, String>> zbList = new ArrayList<>();
listData.stream().filter(t -> t.getFrontModule().contains("1主变低压侧")).forEach(item -> { listData.stream().filter(t -> t.getFrontModule().contains("1主变低压侧")).forEach(item -> {
HashMap<String, String> zbMap = new HashMap<>(); HashMap<String, String> zbMap = new HashMap<>();
zbMap.put("traceId", item.getTraceId());
zbMap.put("title", item.getDisplayName()); zbMap.put("title", item.getDisplayName());
zbMap.put("grade1", keepTwoDecimalPlaces(item.getValue())); zbMap.put("grade1", keepTwoDecimalPlaces(item.getValue()));
zbMap.put("grade2", keepTwoDecimalPlaces(zbGYC.getOrDefault(item.getDisplayName(), "0.0"))); zbMap.put("grade2", keepTwoDecimalPlaces(zbGYC.getOrDefault(item.getDisplayName(), "0.0")));
if (StringUtils.isNotEmpty(item.getUnit())) {
zbMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
}
zbList.add(zbMap); zbList.add(zbMap);
}); });
IPage<Map<String, String>> zbResult = new Page<>(); IPage<Map<String, String>> zbResult = new Page<>();
...@@ -1395,21 +1400,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1395,21 +1400,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
zbResult.setTotal(zbList.size()); zbResult.setTotal(zbList.size());
try { try {
log.info("主变消息内容:{}", JSON.toJSONString(zbResult)); log.info("主变消息内容:{}", JSON.toJSONString(zbResult));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, routeName, "mnl"), JSON.toJSONString(zbResult).getBytes(), 2, false); emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, routeName, "mnl"), JSON.toJSONString(zbResult).getBytes(), 1, true);
} catch (MqttException e) { } catch (MqttException e) {
log.info("消息发送失败"); log.info("消息发送失败");
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {
List<ESEquipments> listData = commonServiceImpl.getListDataByCondtionsAndLike(queryCodtion, null, ESEquipments.class, likeMap); List<ESEquipments> listData = commonServiceImpl.getListDataByCondtions(queryCodtion, null, ESEquipments.class, likeMap);
ArrayList<Map<String, String>> resultList = new ArrayList<>(); ArrayList<Map<String, String>> resultList = new ArrayList<>();
listData.forEach(item -> { listData.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("traceId", item.getTraceId());
stringStringHashMap.put("title", item.getDisplayName()); stringStringHashMap.put("title", item.getDisplayName());
stringStringHashMap.put("value", keepTwoDecimalPlaces(item.getValue())); stringStringHashMap.put("value", keepTwoDecimalPlaces(item.getValue()));
if (StringUtils.isNotEmpty(item.getUnit())) {
stringStringHashMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
}
resultList.add(stringStringHashMap); resultList.add(stringStringHashMap);
}); });
...@@ -1419,7 +1422,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1419,7 +1422,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
result.setTotal(resultList.size()); result.setTotal(resultList.size());
try { try {
log.info("消息内容:{}", JSON.toJSONString(result)); log.info("消息内容:{}", JSON.toJSONString(result));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, routeName, "mnl"), JSON.toJSONString(result).getBytes(), 2, false); emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, routeName, "mnl"), JSON.toJSONString(result).getBytes(), 1, true);
} catch (MqttException e) { } catch (MqttException e) {
log.info("消息发送失败"); log.info("消息发送失败");
e.printStackTrace(); e.printStackTrace();
......
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