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)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal(String param) {
//@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -59,9 +60,10 @@ public class RealTargetScheduledTask {
/**
* 水电站-机组指标加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerTarget(String param) {
//@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerTarget() {
String param = "";
if (Func.isBlank(param)) {
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) {
Calendar calendar = Calendar.getInstance();
// 结束日期
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
Date end = calendar.getTime();
calendar.add(Calendar.DAY_OF_MONTH,-1);
// 开始日期
String start = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH") + ":00:00";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>();
}
return records.stream().map(record -> {
ActivePowerVo load = new ActivePowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss");
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH"));
load.setHour(time.getHours());
if(StringUtil.isNotBlank(record.getVal())){
load.setActivePower(record.getVal());
Date start = calendar.getTime();
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);
List<ActivePowerVo> activePowers = new ArrayList<>();
while (start.compareTo(end) < 0){
String time = DateUtil.format(start,"yyyy-MM-dd HH");
ActivePowerVo active = new ActivePowerVo();
active.setStrHour(time);
active.setHour(start.getHours());
if(CollectionUtil.isNotEmpty(records)){
Optional<AnalyseDataTaosVO> analyseData = records.stream().filter(o->o.getTs().contains(time)).findFirst();
if(analyseData.isPresent()){
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;
}).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList());
activePowers.add(active);
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());
}
}
List<EminfoAndEmParamVo> statonDevices = devices.stream().filter(device-> station.getRefDept().equals(device.getCreateDept())).collect(Collectors.toList());
// 设备
if(CollectionUtil.isNotEmpty(devices)){
result.setDevices(devices.stream().filter(device-> station.getRefDept().equals(device.getCreateDept())).map(iter->{
if(CollectionUtil.isNotEmpty(statonDevices)){
result.setDevices(statonDevices.stream().map(iter->{
HydroelectricDeviceVo device = new HydroelectricDeviceVo();
device.setDeivceCode(iter.getEmCode());
device.setDeivceName(iter.getName());
@ -124,6 +125,13 @@ public class HydroelectricServiceImpl implements HydroelectricService {
}else{
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();

Loading…
Cancel
Save