Browse Source

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

# Conflicts:
#	hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java
#	hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java
zhongwei
Jone 4 months ago
parent
commit
f75d5a9d7c
  1. 2
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java
  2. 2
      hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/SafeCheckStatisticVO.java
  3. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceGenerateVo.java
  4. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDevicePowerVo.java
  5. 72
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceVo.java
  6. 28
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGenerateMonVo.java
  7. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricPowerRainVo.java
  8. 68
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricStationVo.java
  9. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/wind/vo/RainMon.java
  10. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java
  11. 19
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java
  12. 19
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitTargetVo.java
  13. 13
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java
  14. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/feign/IInspectTaskClient.java
  15. 15
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  16. 23
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java
  17. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  18. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java
  19. 11
      hzims-service/hzims-alarm/src/main/resources/dict/dict.sql
  20. 34
      hzims-service/hzims-basic/pom.xml
  21. 8
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java
  22. 1
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java
  23. 6
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
  24. 33
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java
  25. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java
  26. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java
  27. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  28. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/ObtainGenerationService.java
  29. 73
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java
  30. 216
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  31. 12
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
  32. 30
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
  33. 8
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java
  34. 33
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java
  35. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  36. 1
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskClient.java
  37. 31
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  38. 26
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/utils/Condition.java
  39. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java
  40. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  41. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/StorageServiceImpl.java
  42. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/UseServiceImpl.java
  43. 35
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/controller/HydroelectricController.java
  44. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/HydroelectricService.java
  45. 316
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  46. 145
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  47. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  48. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  49. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafetyToolController.java
  50. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/feign/DangerSourceClient.java
  51. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml
  52. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ISafetyToolService.java
  53. 15
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java
  54. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/TicketApplication.java
  55. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/OperRepairMapper.xml
  56. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.xml
  57. 18
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.java
  58. 40
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.xml
  59. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketMeasureMapper.xml
  60. 11
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
  61. 13
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  62. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java
  63. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/OperateTicketClient.java
  64. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/TwoTicketMatterLibraryMapper.xml
  65. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketDelayMapper.xml
  66. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketFlowMapper.xml
  67. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.xml
  68. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketMembersChangeMapper.xml
  69. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketOperateTimeMapper.xml
  70. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketPrincipalChangeMapper.xml
  71. 0
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketSafetyMeasureMapper.xml
  72. BIN
      hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx

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_STATUS = "1.0";
String FDP_INVALID_ZOME_STATUS = "1"; 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);
} }

2
hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/SafeCheckStatisticVO.java

@ -13,7 +13,7 @@ import java.io.Serializable;
*/ */
@ApiModel(value = "安全检查项目统计对象",description = "安全检查项目统计对象") @ApiModel(value = "安全检查项目统计对象",description = "安全检查项目统计对象")
@Data @Data
public class SafeCheckStatisticVO implements Serializable { public class SafeCheckStatisticVO {
@ApiModelProperty(value = "项目类型") @ApiModelProperty(value = "项目类型")
private String projectType; private String projectType;

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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

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

@ -11,4 +11,6 @@ public interface ScheduledConstant {
String THIRTY_DAY_POWER_GENERATION = "thirtyDayPowerGeneration"; String THIRTY_DAY_POWER_GENERATION = "thirtyDayPowerGeneration";
String THIS_DAY_POWER_GENERATION = "thisDayPowerGeneration"; String THIS_DAY_POWER_GENERATION = "thisDayPowerGeneration";
String LOAD_THREE_YEAR_POWER_GENERATION = "loadThreeYearPowerGeneration";
} }

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

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.main.vo; package com.hnac.hzims.operational.main.vo;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.operational.homePage.Hydroelectric.vo.HydroelectricPowerRainVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -45,30 +46,42 @@ public class HydropowerStationVo {
@ApiModelProperty(value = "总发电负荷单位") @ApiModelProperty(value = "总发电负荷单位")
private String powerUnit; private String powerUnit;
@ApiModelProperty(value = "容量利用率")
private Double capacityRate;
@ApiModelProperty(value = "月计划发电量") @ApiModelProperty(value = "月计划发电量")
private Float planPowerMon; private Float planPowerMon;
@ApiModelProperty(value = "年计划发电量")
private Float planPowerYear;
@ApiModelProperty(value = "月发电量") @ApiModelProperty(value = "月发电量")
private Float powerMon; private Float powerMon;
@ApiModelProperty(value = "月发电量完成率") @ApiModelProperty(value = "月发电量完成率")
private Double powerRateMon; private Double powerRateMon;
@ApiModelProperty(value = "年计划发电量")
private Float planPowerYear;
@ApiModelProperty(value = "年发电量") @ApiModelProperty(value = "年发电量")
private Float powerYear; private Float powerYear;
@ApiModelProperty(value = "年发电完成率") @ApiModelProperty(value = "年发电完成率")
private Double powerRateYear; private Double powerRateYear;
@ApiModelProperty(value = "今日发电量")
private Float powerDay;
@ApiModelProperty(value = "昨日发电量")
private Float powerYesterDay;
@ApiModelProperty(value = "站点实时温度") @ApiModelProperty(value = "站点实时温度")
private String temp; private String temp;
@ApiModelProperty(value = "七日内天气") @ApiModelProperty(value = "七日内天气")
private List<Daily> weather; private List<Daily> weather;
@ApiModelProperty(value = "降雨/发电量曲线")
private List<HydroelectricPowerRainVo> powerRains;
@ApiModelProperty(value = "前水位曲线数据") @ApiModelProperty(value = "前水位曲线数据")
private Map<Integer,String> frontCurveMap; private Map<Integer,String> frontCurveMap;

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

@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author ysj * @author ysj
@ -29,12 +28,30 @@ public class HydropowerUnitTargetVo {
@ApiModelProperty(value = "当年发电量") @ApiModelProperty(value = "当年发电量")
private Float powerYear; private Float powerYear;
@ApiModelProperty(value = "当年发电量")
private Float powerYesterYear;
@ApiModelProperty(value = "当月发电量") @ApiModelProperty(value = "当月发电量")
private Float powerMon; private Float powerMon;
@ApiModelProperty(value = "当日发电量") @ApiModelProperty(value = "当日发电量")
private Float powerDay; private Float powerDay;
@ApiModelProperty(value = "昨日发电量")
private Float powerYesterDay;
@ApiModelProperty(value = "本次开机时间")
private String startDownTime;
@ApiModelProperty(value = "本次开机时长")
private Double startupDownDuration;
@ApiModelProperty(value = "年停机时长")
private Double shutDownDurationYear;
@ApiModelProperty(value = "年开机时长")
private Double startupDurationYear;
@ApiModelProperty(value = "当日机组有功功率") @ApiModelProperty(value = "当日机组有功功率")
private List<ActivePowerVo> activePowerVoList; private List<ActivePowerVo> activePowerVoList;

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

2
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/feign/IInspectTaskClient.java

@ -42,7 +42,7 @@ public interface IInspectTaskClient {
* @param inspectType 查询类型 1为运行人员 2管理及其他人员 * @param inspectType 查询类型 1为运行人员 2管理及其他人员
* @return * @return
*/ */
@GetMapping(EXPIRE_INSPECT) @GetMapping(GET_INSPECT_TASK_CHECK)
R<SafeCheckStatisticVO> getInspectTaskCheck(@RequestParam("startDate") String startDate, R<SafeCheckStatisticVO> getInspectTaskCheck(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate, @RequestParam("endDate") String endDate,
@RequestParam("dept") Long dept, @RequestParam("dept") Long dept,

15
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java

@ -1,6 +1,5 @@
package com.hnac.hzims.spare.service.impl; package com.hnac.hzims.spare.service.impl;
import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
@ -33,7 +32,6 @@ import com.hnac.hzims.spare.utils.SheetWriteStyleHandler;
import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient; import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -171,7 +169,6 @@ public class WtSpBasicServiceImpl extends ServiceImpl<WtSpBasicMapper, WtSpBasic
List<WtSpBasicVO> voList = new ArrayList<>(); List<WtSpBasicVO> voList = new ArrayList<>();
IPage<WtSpBasicVO> voPages = new Page<>(); IPage<WtSpBasicVO> voPages = new Page<>();
if (Func.isNotEmpty(spBasicEntity.getName()) && "工具".equals(spBasicEntity.getName())) { if (Func.isNotEmpty(spBasicEntity.getName()) && "工具".equals(spBasicEntity.getName())) {
// if(Func.isNotEmpty(spBasicEntity.getName())){
List<WtSpManagementEntity> list = managementService.list(Wrappers.<WtSpManagementEntity>query().lambda(). List<WtSpManagementEntity> list = managementService.list(Wrappers.<WtSpManagementEntity>query().lambda().
eq(WtSpManagementEntity::getName, spBasicEntity.getName())); eq(WtSpManagementEntity::getName, spBasicEntity.getName()));
if (list.size() == 0) { if (list.size() == 0) {
@ -218,13 +215,6 @@ public class WtSpBasicServiceImpl extends ServiceImpl<WtSpBasicMapper, WtSpBasic
basicVO.setStock(0L); basicVO.setStock(0L);
} }
BeanUtils.copyProperties(basicEntity, basicVO); BeanUtils.copyProperties(basicEntity, basicVO);
List<TicketInfoStatisticVO> ticketVOS = ticketInfoAllClient.getTicketStatistic("2022-02");
// R<Dept> deptR = sysClient.getDept(basicEntity.getWaterPlantId());
// if(Func.isNotEmpty(deptR.getData())){
// basicVO.setWaterPlantName(deptR.getData().getDeptName());
// }
voList.add(basicVO); voList.add(basicVO);
} else { } else {
WtSpBasicVO basicVO = new WtSpBasicVO(); WtSpBasicVO basicVO = new WtSpBasicVO();
@ -240,16 +230,11 @@ public class WtSpBasicServiceImpl extends ServiceImpl<WtSpBasicMapper, WtSpBasic
if (null != totalEntity) { if (null != totalEntity) {
List<WtSpTotalEntity> totalList = totalService.list(Wrappers.<WtSpTotalEntity>query().lambda().eq(WtSpTotalEntity::getSpBasicId, basicEntity.getId())); List<WtSpTotalEntity> totalList = totalService.list(Wrappers.<WtSpTotalEntity>query().lambda().eq(WtSpTotalEntity::getSpBasicId, basicEntity.getId()));
if (totalList.size() > 0) { if (totalList.size() > 0) {
// basicVO.setStock(totalList.get(0).getStock());
basicVO.setStock(totalEntity.getStock()); basicVO.setStock(totalEntity.getStock());
} else { } else {
basicVO.setStock(0L); basicVO.setStock(0L);
} }
BeanUtils.copyProperties(basicEntity, basicVO); BeanUtils.copyProperties(basicEntity, basicVO);
// R<Dept> deptR = sysClient.getDept(basicEntity.getWaterPlantId());
// if(Func.isNotEmpty(deptR.getData())){
// basicVO.setWaterPlantName(deptR.getData().getDeptName());
// }
voList.add(basicVO); voList.add(basicVO);
} }
List<WtSpTotalEntity> totalEntities = totalMapper.selectByWarehouseId(warehouseId); List<WtSpTotalEntity> totalEntities = totalMapper.selectByWarehouseId(warehouseId);

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

@ -37,17 +37,20 @@ public class RealTimeDataServerImpl implements RealTimeDataServer {
@Override @Override
public R<List<FieldsData>> getData(RealDataSearchPO po) { public R<List<FieldsData>> getData(RealDataSearchPO po) {
R<List<FieldsData>> res = analyseDataSearchClient.getRealDataByAnalyzeCode(po);
List<FieldsData> data = null; String msg = res.getMsg();
try { if ("操作成功".equals(msg)) {
data = analyseDataSearchClient.getRealDataByAnalyzeCode(po).getData(); List<FieldsData> data;
} catch (Exception e) { try {
throw new RuntimeException(e.getMessage()); data = analyseDataSearchClient.getRealDataByAnalyzeCode(po).getData();
} } catch (Exception e) {
if(CollectionUtil.isNotEmpty(data)){ throw new RuntimeException(e.getMessage());
return R.data(data); }
if (CollectionUtil.isNotEmpty(data)) {
return R.data(data);
}
} }
return R.data(null); return R.fail(msg);
} }
@Override @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<AlarmEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(AlarmEntity::getStationId,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); 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().eq(AlarmEntity::getIsRightTabulation,0);
queryWrapper.lambda().ge(AlarmEntity::getAlarmTime, DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"); 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)); 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.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; 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.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.alarm.ws.alart.AlarmSessionManager; import com.hnac.hzims.alarm.ws.alart.AlarmSessionManager;
@ -70,6 +71,9 @@ public class MessageServiceImpl implements MessageService {
*/ */
@Override @Override
public void webRightMessage(AlarmEntity alarm) { public void webRightMessage(AlarmEntity alarm) {
if(!AlarmConstants.WHOLE_ALARM_TYPE.contains(alarm.getAlarmType())){
return;
}
if(CollectionUtil.isEmpty(AlarmSessionManager.SESSION_POOL)){ if(CollectionUtil.isEmpty(AlarmSessionManager.SESSION_POOL)){
return; 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 (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 (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 (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');

34
hzims-service/hzims-basic/pom.xml

@ -49,6 +49,40 @@
<artifactId>hzims-operational-api</artifactId> <artifactId>hzims-operational-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
<version>3.3.2</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions> <exclusions>

8
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java

@ -97,7 +97,7 @@ public class PresonManagementController extends BladeController {
@OperationAnnotation(moduleName = "档案管理",title = "档案管理",operatorType = OperatorType.MOBILE,businessType = @OperationAnnotation(moduleName = "档案管理",title = "档案管理",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE,action BusinessType.GENCODE,action
= "档案管理") = "档案管理")
public void exportPersonManagemetVo(HttpServletResponse response,PersonManagemetVo personManagemetVo) { public void exportPersonManagemetVo(HttpServletResponse response,PersonManagemetVo personManagemetVo) throws IOException {
try { try {
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
@ -106,11 +106,14 @@ public class PresonManagementController extends BladeController {
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
List<PersonManagemetExportVo> list=iImsPresonManagementService.exportPersonManagemet(personManagemetVo); List<PersonManagemetExportVo> list=iImsPresonManagementService.exportPersonManagemet(personManagemetVo);
if(list!=null && list.size()>0){ if(list!=null && list.size()>0){
System.out.println("---------------- size = " + list.size());
// 这里需要设置不关闭流 // 这里需要设置不关闭流
EasyExcel.write(response.getOutputStream(), PersonManagemetExportVo.class).autoCloseStream(Boolean.FALSE).sheet("档案管理报表") EasyExcel.write(response.getOutputStream(), PersonManagemetExportVo.class).autoCloseStream(Boolean.FALSE).sheet("档案管理报表")
.doWrite(list); .doWrite(list);
} }
response.getOutputStream().close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
// 重置response // 重置response
response.reset(); response.reset();
response.setContentType("application/json"); response.setContentType("application/json");
@ -120,9 +123,12 @@ public class PresonManagementController extends BladeController {
map.put("msg", "档案管理报表导出失败" + e.getMessage()); map.put("msg", "档案管理报表导出失败" + e.getMessage());
try { try {
response.getWriter().println(JSONUtil.toJsonStr(map)); response.getWriter().println(JSONUtil.toJsonStr(map));
response.getOutputStream().close();
} catch (IOException e3) { } catch (IOException e3) {
response.getOutputStream().close();
throw new ServiceException( "发生异常 :" + e); throw new ServiceException( "发生异常 :" + e);
} }
} }
} }

1
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java

@ -38,6 +38,7 @@ public interface PersonManagemetMapper extends UserDataScopeBaseMapper<PersonMan
@Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "depetIds")List<Long> depetIds, @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "depetIds")List<Long> depetIds,
@Param(value = "current")Integer current, @Param(value = "size")Integer size) ; @Param(value = "current")Integer current, @Param(value = "size")Integer size) ;
@UserDataAuth
List<PersonManagemetExportVo> exportPersonManagemet( List<PersonManagemetExportVo> exportPersonManagemet(
@Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime,
@Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job,

6
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java

@ -15,12 +15,6 @@ import org.springframework.context.annotation.ComponentScan;
@MapperScan(basePackages = {"com.hnac.hzinfo.**.mapper","com.hnac.hzims.**.mapper"}) @MapperScan(basePackages = {"com.hnac.hzinfo.**.mapper","com.hnac.hzims.**.mapper"})
@EnableFeignClients(basePackages = {"org.springblade", "com.hnac"}) @EnableFeignClients(basePackages = {"org.springblade", "com.hnac"})
public class MiddleApplication { public class MiddleApplication {
// static {
// System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042");
// System.setProperty("spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042");
// System.setProperty("spring.cloud.nacos.username", "nacos");
// System.setProperty("spring.cloud.nacos.password", "nacos");
// }
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run("hzims-middle", MiddleApplication.class, args); BladeApplication.run("hzims-middle", MiddleApplication.class, args);

33
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java

@ -45,22 +45,27 @@ public abstract class ProcessAbstractService implements ProcessService {
@Override @Override
public R startFlow(String userId, String dictValue, String taskId, String processName, Map<String, Object> variables) { public R startFlow(String userId, String dictValue, String taskId, String processName, Map<String, Object> variables) {
log.info("开启流程....."); log.info("开启流程.....");
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, taskId, processName, variables);
R r = new R(); R r = new R();
r.setCode(result.getCode()); try {
r.setMsg(result.getMsg()); R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, taskId, processName, variables);
// 更新任务流程Id r.setCode(result.getCode());
if (result.isSuccess()) { r.setMsg(result.getMsg());
log.info("开启流程成功:{}",variables); // 更新任务流程Id
BladeFlow flow = result.getData(); if (result.isSuccess()) {
r.setData(flow.getProcessInstanceId()); log.info("开启流程成功:{}",variables);
} else { BladeFlow flow = result.getData();
log.error("开启流程失败:{}",result); r.setData(flow.getProcessInstanceId());
log.error("流程信息为{}",variables); } else {
r.setData(variables); log.error("开启流程失败:{}",result);
pushStartFailMessage(dictValue,Long.valueOf(taskId),userId,processName,result.getMsg()); log.error("流程信息为{}",variables);
r.setData(variables);
pushStartFailMessage(dictValue,Long.valueOf(taskId),userId,processName,result.getMsg());
}
return r;
}catch (Exception e){
log.error(e.toString()) ;
} }
return r; return R.fail("开启流程失败");
} }
// public R compensateFlow(String userId,String dictValue,String taskId,String processName,Map<String, Object> variables) { // public R compensateFlow(String userId,String dictValue,String taskId,String processName,Map<String, Object> variables) {
// R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, taskId, processName, variables); // R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, taskId, processName, variables);

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); BladeApplication.run("hzims-scheduled", ScheduledApplication.class, args);
} }
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// return BladeApplication.createSpringApplicationBuilder(builder, "hzims-scheduled", ScheduledApplication.class);
// }
} }

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

@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
@ -69,4 +70,19 @@ public class GenerationScheduledTask {
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
/**
* 新版-近3年发电量
* @param param
* @return
*/
@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");
}
service.loadThreeYearPowerGeneration(param,Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3);
return new ReturnT<>("SUCCESS");
}
} }

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

@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;

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

@ -1,5 +1,7 @@
package com.hnac.hzims.scheduled.service.operation.home; package com.hnac.hzims.scheduled.service.operation.home;
import java.util.List;
/** /**
* @author ysj * @author ysj
*/ */
@ -10,4 +12,6 @@ public interface ObtainGenerationService {
void thirtyDayPowerGeneration(String param); void thirtyDayPowerGeneration(String param);
void thisDayPowerGeneration(String param); void thisDayPowerGeneration(String param);
void loadThreeYearPowerGeneration(String param, List<Integer> types, Integer serveType,int year);
} }

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

@ -2,6 +2,7 @@ package com.hnac.hzims.scheduled.service.operation.home.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity; import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity;
@ -59,8 +60,11 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
@Value("${hzims.equipment.emInfo.emInfoList}") @Value("${hzims.equipment.emInfo.emInfoList}")
public String device_cache_cofig_final; public String device_cache_cofig_final;
private final static String recent_year_power_data = "hzims:operation:key:power:data";
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("obtain-generation-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("obtain-generation-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
/** /**
* 设备近3年发电量数据 : 按月分割 * 设备近3年发电量数据 : 按月分割
* @param param * @param param
@ -131,8 +135,8 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
CountDownLatch countDownLatch = new CountDownLatch(limits.size()); CountDownLatch countDownLatch = new CountDownLatch(limits.size());
List<ThirtyGenerationEntity> saves = new CopyOnWriteArrayList<>(); List<ThirtyGenerationEntity> saves = new CopyOnWriteArrayList<>();
for(List<StationEntity> item : limits){ for(List<StationEntity> item : limits){
try{ pool.submit(()->{
pool.submit(()->{ try{
item.forEach(station->{ item.forEach(station->{
// 站点设备集合 // 站点设备集合
List<EminfoAndEmParamVo> eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); List<EminfoAndEmParamVo> eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
@ -175,10 +179,11 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
}); });
countDownLatch.countDown(); countDownLatch.countDown();
log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
}); }catch (Exception e){
}catch (Exception e){ countDownLatch.countDown();
log.error("save_generation_execute_complete_error : {}" ,e.getMessage()); log.error("save_generation_execute_complete_error : {}" ,e.getMessage());
} }
});
} }
// 等待所有线程执行完成 // 等待所有线程执行完成
try { try {
@ -216,9 +221,7 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3); calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3);
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
stations.forEach(station->{ stations.forEach(station-> this.threeGenerateService.saveBatch(this.saveFillGenerate(station,start,end)));
this.threeGenerateService.saveBatch(this.saveFillGenerate(station,start,end));
});
} }
/** /**
@ -306,6 +309,7 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
}); });
}catch (Exception e){ }catch (Exception e){
countDownLatch.countDown();
log.error("save_generation_execute_complete_error : {}" ,e.getMessage()); log.error("save_generation_execute_complete_error : {}" ,e.getMessage());
} }
} }
@ -378,6 +382,7 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
}); });
}catch (Exception e){ }catch (Exception e){
countDownLatch.countDown();
log.error("save_generation_execute_complete_error : {}" ,e.getMessage()); log.error("save_generation_execute_complete_error : {}" ,e.getMessage());
} }
} }
@ -437,4 +442,54 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
private static Integer countStep(Integer size) { private static Integer countStep(Integer size) {
return (size + 3 - 1) / 3; return (size + 3 - 1) / 3;
} }
/**
* 新版-近3年发电量
* @param param
*/
@Override
public void loadThreeYearPowerGeneration(String param, List<Integer> types, Integer serveType,int year) {
// 站点查询
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>() {{
if (CollectionUtil.isNotEmpty(types)) {
in(StationEntity::getType, types);
}
}});
// 开始时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12);
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
// 结束日期
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - year);
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
List<ThreeGenerationEntity> generations = threeGenerateService.list(Wrappers.<ThreeGenerationEntity>lambdaQuery()
.in(ThreeGenerationEntity::getStationId,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))
.ge(ThreeGenerationEntity::getStrMonth,start)
.le(ThreeGenerationEntity::getStrMonth,end)
);
if(CollectionUtil.isEmpty(generations)){
return;
}
Map<String,List<ThreeGenerationEntity>> map = generations.stream().collect(Collectors.groupingBy(ThreeGenerationEntity::getStationId));
// 定义接收参数
Map<String, Map<String, Float>> container = new HashMap<>();
map.forEach((key, value) -> {
Optional<StationEntity> optional = stations.stream().filter(o -> o.getCode().equals(key)).findFirst();
if (!optional.isPresent()) {
return;
}
// 根据月份分组
Map<String, List<ThreeGenerationEntity>> months = value.stream().collect(Collectors.groupingBy(ThreeGenerationEntity::getStrMonth));
// 接收月份发电量对象
Map<String, Float> son = new HashMap<>();
// 遍历月份数据
months.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(iter -> son.put(iter.getKey(), (float) iter.getValue().stream().mapToDouble(o -> o.getGenerate().doubleValue()).sum()));
container.put(optional.get().getCode(), son);
});
redisTemplate.opsForValue().set(recent_year_power_data, container);
}
} }

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

@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.EmParamEntity; import com.hnac.hzims.equipment.entity.EmParamEntity;
import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity;
import com.hnac.hzims.equipment.entity.ThreeGenerationEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient; import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient;
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo;
import com.hnac.hzims.operational.fill.entity.RainfallEntity; 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.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.station.StationConstants; import com.hnac.hzims.operational.station.StationConstants;
@ -19,6 +21,8 @@ import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.equipment.DeviceParamService; import com.hnac.hzims.scheduled.service.equipment.DeviceParamService;
import com.hnac.hzims.scheduled.service.equipment.DeviceService; import com.hnac.hzims.scheduled.service.equipment.DeviceService;
import com.hnac.hzims.scheduled.service.equipment.ThirtyGenerateService;
import com.hnac.hzims.scheduled.service.equipment.ThreeGenerateService;
import com.hnac.hzims.scheduled.service.operation.fill.*; import com.hnac.hzims.scheduled.service.operation.fill.*;
import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; import com.hnac.hzims.scheduled.service.operation.home.ModelStationService;
import com.hnac.hzims.scheduled.service.operation.home.RealTargetService; import com.hnac.hzims.scheduled.service.operation.home.RealTargetService;
@ -92,6 +96,10 @@ public class RealTargetServiceImpl implements RealTargetService {
private final ModelStationService modelStationService; private final ModelStationService modelStationService;
private final ThreeGenerateService threeGenerateService;
private final ThirtyGenerateService thirtyGenerateService;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final IHeWeatherWeatherClient heWeatherWeatherClient; private final IHeWeatherWeatherClient heWeatherWeatherClient;
@ -102,6 +110,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private final DeviceDataClient deviceDataClient; private final DeviceDataClient deviceDataClient;
@Value("${hzims.equipment.emInfo.emInfoList}") @Value("${hzims.equipment.emInfo.emInfoList}")
public String device_cache_cofig_final; public String device_cache_cofig_final;
@ -272,10 +281,17 @@ public class RealTargetServiceImpl implements RealTargetService {
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return; return;
} }
// 设备30日发电量
List<ThirtyGenerationEntity> generations = this.thirtyGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 设备当年发电量
List<ThreeGenerationEntity> generationYears = this.threeGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 设备去年发电量
List<ThreeGenerationEntity> generationYesterYears = this.threeYesterGenerations(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 补充填补发电指标 // 补充填补发电指标
List<HydropowerUnitTargetVo> targets = this.generteFill(stations); List<HydropowerUnitTargetVo> targets = this.generteFill(stations);
// 水电站设备 // 水电站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
Random random = new Random();
if(CollectionUtil.isNotEmpty(devices)){ if(CollectionUtil.isNotEmpty(devices)){
CountDownLatch countDownLatch = new CountDownLatch(devices.size()); CountDownLatch countDownLatch = new CountDownLatch(devices.size());
for(EminfoAndEmParamVo device : devices) { for(EminfoAndEmParamVo device : devices) {
@ -283,19 +299,34 @@ public class RealTargetServiceImpl implements RealTargetService {
try{ try{
HydropowerUnitTargetVo target = new HydropowerUnitTargetVo(); HydropowerUnitTargetVo target = new HydropowerUnitTargetVo();
target.setDeptId(device.getCreateDept()); target.setDeptId(device.getCreateDept());
Optional<StationEntity> station = stations.stream().filter(o->o.getRefDept().equals(device.getCreateDept())).findFirst();
station.ifPresent(stationEntity -> target.setDeptName(stationEntity.getName()));
target.setDeviceCode(device.getEmCode()); target.setDeviceCode(device.getEmCode());
target.setDeviceName(device.getName()); target.setDeviceName(device.getName());
target.setDeptName(device.getName());
// 当年发电量 // 当年发电量
target.setPowerYear(this.getGenerationPower(device, 0)); target.setPowerYear(this.devicePowerYear(generationYears,device));
// 去年发电量
target.setPowerYesterYear(this.devicePowerYesterYear(generationYesterYears,device));
// 当月发电量 // 当月发电量
target.setPowerMon(this.getGenerationPower(device, 1)); target.setPowerMon(this.devicePowerMon(generationYears,device));
// 当日发电量 // 当日发电量
target.setPowerDay(this.getGenerationPower(device, 2)); target.setPowerDay(this.devicePowerDay(generations,device));
// 当天有功功率 // 昨日发电量
target.setPowerYesterDay(this.devicePowerYesterDay(generations,device));
// 近24小时有功功率
target.setActivePowerVoList(this.getLoadsByDay(device)); target.setActivePowerVoList(this.getLoadsByDay(device));
// 30天发电量 // 30天发电量
target.setGenerationPowerVoList(this.getGenerationPowerList(device)); target.setGenerationPowerVoList(this.getGenerationPowerList(generations,device));
// FIXME 本次开机/停机时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE,random.nextInt(1440));
target.setStartDownTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
// FIXME 本次开/停机时长
target.setStartupDownDuration(random.nextDouble() * 24);
// FIXME 今年开机时长
target.setStartupDurationYear(random.nextDouble() * 5024);
// FIXME 今年停机时长
target.setShutDownDurationYear(5024 - target.getStartupDurationYear());
targets.add(target); targets.add(target);
countDownLatch.countDown(); countDownLatch.countDown();
}catch (Exception exception){ }catch (Exception exception){
@ -314,9 +345,79 @@ public class RealTargetServiceImpl implements RealTargetService {
if(CollectionUtil.isEmpty(targets)){ if(CollectionUtil.isEmpty(targets)){
return; return;
} }
redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets); redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets);
} }
/**
* 去年发电量
* @param generations
* @param device
* @return
*/
private Float devicePowerYesterYear(List<ThreeGenerationEntity> generations, EminfoAndEmParamVo device) {
if(CollectionUtil.isEmpty(generations)){
return 0f;
}
return (float) generations.stream().filter(o -> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode())).mapToDouble(o->o.getGenerate().doubleValue()).sum();
}
/**
* 当年发电量
* @param generations
* @param device
* @return
*/
private Float devicePowerYear(List<ThreeGenerationEntity> generations, EminfoAndEmParamVo device) {
if(CollectionUtil.isEmpty(generations)){
return 0f;
}
return (float) generations.stream().filter(o -> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode())).mapToDouble(o->o.getGenerate().doubleValue()).sum();
}
/**
* 当月发电量
* @param generations
* @param device
* @return
*/
private Float devicePowerMon(List<ThreeGenerationEntity> generations, EminfoAndEmParamVo device) {
if(CollectionUtil.isEmpty(generations)){
return 0f;
}
return (float) generations.stream().filter(o-> StringUtil.isNotBlank(o.getDeviceCode()) && o.getDeviceCode().equals(device.getEmCode()) && o.getStrMonth().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(o->o.getGenerate().doubleValue()).sum();
}
/**
* 设备当日发电量
* @param generations
* @param device
* @return
*/
private Float devicePowerDay(List<ThirtyGenerationEntity> generations, EminfoAndEmParamVo device) {
if(CollectionUtil.isEmpty(generations)){
return 0f;
}
return (float) generations.stream().filter(o->o.getDeviceCode().equals(device.getEmCode()) && o.getStrDay().contains(DateUtil.format(new Date(),DateUtil.PATTERN_DATE))).mapToDouble(o->o.getGenerate().doubleValue()).sum();
}
/**
* 设备昨日发电量
* @param generations
* @param device
* @return
*/
private Float devicePowerYesterDay(List<ThirtyGenerationEntity> generations, EminfoAndEmParamVo device) {
if(CollectionUtil.isEmpty(generations)){
return 0f;
}
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
return (float) generations.stream().filter(o->o.getDeviceCode().equals(device.getEmCode()) && o.getStrDay().contains(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE))).mapToDouble(o->o.getGenerate().doubleValue()).sum();
}
/** /**
* 水利-泵组实时加载 * 水利-泵组实时加载
* @param param * @param param
@ -1382,17 +1483,19 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return * @return
*/ */
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
// 开始日期 Calendar calendar = Calendar.getInstance();
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 结束日期 // 结束日期
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59"; String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DAY_OF_MONTH,-1);
// 开始日期
String start = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH") + ":00:00";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
return records.stream().map(record -> { return records.stream().map(record -> {
ActivePowerVo load = new ActivePowerVo(); ActivePowerVo load = new ActivePowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss");
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH"));
load.setHour(time.getHours()); load.setHour(time.getHours());
if(StringUtil.isNotBlank(record.getVal())){ if(StringUtil.isNotBlank(record.getVal())){
@ -1469,10 +1572,14 @@ public class RealTargetServiceImpl implements RealTargetService {
target.setDeptName(station.getName()); target.setDeptName(station.getName());
// 当年发电量 // 当年发电量
target.setPowerYear(generateService.generate(year,station.getCode())); target.setPowerYear(generateService.generate(year,station.getCode()));
// FIXME 去年发电量
target.setPowerYesterYear(0f);
// 当月发电量 // 当月发电量
target.setPowerMon(generateService.generate(mon,station.getCode())); target.setPowerMon(generateService.generate(mon,station.getCode()));
// 当日发电量 // 当日发电量
target.setPowerDay(generateService.generate(day,station.getCode())); target.setPowerDay(generateService.generate(day,station.getCode()));
// FIXME 昨日发电量
target.setPowerYesterDay(0f);
// 30天发电量 // 30天发电量
target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode())); target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode()));
return target; return target;
@ -1875,33 +1982,78 @@ public class RealTargetServiceImpl implements RealTargetService {
return dataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); return dataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
} }
/** /**
* 近30天发电量 * 站点设备近30天发电量
* @param stations
* @return
*/
private List<ThirtyGenerationEntity> thirtyGenerations(List<String> stations) {
Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE);
calendar.add(Calendar.DAY_OF_MONTH,-30);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE);
return thirtyGenerateService.list(Wrappers.<ThirtyGenerationEntity>lambdaQuery()
.in(ThirtyGenerationEntity::getStationId,stations)
.ge(ThirtyGenerationEntity::getStrDay,start)
.le(ThirtyGenerationEntity::getStrDay,end)
);
}
/**
* 站点设备今年发电量
* @param stations
* @return
*/
private List<ThreeGenerationEntity> threeGenerations(List<String> stations) {
return threeGenerateService.list(Wrappers.<ThreeGenerationEntity>lambdaQuery()
.in(ThreeGenerationEntity::getStationId,stations)
.like(ThreeGenerationEntity::getStrMonth,DateUtil.format(new Date(),"yyyy"))
);
}
/**
* 查询设备去年发电量
* @param stations
* @return
*/
private List<ThreeGenerationEntity> threeYesterGenerations(List<String> stations) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.YEAR,-1);
return threeGenerateService.list(Wrappers.<ThreeGenerationEntity>lambdaQuery()
.in(ThreeGenerationEntity::getStationId,stations)
.like(ThreeGenerationEntity::getStrMonth,DateUtil.format(calendar.getTime(),"yyyy"))
);
}
/**
* 设备近30天发电量组装
* @param generations
* @param device * @param device
* @return * @return
*/ */
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { private List<GenerationPowerVo> getGenerationPowerList(List<ThirtyGenerationEntity> generations,EminfoAndEmParamVo device) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); Date end = calendar.getTime();
calendar.add(Calendar.DAY_OF_MONTH,-29); calendar.add(Calendar.DAY_OF_MONTH,-30);
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); Date start = calendar.getTime();
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); List<GenerationPowerVo> powers = new ArrayList<>();
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); while (end.compareTo(start) > 0){
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); GenerationPowerVo power = new GenerationPowerVo();
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); if (CollectionUtil.isEmpty(generations)) {
if(CollectionUtil.isEmpty(records)){ power.setDate(DateUtil.format(start,DateUtil.PATTERN_DATE));
return new ArrayList<>(); power.setGenerate(0f);
}
return records.stream().map(record -> {
GenerationPowerVo generate = new GenerationPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
if(StringUtil.isEmpty(record.getVal())){
generate.setGenerate(0f);
}else{ }else{
generate.setGenerate(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()))); String date = DateUtil.format(start,DateUtil.PATTERN_DATE);
power.setDate(date);
power.setGenerate((float) generations.stream().filter(iter->iter.getDeviceCode().equals(device.getEmCode()) && iter.getStrDay().contains(date)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
} }
return generate; calendar.add(Calendar.DAY_OF_MONTH,1);
}).collect(Collectors.toList()); powers.add(power);
start = calendar.getTime();
}
return powers;
} }
} }

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; package com.hnac.hzinfo.inspect.obj.services;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; 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.ProjectOfflineVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectVO; import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
import org.springblade.core.mp.support.Query; 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<Map<String,Object>> deptProjectTree(ProjectDTO project);
List<ProjectVO> projects(String emCode, ContentDTO content); 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.Constants;
import com.hnac.hzinfo.inspect.obj.ObjectConstants; import com.hnac.hzinfo.inspect.obj.ObjectConstants;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; 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.ContentEntity;
import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; 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.mapper.ProjectMapper;
import com.hnac.hzinfo.inspect.obj.services.ContentService; import com.hnac.hzinfo.inspect.obj.services.ContentService;
import com.hnac.hzinfo.inspect.obj.services.ProjectContentService; import com.hnac.hzinfo.inspect.obj.services.ProjectContentService;
import com.hnac.hzinfo.inspect.obj.services.ProjectService; import com.hnac.hzinfo.inspect.obj.services.ProjectService;
import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; 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.ProjectOfflineVO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectVO; import com.hnac.hzinfo.inspect.obj.vo.ProjectVO;
import com.hnac.hzinfo.inspect.obj.wrapper.ContentWrapper; 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 org.springblade.core.log.exception.ServiceException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.mp.support.Query; 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.core.tool.utils.*;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -49,8 +51,10 @@ import java.util.stream.Stream;
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity> implements ProjectService { public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity> implements ProjectService {
private final ContentService contentService; private final ContentService contentService;
private final ISysClient sysClient; private final ISysClient sysClient;
//private final ProjectContentService projectContentService;
private final ProjectContentMapper projectContentMapper;
@Override @Override
public boolean save(ProjectEntity entity) { 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 project 筛选条件
* @param deptId 机构ID * @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 @Getter
@Setter @Setter
public class ProjectListQueryVO implements Serializable { public class ProjectListQueryVO implements Serializable {
private static final long serialVersionUID = -953928646703619934L; private static final long serialVersionUID = -953928646703619934L;
/**
* 项目编码
*/
@ApiModelProperty(value = "项目编码") @ApiModelProperty(value = "项目编码")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
private String code; private String code;
/**
* 项目名称
*/
@ApiModelProperty(value = "项目名称") @ApiModelProperty(value = "项目名称")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
private String name; private String name;
@ -54,5 +49,4 @@ public class ProjectListQueryVO implements Serializable {
@QueryField(condition = SqlCondition.EQUAL) @QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "创建机构") @ApiModelProperty(value = "创建机构")
private Long createDept; private Long createDept;
} }

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

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

@ -143,21 +143,17 @@ public class TaskController extends BladeController {
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task") @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) { 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); IPage<TaskVo> pages = Condition.getPage(query);
if(!AuthUtil.isAdministrator()){ if (!AuthUtil.isAdministrator()) {
task.setCurUserId(AuthUtil.getUserId()); task.setCurUserId(AuthUtil.getUserId());
task.setTenantId(AuthUtil.getTenantId()); task.setTenantId(AuthUtil.getTenantId());
} }
if (task.getCurUserId() == -1) { if (task.getCurUserId() == -1) {
task.setCurUserId(null); task.setCurUserId(null);
} }
List<TaskVo> list = taskService.getListPage(pages,task); List<TaskVo> list = taskService.getListPage(pages, task);
pages.setRecords(list); pages.setRecords(list);
BladePage<TaskVo> bladePage = BladePage.of(pages); BladePage<TaskVo> bladePage = BladePage.of(pages);
return R.data(bladePage); return R.data(bladePage);

1
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskClient.java

@ -84,6 +84,7 @@ public class InspectTaskClient implements IInspectTaskClient {
* @param deptId * @param deptId
* @return * @return
*/ */
@GetMapping(EXPIRE_INSPECT)
@Override @Override
public List<TaskEntity> expireInspect(String start, String end, Long deptId) { public List<TaskEntity> expireInspect(String start, String end, Long deptId) {
return taskService.list(Wrappers.<TaskEntity>lambdaQuery() return taskService.list(Wrappers.<TaskEntity>lambdaQuery()

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

@ -132,14 +132,18 @@
</select> </select>
<select id="getListPage" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <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 SELECT
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID t.*, u.USER_ID
where t.IS_DELETED=0 and u.IS_DELETED=0 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 "> <if test="task.dutyId != null ">
and t.DUTY_ID=#{task.dutyId} and t.DUTY_ID = #{task.dutyId}
</if> </if>
<if test="task.curUserId != null and task.curUserId != ''"> <if test="task.curUserId != null and task.curUserId != ''">
and u.USER_ID=#{task.curUserId} and u.USER_ID = #{task.curUserId}
</if> </if>
<if test="task.planName != null and task.planName != ''"> <if test="task.planName != null and task.planName != ''">
and t.PLAN_NAME like concat('%', #{task.planName}, '%') and t.PLAN_NAME like concat('%', #{task.planName}, '%')
@ -157,31 +161,32 @@
and t.PLAN_END_TIME &gt;= #{task.startTime} and t.PLAN_END_TIME &gt;= #{task.startTime}
</if> </if>
<if test="task.cycle != null and task.cycle != ''"> <if test="task.cycle != null and task.cycle != ''">
and t.CYCLE=#{task.cycle} and t.CYCLE = #{task.cycle}
</if> </if>
<if test="task.status != null"> <if test="task.status != null">
and t.STATUS=#{task.status} and t.STATUS = #{task.status}
</if> </if>
<if test="task.keepOnRecord != null"> <if test="task.keepOnRecord != null">
and t.KEEP_ON_RECORD=#{task.keepOnRecord} and t.KEEP_ON_RECORD = #{task.keepOnRecord}
</if> </if>
<if test="task.tenantId != null and task.tenantId != ''"> <if test="task.tenantId != null and task.tenantId != ''">
and t.TENANT_ID = #{task.tenantId} and t.TENANT_ID = #{task.tenantId}
</if> </if>
<if test="task.autoVideo != null"> <if test="task.autoVideo != null">
and t.AUTO_VIDEO=#{task.autoVideo} and t.AUTO_VIDEO = #{task.autoVideo}
</if> </if>
<if test="task.taskIds != null and task.taskIds != ''"> <if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID,#{task.taskIds}) and FIND_IN_SET(t.ID, #{task.taskIds})
</if> </if>
<if test="task.areaId != null"> <if test="task.createDept != null">
and t.CREATE_DEPT = #{task.areaId} and t.CREATE_DEPT = #{task.createDept}
</if> </if>
<if test="task.yearMonth != null"> <if test="task.yearMonth != null">
and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearMonth} and date_format(t.PLAN_START_TIME,'%Y-%m') = #{task.yearMonth}
</if> </if>
order by t.UPDATE_TIME desc order by t.UPDATE_TIME desc
</select> </select>
<select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT SELECT
t.*, b.USER_ID as userIds, t.*, b.USER_ID as userIds,

26
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/utils/Condition.java

@ -37,7 +37,7 @@ public class Condition extends org.springblade.core.mp.support.Condition {
qw.setEntityClass(entity.getClass()); qw.setEntityClass(entity.getClass());
Class queryClass = query.getClass(); Class queryClass = query.getClass();
Field[] fields = queryClass.getDeclaredFields(); Field[] fields = queryClass.getDeclaredFields();
for(Field field:fields){ for (Field field : fields) {
field.setAccessible(true); field.setAccessible(true);
QueryField queryField = field.getAnnotation(QueryField.class); QueryField queryField = field.getAnnotation(QueryField.class);
if(queryField==null) { if(queryField==null) {
@ -49,38 +49,38 @@ public class Condition extends org.springblade.core.mp.support.Condition {
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("获取属性性出错"); throw new ServiceException("获取属性性出错");
} }
if(value==null) { if (value==null) {
continue; continue;
} }
List list = null; List list = null;
if(value instanceof List){ if (value instanceof List) {
list = (List)value; list = (List)value;
if(list.size()==0) { if (list.size()==0) {
continue; continue;
} }
} }
String condition = queryField.condition(); String condition = queryField.condition();
if(Func.isBlank(condition)) { if (Func.isBlank(condition)) {
continue; continue;
} }
String fileName = camel2under(field.getName()); String fileName = camel2under(field.getName());
if(SqlCondition.EQUAL.equals(condition)) { if (SqlCondition.EQUAL.equals(condition)) {
qw.eq(fileName, value); qw.eq(fileName, value);
}else if(SqlCondition.LIKE.equals(condition)){ } else if (SqlCondition.LIKE.equals(condition)) {
qw.like(fileName,value); qw.like(fileName,value);
}else if(SqlCondition.LIKE_LEFT.equals(condition)){ } else if (SqlCondition.LIKE_LEFT.equals(condition)) {
qw.likeLeft(fileName,value); qw.likeLeft(fileName,value);
}else if(SqlCondition.LIKE_RIGHT.equals(condition)){ } else if(SqlCondition.LIKE_RIGHT.equals(condition)) {
qw.likeRight(fileName,value); qw.likeRight(fileName,value);
}else if(SqlCondition.NOT_IN.equals(condition)){ } else if(SqlCondition.NOT_IN.equals(condition)) {
String columnName = queryField.columnName(); String columnName = queryField.columnName();
if(Func.isBlank(columnName)) { if (Func.isBlank(columnName)) {
throw new ServiceException("查询不包含条件时需要指定列名"); throw new ServiceException("查询不包含条件时需要指定列名");
} }
qw.notIn(camel2under(columnName),list); qw.notIn(camel2under(columnName),list);
}else if(SqlCondition.IN.equals(condition)){ } else if(SqlCondition.IN.equals(condition)) {
String columnName = queryField.columnName(); String columnName = queryField.columnName();
if(Func.isBlank(columnName)) { if (Func.isBlank(columnName)) {
throw new ServiceException("查询包含条件时需要指定列名"); throw new ServiceException("查询包含条件时需要指定列名");
} }
qw.in(camel2under(columnName),list); qw.in(camel2under(columnName),list);

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

@ -86,8 +86,12 @@ public class OperAccessLibraryServiceImpl extends ServiceImpl<OperAccessLibraryM
} }
@Override @Override
public R<OperAccessLibraryVO> detail(Long id) { public R<OperAccessLibraryVO>
detail(Long id) {
OperAccessLibraryVO detail = OperAccessLibraryWrapper.build(emInfoClient).entityVO(super.getById(id)); OperAccessLibraryVO detail = OperAccessLibraryWrapper.build(emInfoClient).entityVO(super.getById(id));
if(StringUtils.isEmpty(detail.getSafeInfos())){
R.data(detail);
}
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(","))); detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(",")));
return R.data(detail); return R.data(detail);
} }

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -112,6 +112,11 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
if (StringUtils.isNotBlank(AuthUtil.getNickName())){ if (StringUtils.isNotBlank(AuthUtil.getNickName())){
entity.setCreateUserName(AuthUtil.getNickName()); entity.setCreateUserName(AuthUtil.getNickName());
} }
if (StringUtils.isNotBlank(entity.getInitResult())){
entity.setInitResult( entity.getInitResult().replaceAll("\n",""));
entity.setInitResult( entity.getInitResult().replaceAll("</p>",""));
entity.setInitResult( entity.getInitResult().replaceAll("<p>",""));
}
R r=new R(); R r=new R();
//加锁 //加锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + entity.getCreateDept(), entity.getCreateDept(), 30, TimeUnit.SECONDS); Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + entity.getCreateDept(), entity.getCreateDept(), 30, TimeUnit.SECONDS);

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>(){{ StorageEntity history = this.getOne(new LambdaQueryWrapper<StorageEntity>(){{
eq(StorageEntity::getStationCode, entity.getStationCode()); eq(StorageEntity::getStationCode, entity.getStationCode());
eq(StorageEntity::getFillDate,entity.getFillDate()); 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("日期已经存在填报数据!"); throw new ServiceException("日期已经存在填报数据!");
} }
if(ObjectUtil.isEmpty(history)){ if(ObjectUtil.isEmpty(history) && ObjectUtil.isEmpty(entity.getId())){
return this.save(entity); return this.save(entity);
} }
return this.updateById(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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.entity.UseEntity;
import com.hnac.hzims.operational.fill.mapper.UseMapper; import com.hnac.hzims.operational.fill.mapper.UseMapper;
import com.hnac.hzims.operational.fill.service.UseService; 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>(){{ UseEntity history = this.getOne(new LambdaQueryWrapper<UseEntity>(){{
eq(UseEntity::getStationCode, entity.getStationCode()); eq(UseEntity::getStationCode, entity.getStationCode());
eq(UseEntity::getFillDate,entity.getFillDate()); 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("日期已经存在填报数据!"); throw new ServiceException("日期已经存在填报数据!");
} }
if(ObjectUtil.isEmpty(history)){ if(ObjectUtil.isEmpty(history) && ObjectUtil.isEmpty(entity.getId())){
return this.save(entity); return this.save(entity);
} }
return this.updateById(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;
}
}

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

@ -6,6 +6,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
@ -17,7 +18,7 @@ import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo; import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo;
import com.hnac.hzims.operational.fill.entity.GenerateEntity; import com.hnac.hzims.operational.homePage.Hydroelectric.vo.HydroelectricPowerRainVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.entity.UserDeptEntity; import com.hnac.hzims.operational.main.entity.UserDeptEntity;
import com.hnac.hzims.operational.main.service.*; import com.hnac.hzims.operational.main.service.*;
@ -92,6 +93,8 @@ public class HydropowerServiceImpl implements HydropowerService {
private final ISysClient sysClient; private final ISysClient sysClient;
private final IRainfallClient rainfallClient;
private final ITicketInfoClient ticketInfoClient; private final ITicketInfoClient ticketInfoClient;
private final IPlanGenertionClient planGenertionClient; private final IPlanGenertionClient planGenertionClient;
@ -139,6 +142,8 @@ public class HydropowerServiceImpl implements HydropowerService {
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(Collections.singletonList(station.getCode())); Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(Collections.singletonList(station.getCode()));
// 七天天气 // 七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(Collections.singletonList(station.getCode())); Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(Collections.singletonList(station.getCode()));
// 近30天降雨
List<Map<String, Object>> rains = this.get30DayRain(station.getCode());
HydropowerStationVo response = new HydropowerStationVo(); HydropowerStationVo response = new HydropowerStationVo();
// 近年发电量数据 // 近年发电量数据
Map<String, Map<String, Float>> map = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data); Map<String, Map<String, Float>> map = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data);
@ -161,22 +166,104 @@ public class HydropowerServiceImpl implements HydropowerService {
response.setPowerSum(this.getPowerSum(realList,station.getRefDept())); response.setPowerSum(this.getPowerSum(realList,station.getRefDept()));
// 总有功单位 // 总有功单位
response.setPowerUnit(this.getPowerUnit(realList,station.getRefDept())); response.setPowerUnit(this.getPowerUnit(realList,station.getRefDept()));
// 容量利用率
response.setCapacityRate(this.getCapacityRate(response));
// 月计划发电量 // 月计划发电量
response.setPlanPowerMon(this.getPlanPowerrMon(station.getCode())); response.setPlanPowerMon(this.getPlanPowerrMon(station.getCode()));
// 年计划发电量 // 年计划发电量
response.setPlanPowerYear(this.getPlanPowerYear(station.getCode())); response.setPlanPowerYear(this.getPlanPowerYear(station.getCode()));
// 年发电量、月发电量 // 年发电量、月发电量
this.stationMonthPower(station.getCode(),map,response); this.stationMonthPower(station.getCode(),map,response);
// 水位、水位曲线 // 水位
this.handleWaterLeve(station.getCode(),response); this.handleWaterLeve(station.getCode(),response);
// 年发电量完成百分比 // 今日,昨日发电量
this.powerDay(station,targetList,response);
// 年发电量完成百分比曲线
response.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map)); response.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map));
// 设备信息 // 设备信息
response.setDeviceList(this.getDevices(station,realList,targetList)); response.setDeviceList(this.getDevices(station,realList,targetList));
// 降雨
response.setPowerRains(this.getPowerRains(station,response.getDeviceList(),rains));
return response; return response;
} }
/** /**
* 站点发电降雨曲线
* @param devices
* @param rains
* @return
*/
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->{
if(ObjectUtil.isNotEmpty(device.getHydropowerPumpTargetVo()) && CollectionUtil.isNotEmpty(device.getHydropowerPumpTargetVo().getGenerationPowerVoList())){
powers.addAll(device.getHydropowerPumpTargetVo().getGenerationPowerVoList());
}
});
}
// 根据日期遍历
List<String> days = this.get30Day();
return days.stream().map(day->{
HydroelectricPowerRainVo powerRain = new HydroelectricPowerRainVo();
powerRain.setDate(day);
if(CollectionUtil.isEmpty(powers)){
powerRain.setGenerate(0.0);
}else{
powerRain.setGenerate(powers.stream().filter(o-> day.equals(o.getDate())).mapToDouble(GenerationPowerVo::getGenerate).sum());
}
if(CollectionUtil.isEmpty(rains)){
powerRain.setRain(0.0);
}else{
powerRain.setRain(rains.stream().mapToDouble(map->{
if (map.get("fx_date").equals(day)) {
Object object = map.get("precip");
if(ObjectUtil.isEmpty(object)){
return 0.0;
}else{
return Double.parseDouble(object.toString());
}
}
return 0.0;
}).sum());
}
return powerRain;
}).collect(Collectors.toList());
}
/**
* 容量利用率
* @param response
* @return
*/
private double getCapacityRate(HydropowerStationVo response) {
if(response.getInstalledCapacity() > 0 && response.getPowerSum() > 0){
return BigDecimal.valueOf(response.getPowerSum() / response.getInstalledCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
}
return 0.0;
}
/**
* 今日昨日发电量
* @param station
* @param targetList
* @param response
*/
private void powerDay(StationEntity station, List<HydropowerUnitTargetVo> targetList, HydropowerStationVo response) {
response.setPowerDay(0f);
response.setPowerYesterDay(0f);
if(CollectionUtil.isEmpty(targetList)){
return;
}
List<HydropowerUnitTargetVo> valids = targetList.stream().filter(o-> null != station.getRefDept() && station.getRefDept().equals(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(valids)){
return;
}
response.setPowerDay((float)valids.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum());
response.setPowerYesterDay((float)valids.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYesterDay).sum());
}
/**
* 水电站-机组列表 * 水电站-机组列表
* @param deptId * @param deptId
* @return * @return
@ -223,10 +310,8 @@ public class HydropowerServiceImpl implements HydropowerService {
hydropowerUnitVo.setHydropowerPumpRealVo(real); hydropowerUnitVo.setHydropowerPumpRealVo(real);
// 指标数据 // 指标数据
if(CollectionUtil.isNotEmpty(validTargetList)){ if(CollectionUtil.isNotEmpty(validTargetList)){
List<HydropowerUnitTargetVo> target = targetList.stream().filter(o->real.getDeviceCode().equals(o.getDeviceCode())).collect(Collectors.toList()); Optional<HydropowerUnitTargetVo> optional = targetList.stream().filter(o->real.getDeviceCode().equals(o.getDeviceCode())).findFirst();
if(CollectionUtil.isNotEmpty(target)){ optional.ifPresent(hydropowerUnitVo::setHydropowerPumpTargetVo);
hydropowerUnitVo.setHydropowerPumpTargetVo(target.get(0));
}
} }
list.add(hydropowerUnitVo); list.add(hydropowerUnitVo);
} }
@ -292,6 +377,51 @@ public class HydropowerServiceImpl implements HydropowerService {
} }
/** /**
* 获取30天
* @return
*/
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));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
calendar.add(Calendar.DAY_OF_MONTH,-29);
Date start = calendar.getTime();
while (start.compareTo(end) < 0) {
times.add(DateUtil.format(calendar.getTime(),"yyyy-MM-dd"));
calendar.add(Calendar.DAY_OF_MONTH,1);
start = calendar.getTime();
}
return times;
}
/**
* 近30天降雨
* @param code
* @return
*/
private List<Map<String, Object>> get30DayRain(String code) {
Calendar calendar = Calendar.getInstance();
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DAY_OF_MONTH,-1);
String rainEnd = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
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);
String rainStart = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
R<List<Map<String, Object>>> rains = rainfallClient.getDurationRainFall(code,rainStart,rainEnd);
if(!rains.isSuccess() || CollectionUtil.isEmpty(rains.getData())){
return new ArrayList<>();
}
return rains.getData();
}
/**
* 获取设备装机容量 * 获取设备装机容量
* @param list * @param list
* @param refDept * @param refDept
@ -438,7 +568,6 @@ public class HydropowerServiceImpl implements HydropowerService {
WaterLevelVo level = validList.get(0); WaterLevelVo level = validList.get(0);
// 前池水位、当日水位曲线 // 前池水位、当日水位曲线
response.setFrontWaterLevel(level.getFrontWaterLevel()); response.setFrontWaterLevel(level.getFrontWaterLevel());
response.setFrontCurveMap(level.getFrontCurveMap());
} }
/** /**

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.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
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.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.AreaService; import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; 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())) { if (StringUtil.isNotBlank(entity.getName())) {
like(StationEntity::getName, "%".concat(entity.getName()).concat("%")); like(StationEntity::getName, "%".concat(entity.getName()).concat("%"));
} }
if (ObjectUtil.isNotEmpty(entity.getServeType())) {
eq(StationEntity::getServeType, entity.getServeType());
}
if (ObjectUtil.isNotEmpty(entity.getType())) { if (ObjectUtil.isNotEmpty(entity.getType())) {
eq(StationEntity::getType, entity.getType()); eq(StationEntity::getType, entity.getType());
} }

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafetyToolController.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.controller; package com.hnac.hzims.safeproduct.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
@ -26,6 +27,7 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -84,18 +86,13 @@ public class SafetyToolController extends BladeController {
return safetyToolService.doUpdate(safetyTool); return safetyToolService.doUpdate(safetyTool);
} }
/**
* 详情
*/
@GetMapping("/detail") @GetMapping("/detail")
@ApiOperationSupport(order = 40) @ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入safetyTool") @ApiOperation(value = "详情", notes = "传入safetyTool")
@Operate(label = "详情", type = com.hnac.hzinfo.log.contants.BusinessType.QUERY, ignore = false) @Operate(label = "详情", type = com.hnac.hzinfo.log.contants.BusinessType.QUERY, ignore = false)
public R<SafetyToolVO> detail(@RequestParam("id") Long id) { public R<SafetyToolVO> detail(@RequestParam("id") Long id) {
SafetyToolEntity detail = safetyToolService.getOne(Condition.getQueryWrapper(new SafetyToolEntity() {{ SafetyToolVO safetyToolVO = safetyToolService.detail(id);
setId(id); return R.data(safetyToolVO);
}}));
return R.data(SafetyToolWrapper.build().entityVO(detail));
} }
/** /**

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/feign/DangerSourceClient.java

@ -31,7 +31,7 @@ public class DangerSourceClient implements IDangerSourceClient {
@Override @Override
@GetMapping(DETAILS) @GetMapping(DETAILS)
public List<DangerSourceEntity> details(@RequestParam String[] ids) { public List<DangerSourceEntity> details(@RequestParam("ids") String[] ids) {
List<DangerSourceEntity> resp = service.listByIds(Arrays.asList(ids)); List<DangerSourceEntity> resp = service.listByIds(Arrays.asList(ids));
//未查到数据返回空集合 //未查到数据返回空集合
if (CollectionUtils.isEmpty(resp)) { if (CollectionUtils.isEmpty(resp)) {

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml

@ -4,7 +4,7 @@
<select id="selectCarByYear" resultType="com.hnac.hzims.safeproduct.vo.CarMilesYearVO"> <select id="selectCarByYear" resultType="com.hnac.hzims.safeproduct.vo.CarMilesYearVO">
SELECT SELECT
DISTINCT t1.unit, t1.car_brand, t1.plate_number, t1.create_time DISTINCT t1.unit, t1.car_brand, t1.plate_number, t1.create_time, t1.create_user, t1.create_dept
FROM FROM
hzims_car t1 hzims_car t1
LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id
@ -22,7 +22,8 @@
<select id="selectMilesByCar" resultType="com.hnac.hzims.safeproduct.dto.CarMilesYearDTO"> <select id="selectMilesByCar" resultType="com.hnac.hzims.safeproduct.dto.CarMilesYearDTO">
SELECT SELECT
t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t2.end_time, '%m') as dateTime, sum(t2.miles) as miles t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t2.end_time, '%m') as dateTime, sum(t2.miles) as miles,
t1.create_user, t1.create_dept
FROM FROM
hzims_car t1 hzims_car t1
LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id

7
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ISafetyToolService.java

@ -45,4 +45,11 @@ public interface ISafetyToolService extends IService<SafetyToolEntity> {
* @return * @return
*/ */
R remove(List<Long> idList); R remove(List<Long> idList);
/**
* 详情
* @param id 安全工器具id
* @return 安全工器具VO类
*/
SafetyToolVO detail(Long id);
} }

15
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java

@ -38,6 +38,7 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
@ -275,6 +276,20 @@ public class SafetyToolServiceImpl extends ServiceImpl<SafetyToolMapper, SafetyT
return R.status(removeByIds(idList)); return R.status(removeByIds(idList));
} }
/**
* 详情
*/
@Override
public SafetyToolVO detail(Long id) {
SafetyToolEntity detail = this.getOne(Condition.getQueryWrapper(new SafetyToolEntity() {{
setId(id);
}}));
if (cn.hutool.core.util.ObjectUtil.isEmpty(detail)) {
throw new ServiceException(ResultCode.REQ_REJECT, "没有访问该安全工器具的权限");
}
return SafetyToolWrapper.build().entityVO(detail);
}
/** /**
* 工器具Code唯一性校验 * 工器具Code唯一性校验

6
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/TicketApplication.java

@ -24,10 +24,4 @@ public class TicketApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(TicketConstants.APP_NAME, TicketApplication.class, args); BladeApplication.run(TicketConstants.APP_NAME, TicketApplication.class, args);
} }
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// return BladeApplication.createSpringApplicationBuilder(builder, TicketConstants.APP_NAME, TicketApplication.class);
// }
} }

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/OperRepairMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/OperRepairMapper.xml

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.xml

18
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.java

@ -1,16 +1,11 @@
package com.hnac.hzims.ticket.standardTicket.mapper; package com.hnac.hzims.ticket.standardTicket.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.vo.OperateTicketStatisticVO; import com.hnac.hzims.ticket.standardTicket.vo.OperateTicketStatisticVO;
import com.hnac.hzims.ticket.standardTicket.vo.OperateVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -30,14 +25,9 @@ public interface StandardTicketInfoMapper extends UserDataScopeBaseMapper<Standa
int qualifiedCount(Integer valueOf, int year, int month); int qualifiedCount(Integer valueOf, int year, int month);
/** SafeCheckStatisticVO getOperateTicketStatistic(@Param("startDate") String startDate,
* 获取安全检查操作票项统计 @Param("endDate") String endDate,
* @param startDate 开始时间 @Param("dept") Long dept);
* @param endDate 结束时间
* @param dept 机构ID
* @return
*/
SafeCheckStatisticVO getOperateTicketStatistic(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dept") Long dept);
/** /**
* 获取站点月报统计 - 操作票统计 * 获取站点月报统计 - 操作票统计
@ -51,7 +41,6 @@ public interface StandardTicketInfoMapper extends UserDataScopeBaseMapper<Standa
@Param("endDate") String endDate, @Param("endDate") String endDate,
@Param("deptIdList") List<Long> deptIdList); @Param("deptIdList") List<Long> deptIdList);
/** /**
* 分页查询 * 分页查询
* @param searchPage * @param searchPage
@ -61,7 +50,6 @@ public interface StandardTicketInfoMapper extends UserDataScopeBaseMapper<Standa
Page<StandardTicketInfoEntity> selectPages(Page<StandardTicketInfoEntity> searchPage, Page<StandardTicketInfoEntity> selectPages(Page<StandardTicketInfoEntity> searchPage,
@Param(Constants.WRAPPER) QueryWrapper<StandardTicketInfoEntity> queryWrapper); @Param(Constants.WRAPPER) QueryWrapper<StandardTicketInfoEntity> queryWrapper);
List<Map> selectTicketList(@Param(Constants.WRAPPER) QueryWrapper<StandardTicketInfoEntity> queryWrapper);
IPage<StandardTicketInfoEntity> pageCondition(IPage<StandardTicketInfoEntity> page, @Param(Constants.WRAPPER) QueryWrapper<StandardTicketInfoEntity> queryWrapper); IPage<StandardTicketInfoEntity> pageCondition(IPage<StandardTicketInfoEntity> page, @Param(Constants.WRAPPER) QueryWrapper<StandardTicketInfoEntity> queryWrapper);
} }

40
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.xml

@ -39,23 +39,6 @@
and MONTH(t.CREATE_TIME) = #{month} and MONTH(t.CREATE_TIME) = #{month}
and e.status = 1; and e.status = 1;
</select> </select>
<select id="getOperateTicketStatistic" resultType="com.hnac.hzims.vo.SafeCheckStatisticVO">
select count(1) total,count(case when ie.`status` = 1 then 1 else null end) qualified
from hzims_standard_ticket_info ti
left join hzims_ticket_info_evaluate ie on ti.id = ie.ticket_id and ie.is_deleted = 0
<where>
ti.is_deleted = 0
<if test="startDate != null and startDate != ''">
and ti.create_time &gt; #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and ti.create_time &lt; #{endDate}
</if>
<if test="dept != null and dept != ''">
and ti.create_dept = #{dept}
</if>
</where>
</select>
<select id="getOperateTicketReportStatistic" <select id="getOperateTicketReportStatistic"
resultType="com.hnac.hzims.ticket.standardTicket.vo.OperateTicketStatisticVO"> resultType="com.hnac.hzims.ticket.standardTicket.vo.OperateTicketStatisticVO">
select ti.*,ie.`status` evaluation from hzims_standard_ticket_info ti select ti.*,ie.`status` evaluation from hzims_standard_ticket_info ti
@ -82,11 +65,6 @@
hzims_ticket_info_evaluate tie on sti.id = tie.ticket_id hzims_ticket_info_evaluate tie on sti.id = tie.ticket_id
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="selectTicketList" resultType="java.util.Map">
select ti.*,tie.`status` isPass from hzims_standard_ticket_info ti
left join hzims_ticket_info_evaluate tie on ti.id = tie.ticket_id and tie.is_deleted = 0
${ew.customSqlSegment}
</select>
<select id="pageCondition" resultType="com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity"> <select id="pageCondition" resultType="com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity">
SELECT oper.*,eva.`status` isQualified FROM hzims_standard_ticket_info oper SELECT oper.*,eva.`status` isQualified FROM hzims_standard_ticket_info oper
@ -94,4 +72,22 @@
ON oper.id = eva.ticket_id ON oper.id = eva.ticket_id
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="getOperateTicketStatistic" resultType="com.hnac.hzims.vo.SafeCheckStatisticVO">
select count(1) total,count(case when ie.`status` = 1 then 1 else null end) qualified
from hzims_standard_ticket_info ti
left join hzims_ticket_info_evaluate ie on ti.id = ie.ticket_id and ie.is_deleted = 0
<where>
ti.is_deleted = 0
<if test="startDate != null and startDate != ''">
and ti.create_time &gt; #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and ti.create_time &lt; #{endDate}
</if>
<if test="dept != null">
and ti.create_dept = #{dept}
</if>
</where>
</select>
</mapper> </mapper>

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketMeasureMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketMeasureMapper.xml

11
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java

@ -16,6 +16,7 @@ import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.StandardTicketCountQueryVo; import com.hnac.hzims.ticket.twoTicket.vo.ticket.StandardTicketCountQueryVo;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -81,10 +82,10 @@ public interface IStandardTicketInfoService extends IService<StandardTicketInfoE
/** /**
* 获取双票合格率 * 获取双票合格率
* @param List<Long> depatList * @param depatList
* @param LocalDateTime firstDateTime * @param firstDateTime
* @param LocalDateTime now * @param now
* @return DoublePassRateVO * @return
*/ */
DoublePassRateVO getDoublePassRate(List<Long> depatList, LocalDateTime firstDateTime, LocalDateTime now); DoublePassRateVO getDoublePassRate(List<Long> depatList, LocalDateTime firstDateTime, LocalDateTime now);
@ -151,4 +152,6 @@ public interface IStandardTicketInfoService extends IService<StandardTicketInfoE
* @param ticketId * @param ticketId
*/ */
void exportOperateTicket(HttpServletResponse response, Long ticketId); void exportOperateTicket(HttpServletResponse response, Long ticketId);
SafeCheckStatisticVO getOperateTicketStatistic(String startDate, String endDate, Long dept);
} }

13
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -39,6 +39,7 @@ import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketReportStatisticVO; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketReportStatisticVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -937,6 +938,18 @@ public class StandardTicketInfoServiceImpl extends ServiceImpl<StandardTicketInf
PdfUtils.readPdf(response, pdfPath); PdfUtils.readPdf(response, pdfPath);
} }
/**
* 获取安全检查操作票项统计
* @param startDate
* @param endDate
* @param dept
* @return
*/
@Override
public SafeCheckStatisticVO getOperateTicketStatistic(String startDate, String endDate, Long dept) {
return this.baseMapper.getOperateTicketStatistic(startDate,endDate,dept);
}
private void exportTicketWord(List<XWPFDocument> documents, String savePath) throws IOException { private void exportTicketWord(List<XWPFDocument> documents, String savePath) throws IOException {
FileOutputStream out = new FileOutputStream(savePath); FileOutputStream out = new FileOutputStream(savePath);
try { try {

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java

@ -370,15 +370,11 @@ public class FirstWorkTicketServiceImpl extends ServiceImpl<WorkTicketInfoMapper
return result; return result;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
params.put("ticketInfoDangers", dangerList); params.put("ticketInfoDangers", dangerList);
params.put("isSafety", workTicketInfoEntity.getIsSafety()); params.put("isSafety", workTicketInfoEntity.getIsSafety() ? "☑" : "□");
params.put("isHazard", workTicketInfoEntity.getIsHazard()); params.put("isHazard", workTicketInfoEntity.getIsHazard() ? "☑" : "□");
params.put("isRailway", workTicketInfoEntity.getIsRailway()); params.put("isRailway", workTicketInfoEntity.getIsRailway() ? "☑" : "□");
params.put("isLimited", workTicketInfoEntity.getIsLimited()); params.put("isLimited", workTicketInfoEntity.getIsLimited() ? "☑" : "□");
params.put("isStart", workTicketInfoEntity.getIsStart()); params.put("isStart", workTicketInfoEntity.getIsStart());
params.put("isTestTrue", true);
params.put("isTestFalse", false);
params.put("numTest", "32");
// 许可人许可环节 // 许可人许可环节
if(ObjectUtil.isNotEmpty(workTicketInfoEntity.getLicenseTime())) { if(ObjectUtil.isNotEmpty(workTicketInfoEntity.getLicenseTime())) {
String licensorName = StringUtil.isNotBlank(workTicketInfoEntity.getLicensorName()) && Func.isNotEmpty(workTicketInfoEntity.getLicensorName()) ? String licensorName = StringUtil.isNotBlank(workTicketInfoEntity.getLicensorName()) && Func.isNotEmpty(workTicketInfoEntity.getLicensorName()) ?

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/OperateTicketClient.java

@ -1,8 +1,10 @@
package com.hnac.hzims.ticket.workTicket.feign; package com.hnac.hzims.ticket.workTicket.feign;
import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.standardTicket.service.impl.StandardTicketInfoServiceImpl; import com.hnac.hzims.ticket.standardTicket.service.impl.StandardTicketInfoServiceImpl;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
@ -18,9 +20,12 @@ import java.math.RoundingMode;
* @author hx * @author hx
*/ */
@RestController @RestController
@AllArgsConstructor
@Slf4j @Slf4j
public class OperateTicketClient implements IOperateTicketClient { public class OperateTicketClient implements IOperateTicketClient {
private final IStandardTicketInfoService standardTicketInfoService;
/** /**
* 安全检查操作票事项统计 * 安全检查操作票事项统计
* @param startDate 开始时间 * @param startDate 开始时间
@ -33,8 +38,7 @@ public class OperateTicketClient implements IOperateTicketClient {
public R<SafeCheckStatisticVO> getOperateTicketCheck(@RequestParam("startDate") String startDate, public R<SafeCheckStatisticVO> getOperateTicketCheck(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate, @RequestParam("endDate") String endDate,
@RequestParam("dept") Long dept) { @RequestParam("dept") Long dept) {
StandardTicketInfoServiceImpl service = SpringUtil.getBean(StandardTicketInfoServiceImpl.class); SafeCheckStatisticVO vo = standardTicketInfoService.getOperateTicketStatistic(startDate,endDate,dept);
SafeCheckStatisticVO vo = service.getBaseMapper().getOperateTicketStatistic(startDate,endDate,dept);
//查询合格率 保留两位小数 //查询合格率 保留两位小数
if(vo == null){ if(vo == null){
vo = new SafeCheckStatisticVO(); vo = new SafeCheckStatisticVO();

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/TwoTicketMatterLibraryMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/TwoTicketMatterLibraryMapper.xml

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketDelayMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketDelayMapper.xml

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketFlowMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketFlowMapper.xml

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.xml

@ -52,7 +52,7 @@
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and ti.create_time &lt; #{endDate} and ti.create_time &lt; #{endDate}
</if> </if>
<if test="dept != null and dept != ''"> <if test="dept != null">
and ti.create_dept = #{dept} and ti.create_dept = #{dept}
</if> </if>
</where> </where>

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketMembersChangeMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketMembersChangeMapper.xml

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketOperateTimeMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketOperateTimeMapper.xml

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketPrincipalChangeMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketPrincipalChangeMapper.xml

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketSafetyMeasureMapper.xml → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketSafetyMeasureMapper.xml

BIN
hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx

Binary file not shown.
Loading…
Cancel
Save