Browse Source

#站点首页优化

zhongwei
yang_shj 3 months ago
parent
commit
a4cb2ce790
  1. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  2. 42
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  3. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -46,9 +46,10 @@ public class RealTargetScheduledTask {
/** /**
* 水电站-机组实时加载 * 水电站-机组实时加载
*/ */
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL) //@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
//@Scheduled(cron = "0/40 * * * * ? ") @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal(String param) { public ReturnT<String> loadHydropowerReal() {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
@ -59,9 +60,10 @@ public class RealTargetScheduledTask {
/** /**
* 水电站-机组指标加载 * 水电站-机组指标加载
*/ */
@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET) //@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ") @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerTarget(String param) { public ReturnT<String> loadHydropowerTarget() {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

42
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -1485,24 +1485,36 @@ public class RealTargetServiceImpl implements RealTargetService {
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
// 结束日期 // 结束日期
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); Date end = calendar.getTime();
calendar.add(Calendar.DAY_OF_MONTH,-1); calendar.add(Calendar.DAY_OF_MONTH,-1);
// 开始日期 // 开始日期
String start = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH") + ":00:00"; Date start = calendar.getTime();
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(DateUtil.format(start,"yyyy-MM-dd HH") + ":00:00", DateUtil.format(end,DateUtil.PATTERN_DATETIME), 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { List<ActivePowerVo> activePowers = new ArrayList<>();
return new ArrayList<>(); while (start.compareTo(end) < 0){
} String time = DateUtil.format(start,"yyyy-MM-dd HH");
return records.stream().map(record -> { ActivePowerVo active = new ActivePowerVo();
ActivePowerVo load = new ActivePowerVo(); active.setStrHour(time);
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss"); active.setHour(start.getHours());
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); if(CollectionUtil.isNotEmpty(records)){
load.setHour(time.getHours()); Optional<AnalyseDataTaosVO> analyseData = records.stream().filter(o->o.getTs().contains(time)).findFirst();
if(StringUtil.isNotBlank(record.getVal())){ if(analyseData.isPresent()){
load.setActivePower(record.getVal()); if(StringUtil.isNotBlank(analyseData.get().getVal())){
active.setActivePower(analyseData.get().getVal());
}else{
active.setActivePower("0.0");
}
}else{
active.setActivePower("0.0");
}
}else{
active.setActivePower("0.0");
} }
return load; activePowers.add(active);
}).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList()); calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
}
return activePowers.stream().sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList());
} }
/** /**

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

@ -105,9 +105,10 @@ public class HydroelectricServiceImpl implements HydroelectricService {
result.setWeather(week.getDaily()); result.setWeather(week.getDaily());
} }
} }
List<EminfoAndEmParamVo> statonDevices = devices.stream().filter(device-> station.getRefDept().equals(device.getCreateDept())).collect(Collectors.toList());
// 设备 // 设备
if(CollectionUtil.isNotEmpty(devices)){ if(CollectionUtil.isNotEmpty(statonDevices)){
result.setDevices(devices.stream().filter(device-> station.getRefDept().equals(device.getCreateDept())).map(iter->{ result.setDevices(statonDevices.stream().map(iter->{
HydroelectricDeviceVo device = new HydroelectricDeviceVo(); HydroelectricDeviceVo device = new HydroelectricDeviceVo();
device.setDeivceCode(iter.getEmCode()); device.setDeivceCode(iter.getEmCode());
device.setDeivceName(iter.getName()); device.setDeivceName(iter.getName());
@ -124,6 +125,13 @@ public class HydroelectricServiceImpl implements HydroelectricService {
}else{ }else{
device.setCapacityRate(0.0); device.setCapacityRate(0.0);
} }
}else{
device.setState(false);
device.setInstalledCapacity(0.0);
device.setActivePower(0.0);
device.setReactivePower(0.0);
device.setGuideOpen(0.0);
device.setCapacityRate(0.0);
} }
// 指标数据 // 指标数据
Optional<HydropowerUnitTargetVo> target = targets.stream().filter(o-> iter.getEmCode().equals(o.getDeviceCode())).findFirst(); Optional<HydropowerUnitTargetVo> target = targets.stream().filter(o-> iter.getEmCode().equals(o.getDeviceCode())).findFirst();

Loading…
Cancel
Save