|
|
@ -39,7 +39,6 @@ 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 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; |
|
|
@ -698,21 +697,17 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
list.add(waterLevelVo); |
|
|
|
list.add(waterLevelVo); |
|
|
|
} |
|
|
|
} |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
XxlJobLogger.log("load_water_level : 子线程执行完成 {}", item.getInstanceCode()); |
|
|
|
|
|
|
|
} catch (Exception exception) { |
|
|
|
} 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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1444,7 +1439,6 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
powerMap.put(station.getCode(),generateMap); |
|
|
|
powerMap.put(station.getCode(),generateMap); |
|
|
|
}); |
|
|
|
}); |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
log.error("pool_item_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
}catch (Exception e){ |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1461,43 +1455,6 @@ public class RealTargetServiceImpl implements RealTargetService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Float> lastReduceFirst(StationEntity station, List<EminfoAndEmParamVo> devices, String start, String end) { |
|
|
|
|
|
|
|
List<PowerMonthVo> datas = new ArrayList<>(); |
|
|
|
|
|
|
|
// 设备采集发电量
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(devices)){ |
|
|
|
|
|
|
|
devices.forEach(device->{ |
|
|
|
|
|
|
|
List<Map<String, String>> records = dataService.lastFirstBySignage(start,end,7,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
datas.addAll(records.stream().map(record -> { |
|
|
|
|
|
|
|
PowerMonthVo generate = new PowerMonthVo(); |
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
String val = record.get(HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
|
|
|
|
if(StringUtil.isEmpty(val)){ |
|
|
|
|
|
|
|
generate.setPower(0f); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
generate.setPower(Float.parseFloat(String.valueOf(Double.parseDouble(val) * device.getRideCount()))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return generate; |
|
|
|
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 补充填报数据
|
|
|
|
|
|
|
|
datas.addAll(this.generateFill(station,start,end)); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(datas)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 近年发电量数据 |
|
|
|
* 近年发电量数据 |
|
|
|
* |
|
|
|
* |
|
|
|