|
|
@ -41,6 +41,8 @@ import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; |
|
|
|
|
|
|
|
import com.xxl.job.core.log.XxlJobLogger; |
|
|
|
|
|
|
|
import io.undertow.util.CopyOnWriteMap; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
@ -642,14 +644,16 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
List<WaterLevelVo> list = new CopyOnWriteArrayList<>(); |
|
|
|
List<WaterLevelVo> list = new CopyOnWriteArrayList<>(); |
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(modelList.size()); |
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(modelList.size()); |
|
|
|
for(HzimsAnalyzeModelStationEntity item : modelList){ |
|
|
|
for(HzimsAnalyzeModelStationEntity item : modelList){ |
|
|
|
pool.submit(() -> { |
|
|
|
pool.execute(() -> { |
|
|
|
try{ |
|
|
|
try{ |
|
|
|
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList=new ArrayList<>(); |
|
|
|
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = new ArrayList<>(); |
|
|
|
MultiAnalyzeCodePO multiAnalyzeCodePO=new MultiAnalyzeCodePO(); |
|
|
|
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); |
|
|
|
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); |
|
|
|
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); |
|
|
|
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); |
|
|
|
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); |
|
|
|
multiAnalyzeCodePOList.add(multiAnalyzeCodePO); |
|
|
|
multiAnalyzeCodePOList.add(multiAnalyzeCodePO); |
|
|
|
R<List<AnalyzeCodeBySignagesVO>>result=analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); |
|
|
|
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData())){ |
|
|
|
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData())){ |
|
|
|
WaterLevelVo waterLevelVo=new WaterLevelVo(); |
|
|
|
WaterLevelVo waterLevelVo=new WaterLevelVo(); |
|
|
|
waterLevelVo.setStationCode(item.getStationId()); |
|
|
|
waterLevelVo.setStationCode(item.getStationId()); |
|
|
@ -671,21 +675,25 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
list.add(waterLevelVo); |
|
|
|
list.add(waterLevelVo); |
|
|
|
} |
|
|
|
} |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
}catch (Exception exception){ |
|
|
|
XxlJobLogger.log("load_water_level : 子线程执行完成 {}", item.getInstanceCode()); |
|
|
|
log.error("load_water_level_error : {}",exception.getMessage()); |
|
|
|
} catch (Exception exception) { |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
XxlJobLogger.log("load_water_level_error : 子线程执行失败 {}", exception.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
XxlJobLogger.log("load_water_level :等待线程执行"); |
|
|
|
countDownLatch.await(); |
|
|
|
countDownLatch.await(); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
} catch (InterruptedException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
XxlJobLogger.log("load_water_level :线程执行结束"); |
|
|
|
redisTemplate.opsForValue().set(loadwater_level_key,list); |
|
|
|
redisTemplate.opsForValue().set(loadwater_level_key,list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 光伏站-逆变器实时加载 |
|
|
|
* 光伏站-逆变器实时加载 |
|
|
|
* |
|
|
|
* |
|
|
@ -947,7 +955,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
return datas.stream().map(data->{ |
|
|
|
return datas.stream().map(data->{ |
|
|
|
ActivePowerVo active = new ActivePowerVo(); |
|
|
|
ActivePowerVo active = new ActivePowerVo(); |
|
|
|
Date dateTime = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date dateTime; |
|
|
|
|
|
|
|
if(data.getTs().contains(".0")){ |
|
|
|
|
|
|
|
dateTime = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
dateTime = DateUtil.parse(data.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
} |
|
|
|
active.setHour(dateTime.getHours()); |
|
|
|
active.setHour(dateTime.getHours()); |
|
|
|
if (StringUtil.isBlank(data.getVal())) { |
|
|
|
if (StringUtil.isBlank(data.getVal())) { |
|
|
|
active.setActivePower("0"); |
|
|
|
active.setActivePower("0"); |
|
|
@ -974,7 +987,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
return records.stream().map(record -> { |
|
|
|
return records.stream().map(record -> { |
|
|
|
UsrPowerVo usr = new UsrPowerVo(); |
|
|
|
UsrPowerVo usr = new UsrPowerVo(); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time; |
|
|
|
|
|
|
|
if(record.getTs().contains(".0")){ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
} |
|
|
|
usr.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
usr.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
usr.setUsrPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); |
|
|
|
usr.setUsrPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); |
|
|
|
return usr; |
|
|
|
return usr; |
|
|
@ -1004,7 +1022,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
return records.stream().map(record -> { |
|
|
|
return records.stream().map(record -> { |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time; |
|
|
|
|
|
|
|
if(record.getTs().contains(".0")){ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
} |
|
|
|
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); |
|
|
|
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); |
|
|
|
if(StringUtil.isEmpty(record.getVal())){ |
|
|
|
if(StringUtil.isEmpty(record.getVal())){ |
|
|
|
generate.setPower(0f); |
|
|
|
generate.setPower(0f); |
|
|
@ -1217,7 +1240,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
if(StringUtil.isEmpty(time) || "-".equals(time)){ |
|
|
|
if(StringUtil.isEmpty(time) || "-".equals(time)){ |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
|
Date date = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss.sss"); |
|
|
|
Date date; |
|
|
|
|
|
|
|
if(time.contains(".000")){ |
|
|
|
|
|
|
|
date = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss.sss"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
date = DateUtil.parse(time, DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
} |
|
|
|
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ |
|
|
|
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ |
|
|
|
return 0.0; |
|
|
|
return 0.0; |
|
|
|
} |
|
|
|
} |
|
|
@ -1245,7 +1273,11 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
return datas.stream().collect(Collectors.toMap( |
|
|
|
return datas.stream().collect(Collectors.toMap( |
|
|
|
key-> { |
|
|
|
key-> { |
|
|
|
Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
if(key.getTs().contains(".0")){ |
|
|
|
|
|
|
|
Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
return dateTime.getHours(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Date dateTime = DateUtil.parse(key.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
return dateTime.getHours(); |
|
|
|
return dateTime.getHours(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
value -> { |
|
|
|
value -> { |
|
|
@ -1417,7 +1449,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
datas.addAll(records.stream().map(record -> { |
|
|
|
datas.addAll(records.stream().map(record -> { |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
Date time = DateUtil.parse(record.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time; |
|
|
|
|
|
|
|
if(record.get("ts").contains(".0")){ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.get("ts") + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
} |
|
|
|
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
String val = record.get(HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
String val = record.get(HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
if(StringUtil.isEmpty(val)){ |
|
|
|
if(StringUtil.isEmpty(val)){ |
|
|
@ -1535,7 +1572,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
datas.addAll(records.stream().map(record -> { |
|
|
|
datas.addAll(records.stream().map(record -> { |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time; |
|
|
|
|
|
|
|
if(record.getTs().contains(".0")){ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
} |
|
|
|
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); |
|
|
|
if(StringUtil.isEmpty(record.getVal())){ |
|
|
|
if(StringUtil.isEmpty(record.getVal())){ |
|
|
|
generate.setPower(0f); |
|
|
|
generate.setPower(0f); |
|
|
@ -1782,7 +1824,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
return records.stream().map(record -> { |
|
|
|
return records.stream().map(record -> { |
|
|
|
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); |
|
|
|
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time; |
|
|
|
|
|
|
|
if(record.getTs().contains(".0")){ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
} |
|
|
|
load.setHour(time.getHours()); |
|
|
|
load.setHour(time.getHours()); |
|
|
|
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); |
|
|
|
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); |
|
|
|
return load; |
|
|
|
return load; |
|
|
@ -1809,7 +1856,12 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
return records.stream().map(record -> { |
|
|
|
return records.stream().map(record -> { |
|
|
|
GenerationPowerVo generate = new GenerationPowerVo(); |
|
|
|
GenerationPowerVo generate = new GenerationPowerVo(); |
|
|
|
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
Date time; |
|
|
|
|
|
|
|
if(record.getTs().contains(".0")){ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); |
|
|
|
|
|
|
|
} |
|
|
|
generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE)); |
|
|
|
generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE)); |
|
|
|
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); |
|
|
|
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); |
|
|
|
return generate; |
|
|
|
return generate; |
|
|
|