diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java index f8e77cc..2b2ed6d 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java +++ b/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.equipment.entity.PlanGenerationEntity; +import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo; import com.hnac.hzims.equipment.vo.PlanPowerYearVo; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; @@ -64,17 +65,13 @@ public interface IPlanGenertionClient { Map> getYAndMGenerationGroupCount(@RequestParam("stationIds") List stationIds, @RequestParam("date") String date); - /** * 根据参数 站点Id 或者 机构ID 及 时间 'yyyy-MM' 获取计划发电量 - * - * @param stationIds 站点IDS - * @param deptIds 机构IDS - * @param date 时间 + * @param param * @return */ - @GetMapping(GET_PLAN_GENERATION_BY_PARAM) - List getPlanGenerationByParam(@RequestParam(value = "stationIds", required = false) List stationIds, @RequestParam(value = "deptIds", required = false) List deptIds, @RequestParam(value = "date", required = false) String date); + @PostMapping(GET_PLAN_GENERATION_BY_PARAM) + List getPlanGenerationByParam(@RequestBody DevicePlanGenerationVo param); /** diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java index 102c36b..3a5c2d7 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java +++ b/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; import com.hnac.hzims.equipment.entity.PlanGenerationEntity; +import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo; import com.hnac.hzims.equipment.vo.PlanPowerYearVo; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; @@ -42,7 +43,7 @@ public class IPlanGenertionClientBack implements IPlanGenertionClient { } @Override - public List getPlanGenerationByParam(List stationIds,List deptIds, String date) { + public List getPlanGenerationByParam(DevicePlanGenerationVo param) { return null; } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/DevicePlanGenerationVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/DevicePlanGenerationVo.java new file mode 100644 index 0000000..72e2c5c --- /dev/null +++ b/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 ListstationIds; + + + @ApiModelProperty(value = "机构ID集合") + private List deptIds; + + @ApiModelProperty(value = "时间") + private String date; +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryPointRecordEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryPointRecordEntity.java new file mode 100644 index 0000000..b8aa857 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java index 135c2bd..65af5ee 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java +++ b/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; /** - * 设备树绑定巡检实体类 - * @author tanghaihao - * @date 2023年06月14日 16:46 + * @author ysj */ @Data -@TableName("hzims_device_history_template") +@TableName("hzims_history_template") @EqualsAndHashCode(callSuper = true) @ApiModel(value = "设备历史数据模板") public class HistoryTemplateEntity extends TenantEntity { diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java index b54cbba..de1526f 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java +++ b/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 = "设备历史查询参数") public class HistoryDataParamVo { + @ApiModelProperty(value = "站点Id") + private String stationId; + + @ApiModelProperty(value = "站点名称") + private String stationName; + @ApiModelProperty(value = "第一个点位") private String firstAttrId; + @ApiModelProperty(value = "第一个点位名称") + private String firstAttrName; + @ApiModelProperty(value = "第二个点位") private String secondAttrId; + @ApiModelProperty(value = "第二个点位名称") + private String secondAttrName; + @ApiModelProperty(value = "第三个点位") private String thirdlyAttrId; + @ApiModelProperty(value = "第三个点位名称") + private String thirdlyAttrName; + @ApiModelProperty(value = "第四个点位") private String fourthAttrId; + @ApiModelProperty(value = "第四个点位名称") + private String fourthAttrName; + @ApiModelProperty(value = "第五个点位") private String fifthAttrId; + @ApiModelProperty(value = "第五个点位名称") + private String fifthAttrName; + @ApiModelProperty(value = "开始时间") @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataVo.java new file mode 100644 index 0000000..c9b9375 --- /dev/null +++ b/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 data; +} \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailDataVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailDataVo.java new file mode 100644 index 0000000..0e15150 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailVo.java new file mode 100644 index 0000000..b6cab25 --- /dev/null +++ b/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 data; +} \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryPointRecordParamVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryPointRecordParamVo.java new file mode 100644 index 0000000..c114e28 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTabulationParamVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTabulationParamVo.java new file mode 100644 index 0000000..6fdd90f --- /dev/null +++ b/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 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; +} \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java index 320c530..6bbfc09 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java +++ b/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; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; import com.hnac.hzims.hzimsweather.response.weather.Daily; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.experimental.Tolerate; import java.util.List; @@ -22,36 +25,47 @@ public class HydroelectricStationVo { private String stationName; @ApiModelProperty(value = "总装机容量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double installedCapacity; @ApiModelProperty(value = "总发电负荷") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerSum; @ApiModelProperty(value = "容量利用率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double capacityRate; @ApiModelProperty(value = "月计划发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerMonPlan; @ApiModelProperty(value = "月发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerMon; @ApiModelProperty(value = "月发电量完成率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerRateMon; @ApiModelProperty(value = "年计划发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerYearPlan; @ApiModelProperty(value = "年发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerYear; @ApiModelProperty(value = "年发电完成率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerRateYear; @ApiModelProperty(value = "今日发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerDay; @ApiModelProperty(value = "昨日发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double powerYesterDay; @ApiModelProperty(value = "七日内天气") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java index 9d8bfb2..c549eae 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java @@ -1,17 +1,23 @@ package com.hnac.hzims.equipment.feign; 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.service.IPlanGenerationService; +import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo; import com.hnac.hzims.equipment.vo.PlanPowerYearVo; import org.springblade.core.mp.support.Condition; 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.StringUtil; import org.springframework.beans.factory.annotation.Autowired; 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.RestController; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -81,18 +87,22 @@ public class PlanGenertionClient implements IPlanGenertionClient{ public Map> getYAndMGenerationGroupCount(List stationIds,String date) { return service.getYAndMGenerationGroupCount(stationIds,date); } + /** * 根据参数 站点Id 或者 机构ID 及 时间 'yyyy-MM' 获取计划发电量 - * - * @param stationIds 站点IDS - * @param deptIds 机构IDS - * @param date 时间 + * @param param * @return */ - @GetMapping(GET_PLAN_GENERATION_BY_PARAM) + @PostMapping(GET_PLAN_GENERATION_BY_PARAM) @Override - public List getPlanGenerationByParam(List stationIds,List deptIds, String date) { - return service.getPlanGenerationByParam(stationIds,deptIds,date); + public List getPlanGenerationByParam(DevicePlanGenerationVo param) { + 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()); } /** diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/CommonUseController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/CommonUseController.java new file mode 100644 index 0000000..de7d4dc --- /dev/null +++ b/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> tabulation(HistoryPointRecordParamVo params) { + return R.data(service.tabulation(params)); + } +} \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java index 8efc43e..400982a 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java +++ b/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.hnac.hzims.history.service.IHistoryDeviceService; -import com.hnac.hzims.history.vo.HistoryDataParamVo; -import com.hnac.hzims.history.vo.HistoryDevicePointVo; -import com.hnac.hzims.history.vo.HistoryFactoryPointVo; +import com.hnac.hzims.history.vo.*; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO; import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO; @@ -70,14 +68,14 @@ public class DeviceHistoryController extends BladeController { @PostMapping("/history_curve") @ApiOperationSupport(order = 3) @ApiOperation(value = "设备历史数据曲线图", notes = "获取设备历史数据曲线图") - public R> historyCurve(@RequestBody HistoryDataParamVo param) { + public R> historyCurve(@RequestBody HistoryDataParamVo param) { return R.data(service.historyCurve(param)); } @PostMapping("/history_tabulation") @ApiOperationSupport(order = 3) @ApiOperation(value = "设备历史数据列表", notes = "获取设备历史数据列表") - public R> historyTabulation(@RequestBody HistoryDataParamVo param) { + public R>> historyTabulation(@RequestBody HistoryTabulationParamVo param) { return R.data(service.historyTabulation(param)); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.java new file mode 100644 index 0000000..702bd72 --- /dev/null +++ b/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 { + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.xml b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.xml new file mode 100644 index 0000000..1810def --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java index 3634011..a85defb 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java @@ -1,8 +1,6 @@ package com.hnac.hzims.history.service; -import com.hnac.hzims.history.vo.HistoryDataParamVo; -import com.hnac.hzims.history.vo.HistoryDevicePointVo; -import com.hnac.hzims.history.vo.HistoryFactoryPointVo; +import com.hnac.hzims.history.vo.*; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO; import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO; @@ -24,8 +22,7 @@ public interface IHistoryDeviceService { List factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName); + List historyCurve(HistoryDataParamVo param); - Map historyCurve(HistoryDataParamVo param); - - Map historyTabulation(HistoryDataParamVo param); + List> historyTabulation(HistoryTabulationParamVo param); } \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryPointRecordService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryPointRecordService.java new file mode 100644 index 0000000..ffb66c0 --- /dev/null +++ b/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 { + + List tabulation(HistoryPointRecordParamVo params); +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java index 1fbc4ad..0bada0e 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java +++ b/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; +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.vo.HistoryDataParamVo; -import com.hnac.hzims.history.vo.HistoryDevicePointVo; -import com.hnac.hzims.history.vo.HistoryFactoryPointVo; +import com.hnac.hzims.history.service.IHistoryPointRecordService; +import com.hnac.hzims.history.vo.*; import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; 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.DeviceInstanceVO; 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 lombok.AllArgsConstructor; 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.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.springframework.stereotype.Service; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.*; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; /** @@ -31,6 +39,8 @@ import java.util.stream.Collectors; @AllArgsConstructor public class HistoryDeviceServiceImpl implements IHistoryDeviceService { + private final IHistoryPointRecordService pointRecordService; + private final HzFacClient hzFacClient; private final DeviceClient deviceClient; @@ -163,7 +173,7 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService { * @return */ @Override - public Map historyCurve(HistoryDataParamVo param) { + public List historyCurve(HistoryDataParamVo param) { // 计算查询数据维度 : 0-10秒 、 1-1分钟 、2-5分钟 ..... Integer intervalType = this.computeInterval(param.getStartTime(),param.getEndTime()); // 查询数据 @@ -186,19 +196,83 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService { throw new ServiceException(result.getMsg()); } 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 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 * @return */ @Override - public Map historyTabulation(HistoryDataParamVo param) { - return null; + public List> historyTabulation(HistoryTabulationParamVo param) { + 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>> 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; } + + /** + * 异步保存常用记录 + * @param param + */ + private void commonUserSave(HistoryDataParamVo param) { + // 当前用户Id + Long userId = AuthUtil.getUserId(); + + // 点位Id + List 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 records = pointRecordService.list(Wrappers.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 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())); + } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryPointRecordServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryPointRecordServiceImpl.java new file mode 100644 index 0000000..3c65c3e --- /dev/null +++ b/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 implements IHistoryPointRecordService { + + /** + * 查询常用点位前30名 + * @param params + * @return + */ + @Override + public List tabulation(HistoryPointRecordParamVo params) { + IPage page = new Page<>(); + page.setPages(1L); + page.setSize(30); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(HistoryPointRecordEntity::getStationId,params.getStationId()) + .eq(HistoryPointRecordEntity::getCreateUser,params.getCreateUser()) + .orderByDesc(HistoryPointRecordEntity::getNumber); + IPage date = super.page(page,wrapper); + if(ObjectUtil.isEmpty(date) || CollectionUtil.isEmpty(date.getRecords())){ + return new ArrayList<>(); + } + return date.getRecords(); + } +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java index 993f4b1..c7076c4 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java +++ b/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()); //drools 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()); //Soe 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()); //hz3000 HZ3000SoeSubscribe hz3000SoeSubscribe = new HZ3000SoeSubscribe(); @@ -72,7 +72,7 @@ public class MqttConfigHzims { log.info(hz3000Client.toString()+hz3000Client.getClientId()); //视频 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()); }catch (Exception e){ log.error(e.toString()) ; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index af7b0a1..4a70760 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/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(); // 结束日期 Date end = calendar.getTime(); - calendar.add(Calendar.DAY_OF_MONTH,-1); + calendar.add(Calendar.HOUR_OF_DAY,-23); // 开始日期 Date start = calendar.getTime(); List 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 activePowers = new ArrayList<>(); - while (start.compareTo(end) < 0){ + while (start.compareTo(end) <= 0){ String time = DateUtil.format(start,"yyyy-MM-dd HH"); ActivePowerVo active = new ActivePowerVo(); active.setStrHour(time); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index 0d34e55..b81905b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/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.feign.IEmInfoClient; 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.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; @@ -282,7 +283,10 @@ public class TargetServiceImpl implements TargetService { List generations; if(HomePageConstant.HYDROPOWER.equals(type)){ // 计划发电量 - List 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 plans = planClient.getPlanGenerationByParam(param); // 设备指标数据 List targets = (List) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); if(CollectionUtils.isEmpty(targets)){ @@ -363,8 +367,12 @@ public class TargetServiceImpl implements TargetService { return item; }).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList()); }else{ + + DevicePlanGenerationVo param = new DevicePlanGenerationVo(); + param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); + param.setDate(DateUtil.format(new Date(),"yyyy")); // 计划发电量 - List plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); + List plans = planClient.getPlanGenerationByParam(param); String mon = DateUtil.format(new Date(),"yyyy"); List powers = windService.list(Wrappers.lambdaQuery() .in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java index 4db2b8e..b239d27 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java +++ b/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.feign.IEmInfoClient; 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.hzimsweather.feign.IRainfallClient; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; @@ -740,7 +741,10 @@ public class HzimsDataServiceImpl implements HzimsDataService { // 查询计划发电量 Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); - List 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 plans = planGenertionClient.getPlanGenerationByParam(param); // 获取月份集合 List monList = this.mons(0, 12, false); return monList.stream().map(o -> { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/DutyGroupGeneratingCapacityServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/DutyGroupGeneratingCapacityServiceImpl.java index b26df11..fa9d124 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/DutyGroupGeneratingCapacityServiceImpl.java +++ b/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.hnac.hzims.equipment.entity.PlanGenerationEntity; 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.ImsDutyGroupEntity; import com.hnac.hzims.operational.duty.mapper.DutyGroupGeneratingCapacityMapper; @@ -82,7 +83,10 @@ public class DutyGroupGeneratingCapacityServiceImpl extends ServiceImpl 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 planGenerationEntities = planGenertionClient.getPlanGenerationByParam(param); if (CollectionUtil.isNotEmpty(planGenerationEntities)) { planGenerationCount = planGenerationEntities.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); } @@ -90,7 +94,10 @@ public class DutyGroupGeneratingCapacityServiceImpl extends ServiceImpl stationList = stationService.getStationByUserAuth(user); if (CollectionUtil.isNotEmpty(stationList)) { List stationIdList = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); - List 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 planGenerationByDateAndStation = planGenertionClient.getPlanGenerationByParam(param); if (CollectionUtil.isNotEmpty(planGenerationByDateAndStation)) { planGenerationCount = planGenerationByDateAndStation.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java index 4de937d..5c6dbcf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java +++ b/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.hnac.hzims.equipment.entity.PlanGenerationEntity; 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.PlanPowerYearVo; 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.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; } @@ -217,7 +217,10 @@ public class HydroelectricServiceImpl implements HydroelectricService { return area; } // 站点计划发电量数据 - List 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 plans = planClient.getPlanGenerationByParam(param); // 机构名称 R dept = sysClient.getDept(deptId); @@ -310,7 +313,11 @@ public class HydroelectricServiceImpl implements HydroelectricService { return group; } - List 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 plans = planClient.getPlanGenerationByParam(param); // 机构名称 Optional dept = currents.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)); @@ -728,11 +735,13 @@ public class HydroelectricServiceImpl implements HydroelectricService { */ private List stationPowerRains(List devices, List> rains) { List generates = new ArrayList<>(); - devices.forEach(device->{ - if(CollectionUtil.isNotEmpty(device.getGenerates())){ - generates.addAll(device.getGenerates()); - } - }); + if(CollectionUtil.isNotEmpty(devices)){ + devices.forEach(device->{ + if(CollectionUtil.isNotEmpty(device.getGenerates())){ + generates.addAll(device.getGenerates()); + } + }); + } Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH,-1); Date end = calendar.getTime(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java index 09b1aa1..9174538 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java +++ b/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.feign.IEmParamClient; 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.operational.defect.constants.TreatMethodConstant; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; @@ -388,8 +389,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { } //表格总计 List deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList()); - List planYearAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); - List planMonAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, dateFormat); + DevicePlanGenerationVo param = new DevicePlanGenerationVo(); + param.setDeptIds(deptIdsString); + param.setDate(year.toString()); + List planYearAll = planGenertionClient.getPlanGenerationByParam(param); + param.setDate(dateFormat); + List planMonAll = planGenertionClient.getPlanGenerationByParam(param); getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map); //发电情况统计表数据 ArrayList> list = new ArrayList<>(powerPercentageVoList.size()); @@ -709,7 +714,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { private List getMonPowerPercentageVos(Integer year, Integer month, List deptList, List deptIds, List stationEntityList, List stationIds, Integer yearBefore, Integer monthBefore) { List deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList()); //年计划发电量 - List planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); + DevicePlanGenerationVo param = new DevicePlanGenerationVo(); + param.setDeptIds(deptIdsString); + param.setDate(year.toString()); + List planYearData = planGenertionClient.getPlanGenerationByParam(param); List powerPercentageVoList = new ArrayList<>(); //水电站,光伏站和带代运维数据近三年数据 Map> powerMapThree = (Map>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); @@ -1510,8 +1518,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { * @return */ private List getPlanPower(List stationList, String mon) { - List list = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); - return planGenertionClient.getPlanGenerationByParam(list, null, mon); + DevicePlanGenerationVo param = new DevicePlanGenerationVo(); + param.setStationIds(stationList.stream().map(StationEntity::getCode).collect(Collectors.toList())); + param.setDate(mon); + return planGenertionClient.getPlanGenerationByParam(param); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java index 3d4e2e6..271ce6f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java +++ b/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.hnac.hzims.equipment.entity.PlanGenerationEntity; 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.service.HomeService; 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()); } if(CollectionUtil.isNotEmpty(stations)){ - List 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 plans = planService.getPlanGenerationByParam(param); if(CollectionUtil.isNotEmpty(plans)){ double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); if(Math.abs(plan) > 0){ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index beebac5..9815c00 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/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.hnac.hzims.equipment.entity.PlanGenerationEntity; 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.hzimsweather.feign.IRainfallClient; import com.hnac.hzims.hzimsweather.response.weather.Daily; @@ -581,7 +582,10 @@ public class HydropowerServiceImpl implements HydropowerService { // 查询计划发电量 Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); - List 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 plans = planGenertionClient.getPlanGenerationByParam(param); // 获取月份集合 List monList = this.mons(0,12,false); return monList.stream().map(o->{ @@ -805,7 +809,10 @@ public class HydropowerServiceImpl implements HydropowerService { // 获取站点7日天气 Map weekWeather = this.weatherService.getWeekWeather(stations); // 计划发电量 - List 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 plans = planGenertionClient.getPlanGenerationByParam(param); // 实时监测点数据 List reals = (List) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); // 获取站点机组指标数据 @@ -1038,7 +1045,10 @@ public class HydropowerServiceImpl implements HydropowerService { List codes = new ArrayList<>(); areas.forEach((key,value)-> codes.addAll(value.stream().map(StationEntity::getCode).collect(Collectors.toList()))); // 计划发电量 - List 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 plans = planGenertionClient.getPlanGenerationByParam(param); List hydropowerAreas = areas.entrySet().stream().map(entry->{ HydropowerAreaVo area = new HydropowerAreaVo(); area.setDeptId(entry.getKey().getId()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java index 44673c8..f7bdf3f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java +++ b/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.IEmParamClient; 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.EminfoAndEmParamVo; import com.hnac.hzims.monitor.utils.DateUtils; @@ -416,7 +417,10 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer List eminfoAndEmParamVos = this.getEmInfoList(); //获取计划发电量 - List 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 planGenerationByDateAndStationList = planGenertionClient.getPlanGenerationByParam(param); LocalDateTime yearBeginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-01-01 00:00:00"), df); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java index aeb43c5..a18b42f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java +++ b/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.feign.IEmInfoClient; 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.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; @@ -458,7 +459,10 @@ public class SideHustleServiceImpl implements ISideHustleService { if(CollectionUtil.isEmpty(codeList)){ 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 stationCodeList = value.stream().map(StationEntity::getCode).collect(Collectors.toList()); String month = DateUtil.format(new Date(), "yyyy-MM"); // 获取站点的计划发电量 - List planList = planGenertionClient.getPlanGenerationByParam(stationCodeList, null, month); + DevicePlanGenerationVo param = new DevicePlanGenerationVo(); + param.setStationIds(stationCodeList); + param.setDate(month); + List planList = planGenertionClient.getPlanGenerationByParam(param); PowerFinishVo powerFinishVo = new PowerFinishVo(); powerFinishVo.setDepartId(key.getId()); powerFinishVo.setDepartName(key.getDeptName()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java index 11e4cfa..33218a0 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java +++ b/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.hnac.hzims.equipment.entity.PlanGenerationEntity; 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.hzimsweather.response.weather.Daily; 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()); // 年计划发电量 - List 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 yearPlans = planClient.getPlanGenerationByParam(param); score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); // 年发电完成率 if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){ @@ -198,7 +202,10 @@ public class WindHomeServiceImpl implements WindHomeService { */ private List currentGenerateCurve(List winds) { List mons = this.mons(0,12,false); - List 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 plans = planClient.getPlanGenerationByParam(param); return mons.stream().map(mon->{ PowerMonthVo power = new PowerMonthVo(); 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); } // 计划发电量查询 - List 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 plans = planClient.getPlanGenerationByParam(param); double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); // 发电完成率 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()); // 计划发电量 - List 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 plans = planClient.getPlanGenerationByParam(param); kpi.setPlan(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).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")); }}); // 计划发电量 - List 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 plans = planClient.getPlanGenerationByParam(param); return areas.entrySet().stream().map(entry -> { WindAreaVo area = new WindAreaVo(); area.setDeptId(entry.getKey().getId()); @@ -525,7 +541,10 @@ public class WindHomeServiceImpl implements WindHomeService { .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy-MM")); }}); // 计划发电量 - List 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 plans = planClient.getPlanGenerationByParam(param); if(CollectionUtil.isNotEmpty(windMons)){ 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")); }}); // 计划发电量 - List 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 plans = planClient.getPlanGenerationByParam(param); // 设备 List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference>() {}); subordinate.setStations(stations.stream().map(station -> { @@ -953,7 +975,10 @@ public class WindHomeServiceImpl implements WindHomeService { .eq(WindEntity::getStationCode,station.getCode()) ); // 计划发电量 - List 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 plans = planClient.getPlanGenerationByParam(param); if(CollectionUtil.isNotEmpty(all)){ // 年计划发电量 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 monList = this.mons(1,12,false); // 计划发电量查询 - List 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 plans = planClient.getPlanGenerationByParam(param); return monList.stream().map(mon->{ LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); WindGenerationVo generation = new WindGenerationVo(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index 02b3e28..a90e85c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/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.feign.IEmInfoClient; 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.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.service.IAnalyseDataService; @@ -230,7 +231,10 @@ public class RunMonthServiceImpl extends ServiceImpl 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 plans = planClient.getPlanGenerationByParam(param); RunMonthEntity run = new RunMonthEntity(); run.setTenantId(station.getTenantId()); run.setCreateDept(station.getRefDept()); diff --git a/pom.xml b/pom.xml index d36661b..f195bb6 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ 5.1.3.RELEASE.fix2 - 5.1.3.RELEASE.fix3 + 5.2.0.0.RELEASE UTF-8 1.8 UTF-8