Browse Source

#曲线分析

zhongwei
yang_shj 3 months ago
parent
commit
42efcc2dec
  1. 11
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java
  2. 3
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java
  3. 23
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/DevicePlanGenerationVo.java
  4. 33
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryPointRecordEntity.java
  5. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java
  6. 21
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java
  7. 25
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataVo.java
  8. 22
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailDataVo.java
  9. 19
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailVo.java
  10. 17
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryPointRecordParamVo.java
  11. 45
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTabulationParamVo.java
  12. 14
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java
  13. 24
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java
  14. 41
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/CommonUseController.java
  15. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java
  16. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.java
  17. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.xml
  18. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java
  19. 16
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryPointRecordService.java
  20. 157
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  21. 45
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryPointRecordServiceImpl.java
  22. 6
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java
  23. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  24. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  25. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
  26. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/DutyGroupGeneratingCapacityServiceImpl.java
  27. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  28. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  29. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  30. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  31. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java
  32. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  33. 46
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  34. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java
  35. 2
      pom.xml

11
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java

@ -2,6 +2,7 @@ package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo; import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -64,17 +65,13 @@ public interface IPlanGenertionClient {
Map<String, Map<String, Double>> getYAndMGenerationGroupCount(@RequestParam("stationIds") List<String> stationIds, @RequestParam("date") String date); Map<String, Map<String, Double>> getYAndMGenerationGroupCount(@RequestParam("stationIds") List<String> stationIds, @RequestParam("date") String date);
/** /**
* 根据参数 站点Id 或者 机构ID 时间 'yyyy-MM' 获取计划发电量 * 根据参数 站点Id 或者 机构ID 时间 'yyyy-MM' 获取计划发电量
* * @param param
* @param stationIds 站点IDS
* @param deptIds 机构IDS
* @param date 时间
* @return * @return
*/ */
@GetMapping(GET_PLAN_GENERATION_BY_PARAM) @PostMapping(GET_PLAN_GENERATION_BY_PARAM)
List<PlanGenerationEntity> getPlanGenerationByParam(@RequestParam(value = "stationIds", required = false) List<String> stationIds, @RequestParam(value = "deptIds", required = false) List<String> deptIds, @RequestParam(value = "date", required = false) String date); List<PlanGenerationEntity> getPlanGenerationByParam(@RequestBody DevicePlanGenerationVo param);
/** /**

3
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java

@ -1,6 +1,7 @@
package com.hnac.hzims.equipment.feign; package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo; import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -42,7 +43,7 @@ public class IPlanGenertionClientBack implements IPlanGenertionClient {
} }
@Override @Override
public List<PlanGenerationEntity> getPlanGenerationByParam(List<String> stationIds,List<String> deptIds, String date) { public List<PlanGenerationEntity> getPlanGenerationByParam(DevicePlanGenerationVo param) {
return null; return null;
} }

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

@ -0,0 +1,23 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class DevicePlanGenerationVo {
@ApiModelProperty(value = "站点编码集合")
private List<String>stationIds;
@ApiModelProperty(value = "机构ID集合")
private List<String> deptIds;
@ApiModelProperty(value = "时间")
private String date;
}

33
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryPointRecordEntity.java

@ -0,0 +1,33 @@
package com.hnac.hzims.history.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_history_point_record")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备历史数据模板")
public class HistoryPointRecordEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "点位Id")
private String historyPoint;
@ApiModelProperty(value = "点位名称")
private String historyPointName;
@ApiModelProperty(value = "查询次数")
private Integer number;
}

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java

@ -8,12 +8,10 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
/** /**
* 设备树绑定巡检实体类 * @author ysj
* @author tanghaihao
* @date 2023年06月14日 16:46
*/ */
@Data @Data
@TableName("hzims_device_history_template") @TableName("hzims_history_template")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备历史数据模板") @ApiModel(value = "设备历史数据模板")
public class HistoryTemplateEntity extends TenantEntity { public class HistoryTemplateEntity extends TenantEntity {

21
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java

@ -17,21 +17,42 @@ import java.time.LocalDateTime;
@ApiModel(value = "设备历史查询参数") @ApiModel(value = "设备历史查询参数")
public class HistoryDataParamVo { public class HistoryDataParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "第一个点位") @ApiModelProperty(value = "第一个点位")
private String firstAttrId; private String firstAttrId;
@ApiModelProperty(value = "第一个点位名称")
private String firstAttrName;
@ApiModelProperty(value = "第二个点位") @ApiModelProperty(value = "第二个点位")
private String secondAttrId; private String secondAttrId;
@ApiModelProperty(value = "第二个点位名称")
private String secondAttrName;
@ApiModelProperty(value = "第三个点位") @ApiModelProperty(value = "第三个点位")
private String thirdlyAttrId; private String thirdlyAttrId;
@ApiModelProperty(value = "第三个点位名称")
private String thirdlyAttrName;
@ApiModelProperty(value = "第四个点位") @ApiModelProperty(value = "第四个点位")
private String fourthAttrId; private String fourthAttrId;
@ApiModelProperty(value = "第四个点位名称")
private String fourthAttrName;
@ApiModelProperty(value = "第五个点位") @ApiModelProperty(value = "第五个点位")
private String fifthAttrId; private String fifthAttrId;
@ApiModelProperty(value = "第五个点位名称")
private String fifthAttrName;
@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME) @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)

25
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataVo.java

@ -0,0 +1,25 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史数据")
public class HistoryDataVo {
@ApiModelProperty(value = "点位下标")
private String attrIndex;
@ApiModelProperty(value = "第一个点位")
private String attrIndexName;
@ApiModelProperty(value = "点位历史数据")
private List<HistoryDetailDataVo> data;
}

22
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailDataVo.java

@ -0,0 +1,22 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史数据")
public class HistoryDetailDataVo {
@ApiModelProperty(value = "时间")
private String ts;
@ApiModelProperty(value = "值")
private String val;
}

19
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailVo.java

@ -0,0 +1,19 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史数据")
public class HistoryDetailVo {
@ApiModelProperty(value = "数据")
private List<HistoryDetailDataVo> data;
}

17
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryPointRecordParamVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class HistoryPointRecordParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "用户Id")
private Long createUser;
}

45
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTabulationParamVo.java

@ -0,0 +1,45 @@
package com.hnac.hzims.history.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史查询参数")
public class HistoryTabulationParamVo {
@ApiModelProperty(value = "站点Id")
private String projectId;
@ApiModelProperty(value = "站点Id")
private List<String> facDeivceAttrIds;
@ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime startTime;
@ApiModelProperty(value = "结束时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime endTime;
@ApiModelProperty(value = "是否分页")
private Boolean isPage;
@ApiModelProperty(value = "页码")
private Integer current;
@ApiModelProperty(value = "页码条数")
private Integer pageSize;
}

14
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java

@ -1,9 +1,12 @@
package com.hnac.hzims.operational.homePage.hydroelectric.vo; package com.hnac.hzims.operational.homePage.hydroelectric.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Tolerate;
import java.util.List; import java.util.List;
@ -22,36 +25,47 @@ public class HydroelectricStationVo {
private String stationName; private String stationName;
@ApiModelProperty(value = "总装机容量") @ApiModelProperty(value = "总装机容量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double installedCapacity; private Double installedCapacity;
@ApiModelProperty(value = "总发电负荷") @ApiModelProperty(value = "总发电负荷")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerSum; private Double powerSum;
@ApiModelProperty(value = "容量利用率") @ApiModelProperty(value = "容量利用率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double capacityRate; private Double capacityRate;
@ApiModelProperty(value = "月计划发电量") @ApiModelProperty(value = "月计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerMonPlan; private Double powerMonPlan;
@ApiModelProperty(value = "月发电量") @ApiModelProperty(value = "月发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerMon; private Double powerMon;
@ApiModelProperty(value = "月发电量完成率") @ApiModelProperty(value = "月发电量完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerRateMon; private Double powerRateMon;
@ApiModelProperty(value = "年计划发电量") @ApiModelProperty(value = "年计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerYearPlan; private Double powerYearPlan;
@ApiModelProperty(value = "年发电量") @ApiModelProperty(value = "年发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerYear; private Double powerYear;
@ApiModelProperty(value = "年发电完成率") @ApiModelProperty(value = "年发电完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerRateYear; private Double powerRateYear;
@ApiModelProperty(value = "今日发电量") @ApiModelProperty(value = "今日发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerDay; private Double powerDay;
@ApiModelProperty(value = "昨日发电量") @ApiModelProperty(value = "昨日发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerYesterDay; private Double powerYesterDay;
@ApiModelProperty(value = "七日内天气") @ApiModelProperty(value = "七日内天气")

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

@ -1,17 +1,23 @@
package com.hnac.hzims.equipment.feign; package com.hnac.hzims.equipment.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.service.IPlanGenerationService; import com.hnac.hzims.equipment.service.IPlanGenerationService;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo; import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
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.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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -81,18 +87,22 @@ public class PlanGenertionClient implements IPlanGenertionClient{
public Map<String, Map<String, Double>> getYAndMGenerationGroupCount(List<String> stationIds,String date) { public Map<String, Map<String, Double>> getYAndMGenerationGroupCount(List<String> stationIds,String date) {
return service.getYAndMGenerationGroupCount(stationIds,date); return service.getYAndMGenerationGroupCount(stationIds,date);
} }
/** /**
* 根据参数 站点Id 或者 机构ID 时间 'yyyy-MM' 获取计划发电量 * 根据参数 站点Id 或者 机构ID 时间 'yyyy-MM' 获取计划发电量
* * @param param
* @param stationIds 站点IDS
* @param deptIds 机构IDS
* @param date 时间
* @return * @return
*/ */
@GetMapping(GET_PLAN_GENERATION_BY_PARAM) @PostMapping(GET_PLAN_GENERATION_BY_PARAM)
@Override @Override
public List<PlanGenerationEntity> getPlanGenerationByParam(List<String> stationIds,List<String> deptIds, String date) { public List<PlanGenerationEntity> getPlanGenerationByParam(DevicePlanGenerationVo param) {
return service.getPlanGenerationByParam(stationIds,deptIds,date); if(CollectionUtil.isEmpty(param.getStationIds()) && CollectionUtil.isEmpty(param.getDeptIds())){
return new ArrayList<>();
}
if(StringUtils.isEmpty(param.getDate())){
return new ArrayList<>();
}
return service.getPlanGenerationByParam(param.getStationIds(),param.getDeptIds(),param.getDate());
} }
/** /**

41
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/CommonUseController.java

@ -0,0 +1,41 @@
package com.hnac.hzims.history.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.service.IHistoryPointRecordService;
import com.hnac.hzims.history.vo.*;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/commonUse")
@Api(value = "曲线常用点位", tags = "曲线常用点位")
public class CommonUseController extends BladeController {
private final IHistoryPointRecordService service;
@GetMapping("/tabulation")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "常用点位列表", notes = "查询条件:params、query")
public R<List<HistoryPointRecordEntity>> tabulation(HistoryPointRecordParamVo params) {
return R.data(service.tabulation(params));
}
}

8
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java

@ -2,9 +2,7 @@ package com.hnac.hzims.history.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.history.service.IHistoryDeviceService; import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo; import com.hnac.hzims.history.vo.*;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO; import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
@ -70,14 +68,14 @@ public class DeviceHistoryController extends BladeController {
@PostMapping("/history_curve") @PostMapping("/history_curve")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation(value = "设备历史数据曲线图", notes = "获取设备历史数据曲线图") @ApiOperation(value = "设备历史数据曲线图", notes = "获取设备历史数据曲线图")
public R<Map<String, Object>> historyCurve(@RequestBody HistoryDataParamVo param) { public R<List<HistoryDataVo>> historyCurve(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyCurve(param)); return R.data(service.historyCurve(param));
} }
@PostMapping("/history_tabulation") @PostMapping("/history_tabulation")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation(value = "设备历史数据列表", notes = "获取设备历史数据列表") @ApiOperation(value = "设备历史数据列表", notes = "获取设备历史数据列表")
public R<Map<String, Object>> historyTabulation(@RequestBody HistoryDataParamVo param) { public R<List<Map<String, Object>>> historyTabulation(@RequestBody HistoryTabulationParamVo param) {
return R.data(service.historyTabulation(param)); return R.data(service.historyTabulation(param));
} }

11
hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.java

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

5
hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.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.history.mapper.HistoryPointRecordMapper" >
</mapper>

9
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java

@ -1,8 +1,6 @@
package com.hnac.hzims.history.service; package com.hnac.hzims.history.service;
import com.hnac.hzims.history.vo.HistoryDataParamVo; import com.hnac.hzims.history.vo.*;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO; import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
@ -24,8 +22,7 @@ public interface IHistoryDeviceService {
List<HistoryFactoryPointVo> factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName); List<HistoryFactoryPointVo> factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName);
List<HistoryDataVo> historyCurve(HistoryDataParamVo param);
Map<String, Object> historyCurve(HistoryDataParamVo param); List<Map<String, Object>> historyTabulation(HistoryTabulationParamVo param);
Map<String, Object> historyTabulation(HistoryDataParamVo param);
} }

16
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryPointRecordService.java

@ -0,0 +1,16 @@
package com.hnac.hzims.history.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.vo.HistoryPointRecordParamVo;
import java.util.List;
/**
* @author ysj
*/
public interface IHistoryPointRecordService extends IService<HistoryPointRecordEntity> {
List<HistoryPointRecordEntity> tabulation(HistoryPointRecordParamVo params);
}

157
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java

@ -1,12 +1,16 @@
package com.hnac.hzims.history.service.impl; package com.hnac.hzims.history.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.service.IHistoryDeviceService; import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo; import com.hnac.hzims.history.service.IHistoryPointRecordService;
import com.hnac.hzims.history.vo.HistoryDevicePointVo; import com.hnac.hzims.history.vo.*;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
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.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.source.dto.HisFacSourceDataDTO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.HzFacClient; import com.hnac.hzinfo.sdk.v5.hzfac.HzFacClient;
@ -14,14 +18,18 @@ import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO; import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -31,6 +39,8 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public class HistoryDeviceServiceImpl implements IHistoryDeviceService { public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
private final IHistoryPointRecordService pointRecordService;
private final HzFacClient hzFacClient; private final HzFacClient hzFacClient;
private final DeviceClient deviceClient; private final DeviceClient deviceClient;
@ -163,7 +173,7 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
* @return * @return
*/ */
@Override @Override
public Map<String, Object> historyCurve(HistoryDataParamVo param) { public List<HistoryDataVo> historyCurve(HistoryDataParamVo param) {
// 计算查询数据维度 : 0-10秒 、 1-1分钟 、2-5分钟 ..... // 计算查询数据维度 : 0-10秒 、 1-1分钟 、2-5分钟 .....
Integer intervalType = this.computeInterval(param.getStartTime(),param.getEndTime()); Integer intervalType = this.computeInterval(param.getStartTime(),param.getEndTime());
// 查询数据 // 查询数据
@ -186,19 +196,83 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
throw new ServiceException(result.getMsg()); throw new ServiceException(result.getMsg());
} }
if(CollectionUtil.isEmpty(result.getData())){ if(CollectionUtil.isEmpty(result.getData())){
return new HashMap<>(); return new ArrayList<>();
} }
return result.getData(); // 异步线程保存常用查询
CompletableFuture.runAsync(() -> this.commonUserSave(param));
// 返回结构
return result.getData().entrySet().stream().map(entry->{
HistoryDataVo history = new HistoryDataVo();
if("firstAttr".equals(entry.getKey())){
history.setAttrIndex(param.getFirstAttrId());
history.setAttrIndexName(param.getFirstAttrName());
}else if("secondAttr".equals(entry.getKey())){
history.setAttrIndex(param.getSecondAttrId());
history.setAttrIndexName(param.getSecondAttrName());
}else if("thirdlyAttr".equals(entry.getKey())){
history.setAttrIndex(param.getThirdlyAttrId());
history.setAttrIndexName(param.getThirdlyAttrName());
}else if("fourthAttr".equals(entry.getKey())){
history.setAttrIndex(param.getFourthAttrId());
history.setAttrIndexName(param.getFourthAttrName());
}else{
history.setAttrIndex(param.getFifthAttrName());
history.setAttrIndexName(param.getFifthAttrName());
}
HistoryDetailVo historyDetail = JSONObject.parseObject(JSONObject.toJSONString(entry.getValue()),HistoryDetailVo.class);
Date start = null;
String val = null;
List<HistoryDetailDataVo> detailRecords = new ArrayList<>();
for(HistoryDetailDataVo data : historyDetail.getData()) {
HistoryDetailDataVo detail = new HistoryDetailDataVo();
detail.setTs(data.getTs());
if(ObjectUtil.isEmpty(val)){
start = DateUtil.parse(data.getTs(),DateUtil.PATTERN_DATETIME);
val = data.getVal();
detail.setVal(val);
}else{
Date end = DateUtil.parse(data.getTs(),DateUtil.PATTERN_DATETIME);
if(StringUtils.isEmpty(data.getVal())){
if(end.getTime() - start.getTime() <= 5 * 60 * 1000L){
detail.setVal(val);
}else{
detail.setVal(data.getVal());
}
}else{
detail.setVal(data.getVal());
start = DateUtil.parse(data.getTs(),DateUtil.PATTERN_DATETIME);
val = data.getVal();
}
}
detailRecords.add(detail);
}
history.setData(detailRecords);
return history;
}).collect(Collectors.toList());
} }
/** /**
* 获取设备历史数据列表 * 获取设备历史数据列表
* @param param * @param param
* @return * @return
*/ */
@Override @Override
public Map<String, Object> historyTabulation(HistoryDataParamVo param) { public List<Map<String, Object>> historyTabulation(HistoryTabulationParamVo param) {
return null; HisFacSourceDataDTO source = new HisFacSourceDataDTO();
source.setProjectId(param.getProjectId());
source.setFacDeivceAttrIds(param.getFacDeivceAttrIds());
source.setBeginTime(param.getStartTime());
source.setFinishTime(param.getEndTime());
source.setIsPage(true);
source.setCurrent(param.getCurrent());
source.setPageSize(param.getPageSize());
Result<List<Map<String, Object>>> tabulations = deviceDataClient.hisFacSourceData(source);
if(!tabulations.isSuccess() || CollectionUtil.isEmpty(tabulations.getData())){
return new ArrayList<>();
}
return tabulations.getData();
} }
@ -231,4 +305,71 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
} }
return 5; return 5;
} }
/**
* 异步保存常用记录
* @param param
*/
private void commonUserSave(HistoryDataParamVo param) {
// 当前用户Id
Long userId = AuthUtil.getUserId();
// 点位Id
List<String> points = new ArrayList<>();
if(StringUtils.isNotEmpty(param.getFirstAttrId())){
points.add(param.getFirstAttrId());
}
if(StringUtils.isNotEmpty(param.getSecondAttrId())){
points.add(param.getFirstAttrId());
}
if(StringUtils.isNotEmpty(param.getThirdlyAttrId())){
points.add(param.getFirstAttrId());
}
if(StringUtils.isNotEmpty(param.getFourthAttrId())){
points.add(param.getFirstAttrId());
}
if(StringUtils.isNotEmpty(param.getFifthAttrId())){
points.add(param.getFirstAttrId());
}
// 查询历史保存数据
List<HistoryPointRecordEntity> records = pointRecordService.list(Wrappers.<HistoryPointRecordEntity>lambdaQuery()
.in(HistoryPointRecordEntity::getHistoryPoint,points)
.eq(HistoryPointRecordEntity::getCreateUser,userId)
.eq(HistoryPointRecordEntity::getStationId,param.getStationId())
);
pointRecordService.saveOrUpdateBatch(points.stream().map(point->{
HistoryPointRecordEntity entity = new HistoryPointRecordEntity();
entity.setStationId(param.getStationId());
entity.setStationName(param.getStationName());
entity.setHistoryPoint(point);
if("firstAttr".equals(point)){
entity.setHistoryPointName(param.getFirstAttrName());
}else if("secondAttr".equals(point)){
entity.setHistoryPointName(param.getSecondAttrName());
}else if("thirdlyAttr".equals(point)){
entity.setHistoryPointName(param.getThirdlyAttrName());
}else if("fourthAttr".equals(point)){
entity.setHistoryPointName(param.getFourthAttrName());
}else{
entity.setHistoryPointName(param.getFifthAttrName());
}
if(CollectionUtil.isEmpty(records)){
entity.setNumber(1);
}else{
// 包含
if(records.stream().map(HistoryPointRecordEntity::getHistoryPoint).collect(Collectors.toList()).contains(point)){
Optional<HistoryPointRecordEntity> optional = records.stream().filter(o->o.getHistoryPoint().equals(point)).findFirst();
if(optional.isPresent()){
entity.setNumber(optional.get().getNumber() + 1);
}else{
entity.setNumber(1);
}
}else{
entity.setNumber(1);
}
}
return entity;
}).collect(Collectors.toList()));
}
} }

45
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryPointRecordServiceImpl.java

@ -0,0 +1,45 @@
package com.hnac.hzims.history.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.mapper.HistoryPointRecordMapper;
import com.hnac.hzims.history.service.IHistoryPointRecordService;
import com.hnac.hzims.history.vo.HistoryPointRecordParamVo;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author ysj
*/
@Service
public class HistoryPointRecordServiceImpl extends ServiceImpl<HistoryPointRecordMapper, HistoryPointRecordEntity> implements IHistoryPointRecordService {
/**
* 查询常用点位前30名
* @param params
* @return
*/
@Override
public List<HistoryPointRecordEntity> tabulation(HistoryPointRecordParamVo params) {
IPage<HistoryPointRecordEntity> page = new Page<>();
page.setPages(1L);
page.setSize(30);
LambdaQueryWrapper wrapper = Wrappers.<HistoryPointRecordEntity>lambdaQuery()
.eq(HistoryPointRecordEntity::getStationId,params.getStationId())
.eq(HistoryPointRecordEntity::getCreateUser,params.getCreateUser())
.orderByDesc(HistoryPointRecordEntity::getNumber);
IPage<HistoryPointRecordEntity> date = super.page(page,wrapper);
if(ObjectUtil.isEmpty(date) || CollectionUtil.isEmpty(date.getRecords())){
return new ArrayList<>();
}
return date.getRecords();
}
}

6
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java

@ -60,11 +60,11 @@ public class MqttConfigHzims {
log.info(fdpClient.toString()+fdpClient.getClientId()); log.info(fdpClient.toString()+fdpClient.getClientId());
//drools //drools
DroolsSoeSubscribe droolsSoeSubscribe = new DroolsSoeSubscribe(); DroolsSoeSubscribe droolsSoeSubscribe = new DroolsSoeSubscribe();
MqttAsyncClient droolsClient = droolsSoeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), droolsMqttConsumer); MqttAsyncClient droolsClient = droolsSoeSubscribe.subscribe(mqttConfig, "#",Collections.singletonList("#"), droolsMqttConsumer);
log.info(droolsClient.toString()+droolsClient.getClientId()); log.info(droolsClient.toString()+droolsClient.getClientId());
//Soe //Soe
SoeSubscribe soeSubscribe = new SoeSubscribe(); SoeSubscribe soeSubscribe = new SoeSubscribe();
MqttAsyncClient soeClient = soeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), soeMqttConsumer); MqttAsyncClient soeClient = soeSubscribe.subscribe(mqttConfig,"#", Collections.singletonList("#"), soeMqttConsumer);
log.info(soeClient.toString()+soeClient.getClientId()); log.info(soeClient.toString()+soeClient.getClientId());
//hz3000 //hz3000
HZ3000SoeSubscribe hz3000SoeSubscribe = new HZ3000SoeSubscribe(); HZ3000SoeSubscribe hz3000SoeSubscribe = new HZ3000SoeSubscribe();
@ -72,7 +72,7 @@ public class MqttConfigHzims {
log.info(hz3000Client.toString()+hz3000Client.getClientId()); log.info(hz3000Client.toString()+hz3000Client.getClientId());
//视频 //视频
SoeSubscribe subscribe = new SoeSubscribe(); SoeSubscribe subscribe = new SoeSubscribe();
MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig, Collections.singletonList("#"), videoMqttConsumer); MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig,"#" , Collections.singletonList("#"), videoMqttConsumer);
log.info(videoClient.toString()+videoClient.getClientId()); log.info(videoClient.toString()+videoClient.getClientId());
}catch (Exception e){ }catch (Exception e){
log.error(e.toString()) ; log.error(e.toString()) ;

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

@ -1486,12 +1486,12 @@ public class RealTargetServiceImpl implements RealTargetService {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
// 结束日期 // 结束日期
Date end = calendar.getTime(); Date end = calendar.getTime();
calendar.add(Calendar.DAY_OF_MONTH,-1); 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(end,DateUtil.PATTERN_DATETIME), 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);
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");
ActivePowerVo active = new ActivePowerVo(); ActivePowerVo active = new ActivePowerVo();
active.setStrHour(time); active.setStrHour(time);

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -9,6 +9,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
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.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
@ -282,7 +283,10 @@ public class TargetServiceImpl implements TargetService {
List<CompleteGenerationVo> generations; List<CompleteGenerationVo> generations;
if(HomePageConstant.HYDROPOWER.equals(type)){ if(HomePageConstant.HYDROPOWER.equals(type)){
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 设备指标数据 // 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){ if(CollectionUtils.isEmpty(targets)){
@ -363,8 +367,12 @@ public class TargetServiceImpl implements TargetService {
return item; return item;
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList()); }).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList());
}else{ }else{
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
String mon = DateUtil.format(new Date(),"yyyy"); String mon = DateUtil.format(new Date(),"yyyy");
List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery() List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery()
.in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) .in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
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.hzimsweather.feign.IRainfallClient; import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
@ -740,7 +741,10 @@ public class HzimsDataServiceImpl implements HzimsDataService {
// 查询计划发电量 // 查询计划发电量
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.setTime(new Date());
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, String.valueOf(calendar.get(Calendar.YEAR))); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(String.valueOf(calendar.get(Calendar.YEAR)));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
// 获取月份集合 // 获取月份集合
List<String> monList = this.mons(0, 12, false); List<String> monList = this.mons(0, 12, false);
return monList.stream().map(o -> { return monList.stream().map(o -> {

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/DutyGroupGeneratingCapacityServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.operational.duty.entity.DutyGroupGeneratingCapacityEntity; import com.hnac.hzims.operational.duty.entity.DutyGroupGeneratingCapacityEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity;
import com.hnac.hzims.operational.duty.mapper.DutyGroupGeneratingCapacityMapper; import com.hnac.hzims.operational.duty.mapper.DutyGroupGeneratingCapacityMapper;
@ -82,7 +83,10 @@ public class DutyGroupGeneratingCapacityServiceImpl extends ServiceImpl<DutyGrou
if(CollectionUtil.isNotEmpty(imsDeptEntityList)) { if(CollectionUtil.isNotEmpty(imsDeptEntityList)) {
ImsDeptEntity imsDeptEntity = imsDeptEntityList.get(0); ImsDeptEntity imsDeptEntity = imsDeptEntityList.get(0);
if (imsDeptEntity.getDeptCategory() == 4) { if (imsDeptEntity.getDeptCategory() == 4) {
List<PlanGenerationEntity> planGenerationEntities = planGenertionClient.getPlanGenerationByParam(null, Arrays.asList(imsDeptEntity.getId().toString().split(",")), DateUtil.format(new Date(), "yyyy-MM")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setDeptIds(Arrays.asList(imsDeptEntity.getId().toString().split(",")));
param.setDate(DateUtil.format(new Date(), "yyyy-MM"));
List<PlanGenerationEntity> planGenerationEntities = planGenertionClient.getPlanGenerationByParam(param);
if (CollectionUtil.isNotEmpty(planGenerationEntities)) { if (CollectionUtil.isNotEmpty(planGenerationEntities)) {
planGenerationCount = planGenerationEntities.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); planGenerationCount = planGenerationEntities.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
} }
@ -90,7 +94,10 @@ public class DutyGroupGeneratingCapacityServiceImpl extends ServiceImpl<DutyGrou
List<StationEntity> stationList = stationService.getStationByUserAuth(user); List<StationEntity> stationList = stationService.getStationByUserAuth(user);
if (CollectionUtil.isNotEmpty(stationList)) { if (CollectionUtil.isNotEmpty(stationList)) {
List<String> stationIdList = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); List<String> stationIdList = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList());
List<PlanGenerationEntity> planGenerationByDateAndStation = planGenertionClient.getPlanGenerationByParam(stationIdList, null, DateUtil.format(new Date(), "yyyy-MM")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setDeptIds(stationIdList);
param.setDate(DateUtil.format(new Date(), "yyyy-MM"));
List<PlanGenerationEntity> planGenerationByDateAndStation = planGenertionClient.getPlanGenerationByParam(param);
if (CollectionUtil.isNotEmpty(planGenerationByDateAndStation)) { if (CollectionUtil.isNotEmpty(planGenerationByDateAndStation)) {
planGenerationCount = planGenerationByDateAndStation.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); planGenerationCount = planGenerationByDateAndStation.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
} }

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

@ -6,6 +6,7 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
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.hzimsweather.feign.IRainfallClient; import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
@ -194,12 +195,11 @@ public class HydroelectricServiceImpl implements HydroelectricService {
// 今日发电量、昨日发电量 // 今日发电量、昨日发电量
result.setPowerDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerDay).sum()); result.setPowerDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerDay).sum());
result.setPowerYesterDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerYesterDay).sum()); result.setPowerYesterDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerYesterDay).sum());
// 近30日降雨量/发电量
result.setPowerRains(this.stationPowerRains(result.getDevices(),rains));
// 电站月发电/计划发电
result.setGenerateMons(this.stationGenerateMons(plans,map.get(station.getCode())));
} }
// 近30日降雨量/发电量
result.setPowerRains(this.stationPowerRains(result.getDevices(),rains));
// 电站月发电/计划发电
result.setGenerateMons(this.stationGenerateMons(plans,map.get(station.getCode())));
return result; return result;
} }
@ -217,7 +217,10 @@ public class HydroelectricServiceImpl implements HydroelectricService {
return area; return area;
} }
// 站点计划发电量数据 // 站点计划发电量数据
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 机构名称 // 机构名称
R<Dept> dept = sysClient.getDept(deptId); R<Dept> dept = sysClient.getDept(deptId);
@ -310,7 +313,11 @@ public class HydroelectricServiceImpl implements HydroelectricService {
return group; return group;
} }
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,DateUtil.format(new Date(),"yyyy")); // 查询计划发电量
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 机构名称 // 机构名称
Optional<Dept> dept = currents.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)); Optional<Dept> dept = currents.getData().stream().min(Comparator.comparing(Dept::getDeptCategory));
@ -728,11 +735,13 @@ public class HydroelectricServiceImpl implements HydroelectricService {
*/ */
private List<HydroelectricPowerRainVo> stationPowerRains(List<HydroelectricDeviceVo> devices, List<Map<String, Object>> rains) { private List<HydroelectricPowerRainVo> stationPowerRains(List<HydroelectricDeviceVo> devices, List<Map<String, Object>> rains) {
List<HydroelectricDeviceGenerateVo> generates = new ArrayList<>(); List<HydroelectricDeviceGenerateVo> generates = new ArrayList<>();
devices.forEach(device->{ if(CollectionUtil.isNotEmpty(devices)){
if(CollectionUtil.isNotEmpty(device.getGenerates())){ devices.forEach(device->{
generates.addAll(device.getGenerates()); if(CollectionUtil.isNotEmpty(device.getGenerates())){
} generates.addAll(device.getGenerates());
}); }
});
}
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1); calendar.add(Calendar.DAY_OF_MONTH,-1);
Date end = calendar.getTime(); Date end = calendar.getTime();

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -7,6 +7,7 @@ import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmParamClient; import com.hnac.hzims.equipment.feign.IEmParamClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
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.operational.defect.constants.TreatMethodConstant; import com.hnac.hzims.operational.defect.constants.TreatMethodConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
@ -388,8 +389,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
} }
//表格总计 //表格总计
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList()); List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, dateFormat); param.setDeptIds(deptIdsString);
param.setDate(year.toString());
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(param);
param.setDate(dateFormat);
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(param);
getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map); getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map);
//发电情况统计表数据 //发电情况统计表数据
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size()); ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size());
@ -709,7 +714,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
private List<MonPowerPercentageVo> getMonPowerPercentageVos(Integer year, Integer month, List<Dept> deptList, List<Long> deptIds, List<StationEntity> stationEntityList, List<String> stationIds, Integer yearBefore, Integer monthBefore) { private List<MonPowerPercentageVo> getMonPowerPercentageVos(Integer year, Integer month, List<Dept> deptList, List<Long> deptIds, List<StationEntity> stationEntityList, List<String> stationIds, Integer yearBefore, Integer monthBefore) {
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList()); List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
//年计划发电量 //年计划发电量
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setDeptIds(deptIdsString);
param.setDate(year.toString());
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(param);
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>(); List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>();
//水电站,光伏站和带代运维数据近三年数据 //水电站,光伏站和带代运维数据近三年数据
Map<String, Map<String, Float>> powerMapThree = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); Map<String, Map<String, Float>> powerMapThree = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
@ -1510,8 +1518,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
* @return * @return
*/ */
private List<PlanGenerationEntity> getPlanPower(List<StationEntity> stationList, String mon) { private List<PlanGenerationEntity> getPlanPower(List<StationEntity> stationList, String mon) {
List<String> list = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
return planGenertionClient.getPlanGenerationByParam(list, null, mon); param.setStationIds(stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(mon);
return planGenertionClient.getPlanGenerationByParam(param);
} }
/** /**

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.HomeService; import com.hnac.hzims.operational.main.service.HomeService;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
@ -228,7 +229,10 @@ public class HomeServiceImpl implements HomeService {
target.setTaget_two(targets.stream().filter(tar->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(tar.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); target.setTaget_two(targets.stream().filter(tar->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(tar.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
} }
if(CollectionUtil.isNotEmpty(stations)){ if(CollectionUtil.isNotEmpty(stations)){
List<PlanGenerationEntity> plans = planService.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> plans = planService.getPlanGenerationByParam(param);
if(CollectionUtil.isNotEmpty(plans)){ if(CollectionUtil.isNotEmpty(plans)){
double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
if(Math.abs(plan) > 0){ if(Math.abs(plan) > 0){

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
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.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;
@ -581,7 +582,10 @@ public class HydropowerServiceImpl implements HydropowerService {
// 查询计划发电量 // 查询计划发电量
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.setTime(new Date());
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,String.valueOf(calendar.get(Calendar.YEAR))); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(String.valueOf(calendar.get(Calendar.YEAR)));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
// 获取月份集合 // 获取月份集合
List<String> monList = this.mons(0,12,false); List<String> monList = this.mons(0,12,false);
return monList.stream().map(o->{ return monList.stream().map(o->{
@ -805,7 +809,10 @@ public class HydropowerServiceImpl implements HydropowerService {
// 获取站点7日天气 // 获取站点7日天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(stations); Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(stations);
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(codes, null, DateUtil.format(new Date(), "yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codes);
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
// 实时监测点数据 // 实时监测点数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
// 获取站点机组指标数据 // 获取站点机组指标数据
@ -1038,7 +1045,10 @@ public class HydropowerServiceImpl implements HydropowerService {
List<String> codes = new ArrayList<>(); List<String> codes = new ArrayList<>();
areas.forEach((key,value)-> codes.addAll(value.stream().map(StationEntity::getCode).collect(Collectors.toList()))); areas.forEach((key,value)-> codes.addAll(value.stream().map(StationEntity::getCode).collect(Collectors.toList())));
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(codes,null,String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codes);
param.setDate(String.valueOf(Calendar.getInstance().get(Calendar.YEAR)));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
List<HydropowerAreaVo> hydropowerAreas = areas.entrySet().stream().map(entry->{ List<HydropowerAreaVo> hydropowerAreas = areas.entrySet().stream().map(entry->{
HydropowerAreaVo area = new HydropowerAreaVo(); HydropowerAreaVo area = new HydropowerAreaVo();
area.setDeptId(entry.getKey().getId()); area.setDeptId(entry.getKey().getId());

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java

@ -12,6 +12,7 @@ import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IEmParamClient; import com.hnac.hzims.equipment.feign.IEmParamClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EmInfoExtendVo; import com.hnac.hzims.equipment.vo.EmInfoExtendVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.monitor.utils.DateUtils; import com.hnac.hzims.monitor.utils.DateUtils;
@ -416,7 +417,10 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer
List<EminfoAndEmParamVo> eminfoAndEmParamVos = this.getEmInfoList(); List<EminfoAndEmParamVo> eminfoAndEmParamVos = this.getEmInfoList();
//获取计划发电量 //获取计划发电量
List<PlanGenerationEntity> planGenerationByDateAndStationList = planGenertionClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy-")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> planGenerationByDateAndStationList = planGenertionClient.getPlanGenerationByParam(param);
LocalDateTime yearBeginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-01-01 00:00:00"), df); LocalDateTime yearBeginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-01-01 00:00:00"), df);

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -8,6 +8,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
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;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
@ -458,7 +459,10 @@ public class SideHustleServiceImpl implements ISideHustleService {
if(CollectionUtil.isEmpty(codeList)){ if(CollectionUtil.isEmpty(codeList)){
return null; return null;
} }
return planGenertionClient.getPlanGenerationByParam(codeList, null, DateUtil.format(new Date(), "yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codeList);
param.setDate(DateUtil.format(new Date(), "yyyy"));
return planGenertionClient.getPlanGenerationByParam(param);
} }
@ -714,7 +718,10 @@ public class SideHustleServiceImpl implements ISideHustleService {
List<String> stationCodeList = value.stream().map(StationEntity::getCode).collect(Collectors.toList()); List<String> stationCodeList = value.stream().map(StationEntity::getCode).collect(Collectors.toList());
String month = DateUtil.format(new Date(), "yyyy-MM"); String month = DateUtil.format(new Date(), "yyyy-MM");
// 获取站点的计划发电量 // 获取站点的计划发电量
List<PlanGenerationEntity> planList = planGenertionClient.getPlanGenerationByParam(stationCodeList, null, month); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stationCodeList);
param.setDate(month);
List<PlanGenerationEntity> planList = planGenertionClient.getPlanGenerationByParam(param);
PowerFinishVo powerFinishVo = new PowerFinishVo(); PowerFinishVo powerFinishVo = new PowerFinishVo();
powerFinishVo.setDepartId(key.getId()); powerFinishVo.setDepartId(key.getId());
powerFinishVo.setDepartName(key.getDeptName()); powerFinishVo.setDepartName(key.getDeptName());

46
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
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.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;
@ -133,7 +134,10 @@ public class WindHomeServiceImpl implements WindHomeService {
// 年发电量 // 年发电量
score.setGenerateYear(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(WindEntity::getPower).sum()); score.setGenerateYear(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(WindEntity::getPower).sum());
// 年计划发电量 // 年计划发电量
List<PlanGenerationEntity> yearPlans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> yearPlans = planClient.getPlanGenerationByParam(param);
score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 年发电完成率 // 年发电完成率
if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){ if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){
@ -198,7 +202,10 @@ public class WindHomeServiceImpl implements WindHomeService {
*/ */
private List<PowerMonthVo> currentGenerateCurve(List<WindEntity> winds) { private List<PowerMonthVo> currentGenerateCurve(List<WindEntity> winds) {
List<String> mons = this.mons(0,12,false); List<String> mons = this.mons(0,12,false);
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(winds.stream().map(WindEntity::getStationCode).distinct().collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(winds.stream().map(WindEntity::getStationCode).distinct().collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
return mons.stream().map(mon->{ return mons.stream().map(mon->{
PowerMonthVo power = new PowerMonthVo(); PowerMonthVo power = new PowerMonthVo();
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
@ -268,7 +275,10 @@ public class WindHomeServiceImpl implements WindHomeService {
subordinate.setGenerationRate(0.0); subordinate.setGenerationRate(0.0);
} }
// 计划发电量查询 // 计划发电量查询
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
// 发电完成率 // 发电完成率
if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(plan) > 0){ if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(plan) > 0){
@ -329,7 +339,10 @@ public class WindHomeServiceImpl implements WindHomeService {
// 装机容量 // 装机容量
kpi.setCapacity(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum()); kpi.setCapacity(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum());
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
kpi.setPlan(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); kpi.setPlan(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 实际发电量 // 实际发电量
kpi.setGenerate(winds.stream().mapToDouble(WindEntity::getPower).sum()); kpi.setGenerate(winds.stream().mapToDouble(WindEntity::getPower).sum());
@ -384,7 +397,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy")); .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy"));
}}); }});
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(codes, null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codes);
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
return areas.entrySet().stream().map(entry -> { return areas.entrySet().stream().map(entry -> {
WindAreaVo area = new WindAreaVo(); WindAreaVo area = new WindAreaVo();
area.setDeptId(entry.getKey().getId()); area.setDeptId(entry.getKey().getId());
@ -525,7 +541,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy-MM")); .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy-MM"));
}}); }});
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy-MM")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy-MM"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
if(CollectionUtil.isNotEmpty(windMons)){ if(CollectionUtil.isNotEmpty(windMons)){
areaDuty.setGenerateMon(windMons.stream().mapToDouble(WindEntity::getPower).sum()); areaDuty.setGenerateMon(windMons.stream().mapToDouble(WindEntity::getPower).sum());
// 月计划发电量 // 月计划发电量
@ -829,7 +848,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy")); .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy"));
}}); }});
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 设备 // 设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {}); List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
subordinate.setStations(stations.stream().map(station -> { subordinate.setStations(stations.stream().map(station -> {
@ -953,7 +975,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.eq(WindEntity::getStationCode,station.getCode()) .eq(WindEntity::getStationCode,station.getCode())
); );
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(Collections.singletonList(station.getCode()), null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(Collections.singletonList(station.getCode()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
if(CollectionUtil.isNotEmpty(all)){ if(CollectionUtil.isNotEmpty(all)){
// 年计划发电量 // 年计划发电量
wind.setPlanYear(plans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); wind.setPlanYear(plans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
@ -997,7 +1022,10 @@ public class WindHomeServiceImpl implements WindHomeService {
} }
List<String> monList = this.mons(1,12,false); List<String> monList = this.mons(1,12,false);
// 计划发电量查询 // 计划发电量查询
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(Collections.singletonList(station.getCode()), null,DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(Collections.singletonList(station.getCode()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
return monList.stream().map(mon->{ return monList.stream().map(mon->{
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
WindGenerationVo generation = new WindGenerationVo(); WindGenerationVo generation = new WindGenerationVo();

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

@ -16,6 +16,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.RideDeviceVo; import com.hnac.hzims.equipment.vo.RideDeviceVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.IAnalyseDataService; import com.hnac.hzims.operational.main.service.IAnalyseDataService;
@ -230,7 +231,10 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!");
} }
// 计划发电量 // 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(Collections.singletonList(stationCode), null , DateUtil.format(new Date(),"yyyy")); DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(Collections.singletonList(stationCode));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
RunMonthEntity run = new RunMonthEntity(); RunMonthEntity run = new RunMonthEntity();
run.setTenantId(station.getTenantId()); run.setTenantId(station.getTenantId());
run.setCreateDept(station.getRefDept()); run.setCreateDept(station.getRefDept());

2
pom.xml

@ -15,7 +15,7 @@
<properties> <properties>
<hzinfo.platform.version>5.1.3.RELEASE.fix2</hzinfo.platform.version> <hzinfo.platform.version>5.1.3.RELEASE.fix2</hzinfo.platform.version>
<data.sdk.version>5.1.3.RELEASE.fix3</data.sdk.version> <data.sdk.version>5.2.0.0.RELEASE</data.sdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Loading…
Cancel
Save