Commit f937b12d authored by caotao's avatar caotao

运行监盘将查询influxdb迁移到查询es

parent df5f5cdb
...@@ -77,4 +77,17 @@ public class CommonConstans { ...@@ -77,4 +77,17 @@ public class CommonConstans {
} }
}; };
//es EquipIndexName 查绚关键字
public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword";
//es gatewayId 查绚关键字
public static final String QueryStringGateWayId = "gatewayId.keyword";
public static final String QueryStringFrontMoudle = "frontModule";
public static final String QueryStringSystemType = "systemType";
public static final String QueryStringEquipmentNumber = "equipmentNumber";
public static final String QueryStringValue = "value";
public static final String QueryStringDataType = "dataType";
public static final String QueryStringDisplayName = "displayName";
public static final String QueryStringIsAlarm = "isAlarm";
public static final String Twodecimalplaces= "%.2f";
public static final String Fourdecimalplaces = "%.4f";
} }
...@@ -101,13 +101,13 @@ public class DemoController extends BaseController { ...@@ -101,13 +101,13 @@ public class DemoController extends BaseController {
ESEquipmentsRepository equipmentsRepository; ESEquipmentsRepository equipmentsRepository;
@Autowired @Autowired
CommonServiceImpl commonServiceImpl; CommonServiceImpl commonServiceImpl;
@Autowired // @Autowired
PowerGenerationImpl powerGenerationImpl; // PowerGenerationImpl powerGenerationImpl;
@Autowired @Autowired
StationCacheDataInit stationCacheDataInit; StationCacheDataInit stationCacheDataInit;
@Autowired // @Autowired
LargeScreenImpl largeScreenImpl; // LargeScreenImpl largeScreenImpl;
private final String ss= "瞬时风速"; private final String ss= "瞬时风速";
private final String zfs= "WTX-801_25_WTX-801_总辐射"; private final String zfs= "WTX-801_25_WTX-801_总辐射";
private final String zfslj= "WTX-801_25_WTX-801_总辐射累计"; private final String zfslj= "WTX-801_25_WTX-801_总辐射累计";
...@@ -513,43 +513,43 @@ public class DemoController extends BaseController { ...@@ -513,43 +513,43 @@ public class DemoController extends BaseController {
} }
return mapdta; return mapdta;
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分组求和数") // @ApiOperation(value = "分组求和数")
@GetMapping("/test15") // @GetMapping("/test15")
public Map test15() { // public Map test15() {
//
Map<String,Double> map= largeScreenImpl.getqg(); //// Map<String,Double> map= largeScreenImpl.getqg();
//
return map; // return map;
} // }
//
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分组求和数") // @ApiOperation(value = "分组求和数")
@GetMapping("/test16") // @GetMapping("/test16")
public Map test16() { // public Map test16() {
//
//获取每个区域下所有风机网管 // //获取每个区域下所有风机网管
List<StationCacheInfoDto> listk =commonServiceImpl.getListStationCacheInfoDto(); // List<StationCacheInfoDto> listk =commonServiceImpl.getListStationCacheInfoDto();
//
Map<String, List<StationCacheInfoDto>> map = listk.stream().filter(v -> StringUtils.isNotEmpty(v.getBelongArea())).collect(Collectors.groupingBy(StationCacheInfoDto :: getBelongArea)); // Map<String, List<StationCacheInfoDto>> map = listk.stream().filter(v -> StringUtils.isNotEmpty(v.getBelongArea())).collect(Collectors.groupingBy(StationCacheInfoDto :: getBelongArea));
Map<String,Double> maps=null; // Map<String,Double> maps=null;
//
for(String key:map.keySet()){ // for(String key:map.keySet()){
List<String> value1=new ArrayList<>(); // List<String> value1=new ArrayList<>();
//
List<StationCacheInfoDto> list= map.get(key); // List<StationCacheInfoDto> list= map.get(key);
//
for (StationCacheInfoDto stationCacheInfoDto : list) { // for (StationCacheInfoDto stationCacheInfoDto : list) {
value1.add(stationCacheInfoDto.getBoosterGatewayId()); // value1.add(stationCacheInfoDto.getBoosterGatewayId());
value1.add(stationCacheInfoDto.getFanGatewayId()); // value1.add(stationCacheInfoDto.getFanGatewayId());
} // }
//
maps= largeScreenImpl.getqy(value1); // maps= largeScreenImpl.getqy(value1);
break; // break;
} // }
//
return maps; // return maps;
} // }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化inlfuxdb-new") @ApiOperation(value = "初始化inlfuxdb-new")
...@@ -607,40 +607,46 @@ public class DemoController extends BaseController { ...@@ -607,40 +607,46 @@ public class DemoController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分组求和数") // @ApiOperation(value = "分组求和数")
@GetMapping("/test18") // @GetMapping("/test18")
public Map test18() { // public Map test18() {
List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto(); // List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto();
//获取时间天字符串 // //获取时间天字符串
//
String datyvalue= "2023-08-11"; // String datyvalue= "2023-08-11";
elasticsearchTemplate.deleteIndex(ESDailyPowerGeneration.class); // elasticsearchTemplate.deleteIndex(ESDailyPowerGeneration.class);
elasticsearchTemplate.deleteIndex(ESMoonPowerGeneration.class); // elasticsearchTemplate.deleteIndex(ESMoonPowerGeneration.class);
elasticsearchTemplate.deleteIndex(ESYearPowerGeneration.class); // elasticsearchTemplate.deleteIndex(ESYearPowerGeneration.class);
//
for (StationCacheInfoDto stationCacheInfoDto : list) { // for (StationCacheInfoDto stationCacheInfoDto : list) {
if("FDZ".equals(stationCacheInfoDto.getStationType())){ // if("FDZ".equals(stationCacheInfoDto.getStationType())){
//
//风机 // //风机
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"FDZ",datyvalue); // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"FDZ",datyvalue);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"FDZ",datyvalue); // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"FDZ",datyvalue);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"FDZ",datyvalue); // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"FDZ",datyvalue);
//
}else{ // }else{
//
//光伏 // //光伏
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"GFDZ",datyvalue); // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"GFDZ",datyvalue);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"GFDZ",datyvalue); // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"GFDZ",datyvalue);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"GFDZ",datyvalue); // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"GFDZ",datyvalue);
//
} // }
} // }
//
// return null;
// }
return null; @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "es获取数据")
@GetMapping("/test19")
public void test19() {
Map<String,List<String>> queryConditon = new HashMap<>();
queryConditon.put("equipmentIndexName.keyword",Arrays.asList("日发电量","月发电量","年发电量"));
commonServiceImpl.getListDataByCondtions(queryConditon,null,ESEquipments.class);
} }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.scheduled; //package com.yeejoin.amos.boot.module.jxiop.biz.scheduled;
//
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESDailyPowerGeneration; //import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESDailyPowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration; //import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto; //import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; //import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PowerGenerationImpl; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.EnableScheduling; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component; //
//import java.text.SimpleDateFormat;
import java.text.SimpleDateFormat; //import java.util.ArrayList;
import java.util.ArrayList; //import java.util.Date;
import java.util.Date; //import java.util.List;
import java.util.List; //
///**
/** // * @description:
* @description: // * @author: tw
* @author: tw // * @createDate: 2023/8/9
* @createDate: 2023/8/9 // */
*/ //
//@Component
@Component //@EnableScheduling
@EnableScheduling //public class PowerGeneration {
public class PowerGeneration { //
//// @Autowired
@Autowired //// PowerGenerationImpl powerGenerationImpl;
PowerGenerationImpl powerGenerationImpl; // @Autowired
@Autowired // CommonServiceImpl commonServiceImpl;
CommonServiceImpl commonServiceImpl; //
// private final String dayvalue="日发电量";
private final String dayvalue="日发电量"; // private final String moonValue="月发电量";
private final String moonValue="月发电量"; // private final String yearValue="年发电量";
private final String yearValue="年发电量"; //
// private final String dayDateFormat="yyyy-MM-dd";
private final String dayDateFormat="yyyy-MM-dd"; // private final String moonDateFormat="yyyy-MM";
private final String moonDateFormat="yyyy-MM"; // private final String yearDateFormat="yyyy";
private final String yearDateFormat="yyyy"; //
// private final String dayType="day";
private final String dayType="day"; // private final String moonType="moon";
private final String moonType="moon"; // private final String yearType="year";
private final String yearType="year"; //
// //定时更新日发电量
//定时更新日发电量 // @Scheduled(cron = "${daily.power.generation.cron}")
@Scheduled(cron = "${daily.power.generation.cron}") // public void addESDailyPowerGeneration(){
public void addESDailyPowerGeneration(){ // List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto(); // //获取时间天字符串
//获取时间天字符串 // SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd"); // Date now=new Date();
Date now=new Date(); // String daty= myFmt2.format(now);
String daty= myFmt2.format(now); // for (StationCacheInfoDto stationCacheInfoDto : list) {
for (StationCacheInfoDto stationCacheInfoDto : list) { //
// if("FDZ".equals(stationCacheInfoDto.getStationType())){
if("FDZ".equals(stationCacheInfoDto.getStationType())){ //
// //风机
//风机 // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"FDZ",daty);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"FDZ",daty); //
// }else{
}else{ //
// //光伏
//光伏 // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"GFDZ",daty);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"GFDZ",daty); //
// }
} //
// }
} //
//
// }
} // //定时更新月发电量
//定时更新月发电量 // @Scheduled(cron = "${moon.power.generation.cron}")
@Scheduled(cron = "${moon.power.generation.cron}") // public void addESMoonPowerGeneration(){
public void addESMoonPowerGeneration(){ // List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto(); // //获取时间天字符串
//获取时间天字符串 // SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd"); // Date now=new Date();
Date now=new Date(); // String daty= myFmt2.format(now);
String daty= myFmt2.format(now); // for (StationCacheInfoDto stationCacheInfoDto : list) {
for (StationCacheInfoDto stationCacheInfoDto : list) { // //风机
//风机 // if("FDZ".equals(stationCacheInfoDto.getStationType())){
if("FDZ".equals(stationCacheInfoDto.getStationType())){ //
// //风机
//风机 // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"FDZ",daty);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"FDZ",daty); //
// }else{
}else{ //
// //光伏
//光伏 // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"GFDZ",daty);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"GFDZ",daty); //
// }
} //
// }
} // }
} // //定时更新年发电量
//定时更新年发电量 // @Scheduled(cron = "${year.power.generation.cron}")
@Scheduled(cron = "${year.power.generation.cron}") // public void addESYearPowerGeneration(){
public void addESYearPowerGeneration(){ // List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto(); // //获取时间天字符串
//获取时间天字符串 // SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd"); // Date now=new Date();
Date now=new Date(); // String daty= myFmt2.format(now);
String daty= myFmt2.format(now); // for (StationCacheInfoDto stationCacheInfoDto : list) {
for (StationCacheInfoDto stationCacheInfoDto : list) { // //风机
//风机 // if("FDZ".equals(stationCacheInfoDto.getStationType())){
if("FDZ".equals(stationCacheInfoDto.getStationType())){ //
// //风机
//风机 // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"FDZ",daty);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"FDZ",daty); //
// }else{
}else{ //
// //光伏
//光伏 // powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"GFDZ",daty);
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"GFDZ",daty); //
// }
} //
// }
} // }
} //
//
//
//}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; //package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
//
import com.google.common.collect.Lists; //import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto; //import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; //import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; //import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
import java.util.List; //import java.util.List;
//
/** ///**
* @description: // * @description:
* @author: tw // * @author: tw
* @createDate: 2023/7/4 // * @createDate: 2023/7/4
*/ // */
@Component //@Component
public class MonitorFanIndicatorAsync { //public class MonitorFanIndicatorAsync {
@Autowired // @Autowired
MonitorFanIndicatorImpl monitorFanIndicatorImpl; // MonitorFanIndicatorImpl monitorFanIndicatorImpl;
@Value("${station.section}") // @Value("${station.section}")
private int stationSection; // private int stationSection;
@Value("${station.isok}") // @Value("${station.isok}")
private boolean isok; // private boolean isok;
//
//
@Async("jxiopAsyncExecutor") // @Async("jxiopAsyncExecutor")
public void UpdateMonitorFanIndicator(List<IndexDto> list){ // public void UpdateMonitorFanIndicator(List<IndexDto> list){
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list); // monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
} // }
//
//
} //}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; //package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
//
import com.google.common.collect.Lists; //import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.jxiop.api.dto.DeviceDto; //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.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto; //import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; //import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.service.IStationDataTask; //import com.yeejoin.amos.boot.module.jxiop.api.service.IStationDataTask;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz; //import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook; //import com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils; //import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection; //import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import org.influxdb.dto.QueryResult; //import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; //import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; //import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync; //import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
////已废弃
@Component //@Component
public class StationDataTaskImpl { //public class StationDataTaskImpl {
@Autowired // @Autowired
StationBasicServiceImpl stationBasicServiceImpl; // StationBasicServiceImpl stationBasicServiceImpl;
//
@Autowired // @Autowired
SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl; // SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl;
//
@Autowired // @Autowired
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl; // TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
//
@Autowired // @Autowired
MonitorFanIndicatorImpl monitorFanIndicatorImpl; // MonitorFanIndicatorImpl monitorFanIndicatorImpl;
@Value("${station.section}") // @Value("${station.section}")
private int stationSection; // private int stationSection;
@Value("${station.isok}") // @Value("${station.isok}")
private boolean isok; // private boolean isok;
//
@Autowired // @Autowired
InfluxDButils influxDButils; // InfluxDButils influxDButils;
@Autowired //// @Autowired
MonitorFanIndicatorAsync monitorFanIndicatorAsync; //// MonitorFanIndicatorAsync monitorFanIndicatorAsync;
//
/** // /**
* 获取 List<StationTaksDto> // * 获取 List<StationTaksDto>
* @return <StationTaksDto> // * @return <StationTaksDto>
*/ // */
public List<StationTaksDto> getListStationBasic() { // public List<StationTaksDto> getListStationBasic() {
return stationBasicServiceImpl.getStationTaksDtoList(); // return stationBasicServiceImpl.getStationTaksDtoList();
} // }
//
//
/** // /**
* @deprecated 获取该场站下所有的风机信息 // * @deprecated 获取该场站下所有的风机信息
* @param stationTaksDto // * @param stationTaksDto
* @return List<DeviceDto> 设备信息列表 // * @return List<DeviceDto> 设备信息列表
*/ // */
public List<DeviceDto> getListDevice(StationTaksDto stationTaksDto) { // public List<DeviceDto> getListDevice(StationTaksDto stationTaksDto) {
List<DeviceDto> deviceDtoList = new ArrayList<>(); // List<DeviceDto> deviceDtoList = new ArrayList<>();
//获取风机的字典id // //获取风机的字典id
TpriDmpDatabook tpriDmpDatabook = tpriDmpDatabookServiceImpl.getTpriDmpDatabookByDataName("风机"); // TpriDmpDatabook tpriDmpDatabook = tpriDmpDatabookServiceImpl.getTpriDmpDatabookByDataName("风机");
//根据字典id与场站编码获取所有的风机列表 // //根据字典id与场站编码获取所有的风机列表
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzServiceImpl .getSjglZsjZsbtzList(tpriDmpDatabook.getDataid(),stationTaksDto.getStationNumber()); // List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzServiceImpl .getSjglZsjZsbtzList(tpriDmpDatabook.getDataid(),stationTaksDto.getStationNumber());
//遍历风机列表对于需要的参数进行组装 // //遍历风机列表对于需要的参数进行组装
sjglZsjZsbtzList.forEach(sjglZsjZsbtz -> { // sjglZsjZsbtzList.forEach(sjglZsjZsbtz -> {
DeviceDto deviceDto = new DeviceDto(); // DeviceDto deviceDto = new DeviceDto();
deviceDto.setGateway(stationTaksDto.getGateway()); // deviceDto.setGateway(stationTaksDto.getGateway());
String kksbm = sjglZsjZsbtz.getKksbm(); // String kksbm = sjglZsjZsbtz.getKksbm();
String [] kksbms = kksbm.split(" "); // String [] kksbms = kksbm.split(" ");
String numberName = kksbms[kksbms.length-1].replace("MD",""); // String numberName = kksbms[kksbms.length-1].replace("MD","");
deviceDto.setNumberName(numberName); // deviceDto.setNumberName(numberName);
deviceDtoList.add(deviceDto); // deviceDtoList.add(deviceDto);
}); // });
return deviceDtoList; // return deviceDtoList;
} // }
//
// @Async("jxiopAsyncExecutor") //// @Async("jxiopAsyncExecutor")
public List<IndexDto> getIndexDto(DeviceDto deviceDto) { // public List<IndexDto> getIndexDto(DeviceDto deviceDto) {
String querysql ="SELECT createdTime ,gatewayId,address,valueLabel ,equipmentsIdx FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+"风机"+".*/ and gatewayId='"+deviceDto.getGateway()+"' ORDER BY time desc LIMIT 600"; // String querysql ="SELECT createdTime ,gatewayId,address,valueLabel ,equipmentsIdx FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+"风机"+".*/ and gatewayId='"+deviceDto.getGateway()+"' ORDER BY time desc LIMIT 600";
//每个分机的指标数据 // //每个分机的指标数据
List<IndexDto> list = influxDButils.getListData(querysql,IndexDto.class); // List<IndexDto> list = influxDButils.getListData(querysql,IndexDto.class);
if(list!=null&&list.size()>0){ // if(list!=null&&list.size()>0){
//对数据切片处理 默认创建 // //对数据切片处理 默认创建
if(stationSection>list.size()||!isok){ // if(stationSection>list.size()||!isok){
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list); // monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
}else{ // }else{
//进行分片处理 // //进行分片处理
//
List<List<IndexDto>> listfp4= Lists.partition(list,stationSection); // List<List<IndexDto>> listfp4= Lists.partition(list,stationSection);
for (List<IndexDto> indexDtos : listfp4) { // for (List<IndexDto> indexDtos : listfp4) {
//每个分级信息处理 // //每个分级信息处理
monitorFanIndicatorAsync.UpdateMonitorFanIndicator(indexDtos); // monitorFanIndicatorAsync.UpdateMonitorFanIndicator(indexDtos);
} // }
} // }
} // }
//
return list; // return list;
} // }
//
//
//
//
//
} //}
package com.yeejoin.amos.boot.module.jxiop.biz.tasks; //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.DeviceDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto; //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.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationDataTaskImpl; ////import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationDataTaskImpl;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; //import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
import java.util.List; //import java.util.List;
//
/** ///**
* @description: 定时获取场站最新数据 // * @description: 定时获取场站最新数据
* @author: tw // * @author: tw
* @createDate: 2023/7/3 // * @createDate: 2023/7/3
*/ // */
//
@Component //@Component
@EnableScheduling //@EnableScheduling
public class StationDataTask { //public class StationDataTask {
//
@Autowired // @Autowired
StationDataTaskImpl stationDataTask; // StationDataTaskImpl stationDataTask;
//
//
//定时获取场站指标最新数据 // //定时获取场站指标最新数据
// @Scheduled(cron = "${station.task.cron}") // // @Scheduled(cron = "${station.task.cron}")
public void getStationDataTask(){ // public void getStationDataTask(){
//获取所有场站信息 // //获取所有场站信息
List<StationTaksDto> list=stationDataTask.getListStationBasic(); // List<StationTaksDto> list=stationDataTask.getListStationBasic();
for (StationTaksDto stationTaksDto : list) { // for (StationTaksDto stationTaksDto : list) {
//获取分机 // //获取分机
List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto); // List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
if(listDeviceDto!=null&&listDeviceDto.size()>0){ // if(listDeviceDto!=null&&listDeviceDto.size()>0){
for (DeviceDto deviceDto : listDeviceDto) { // for (DeviceDto deviceDto : listDeviceDto) {
List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto); // List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
} // }
} // }
} // }
} // }
} //}
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