Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
ty 4 months ago
parent
commit
f92cd2a48a
  1. 2
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java
  2. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceGenerateVo.java
  3. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDevicePowerVo.java
  4. 72
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceVo.java
  5. 28
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGenerateMonVo.java
  6. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricPowerRainVo.java
  7. 68
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricStationVo.java
  8. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/wind/vo/RainMon.java
  9. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java
  10. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/pv/PowerRainVo.java
  11. 13
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java
  12. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java
  13. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  14. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java
  15. 11
      hzims-service/hzims-alarm/src/main/resources/dict/dict.sql
  16. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java
  17. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java
  18. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  19. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  20. 12
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
  21. 30
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
  22. 8
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java
  23. 31
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java
  24. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  25. 15
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  26. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/StorageServiceImpl.java
  27. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/UseServiceImpl.java
  28. 35
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/controller/HydroelectricController.java
  29. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/HydroelectricService.java
  30. 316
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  31. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  32. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  33. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

2
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java

@ -69,4 +69,6 @@ public interface AlarmConstants {
String FDP_INVALID_STATUS = "1.0";
String FDP_INVALID_ZOME_STATUS = "1";
List<Integer> WHOLE_ALARM_TYPE = Arrays.asList(AlarmConstants.WARNING,AlarmConstants.FAULT,AlarmConstants.OFFSIDE,AlarmConstants.INTERRUPT,AlarmConstants.ABNORMAL,AlarmConstants.EARLY,AlarmConstants.START,AlarmConstants.STOP);
}

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceGenerateVo.java

@ -0,0 +1,26 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "站点首页-设备近30天发电量")
public class HydroelectricDeviceGenerateVo {
@ApiModelProperty(value = "日期")
private String date;
@ApiModelProperty(value = "发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float generate;
@ApiModelProperty(value = "功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float load;
}

22
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDevicePowerVo.java

@ -0,0 +1,22 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "站点首页-设备近24小时功率曲线")
public class HydroelectricDevicePowerVo {
@ApiModelProperty(value = "字符串时间")
private String strHour;
@ApiModelProperty(value = "小时")
private Integer hour;
@ApiModelProperty(value = "有功功率")
private String activePower;
}

72
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceVo.java

@ -0,0 +1,72 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.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 HydroelectricDeviceVo {
@ApiModelProperty(value = "设备编号")
private String deivceCode;
@ApiModelProperty(value = "设备名称")
private String deivceName;
@ApiModelProperty(value = "开关机状态: 0 - 关机 1 - 开机")
private Boolean state;
@ApiModelProperty(value = "总装机容量")
private Double installedCapacity;
@ApiModelProperty(value = "有功功率")
private Double activePower;
@ApiModelProperty(value = "容量利用率")
private Double capacityRate;
@ApiModelProperty(value = "无功功率")
private Double reactivePower;
@ApiModelProperty(value = "导叶开度")
private Double guideOpen;
@ApiModelProperty(value = "今日发电量")
private Float powerDay;
@ApiModelProperty(value = "昨日发电量")
private Float powerYesterDay;
@ApiModelProperty(value = "当年发电量")
private Float powerYear;
@ApiModelProperty(value = "去年发电量")
private Float powerYesterYear;
@ApiModelProperty(value = "当月发电量")
private Float powerMon;
@ApiModelProperty(value = "本次开机时间")
private String startDownTime;
@ApiModelProperty(value = "本次开机时长")
private Double startupDownDuration;
@ApiModelProperty(value = "年停机时长")
private Double shutDownDurationYear;
@ApiModelProperty(value = "年开机时长")
private Double startupDurationYear;
@ApiModelProperty(value = "设备近24小时有功功率")
private List<HydroelectricDevicePowerVo> powers;
@ApiModelProperty(value = "设备近30日发电量")
private List<HydroelectricDeviceGenerateVo> generates;
}

28
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGenerateMonVo.java

@ -0,0 +1,28 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "月发电对象")
public class HydroelectricGenerateMonVo {
@ApiModelProperty(value = "年份")
private Integer year;
@ApiModelProperty(value = "月份")
private Integer month;
@ApiModelProperty(value = "字符串格式月份")
private String strMonth;
@ApiModelProperty(value = "月发电量")
private Double power;
@ApiModelProperty(value = "计划发电量")
private Double planPower;
}

22
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricPowerRainVo.java

@ -0,0 +1,22 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "站点首页-最近30日发电量/降雨量")
public class HydroelectricPowerRainVo {
@ApiModelProperty(value = "日期")
private String date;
@ApiModelProperty(value = "发电量")
private Double generate;
@ApiModelProperty(value = "降雨")
private Double rain;
}

68
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricStationVo.java

@ -0,0 +1,68 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.vo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "水电站首页-站点")
public class HydroelectricStationVo {
@ApiModelProperty(value = "站点编号")
private String stationCode;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "总装机容量")
private Double installedCapacity;
@ApiModelProperty(value = "总发电负荷")
private Double powerSum;
@ApiModelProperty(value = "容量利用率")
private Double capacityRate;
@ApiModelProperty(value = "月计划发电量")
private Double powerMonPlan;
@ApiModelProperty(value = "月发电量")
private Double powerMon;
@ApiModelProperty(value = "月发电量完成率")
private Double powerRateMon;
@ApiModelProperty(value = "年计划发电量")
private Double powerYearPlan;
@ApiModelProperty(value = "年发电量")
private Double powerYear;
@ApiModelProperty(value = "年发电完成率")
private Double powerRateYear;
@ApiModelProperty(value = "今日发电量")
private Double powerDay;
@ApiModelProperty(value = "昨日发电量")
private Double powerYesterDay;
@ApiModelProperty(value = "七日内天气")
private List<Daily> weather;
@ApiModelProperty(value = "设备集合")
private List<HydroelectricDeviceVo> devices;
@ApiModelProperty(value = "降雨/发电量曲线")
private List<HydroelectricPowerRainVo> powerRains;
@ApiModelProperty(value = "降雨/发电量曲线")
private List<HydroelectricGenerateMonVo> generateMons;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/home/wind/RainMon.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/wind/vo/RainMon.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.home.wind;
package com.hnac.hzims.operational.homePage.wind.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java

@ -1,7 +1,7 @@
package com.hnac.hzims.operational.main.vo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.operational.main.vo.pv.PowerRainVo;
import com.hnac.hzims.operational.homePage.Hydroelectric.vo.HydroelectricPowerRainVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -80,7 +80,7 @@ public class HydropowerStationVo {
private List<Daily> weather;
@ApiModelProperty(value = "降雨/发电量曲线")
private List<PowerRainVo> powerRains;
private List<HydroelectricPowerRainVo> powerRains;
@ApiModelProperty(value = "前水位曲线数据")
private Map<Integer,String> frontCurveMap;

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/pv/PowerRainVo.java

@ -1,26 +0,0 @@
package com.hnac.hzims.operational.main.vo.pv;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "当日机组有功功率")
public class PowerRainVo {
@ApiModelProperty(value = "日期")
private String date;
@ApiModelProperty(value = "发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generate;
@ApiModelProperty(value = "降雨")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double rain;
}

13
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java

@ -13,7 +13,6 @@ import org.springblade.core.tenant.mp.TenantEntity;
import javax.validation.constraints.Size;
import java.util.List;
/**
* 巡检项目实体类
*
@ -28,20 +27,13 @@ public class ProjectEntity extends TenantEntity {
private static final long serialVersionUID = -1105554271550820235L;
/**
* 项目编码
*/
@ApiModelProperty(value = "项目编码")
private String code;
/**
* 项目名称
*/
@ApiModelProperty(value = "项目名称长度必须为1到128")
@Size(min=1,max = 128,message ="项目名称长度必须为1到128")
private String name;
/**
* 项目描述
*/
@ApiModelProperty(value = "项目描述长度必须为0到512")
@Size(min=0,max = 512,message ="项目描述长度必须为0到512")
private String description;
@ -62,5 +54,4 @@ public class ProjectEntity extends TenantEntity {
@ApiModelProperty("设备编号")
private String emCode;
}

9
hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java

@ -37,8 +37,10 @@ public class RealTimeDataServerImpl implements RealTimeDataServer {
@Override
public R<List<FieldsData>> getData(RealDataSearchPO po) {
List<FieldsData> data = null;
R<List<FieldsData>> res = analyseDataSearchClient.getRealDataByAnalyzeCode(po);
String msg = res.getMsg();
if ("操作成功".equals(msg)) {
List<FieldsData> data;
try {
data = analyseDataSearchClient.getRealDataByAnalyzeCode(po).getData();
} catch (Exception e) {
@ -47,7 +49,8 @@ public class RealTimeDataServerImpl implements RealTimeDataServer {
if (CollectionUtil.isNotEmpty(data)) {
return R.data(data);
}
return R.data(null);
}
return R.fail(msg);
}
@Override

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -245,7 +245,7 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
// 条件过滤
QueryWrapper<AlarmEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(AlarmEntity::getStationId,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
queryWrapper.lambda().in(AlarmEntity::getAlarmType, Arrays.asList(AlarmConstants.WARNING,AlarmConstants.FAULT,AlarmConstants.OFFSIDE,AlarmConstants.INTERRUPT,AlarmConstants.ABNORMAL,AlarmConstants.EARLY,AlarmConstants.START,AlarmConstants.STOP));
queryWrapper.lambda().in(AlarmEntity::getAlarmType, AlarmConstants.WHOLE_ALARM_TYPE);
queryWrapper.lambda().eq(AlarmEntity::getIsRightTabulation,0);
queryWrapper.lambda().ge(AlarmEntity::getAlarmTime, DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00");
queryWrapper.lambda().le(AlarmEntity::getAlarmTime,DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.alarm.source.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.alarm.ws.alart.AlarmSessionManager;
@ -70,6 +71,9 @@ public class MessageServiceImpl implements MessageService {
*/
@Override
public void webRightMessage(AlarmEntity alarm) {
if(!AlarmConstants.WHOLE_ALARM_TYPE.contains(alarm.getAlarmType())){
return;
}
if(CollectionUtil.isEmpty(AlarmSessionManager.SESSION_POOL)){
return;
}

11
hzims-service/hzims-alarm/src/main/resources/dict/dict.sql

@ -56,3 +56,14 @@ insert into `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_
insert into `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) values (1651150146049789954, 1651149948657455106, 'alarm_handle_type', '4', '检修', 4, '', 0, 0, 0, -1, 'hzims-alarm');
insert into `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) values (1651150182032723969, 1651149948657455106, 'alarm_handle_type', '5', '处理', 5, '', 0, 0, 0, -1, 'hzims-alarm');
insert into `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) values (1651150182032756242, 1651149948657455106, 'alarm_handle_type', '6', '处理完成', 5, '', 0, 0, 0, -1, 'hzims-alarm');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106981, 1658763247160922117, 'WHOLE_ALARM_TYPE', '2', '告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106982, 1658763247160922117, 'WHOLE_ALARM_TYPE', '3', '故障', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106983, 1658763247160922117, 'WHOLE_ALARM_TYPE', '5', '遥测越限', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106984, 1658763247160922117, 'WHOLE_ALARM_TYPE', '13', '通讯中断', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106985, 1658763247160922117, 'WHOLE_ALARM_TYPE', '14', '数据异常', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106986, 1658763247160922117, 'WHOLE_ALARM_TYPE', '60', '开机告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106987, 1658763247160922117, 'WHOLE_ALARM_TYPE', '61', '关机告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160106988, 1658763247160922117, 'WHOLE_ALARM_TYPE', '30', '智能预警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');

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

@ -24,8 +24,4 @@ public class ScheduledApplication {
BladeApplication.run("hzims-scheduled", ScheduledApplication.class, args);
}
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// return BladeApplication.createSpringApplicationBuilder(builder, "hzims-scheduled", ScheduledApplication.class);
// }
}

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java

@ -75,10 +75,9 @@ public class GenerationScheduledTask {
* @param param
* @return
*/
//@XxlJob(LOAD_THREE_YEAR_POWER_GENERATION)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadThreeYearPowerGeneration() {
String param = "";
@XxlJob(LOAD_THREE_YEAR_POWER_GENERATION)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadThreeYearPowerGeneration(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

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

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

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

@ -13,7 +13,7 @@ import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient;
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo;
import com.hnac.hzims.operational.fill.entity.RainfallEntity;
import com.hnac.hzims.operational.home.wind.RainMon;
import com.hnac.hzims.operational.homePage.wind.vo.RainMon;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.station.StationConstants;
@ -1488,7 +1488,7 @@ public class RealTargetServiceImpl implements RealTargetService {
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DAY_OF_MONTH,-1);
// 开始日期
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
String start = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH") + ":00:00";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>();

12
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java

@ -1,16 +1,16 @@
package com.hnac.hzinfo.inspect.obj.services;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectListQueryVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
import org.springblade.core.mp.support.Query;
@ -59,4 +59,12 @@ public interface ProjectService extends IService<ProjectEntity> {
List<Map<String,Object>> deptProjectTree(ProjectDTO project);
List<ProjectVO> projects(String emCode, ContentDTO content);
/**
* 查询列表
* @param project 参数
* @param query 分页类
* @return 巡检项目管理列表
*/
IPage<ProjectEntity> getList(ProjectListQueryVO project, Query query);
}

30
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzinfo.inspect.Constants;
import com.hnac.hzinfo.inspect.obj.ObjectConstants;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
@ -14,11 +13,13 @@ import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
import com.hnac.hzinfo.inspect.obj.entity.ContentEntity;
import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
import com.hnac.hzinfo.inspect.obj.mapper.ProjectContentMapper;
import com.hnac.hzinfo.inspect.obj.mapper.ProjectMapper;
import com.hnac.hzinfo.inspect.obj.services.ContentService;
import com.hnac.hzinfo.inspect.obj.services.ProjectContentService;
import com.hnac.hzinfo.inspect.obj.services.ProjectService;
import com.hnac.hzinfo.inspect.obj.utils.CodeUtils;
import com.hnac.hzinfo.inspect.obj.vo.ProjectListQueryVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
import com.hnac.hzinfo.inspect.obj.wrapper.ContentWrapper;
@ -29,7 +30,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.*;
import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service;
@ -49,8 +51,10 @@ import java.util.stream.Stream;
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity> implements ProjectService {
private final ContentService contentService;
private final ISysClient sysClient;
//private final ProjectContentService projectContentService;
private final ProjectContentMapper projectContentMapper;
@Override
public boolean save(ProjectEntity entity) {
@ -202,6 +206,26 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
}
/**
* 查询列表
*/
@Override
public IPage<ProjectEntity> getList(ProjectListQueryVO project, Query query) {
LambdaQueryWrapper<ProjectEntity> queryWrapper = Condition.getQueryWrapper(new ProjectEntity(), project);
queryWrapper.orderByDesc(ProjectEntity::getUpdateTime);
if (!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) {
queryWrapper.eq(ProjectEntity::getTenantId, AuthUtil.getTenantId());
}
IPage<ProjectEntity> pages = this.page(Condition.getPage(query), queryWrapper);
pages.getRecords().forEach(entity->{
QueryWrapper<ProjectContentEntity> qw = new QueryWrapper<>();
qw.lambda().eq(ProjectContentEntity::getProjectId, entity.getId());
Long contentNum = projectContentMapper.selectCount(qw);
entity.setContentNum(contentNum.intValue());
});
return pages;
}
/**
* 获取项目树中 机构下巡检项目的子集
* @param project 筛选条件
* @param deptId 机构ID

8
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java

@ -20,18 +20,13 @@ import java.util.List;
@Getter
@Setter
public class ProjectListQueryVO implements Serializable {
private static final long serialVersionUID = -953928646703619934L;
/**
* 项目编码
*/
@ApiModelProperty(value = "项目编码")
@QueryField(condition = SqlCondition.LIKE)
private String code;
/**
* 项目名称
*/
@ApiModelProperty(value = "项目名称")
@QueryField(condition = SqlCondition.LIKE)
private String name;
@ -54,5 +49,4 @@ public class ProjectListQueryVO implements Serializable {
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "创建机构")
private Long createDept;
}

31
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java

@ -23,11 +23,8 @@ import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept;
@ -61,24 +58,13 @@ public class ProjectController {
@Autowired
private ISysClient sysClient;
/**
* 巡检项目列表
*/
@GetMapping("/list")
@ApiOperation(value = "巡检项目列表", notes = "巡检项目列表")
@OperationAnnotation(moduleName = "巡检管理",title = "巡检配置",operatorType = OperatorType.MOBILE, businessType =
BusinessType.GENCODE,
action = "查询巡检项目管理列表")
public R<IPage<ProjectEntity>> list(ProjectListQueryVO project, Query query) {
LambdaQueryWrapper<ProjectEntity> queryWrapper = Condition.getQueryWrapper(new ProjectEntity(),project);
queryWrapper.orderByDesc(ProjectEntity::getUpdateTime);
IPage<ProjectEntity> pages = projectService.page(Condition.getPage(query), (!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.eq(ProjectEntity::getTenantId, AuthUtil.getTenantId()) : queryWrapper);
pages.getRecords().forEach(entity->{
QueryWrapper<ProjectContentEntity> qw = new QueryWrapper<>();
qw.lambda().eq(ProjectContentEntity::getProjectId, entity.getId());
Long contentNum = projectContentService.count(qw);
entity.setContentNum(contentNum.intValue());
});
IPage<ProjectEntity> pages = projectService.getList(project, query);
return R.data(pages);
}
@ -89,9 +75,6 @@ public class ProjectController {
return R.data(projectService.deptProjectTree(project));
}
/**
* 查询单条
*/
@ApiOperation(value = "查看详情", notes = "传入id")
@GetMapping("/detail")
public R<ProjectEntity> detail(Long id) {
@ -99,9 +82,6 @@ public class ProjectController {
return R.data(project);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperation(value = "新增或修改", notes = "传入巡检项目")
public R<Boolean> submit(@Valid @RequestBody ProjectEntity project) {
@ -111,9 +91,6 @@ public class ProjectController {
return R.status(projectService.saveOrUpdate(project));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "删除", notes = "传入id集合")
@ -137,9 +114,6 @@ public class ProjectController {
return R.success("删除成功!");
}
/**
* 启用/停用
*/
@GetMapping("/disableOrEnable")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "启用/停用", notes = "传入id,以及状态")
@ -155,9 +129,6 @@ public class ProjectController {
return R.status(projectService.update(ew));
}
/**
* 根据ids 批量复制
*/
@PostMapping("/insertCopyBatch")
@ApiOperation(value = "根据ids 数据库批量复制", notes = "传入id集合")
public R insertCopyBatch(@ApiParam(value = "主键集合 ,隔开", required = true)@RequestParam String ids,

6
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java

@ -143,12 +143,8 @@ public class TaskController extends BladeController {
*/
@GetMapping("/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task")
@Operate(label = "查询巡检任务分页列表-2",type = BusinessType.QUERY,ignore = false)
@Operate(label = "查询巡检任务分页列表-2",type = BusinessType.QUERY)
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) {
//CacheUtil.put("test#2","inspect","test","12");
// LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task);
// queryWrapper.orderByDesc(TaskEntity::getUpdateTime);
// IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper);
IPage<TaskVo> pages = Condition.getPage(query);
if (!AuthUtil.isAdministrator()) {
task.setCurUserId(AuthUtil.getUserId());

15
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -132,9 +132,13 @@
</select>
<select id="getListPage" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,u.USER_ID from HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID
where t.IS_DELETED=0 and u.IS_DELETED=0
SELECT
t.*, u.USER_ID
from
HZ_ST_EX_TASK t
left join HZ_ST_EX_TASK_USER u on t.ID = u.TASK_ID
where
t.IS_DELETED = 0 and u.IS_DELETED = 0
<if test="task.dutyId != null ">
and t.DUTY_ID = #{task.dutyId}
</if>
@ -174,14 +178,15 @@
<if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID, #{task.taskIds})
</if>
<if test="task.areaId != null">
and t.CREATE_DEPT = #{task.areaId}
<if test="task.createDept != null">
and t.CREATE_DEPT = #{task.createDept}
</if>
<if test="task.yearMonth != null">
and date_format(t.PLAN_START_TIME,'%Y-%m') = #{task.yearMonth}
</if>
order by t.UPDATE_TIME desc
</select>
<select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT
t.*, b.USER_ID as userIds,

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/StorageServiceImpl.java

@ -69,11 +69,12 @@ public class StorageServiceImpl extends ServiceImpl<StorageMapper, StorageEntity
StorageEntity history = this.getOne(new LambdaQueryWrapper<StorageEntity>(){{
eq(StorageEntity::getStationCode, entity.getStationCode());
eq(StorageEntity::getFillDate,entity.getFillDate());
ne(ObjectUtil.isNotEmpty(entity.getId()),StorageEntity::getId,entity.getId());
}});
if(ObjectUtil.isNotEmpty(history) && (ObjectUtil.isEmpty(entity.getId()) || !entity.getId().equals(history.getId()))){
if(ObjectUtil.isNotEmpty(history)){
throw new ServiceException("日期已经存在填报数据!");
}
if(ObjectUtil.isEmpty(history)){
if(ObjectUtil.isEmpty(history) && ObjectUtil.isEmpty(entity.getId())){
return this.save(entity);
}
return this.updateById(entity);

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

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.StorageEntity;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.mapper.UseMapper;
import com.hnac.hzims.operational.fill.service.UseService;
@ -97,11 +98,12 @@ public class UseServiceImpl extends ServiceImpl<UseMapper, UseEntity> implements
UseEntity history = this.getOne(new LambdaQueryWrapper<UseEntity>(){{
eq(UseEntity::getStationCode, entity.getStationCode());
eq(UseEntity::getFillDate,entity.getFillDate());
ne(ObjectUtil.isNotEmpty(entity.getId()), UseEntity::getId,entity.getId());
}});
if(ObjectUtil.isNotEmpty(history) && (ObjectUtil.isEmpty(entity.getId()) || !entity.getId().equals(history.getId()))){
if(ObjectUtil.isNotEmpty(history)){
throw new ServiceException("日期已经存在填报数据!");
}
if(ObjectUtil.isEmpty(history)){
if(ObjectUtil.isEmpty(history) && ObjectUtil.isEmpty(entity.getId())){
return this.save(entity);
}
return this.updateById(entity);

35
hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/controller/HydroelectricController.java

@ -0,0 +1,35 @@
package com.hnac.hzims.operational.homePage.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.homePage.Hydroelectric.vo.HydroelectricStationVo;
import com.hnac.hzims.operational.homePage.service.HydroelectricService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@RestController
@RequestMapping("/hydroelectric")
@Api(value = "水电站-首页", tags = "水电站-首页")
@AllArgsConstructor
public class HydroelectricController extends BladeController {
private final HydroelectricService hydroelectricService;
@ApiOperation("水电站站点指标")
@GetMapping("/station")
@ApiOperationSupport(order = 1)
public R<HydroelectricStationVo> station(@RequestParam("deptId") Long deptId) {
return R.data(hydroelectricService.station(deptId));
}
}

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

@ -0,0 +1,12 @@
package com.hnac.hzims.operational.homePage.service;
import com.hnac.hzims.operational.homePage.Hydroelectric.vo.HydroelectricStationVo;
/**
* 水电站-首页接口
* @author ysj
*/
public interface HydroelectricService {
HydroelectricStationVo station(Long deptId);
}

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

@ -0,0 +1,316 @@
package com.hnac.hzims.operational.homePage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.operational.homePage.Hydroelectric.vo.*;
import com.hnac.hzims.operational.homePage.service.HydroelectricService;
import com.hnac.hzims.operational.main.service.IWeatherService;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitTargetVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
/**
* 水电站-首页接口实现类
* @author ysj
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class HydroelectricServiceImpl implements HydroelectricService {
private final IStationService stationService;
private final IWeatherService weatherService;
private final IRainfallClient rainClient;
private final IPlanGenertionClient planClient;
private final RedisTemplate redisTemplate;
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data";
private final static String LOAD_HYDROPOWER_REAL_KEY = "hzims:operation:loadhydropowerunit:real:key";
private final static String LOAD_HYDROPOWER_TARGET_KEY = "hzims:operation:loadhydropowerunit:target:key";
private final static String DEVICE_CACHE_COFIG_FINAL = "hzims:equipment:emInfo:deviceCode.emInfoList";
/**
* 水电站首页-站点首页
* @param deptId
* @return
*/
@Override
public HydroelectricStationVo station(Long deptId) {
// 步骤1.查询站点
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery().eq(StationEntity::getRefDept,deptId));
if(ObjectUtil.isEmpty(station)){
return new HydroelectricStationVo();
}
// 步骤2.数据准备
// 设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(DEVICE_CACHE_COFIG_FINAL).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
// 实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_REAL_KEY);
// 指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_TARGET_KEY);
// 降雨数据
List<Map<String, Object>> rains = this.nearThirtyRains(station.getCode());
// 七日天气
Map<String, HeWeatherWeatherDailyResponse> weathers = this.weekWeather(Collections.singletonList(station.getCode()));
// 近3年发电量
Map<String, Map<String, Float>> map = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
// 计划发电量
List<PlanPowerYearVo> plans = planClient.getPlanPowerByYear(station.getCode(), Integer.parseInt(DateUtil.format(new Date(),"yyyy")));
// 步骤3.数据处理、赋值
HydroelectricStationVo result = new HydroelectricStationVo();
result.setStationCode(station.getCode());
result.setStationName(station.getName());
// 天气
if(MapUtils.isNotEmpty(weathers) && weathers.containsKey(station.getCode())){
HeWeatherWeatherDailyResponse week = weathers.get(station.getCode());
if(ObjectUtil.isNotEmpty(week) && CollectionUtil.isNotEmpty(week.getDaily())){
result.setWeather(week.getDaily());
}
}
// 设备
if(CollectionUtil.isNotEmpty(devices)){
result.setDevices(devices.stream().map(iter->{
HydroelectricDeviceVo device = new HydroelectricDeviceVo();
Optional<HydropowerUnitRealVo> real = reals.stream().filter(o-> iter.getEmCode().equals(o.getDeviceCode())).findFirst();
// 实时数据
if(real.isPresent()){
device.setState(real.get().getState());
device.setInstalledCapacity(real.get().getInstalledCapacity());
device.setActivePower(real.get().getActivePower());
device.setReactivePower(real.get().getReactivePower());
device.setGuideOpen(real.get().getGuideOpen());
if(device.getActivePower() > 0 && device.getReactivePower() > 0){
device.setCapacityRate(BigDecimal.valueOf(device.getActivePower() / device.getInstalledCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
device.setCapacityRate(0.0);
}
}
// 指标数据
Optional<HydropowerUnitTargetVo> target = targets.stream().filter(o-> iter.getEmCode().equals(o.getDeviceCode())).findFirst();
if(target.isPresent()){
device.setPowerDay(target.get().getPowerDay());
device.setPowerYesterDay(target.get().getPowerYesterDay());
device.setPowerYear(target.get().getPowerYear());
device.setPowerYesterYear(target.get().getPowerYesterYear());
device.setPowerMon(target.get().getPowerMon());
device.setStartDownTime(target.get().getStartDownTime());
device.setStartupDownDuration(target.get().getStartupDownDuration());
device.setStartupDurationYear(target.get().getStartupDurationYear());
device.setShutDownDurationYear(target.get().getShutDownDurationYear());
if(CollectionUtil.isNotEmpty(target.get().getActivePowerVoList())){
device.setPowers(target.get().getActivePowerVoList().stream().map(o-> BeanUtil.copy(o, HydroelectricDevicePowerVo.class)).collect(Collectors.toList()));
}
if(CollectionUtil.isNotEmpty(target.get().getActivePowerVoList())){
device.setGenerates(target.get().getGenerationPowerVoList().stream().map(o-> BeanUtil.copy(o, HydroelectricDeviceGenerateVo.class)).collect(Collectors.toList()));
}
}
return device;
}).collect(Collectors.toList()));
}
// 站点指标数据
if(CollectionUtil.isNotEmpty(result.getDevices())){
// 装机容量、发电负荷
result.setInstalledCapacity(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getInstalledCapacity).sum());
result.setPowerSum(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getActivePower).sum());
if(result.getInstalledCapacity() > 0 && result.getPowerSum() > 0 ){
result.setCapacityRate(BigDecimal.valueOf(result.getPowerSum() / result.getInstalledCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
result.setCapacityRate(0.0);
}
// 月计划发电量、月已发电量
if(CollectionUtil.isNotEmpty(plans)){
result.setPowerMonPlan(plans.stream().filter(plan -> plan.getMon().contains(DateUtil.format(new Date(),"yyyy-NM"))).mapToDouble(PlanPowerYearVo::getPlanPower).sum());
}else{
result.setPowerMonPlan(0.0);
}
result.setPowerMon(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerMon).sum());
// 年计划发电量、年已发电量
if(CollectionUtil.isNotEmpty(plans)){
result.setPowerYearPlan(plans.stream().mapToDouble(PlanPowerYearVo::getPlanPower).sum());
}else{
result.setPowerYearPlan(0.0);
}
result.setPowerYear(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerYear).sum());
// 今日发电量、昨日发电量
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())));
}
return result;
}
/**
* 站点近30天降雨数据
* @param station
* @return
*/
private List<Map<String, Object>> nearThirtyRains(String station) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
calendar.add(Calendar.DAY_OF_MONTH,-29);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
R<List<Map<String, Object>>> rains = rainClient.getDurationRainFall(station,start,end);
if(!rains.isSuccess() || CollectionUtil.isEmpty(rains.getData())){
return new ArrayList<>();
}
return rains.getData();
}
/**
* 站点七天天气
* @param stations
*/
private Map<String, HeWeatherWeatherDailyResponse> weekWeather(List stations) {
if(CollectionUtil.isEmpty(stations)){
return new HashMap<>();
}
// 实时天气
return weatherService.getWeekWeather(stations);
}
/**
* 站点近30天降雨量/发电量
* @param devices
* @return
*/
private List<HydroelectricPowerRainVo> stationPowerRains(List<HydroelectricDeviceVo> devices,List<Map<String, Object>> rains) {
List<HydroelectricDeviceGenerateVo> generates = new ArrayList<>();
devices.forEach(device->{
generates.addAll(device.getGenerates());
});
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
calendar.add(Calendar.DAY_OF_MONTH,-29);
Date start = calendar.getTime();
List<HydroelectricPowerRainVo> powerRains = new ArrayList<>();
while (start.compareTo(end) < 0) {
HydroelectricPowerRainVo powerRain = new HydroelectricPowerRainVo();
// 日期
powerRain.setDate(DateUtil.format(calendar.getTime(),"yyyy-MM-dd"));
// 发电量
powerRain.setGenerate(generates.stream().filter(o-> powerRain.getDate().equals(o.getDate())).mapToDouble(HydroelectricDeviceGenerateVo::getGenerate).sum());
// 降雨量
if(CollectionUtil.isNotEmpty(rains)){
powerRain.setRain(rains.stream().mapToDouble(map->{
if (map.get("fx_date").equals(powerRain.getDate())) {
Object object = map.get("precip");
if(ObjectUtil.isEmpty(object)){
return 0.0;
}else{
return Double.parseDouble(object.toString());
}
}
return 0.0;
}).sum());
}else{
powerRain.setRain(0.0);
}
powerRains.add(powerRain);
calendar.add(Calendar.DAY_OF_MONTH,1);
start = calendar.getTime();
}
return powerRains;
}
/**
* 站点电站月发电/计划发电
* @param plans
* @param map
* @return
*/
private List<HydroelectricGenerateMonVo> stationGenerateMons(List<PlanPowerYearVo> plans, Map<String, Float> map) {
// 获取月份集合
List<String> mons = this.mons(0,12,false);
return mons.stream().map(mon->{
Date date = DateUtil.parse(mon,DateUtil.PATTERN_DATE);
HydroelectricGenerateMonVo generateMon = new HydroelectricGenerateMonVo();
generateMon.setStrMonth(mon);
generateMon.setYear(date.getYear());
generateMon.setMonth(date.getMonth() + 1);
// 计划发电量
if(CollectionUtil.isNotEmpty(plans)){
generateMon.setPlanPower(plans.stream().filter(plan -> plan.getMon().contains(DateUtil.format(date,"yyyy-MM"))).mapToDouble(PlanPowerYearVo::getPlanPower).sum());
}else{
generateMon.setPlanPower(0.0);
}
// 实际发电
if(MapUtils.isNotEmpty(map)){
generateMon.setPower(map.entrySet().stream().filter(entry->entry.getKey().equals(mon)).mapToDouble(Map.Entry::getValue).sum());
}else{
generateMon.setPlanPower(0.0);
}
return generateMon;
}).collect(Collectors.toList());
}
/**
* 获取近年月份集合
* @param year
* @return
*/
public List<String> mons(int year, int endMoth, boolean nextMon) {
List<String> list = new ArrayList<>();
// 开始日期
Calendar endCal = Calendar.getInstance();
endCal.setTime(new Date());
endCal.add(Calendar.MONTH, -endCal.get(Calendar.MONTH) + endMoth);
endCal.add(Calendar.DATE, -endCal.get(Calendar.DATE) + 1);
// 结束日期
Calendar startCal = Calendar.getInstance();
startCal.setTime(new Date());
startCal.set(Calendar.YEAR, startCal.get(Calendar.YEAR) - year);
startCal.add(Calendar.MONTH, -startCal.get(Calendar.MONTH));
startCal.add(Calendar.DATE, -startCal.get(Calendar.DATE) + 1);
// 获取日期之间的月份
while (endCal.after(startCal)) {
list.add(DateUtil.format(startCal.getTime(),DateUtil.PATTERN_DATE));
startCal.add(Calendar.MONTH, 1);
}
if(nextMon){
list.add(DateUtil.format(endCal.getTime(),DateUtil.PATTERN_DATE));
}
return list;
}
}

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

@ -18,11 +18,11 @@ import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo;
import com.hnac.hzims.operational.homePage.Hydroelectric.vo.HydroelectricPowerRainVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.entity.UserDeptEntity;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.main.vo.pv.PowerRainVo;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.station.entity.StationEntity;
@ -193,7 +193,7 @@ public class HydropowerServiceImpl implements HydropowerService {
* @param rains
* @return
*/
private List<PowerRainVo> getPowerRains(StationEntity station,List<HydropowerUnitVo> devices, List<Map<String, Object>> rains) {
private List<HydroelectricPowerRainVo> getPowerRains(StationEntity station,List<HydropowerUnitVo> devices, List<Map<String, Object>> rains) {
List<GenerationPowerVo> powers = new ArrayList<>();
if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{
@ -205,7 +205,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 根据日期遍历
List<String> days = this.get30Day();
return days.stream().map(day->{
PowerRainVo powerRain = new PowerRainVo();
HydroelectricPowerRainVo powerRain = new HydroelectricPowerRainVo();
powerRain.setDate(day);
if(CollectionUtil.isEmpty(powers)){
powerRain.setGenerate(0.0);
@ -383,6 +383,7 @@ public class HydropowerServiceImpl implements HydropowerService {
private List<String> get30Day() {
List<String> times = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

@ -4,7 +4,7 @@ import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.operational.home.wind.RainMon;
import com.hnac.hzims.operational.homePage.wind.vo.RainMon;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -819,6 +819,9 @@ public class StationServiceImpl extends ServiceImpl<StationMapper, StationEntity
if (StringUtil.isNotBlank(entity.getName())) {
like(StationEntity::getName, "%".concat(entity.getName()).concat("%"));
}
if (ObjectUtil.isNotEmpty(entity.getServeType())) {
eq(StationEntity::getServeType, entity.getServeType());
}
if (ObjectUtil.isNotEmpty(entity.getType())) {
eq(StationEntity::getType, entity.getType());
}

Loading…
Cancel
Save