Browse Source

#运行报表

zhongwei
yang_shj 2 months ago
parent
commit
33a442b665
  1. 30
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/entity/RunTemplateEntity.java
  2. 20
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/RunDeviceSignagesVo.java
  3. 23
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/RunParamVo.java
  4. 16
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/RunResultVo.java
  5. 33
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/StartStopTimeVO.java
  6. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/constant/HydroelectricConstant.java
  7. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java
  8. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitTargetVo.java
  9. 20
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/controller/ElectricReportController.java
  10. 50
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/controller/RunTemplateController.java
  11. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/mapper/RunTemplateMapper.java
  12. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/mapper/RunTemplateMapper.xml
  13. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/IElectricReportService.java
  14. 16
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/IRunTemplateService.java
  15. 143
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java
  16. 28
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java
  17. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java
  18. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  19. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java
  20. 46
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/StartStopDurationServiceImpl.java
  21. 5
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java
  22. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  23. 28
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  24. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java

30
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/entity/RunTemplateEntity.java

@ -0,0 +1,30 @@
package com.hnac.hzims.electric.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* @author ysj
*/
@Data
@TableName("hzims_run_template")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "运行报表模板")
public class RunTemplateEntity extends TenantEntity {
@ApiModelProperty(value = "模板名称")
private String templateName;
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "标识数据")
private String signages;
}

20
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/RunDeviceSignagesVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.electric.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class RunDeviceSignagesVo {
@ApiModelProperty(value = "设备编号")
private String deviceCode;
@ApiModelProperty(value = "属性标识")
private List<String> signages;
}

23
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/RunParamVo.java

@ -0,0 +1,23 @@
package com.hnac.hzims.electric.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class RunParamVo {
@ApiModelProperty(value = "时间 :yyyy-MM-dd")
private String time;
@ApiModelProperty(value = "机构Id")
private Long deptId;
@ApiModelProperty(value = "机构Id")
private List<RunDeviceSignagesVo> deviceSignages;
}

16
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/RunResultVo.java

@ -0,0 +1,16 @@
package com.hnac.hzims.electric.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class RunResultVo {
@ApiModelProperty(value = "时间")
private String time;
}

33
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/StartStopTimeVO.java

@ -0,0 +1,33 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author ysj
*/
@Data
public class StartStopTimeVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "设备编号")
private String deviceCode;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "属性标识")
private String signage;
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "质量值 : 0-有效 1-无效")
private Integer quality;
}

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/constant/HydroelectricConstant.java

@ -15,4 +15,9 @@ public interface HydroelectricConstant {
* 代运维 * 代运维
*/ */
Integer PROXY_OPEARIONAL = 2; Integer PROXY_OPEARIONAL = 2;
/**
* 站点状态: 有效站点
*/
Integer INVALID_STATION = 2;
} }

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java

@ -15,4 +15,6 @@ public interface ScheduledConstant {
String LOAD_THREE_YEAR_POWER_GENERATION = "loadThreeYearPowerGeneration"; String LOAD_THREE_YEAR_POWER_GENERATION = "loadThreeYearPowerGeneration";
String THIS_DAY_START_STOP_RECORD = "thisDayStartStopRecord"; String THIS_DAY_START_STOP_RECORD = "thisDayStartStopRecord";
String START_STOP_TIME_RECORD = "startStopTimeRecord";
} }

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitTargetVo.java

@ -40,12 +40,6 @@ public class HydropowerUnitTargetVo {
@ApiModelProperty(value = "昨日发电量") @ApiModelProperty(value = "昨日发电量")
private Float powerYesterDay; private Float powerYesterDay;
@ApiModelProperty(value = "本次开机时间")
private String startDownTime;
@ApiModelProperty(value = "本次开机时长")
private Double startupDownDuration;
@ApiModelProperty(value = "年停机时长") @ApiModelProperty(value = "年停机时长")
private Double shutDownDurationYear; private Double shutDownDurationYear;

20
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/controller/ElectricReportController.java

@ -3,17 +3,14 @@ package com.hnac.hzims.electric.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.electric.service.IElectricReportService; import com.hnac.hzims.electric.service.IElectricReportService;
import com.hnac.hzims.electric.vo.ComprehensiveElectricVo; import com.hnac.hzims.electric.vo.ComprehensiveElectricVo;
import com.hnac.hzims.equipment.entity.EmAssociationEntity; import com.hnac.hzims.electric.vo.RunParamVo;
import com.hnac.hzims.electric.vo.RunResultVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -39,10 +36,17 @@ public class ElectricReportController extends BladeController {
} }
@GetMapping("/comprehensive") @GetMapping("/comprehensive")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 2)
@ApiOperation(value = "综合报表", notes = "传入 deptId") @ApiOperation(value = "综合报表", notes = "传入 deptId、year")
public R<List<ComprehensiveElectricVo>> comprehensive(@RequestParam(value = "deptId") Long deptId, public R<List<ComprehensiveElectricVo>> comprehensive(@RequestParam(value = "deptId") Long deptId,
@RequestParam(value = "year") String year) { @RequestParam(value = "year") String year) {
return R.data(service.comprehensive(deptId,year)); return R.data(service.comprehensive(deptId,year));
} }
@PostMapping("/run")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "运行报表", notes = "传入 deptId、day")
public R<Map<String,Object>> run(@RequestBody RunParamVo param) {
return R.data(service.run(param));
}
} }

50
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/controller/RunTemplateController.java

@ -0,0 +1,50 @@
package com.hnac.hzims.electric.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.electric.entity.RunTemplateEntity;
import com.hnac.hzims.electric.service.IRunTemplateService;
import com.hnac.hzims.history.vo.HistoryTemplateParamVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/run/template")
@Api(tags = "电量报表")
public class RunTemplateController extends BladeController {
private final IRunTemplateService service;
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增历史数据模板", notes = "传入HistoryTemplateEntity")
public R save(@RequestBody RunTemplateEntity entity) {
return R.status(service.save(entity));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "删除历史数据模板")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(service.removeByIds(Func.toLongList(ids)));
}
@GetMapping("/pages")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "分页历史数据模板", notes = "查询条件:params、query")
public R<IPage<RunTemplateEntity>> pageCondition(HistoryTemplateParamVo params, Query query) {
return R.data(service.pageCondition(params, Condition.getPage(query)));
}
}

11
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/mapper/RunTemplateMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.electric.mapper;
import com.hnac.hzims.electric.entity.RunTemplateEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface RunTemplateMapper extends UserDataScopeBaseMapper<RunTemplateEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/mapper/RunTemplateMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.electric.mapper.RunTemplateMapper" >
</mapper>

4
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/IElectricReportService.java

@ -1,6 +1,8 @@
package com.hnac.hzims.electric.service; package com.hnac.hzims.electric.service;
import com.hnac.hzims.electric.vo.ComprehensiveElectricVo; import com.hnac.hzims.electric.vo.ComprehensiveElectricVo;
import com.hnac.hzims.electric.vo.RunParamVo;
import com.hnac.hzims.electric.vo.RunResultVo;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -14,4 +16,6 @@ public interface IElectricReportService {
Map<String, Object> basics(Long deptId, Long type,String time); Map<String, Object> basics(Long deptId, Long type,String time);
List<ComprehensiveElectricVo> comprehensive(Long deptId,String year); List<ComprehensiveElectricVo> comprehensive(Long deptId,String year);
Map<String, Object> run(RunParamVo param);
} }

16
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/IRunTemplateService.java

@ -0,0 +1,16 @@
package com.hnac.hzims.electric.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.electric.entity.RunTemplateEntity;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.vo.HistoryTemplateParamVo;
/**
* @author ysj
*/
public interface IRunTemplateService extends IService<RunTemplateEntity> {
IPage<RunTemplateEntity> pageCondition(HistoryTemplateParamVo params, IPage<RunTemplateEntity> page);
}

143
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java

@ -12,8 +12,10 @@ import com.hnac.hzims.electric.service.ThirtyService;
import com.hnac.hzims.electric.service.ThreeService; import com.hnac.hzims.electric.service.ThreeService;
import com.hnac.hzims.electric.vo.ComprehensiveElectricVo; import com.hnac.hzims.electric.vo.ComprehensiveElectricVo;
import com.hnac.hzims.electric.vo.DeviceElectricVo; import com.hnac.hzims.electric.vo.DeviceElectricVo;
import com.hnac.hzims.electric.vo.RunParamVo;
import com.hnac.hzims.electric.vo.TableHeadVo; import com.hnac.hzims.electric.vo.TableHeadVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
@ -52,6 +54,8 @@ public class ElectricReportServiceImpl implements IElectricReportService {
private final ISysClient sysClient; private final ISysClient sysClient;
private final IRainfallClient rainClient;
private final IStationClient stationClient; private final IStationClient stationClient;
private final IAnalyseDataSearchClient analyseDataSearchClient; private final IAnalyseDataSearchClient analyseDataSearchClient;
@ -128,7 +132,8 @@ public class ElectricReportServiceImpl implements IElectricReportService {
.ge(ThreeEntity::getStrMonth, DateUtil.format(start,DateUtil.PATTERN_DATE)) .ge(ThreeEntity::getStrMonth, DateUtil.format(start,DateUtil.PATTERN_DATE))
.le(ThreeEntity::getStrMonth, DateUtil.format(end,DateUtil.PATTERN_DATE)) .le(ThreeEntity::getStrMonth, DateUtil.format(end,DateUtil.PATTERN_DATE))
); );
// 查询站点降雨量
List<Map<String, Object>> rains = this.rains(station.getData().getCode(),DateUtil.format(start,DateUtil.PATTERN_DATE),DateUtil.format(end,DateUtil.PATTERN_DATE));
calendar.setTime(DateUtil.parse(year,"yyyy")); calendar.setTime(DateUtil.parse(year,"yyyy"));
calendar.add(Calendar.YEAR,1); calendar.add(Calendar.YEAR,1);
@ -143,6 +148,26 @@ public class ElectricReportServiceImpl implements IElectricReportService {
comprehensive.setMonth(current.getMonth() + 1 + "月"); comprehensive.setMonth(current.getMonth() + 1 + "月");
String currentMon = DateUtil.format(calendar.getTime(),"yyyy-MM"); String currentMon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String currentYear = DateUtil.format(calendar.getTime(),"yyyy"); String currentYear = DateUtil.format(calendar.getTime(),"yyyy");
if(calendar.getTime().compareTo(new Date()) > 0){
comprehensive.setMonthGenerate(-1.0);
comprehensive.setLastMonthGenerate(-1.0);
comprehensive.setYearGenerate(-1.0);
comprehensive.setLastYearGenerate(-1.0);
comprehensive.setLastMonthGenerateRate(-1.0);
comprehensive.setLastYearGenerateRate(-1.0);
comprehensive.setMonthEquivalent(-1.0);
comprehensive.setLastMonthEquivalent(-1.0);
comprehensive.setYearEquivalent(-1.0);
comprehensive.setLastYearEquivalent(-1.0);
comprehensive.setMonthRain(-1.0);
comprehensive.setLastMonthRain(-1.0);
comprehensive.setYearRain(-1.0);
comprehensive.setLastYearRain(-1.0);
electrics.add(comprehensive);
calendar.add(Calendar.MONTH,1);
current = calendar.getTime();
continue;
}
calendar.add(Calendar.YEAR,-1); calendar.add(Calendar.YEAR,-1);
String lastMon = DateUtil.format(calendar.getTime(),"yyyy-MM"); String lastMon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String lastYear = DateUtil.format(calendar.getTime(),"yyyy"); String lastYear = DateUtil.format(calendar.getTime(),"yyyy");
@ -205,9 +230,30 @@ public class ElectricReportServiceImpl implements IElectricReportService {
comprehensive.setYearEquivalent(0.0); comprehensive.setYearEquivalent(0.0);
comprehensive.setLastYearEquivalent(0.0); comprehensive.setLastYearEquivalent(0.0);
} }
// 降雨 : fixme 模拟降雨 // 降雨量
comprehensive.setMonthRain(BigDecimal.valueOf(random.nextDouble() * 10 * 8).setScale(2, RoundingMode.HALF_UP).doubleValue()); if(CollectionUtil.isNotEmpty(rains)){
comprehensive.setLastMonthRain(BigDecimal.valueOf(random.nextDouble() * 10 * 8).setScale(2, RoundingMode.HALF_UP).doubleValue()); comprehensive.setMonthRain(rains.stream().mapToDouble(map->{
if (map.get("fx_date").toString().contains(currentMon)) {
Object object = map.get("precip");
if(ObjectUtil.isEmpty(object)){
return 0.0;
}else{
return Double.parseDouble(object.toString());
}
}
return 0.0;
}).sum());
comprehensive.setLastMonthRain(rains.stream().mapToDouble(map->{
if (map.get("fx_date").toString().contains(lastMon)) {
Object object = map.get("precip");
if(ObjectUtil.isEmpty(object)){
return 0.0;
}else{
return Double.parseDouble(object.toString());
}
}
return 0.0;
}).sum());
if(CollectionUtil.isEmpty(electrics)){ if(CollectionUtil.isEmpty(electrics)){
comprehensive.setYearRain(comprehensive.getMonthRain()); comprehensive.setYearRain(comprehensive.getMonthRain());
comprehensive.setLastYearRain(comprehensive.getLastMonthRain()); comprehensive.setLastYearRain(comprehensive.getLastMonthRain());
@ -216,6 +262,12 @@ public class ElectricReportServiceImpl implements IElectricReportService {
comprehensive.setYearRain(electrics.stream().mapToDouble(ComprehensiveElectricVo::getMonthRain).sum() + comprehensive.getMonthRain()); comprehensive.setYearRain(electrics.stream().mapToDouble(ComprehensiveElectricVo::getMonthRain).sum() + comprehensive.getMonthRain());
comprehensive.setLastYearRain(electrics.stream().mapToDouble(ComprehensiveElectricVo::getLastMonthRain).sum() + comprehensive.getLastMonthRain()); comprehensive.setLastYearRain(electrics.stream().mapToDouble(ComprehensiveElectricVo::getLastMonthRain).sum() + comprehensive.getLastMonthRain());
} }
}else{
comprehensive.setMonthRain(0.0);
comprehensive.setLastMonthRain(0.0);
comprehensive.setYearRain(0.0);
comprehensive.setLastYearRain(0.0);
}
electrics.add(comprehensive); electrics.add(comprehensive);
calendar.add(Calendar.MONTH,1); calendar.add(Calendar.MONTH,1);
current = calendar.getTime(); current = calendar.getTime();
@ -223,6 +275,21 @@ public class ElectricReportServiceImpl implements IElectricReportService {
return electrics; return electrics;
} }
/**
* 站点降雨量查询
* @param stationId
* @param start
* @param end
* @return
*/
private List<Map<String, Object>> rains(String stationId, String start, String end) {
R<List<Map<String, Object>>> durations = rainClient.getDurationRainFall(stationId,start,end);
if(!durations.isSuccess() || CollectionUtil.isEmpty(durations.getData())){
return new ArrayList<>();
}
return durations.getData();
}
/** /**
* 确认机构级别 * 确认机构级别
@ -307,6 +374,19 @@ public class ElectricReportServiceImpl implements IElectricReportService {
List<Object> item = new ArrayList<>(); List<Object> item = new ArrayList<>();
String day = DateUtil.format(start,DateUtil.PATTERN_DATE); String day = DateUtil.format(start,DateUtil.PATTERN_DATE);
item.add(start.getDate() + "日"); item.add(start.getDate() + "日");
if(start.compareTo(new Date()) > 0){
item.add(-1.0);
item.add(-1.0);
group.entrySet().stream().sorted(Map.Entry.
comparingByKey()).forEach(entry->{
item.add(-1.0);
item.add(-1.0);
});
calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
continue;
}
// 总计:有功、无功 // 总计:有功、无功
item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getGenerate().doubleValue()).sum()); item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getReactiveGenerate().doubleValue()).sum()); item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getReactiveGenerate().doubleValue()).sum());
@ -477,6 +557,18 @@ public class ElectricReportServiceImpl implements IElectricReportService {
List<Object> item = new ArrayList<>(); List<Object> item = new ArrayList<>();
String day = DateUtil.format(start,DateUtil.PATTERN_DATE); String day = DateUtil.format(start,DateUtil.PATTERN_DATE);
item.add(start.getDate() + "日"); item.add(start.getDate() + "日");
if(start.compareTo(new Date()) > 0){
item.add(-1.0);
item.add(-1.0);
areas.stream().sorted(Comparator.comparing(Dept::getDeptName)).forEach(area->{
item.add(-1.0);
item.add(-1.0);
});
calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
continue;
}
// 总计:有功、无功 // 总计:有功、无功
item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getGenerate().doubleValue()).sum()); item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getReactiveGenerate().doubleValue()).sum()); item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day)).mapToDouble(o->o.getReactiveGenerate().doubleValue()).sum());
@ -485,10 +577,14 @@ public class ElectricReportServiceImpl implements IElectricReportService {
areas.stream().sorted(Comparator.comparing(Dept::getDeptName)).forEach(area->{ areas.stream().sorted(Comparator.comparing(Dept::getDeptName)).forEach(area->{
List<Long> childs = depts.stream().filter(o->o.getParentId().equals(area.getId())).map(Dept::getId).collect(Collectors.toList()); List<Long> childs = depts.stream().filter(o->o.getParentId().equals(area.getId())).map(Dept::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(childs)){ if(CollectionUtil.isEmpty(childs)){
item.add(0.0);
item.add(0.0);
return; return;
} }
List<String> codes = stations.getData().stream().filter(o-> childs.contains(o.getRefDept()) && ObjectUtil.isNotEmpty(o.getType()) && o.getType().equals(0)).map(StationEntity::getCode).collect(Collectors.toList()); List<String> codes = stations.getData().stream().filter(o-> childs.contains(o.getRefDept()) && ObjectUtil.isNotEmpty(o.getType()) && o.getType().equals(0)).map(StationEntity::getCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(codes)){ if(CollectionUtil.isEmpty(codes)){
item.add(0.0);
item.add(0.0);
return; return;
} }
item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day) && codes.contains(thirty.getStationId())).mapToDouble(o->o.getGenerate().doubleValue()).sum()); item.add(thirtys.stream().filter(thirty -> thirty.getStrDay().contains(day) && codes.contains(thirty.getStationId())).mapToDouble(o->o.getGenerate().doubleValue()).sum());
@ -656,6 +752,17 @@ public class ElectricReportServiceImpl implements IElectricReportService {
List<Object> item = new ArrayList<>(); List<Object> item = new ArrayList<>();
String hours = DateUtil.format(start,"yyyy-MM-dd HH"); String hours = DateUtil.format(start,"yyyy-MM-dd HH");
item.add(start.getHours() + "时"); item.add(start.getHours() + "时");
if(start.compareTo(new Date()) > 0){
item.add(-1.0);
item.add(-1.0);
stationDevices.stream().sorted(Comparator.comparing(EminfoAndEmParamVo::getOrd)).forEach(device->{
item.add(-1.0);
item.add(-1.0);
});
calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
continue;
}
// 总计:有功、无功 // 总计:有功、无功
item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getGenerate).sum()); item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getGenerate).sum());
item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getReactiveGenerate).sum()); item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getReactiveGenerate).sum());
@ -900,4 +1007,32 @@ public class ElectricReportServiceImpl implements IElectricReportService {
}); });
return electrics; return electrics;
} }
/**
* 运行报表
* @param param
* @return
*/
@Override
public Map<String, Object> run(RunParamVo param) {
// 设备参数校验
if(CollectionUtil.isEmpty(param.getDeviceSignages())){
return new HashMap<>();
}
// 查询站点
StationEntity query = new StationEntity();
query.setRefDept(param.getDeptId());
R<StationEntity> station = stationClient.getStationByCodeOrRedDept(query);
if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){
return new HashMap<>();
}
// 开始时间、结束时间
Date start = DateUtil.parse(param.getTime() + " 00:00:00",DateUtil.PATTERN_DATETIME);
Date end = DateUtil.parse(param.getTime() + " 23:59:59",DateUtil.PATTERN_DATETIME);
return null;
}
} }

28
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java

@ -0,0 +1,28 @@
package com.hnac.hzims.electric.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.electric.entity.RunTemplateEntity;
import com.hnac.hzims.electric.mapper.RunTemplateMapper;
import com.hnac.hzims.electric.service.IRunTemplateService;
import com.hnac.hzims.history.vo.HistoryTemplateParamVo;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Service
public class RunTemplateServiceImpl extends ServiceImpl<RunTemplateMapper, RunTemplateEntity> implements IRunTemplateService {
/**
* 查询运行报表模板
* @param params
* @param page
* @return
*/
@Override
public IPage<RunTemplateEntity> pageCondition(HistoryTemplateParamVo params, IPage<RunTemplateEntity> page) {
return null;
}
}

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java

@ -12,10 +12,7 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -112,7 +109,7 @@ public class PlanGenertionClient implements IPlanGenertionClient{
*/ */
@PostMapping(GET_POWER_YEAR) @PostMapping(GET_POWER_YEAR)
@Override @Override
public Double getPlanPowerYear(DevicePlanGenerationVo param) { public Double getPlanPowerYear(@RequestBody DevicePlanGenerationVo param) {
return service.getPlanPowerYear(param.getStationIds(),param.getDate()); return service.getPlanPowerYear(param.getStationIds(),param.getDate());
} }

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

@ -62,7 +62,7 @@ public class RealTargetScheduledTask {
* 水电站-机组指标加载 * 水电站-机组指标加载
*/ */
//@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET) //@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
@Scheduled(cron = "0 0/2 * * * ? ") @Scheduled(cron = "0 0/3 * * * ? ")
public ReturnT<String> loadHydropowerTarget() { public ReturnT<String> loadHydropowerTarget() {
String param = ""; String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
@ -114,7 +114,7 @@ public class RealTargetScheduledTask {
* 水利-站点水位数据 * 水利-站点水位数据
*/ */
//@XxlJob(LOAD_WATER_LEVEL) //@XxlJob(LOAD_WATER_LEVEL)
@Scheduled(cron = "0/40 * * * * ? ") @Scheduled(cron = "0 0/5 * * * ? ")
public ReturnT<String> loadWaterLevel() { public ReturnT<String> loadWaterLevel() {
String param = ""; String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {

4
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java

@ -44,8 +44,8 @@ public class StartStopScheduledTask {
/** /**
* 设备开停机时间记录 * 设备开停机时间记录
*/ */
@XxlJob(START_STOP_TIME_RECORD) //@XxlJob(START_STOP_TIME_RECORD)
//@Scheduled(cron = "0/40 * * * * ? ") @Scheduled(cron = "0 0/2 * * * ? ")
public ReturnT<String> startStopTimeRecord() { public ReturnT<String> startStopTimeRecord() {
String param = ""; String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {

46
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/StartStopDurationServiceImpl.java

@ -8,15 +8,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.StartStopDurationEntity; import com.hnac.hzims.equipment.entity.StartStopDurationEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.StartStopTimeVO;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.vo.StartStopDurationRecordVo; import com.hnac.hzims.operational.station.vo.StartStopDurationRecordVo;
import com.hnac.hzims.scheduled.mapper.equipment.StartStopDurationMapper; import com.hnac.hzims.scheduled.mapper.equipment.StartStopDurationMapper;
import com.hnac.hzims.scheduled.service.equipment.StartStopDurationService; import com.hnac.hzims.scheduled.service.equipment.StartStopDurationService;
import com.hnac.hzims.scheduled.service.operation.plate.DataService;
import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzinfo.datasearch.PointData; import com.hnac.hzinfo.datasearch.PointData;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient; import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient;
import com.hnac.hzinfo.datasearch.history.OriginalDataQuery; import com.hnac.hzinfo.datasearch.history.OriginalDataQuery;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
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;
@ -55,6 +59,8 @@ import java.util.stream.Collectors;
@DS("equipment") @DS("equipment")
public class StartStopDurationServiceImpl extends ServiceImpl<StartStopDurationMapper, StartStopDurationEntity> implements StartStopDurationService { public class StartStopDurationServiceImpl extends ServiceImpl<StartStopDurationMapper, StartStopDurationEntity> implements StartStopDurationService {
private final DataService dataService;
private final StationService stationService; private final StationService stationService;
private final DeviceDataClient deviceDataClient; private final DeviceDataClient deviceDataClient;
@ -64,6 +70,8 @@ public class StartStopDurationServiceImpl extends ServiceImpl<StartStopDurationM
@Value("${hzims.equipment.emInfo.emInfoList}") @Value("${hzims.equipment.emInfo.emInfoList}")
public String device_cache_cofig_final; public String device_cache_cofig_final;
private final static String START_STOP_TIME_KEY = "hzims:operation:start:stop:key";
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("device-start-stop-duration-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("device-start-stop-duration-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
/** /**
@ -154,7 +162,45 @@ public class StartStopDurationServiceImpl extends ServiceImpl<StartStopDurationM
*/ */
@Override @Override
public void startStopTimeRecord(String param) { public void startStopTimeRecord(String param) {
// 获取所有设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
if(CollectionUtil.isEmpty(devices)){
return;
}
// 获取历史开关机状态记录
List<StartStopTimeVO> startStopTimes = (List<StartStopTimeVO>) redisTemplate.opsForValue().get(START_STOP_TIME_KEY);
// 遍历设备
redisTemplate.opsForValue().set(START_STOP_TIME_KEY,devices.stream().map(device->{
StartStopTimeVO startStopTime = new StartStopTimeVO();
startStopTime.setDeviceCode(device.getEmCode());
startStopTime.setDeviceName(device.getName());
startStopTime.setSignage(HomePageConstant.START_STOP_STATUS);
if(MapUtils.isEmpty(device.getPoint()) || !device.getPoint().containsKey(HomePageConstant.START_STOP_STATUS)){
startStopTime.setQuality(-1);
}
// 调用fegin接口查询实时数据
List<FieldsData> fields = dataService.getRealDataByAnalyzeCode(device.getEmCode(),Collections.singletonList(HomePageConstant.START_STOP_STATUS));
if(CollectionUtil.isEmpty(fields) || fields.get(0).getQ() > -1){
startStopTime.setQuality(-1);
return startStopTime;
}
// 有效开关机点位比较value差异
if(CollectionUtil.isNotEmpty(startStopTimes)){
// 寻找设备上次记录值
Optional<StartStopTimeVO> optional = startStopTimes.stream().filter(o->o.getDeviceCode().equals(device.getEmCode())).findFirst();
if(optional.isPresent() && optional.get().getValue().equals(fields.get(0).getValue())){
startStopTime.setValue(optional.get().getValue());
startStopTime.setTime(optional.get().getTime());
startStopTime.setQuality(optional.get().getQuality());
return startStopTime;
}
}
startStopTime.setTime(fields.get(0).getTime());
startStopTime.setValue(fields.get(0).getValue());
startStopTime.setQuality(fields.get(0).getQ());
return startStopTime;
}).collect(Collectors.toList()));
} }
/** /**

5
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java

@ -105,7 +105,10 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
public void thisDayPowerGeneration(String param) { public void thisDayPowerGeneration(String param) {
String month = DateUtil.format(new Date(),DateUtil.PATTERN_DATE); String month = DateUtil.format(new Date(),DateUtil.PATTERN_DATE);
// 步骤1.水电、光伏站点 // 步骤1.水电、光伏站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery().in(StationEntity::getType, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC))); List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery().
in(StationEntity::getType, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC))
.in(StationEntity::getCode, Arrays.asList("901800000612","901800000137"))
);
// 步骤2.缓存设备信息 // 步骤2.缓存设备信息
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {}); List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});

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

@ -297,7 +297,6 @@ public class RealTargetServiceImpl implements RealTargetService {
// 今年已经过去多少个小时了 // 今年已经过去多少个小时了
double hoursPassed = this.hoursPassed(); double hoursPassed = this.hoursPassed();
Random random = new Random();
if(CollectionUtil.isNotEmpty(devices)){ if(CollectionUtil.isNotEmpty(devices)){
CountDownLatch countDownLatch = new CountDownLatch(devices.size()); CountDownLatch countDownLatch = new CountDownLatch(devices.size());
for(EminfoAndEmParamVo device : devices) { for(EminfoAndEmParamVo device : devices) {
@ -330,23 +329,16 @@ public class RealTargetServiceImpl implements RealTargetService {
.eq(StartStopDurationEntity::getDeviceCode,device.getEmCode()) .eq(StartStopDurationEntity::getDeviceCode,device.getEmCode())
); );
if(CollectionUtil.isEmpty(durations)){ if(CollectionUtil.isEmpty(durations)){
target.setStartupDurationYear(0.0); target.setStartupDurationYear(-1.0);
target.setShutDownDurationYear(hoursPassed); target.setShutDownDurationYear(-1.0);
}else{ }else{
target.setStartupDurationYear(durations.stream().mapToDouble(StartStopDurationEntity::getStartDuration).sum()); target.setStartupDurationYear(durations.stream().mapToDouble(StartStopDurationEntity::getStartDuration).sum());
target.setShutDownDurationYear(durations.stream().mapToDouble(StartStopDurationEntity::getStopDuration).sum()); target.setShutDownDurationYear(durations.stream().mapToDouble(StartStopDurationEntity::getStopDuration).sum());
} }
}else{ }else{
target.setStartupDurationYear(0.0); target.setStartupDurationYear(-1.0);
target.setShutDownDurationYear(hoursPassed); target.setShutDownDurationYear(-1.0);
} }
// FIXME 本次开机/停机时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE,random.nextInt(1440));
target.setStartDownTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
// FIXME 本次开/停机时长
target.setStartupDownDuration(random.nextDouble() * 24);
targets.add(target);
countDownLatch.countDown(); countDownLatch.countDown();
}catch (Exception exception){ }catch (Exception exception){
countDownLatch.countDown(); countDownLatch.countDown();
@ -1256,10 +1248,7 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return * @return
*/ */
private double getWaterLevel(String instanceCode, String signage) { private double getWaterLevel(String instanceCode, String signage) {
RealDataSearchPO realData = new RealDataSearchPO();
realData.setAnalyzeCode(instanceCode);
List<String> signages = Collections.singletonList(signage); List<String> signages = Collections.singletonList(signage);
realData.setSignages(signages);
// 调用fegin接口查询实时数据 // 调用fegin接口查询实时数据
List<FieldsData> fields = dataService.getRealDataByAnalyzeCode(instanceCode,signages); List<FieldsData> fields = dataService.getRealDataByAnalyzeCode(instanceCode,signages);
if(CollectionUtil.isEmpty(fields)){ if(CollectionUtil.isEmpty(fields)){
@ -1559,7 +1548,7 @@ public class RealTargetServiceImpl implements RealTargetService {
calendar.add(Calendar.HOUR_OF_DAY,-23); calendar.add(Calendar.HOUR_OF_DAY,-23);
// 开始日期 // 开始日期
Date start = calendar.getTime(); Date start = calendar.getTime();
List<AnalyseDataTaosVO> records = dataService.periodTargetData(DateUtil.format(start,"yyyy-MM-dd HH") + ":00:00", DateUtil.format(start,"yyyy-MM-dd HH") + ":59:59", 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(DateUtil.format(start,"yyyy-MM-dd HH") + ":00:00", DateUtil.format(end,"yyyy-MM-dd HH") + ":59:59", 3, 2, device.getEmCode(), HomePageConstant.HYDROPOWER_ACTIVE_POWER);
List<ActivePowerVo> activePowers = new ArrayList<>(); List<ActivePowerVo> activePowers = new ArrayList<>();
while (start.compareTo(end) <= 0){ while (start.compareTo(end) <= 0){
String time = DateUtil.format(start,"yyyy-MM-dd HH"); String time = DateUtil.format(start,"yyyy-MM-dd HH");

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

@ -9,6 +9,7 @@ import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo; import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo; import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import com.hnac.hzims.equipment.vo.StartStopTimeVO;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient; import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
@ -66,6 +67,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
private final static String LOADWATER_LEVEL_KEY = "hzims:operation:loadwater:level:key"; private final static String LOADWATER_LEVEL_KEY = "hzims:operation:loadwater:level:key";
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data"; private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data";
private final static String START_STOP_TIME_KEY = "hzims:operation:start:stop:key";
private final static String LOAD_HYDROPOWER_REAL_KEY = "hzims:operation:loadhydropowerunit:real:key"; private final static String LOAD_HYDROPOWER_REAL_KEY = "hzims:operation:loadhydropowerunit:real:key";
private final static String LOAD_HYDROPOWER_TARGET_KEY = "hzims:operation:loadhydropowerunit:target:key"; private final static String LOAD_HYDROPOWER_TARGET_KEY = "hzims:operation:loadhydropowerunit:target:key";
private final static String DEVICE_CACHE_COFIG_FINAL = "hzims:equipment:emInfo:deviceCode.emInfoList"; private final static String DEVICE_CACHE_COFIG_FINAL = "hzims:equipment:emInfo:deviceCode.emInfoList";
@ -99,6 +101,8 @@ public class HydroelectricServiceImpl implements HydroelectricService {
List<PlanPowerYearVo> plans = planClient.getPlanPowerByYear(station.getCode(), Integer.parseInt(DateUtil.format(new Date(),"yyyy"))); List<PlanPowerYearVo> plans = planClient.getPlanPowerByYear(station.getCode(), Integer.parseInt(DateUtil.format(new Date(),"yyyy")));
// 水位数据 // 水位数据
List<WaterLevelVo> waterLevels = (List<WaterLevelVo>) redisTemplate.opsForValue().get(LOADWATER_LEVEL_KEY); List<WaterLevelVo> waterLevels = (List<WaterLevelVo>) redisTemplate.opsForValue().get(LOADWATER_LEVEL_KEY);
// 设备开停机
List<StartStopTimeVO> startStopTimes = (List<StartStopTimeVO>) redisTemplate.opsForValue().get(START_STOP_TIME_KEY);
// 步骤3.数据处理、赋值 // 步骤3.数据处理、赋值
HydroelectricStationVo result = new HydroelectricStationVo(); HydroelectricStationVo result = new HydroelectricStationVo();
@ -147,8 +151,6 @@ public class HydroelectricServiceImpl implements HydroelectricService {
device.setPowerYear(target.get().getPowerYear()); device.setPowerYear(target.get().getPowerYear());
device.setPowerYesterYear(target.get().getPowerYesterYear()); device.setPowerYesterYear(target.get().getPowerYesterYear());
device.setPowerMon(target.get().getPowerMon()); device.setPowerMon(target.get().getPowerMon());
device.setStartDownTime(target.get().getStartDownTime());
device.setStartupDownDuration(target.get().getStartupDownDuration());
device.setStartupDurationYear(target.get().getStartupDurationYear()); device.setStartupDurationYear(target.get().getStartupDurationYear());
device.setShutDownDurationYear(target.get().getShutDownDurationYear()); device.setShutDownDurationYear(target.get().getShutDownDurationYear());
if(CollectionUtil.isNotEmpty(target.get().getActivePowerVoList())){ if(CollectionUtil.isNotEmpty(target.get().getActivePowerVoList())){
@ -158,6 +160,26 @@ public class HydroelectricServiceImpl implements HydroelectricService {
device.setGenerates(target.get().getGenerationPowerVoList().stream().map(o-> BeanUtil.copy(o, HydroelectricDeviceGenerateVo.class)).collect(Collectors.toList())); device.setGenerates(target.get().getGenerationPowerVoList().stream().map(o-> BeanUtil.copy(o, HydroelectricDeviceGenerateVo.class)).collect(Collectors.toList()));
} }
} }
// 开停机数据
Optional<StartStopTimeVO> startStop = startStopTimes.stream().filter(o->iter.equals(o.getDeviceCode())).findFirst();
if(startStop.isPresent()){
if(startStop.get().getQuality() > 0){
Date time;
if(startStop.get().getTime().contains(".000")){
time = DateUtil.parse(startStop.get().getTime(), "yyyy-MM-dd HH:mm:ss.sss");
}else{
time = DateUtil.parse(startStop.get().getTime(), DateUtil.PATTERN_DATETIME);
}
device.setStartDownTime(DateUtil.format(time,DateUtil.PATTERN_DATETIME));
device.setStartupDownDuration(BigDecimal.valueOf(new Date().getTime() - time.getTime() / (1000 * 60 * 60.00)).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
device.setStartDownTime("-1");
device.setStartupDownDuration(-1.0);
}
}else{
device.setStartDownTime("-1");
device.setStartupDownDuration(-1.0);
}
return device; return device;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} }
@ -304,6 +326,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
// 查询用户当前权限站点 // 查询用户当前权限站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.ne(StationEntity::getStatus,HydroelectricConstant.INVALID_STATION)
.eq(StationEntity::getServeType,HydroelectricConstant.PROXY_OPEARIONAL) .eq(StationEntity::getServeType,HydroelectricConstant.PROXY_OPEARIONAL)
.eq(StationEntity::getType,HydroelectricConstant.HYDROPOWER) .eq(StationEntity::getType,HydroelectricConstant.HYDROPOWER)
); );
@ -703,6 +726,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
return new ArrayList<>(); return new ArrayList<>();
} }
return stationService.list(Wrappers.<StationEntity>lambdaQuery() return stationService.list(Wrappers.<StationEntity>lambdaQuery()
.ne(StationEntity::getStatus,HydroelectricConstant.INVALID_STATION)
.eq(StationEntity::getType, HydroelectricConstant.HYDROPOWER) .eq(StationEntity::getType, HydroelectricConstant.HYDROPOWER)
.eq(StationEntity::getServeType,HydroelectricConstant.PROXY_OPEARIONAL) .eq(StationEntity::getServeType,HydroelectricConstant.PROXY_OPEARIONAL)
.in(StationEntity::getRefDept,deptIds) .in(StationEntity::getRefDept,deptIds)

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java

@ -1,11 +1,8 @@
package com.hnac.hzims.operational.station.mapper; package com.hnac.hzims.operational.station.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.vo.StationVideoTypeVO; import com.hnac.hzims.operational.station.vo.StationVideoTypeVO;
@ -14,7 +11,6 @@ import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.sql.Wrapper;
import java.util.List; import java.util.List;
/** /**

Loading…
Cancel
Save