Commit 5d998a47 authored by chenzhao's avatar chenzhao

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

parents 8463cf1c 20ce594e
......@@ -8,9 +8,14 @@ import com.netflix.loadbalancer.RetryRule;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import io.swagger.models.auth.In;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -44,7 +49,7 @@ public class MonitoringServiceIMQTTmpl {
//风机实时数据Cron表达式
private final String fanCurrentDataCron = "0 0/1 * * * *";
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
private String fanStatusImagePathPrefix;
/**
* 场站mapper
*/
......@@ -62,6 +67,11 @@ public class MonitoringServiceIMQTTmpl {
@Autowired
CommonServiceImpl commonService;
@Autowired
InfluxDButils influxDButils;
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
/**
......@@ -291,7 +301,7 @@ public class MonitoringServiceIMQTTmpl {
.collect(Collectors.toList());
page.setTotal(fanStatusList.size());
page.setRecords(collect);
IPage<HashMap<String,String>> fanStatusListImages =getFanStatusListImages(collect);
IPage<HashMap<String, String>> fanStatusListImages = getFanStatusListImages(collect);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationFanStatusList_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationFanStatusListImages_topic", JSON.toJSON(fanStatusListImages).toString().getBytes("UTF-8"), 1, true);
......@@ -385,9 +395,9 @@ public class MonitoringServiceIMQTTmpl {
}
/**
* @deprecated 根据查询出来的风机状态返回风机的状态图片
* @param collect 根据网关id查询出来的数据
* @return 加工后风机实时运行状态图列表数据
* @deprecated 根据查询出来的风机状态返回风机的状态图片
*/
public IPage<HashMap<String, String>> getFanStatusListImages(List<IndexDto> collect) {
IPage<HashMap<String, String>> page = new Page<>();
......@@ -407,4 +417,45 @@ public class MonitoringServiceIMQTTmpl {
page.setRecords(hashMapList);
return page;
}
@Scheduled(cron = "0 0/1 * * * *")
public void getIndicatorsSwitchInfo() {
Integer current = 1;
Integer size = 99;
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("booster_gateway_id").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
//获取系统的forntmodule 前期每次都查询 后续应该放到缓存中
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo(stationBasic.getBoosterGatewayId());
for (int i = 0; i < boosterStationInfo.size(); i++) {
Map<String, String> map = boosterStationInfo.get(i);
sendIndicatorSwitch(stationBasic.getSequenceNbr().toString(),stationBasic.getBoosterGatewayId(), map.get("boosterName"));
}
});
}
public void sendIndicatorSwitch(String stationId,String bootStationGateWayId, String frontMoudule) {
String sql = "SELECT * FROM indicators_" + bootStationGateWayId + " where frontModule = '" + frontMoudule + "' and systemType='开关'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql, IndicatorsDto.class);
//过滤掉包含数字的开关
List<IndicatorsDto> result = indicatorsDtoList.stream().filter(indicatorsDto -> !indicatorsDto.getDisplayName().matches(".*\\d+.*")).collect(Collectors.toList());
HashMap<String,String> hashMap =new HashMap<>();
for (int i = 0; i < result.size(); i++) {
IndicatorsDto indicatorsDto = result.get(i);
hashMap.put("url"+i,"tetee");
hashMap.put("display"+i,indicatorsDto.getDisplayName());
}
Page<HashMap<String,String>> hashMapPage = new Page<>();
List<HashMap<String,String>> list = new ArrayList<>();
list.add(hashMap);
hashMapPage.setRecords(list);
hashMapPage.setTotal(list.size());
hashMapPage.setCurrent(1);
System.out.println(result.size());
try {
emqKeeper.getMqttClient().publish(stationId+bootStationGateWayId + "_topic", JSON.toJSON(hashMapPage).toString().getBytes("UTF-8"), 1, true);
logger.info(JSON.toJSONString(hashMapPage));
logger.info("-----------------发送升压站数据成功=================== 成功!");
}catch (Exception e){
logger.info("-----------------发送升压站数据成功=================== 成功!");
}
}
}
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