Commit ed3ff9b5 authored by tangwei's avatar tangwei

解决冲突

parents a388b8f2 8828d9b5
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.cache.Redis;
import java.util.ArrayList;
import java.util.List;
@Service
public class DataSynchronizationImpl {
//缓存的热工院数据
private static final String RedisKey = "RGYZJB_CACHE";
/**
* 场站信息service
*/
@Autowired
StationBasicServiceImpl stationBasicServiceImpl;
/**
* 中间表service
*/
@Autowired
SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl;
public void dataSync(){
// 1: 场站 list
List<StationBasic> stationBasicList = getStationBasicList();
stationBasicList.forEach(stationBasic -> {
getSjglZsjZsbtz(stationBasic);
});
// 2:异步 每个场站
// 3: 风机list 同步
// 4:查询单个分机 异步
// 5:时序库 lidt
// size(),
// List<List<Map<String ,Object>>> lidtd= Lists.partition(lidt,1000);
//
// 异步:
// mysql
}
/**@deprecated 获取所有的场站列表
*
* @return 场站列表list
*/
public List<StationBasic> getStationBasicList(){
List<StationBasic> stationBasicList = new ArrayList<>();
stationBasicList = stationBasicServiceImpl.list();
return stationBasicList;
}
/**
* @deprecated 获取场站下的所有设备信
* @param stationBasic 场站信息
* @return 设备基础信息
*/
public List<SjglZsjZsbtz> getSjglZsjZsbtz(StationBasic stationBasic){
List<SjglZsjZsbtz> sjglZsjZsbtzList = new ArrayList<>();
sjglZsjZsbtzList = sjglZsjZsbtzServiceImpl.getSjglZsjZsbtzListByWerks(stationBasic.getStationNumber());
return sjglZsjZsbtzList;
}
/**
* @deprecated 获取场站下的所有设备信
* @return 设备基础信息
*/
public List<SjglZsjZsbtz> cacheSjglZsjZsbtz(){
List cacheParams = new ArrayList();
cacheParams = Redis.getRedisTemplate().opsForList().range(RedisKey, 0, -1);
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzServiceImpl.getSjglZsjZsbtzList();
if(cacheParams.size() != sjglZsjZsbtzList.size()){
Redis.getRedisTemplate().delete(RedisKey);
Redis.getRedisTemplate().opsForList().leftPushAll(RedisKey,sjglZsjZsbtzList);
}
return sjglZsjZsbtzList;
}
}
......@@ -8,6 +8,8 @@ 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.biz.entity.SjglZsjZsbtz;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
......@@ -25,6 +27,8 @@ public class StationDataTaskImpl implements IStationDataTask {
@Autowired
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
@Autowired
InfluxDbConnection influxDbConnection;
@Autowired
MonitorFanIndicatorImpl monitorFanIndicatorImpl;
......@@ -45,7 +49,6 @@ public class StationDataTaskImpl implements IStationDataTask {
}
@Override
@Async("jxiopAsyncExecutor")
public List<DeviceDto> getListDevice(StationTaksDto stationTaksDto) {
List<DeviceDto> deviceDtoList = new ArrayList<>();
TpriDmpDatabook tpriDmpDatabook = tpriDmpDatabookServiceImpl.getTpriDmpDatabookByDataName("风机");
......@@ -53,7 +56,10 @@ public class StationDataTaskImpl implements IStationDataTask {
sjglZsjZsbtzList.forEach(sjglZsjZsbtz -> {
DeviceDto deviceDto = new DeviceDto();
deviceDto.setGateway(stationTaksDto.getGateway());
deviceDto.setNumberName("");
String kksbm = sjglZsjZsbtz.getKksbm();
String [] kksbms = kksbm.split(" ");
String numberName = kksbms[kksbms.length-1].replace("MD","");
deviceDto.setNumberName(numberName);
});
return deviceDtoList;
}
......@@ -63,11 +69,20 @@ public class StationDataTaskImpl implements IStationDataTask {
public void getIndexDto(DeviceDto deviceDto) {
//每个分机的指标数据
List<IndexDto> list=null;
List<IndexDto> list = null;
QueryResult query = influxDbConnection.query("SELECT * FROM iot_data where \"equipmentSpecificName\" =~/.*" + deviceDto.getNumberName() + ".*/ and \"gatewayId\" =~/" + deviceDto.getGateway() + "/ group by \"equipmentsIdx\" limit 1");
List<QueryResult.Result> queryResults = query.getResults();
for (int i = 0; i < queryResults.size(); i++) {
QueryResult.Result result = queryResults.get(i);
List seriesList = result.getSeries();
for (int j = 0; j < list.size(); j++) {
QueryResult.Series series = (QueryResult.Series) seriesList.get(j);
System.out.println(series.getName());
System.out.println(series.getColumns());
System.out.println(series.getValues());
System.out.println(series.getTags());
}
}
if(list!=null&&list.size()>0){
......@@ -85,6 +100,4 @@ public class StationDataTaskImpl implements IStationDataTask {
}
}
}
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