Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
7834b82cb7
  1. 0
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java
  2. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealAttributeVo.java
  4. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java
  5. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java
  6. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WeatherVo.java
  7. 1
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
  8. 132
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/WorkTicketConstants.java
  9. 11
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java
  10. 65
      hzims-service/hzims-scheduled/pom.xml
  11. 59
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java
  12. 10
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/WorkshopInfoMapper.java
  13. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java
  14. 17
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/GenerateMapper.java
  15. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java
  16. 9
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/ModelStationMapper.java
  17. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PowerMapper.java
  18. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/RecordMapper.java
  19. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StFocusPropertiesMapper.java
  20. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttrConfigMapper.java
  21. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java
  22. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java
  23. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/UseMapper.java
  24. 65
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  25. 126
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  26. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java
  27. 54
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java
  28. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java
  29. 101
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StAlamRecordTask.java
  30. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/HistoryAbnormalAlarmService.java
  31. 17
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java
  32. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IMainSystemMonitoringService.java
  33. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java
  34. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttrConfigService.java
  35. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java
  36. 27
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java
  37. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java
  38. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java
  39. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StFocusPropertiesService.java
  40. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/WorkshopInfoService.java
  41. 20
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java
  42. 242
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java
  43. 41
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java
  44. 17
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java
  45. 51
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java
  46. 164
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java
  47. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java
  48. 60
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java
  49. 201
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/WaterServiceImpl.java
  50. 10
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AbnormalAlarmService.java
  51. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java
  52. 25
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/GenerateService.java
  53. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ModelStationService.java
  54. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java
  55. 17
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PowerService.java
  56. 34
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java
  57. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RecordService.java
  58. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttrConfigService.java
  59. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttributeService.java
  60. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationService.java
  61. 29
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/UseService.java
  62. 33
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AbnormalAlarmServiceImpl.java
  63. 139
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java
  64. 112
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/GenerateServiceImpl.java
  65. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ModelStationServiceImpl.java
  66. 581
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java
  67. 77
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PowerServiceImpl.java
  68. 1512
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
  69. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RecordServiceImpl.java
  70. 18
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttrConfigServiceImpl.java
  71. 36
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttributeServiceImpl.java
  72. 19
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationServiceImpl.java
  73. 99
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/UseServiceImpl.java
  74. 52
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java
  75. 33
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java
  76. 54
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java
  77. 17
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java
  78. 30
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java
  79. 208
      hzims-service/hzims-scheduled/src/main/resources/application.yml
  80. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/WorkshopInfoMapper.xml
  81. 12
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml
  82. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/GenerateMapper.xml
  83. 21
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/ModelStationMapper.xml
  84. 32
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PowerMapper.xml
  85. 29
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/RecordMapper.xml
  86. 19
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml
  87. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttrConfigMapper.xml
  88. 15
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttributeMapper.xml
  89. 6
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationMapper.xml
  90. 4
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/UseMapper.xml
  91. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java
  92. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java
  93. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java
  94. 18
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java
  95. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  96. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java
  97. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java
  98. 44
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessDictController.java
  99. 115
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java
  100. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/ProcessDictMapper.java
  101. Some files were not shown because too many files have changed in this diff Show More

0
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/StationRealVo.java

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

@ -146,7 +146,7 @@ public interface HomePageConstant {
// 水利-泵组实时属性名称 // 水利-泵组实时属性名称
String JOINT_RELAY = "joint_relay"; // 开机状态 String JOINT_RELAY = "joint_relay"; // 开机状态
String SWITCH_ON_OFF = "switch_on_off"; // 开机状态 String SWITCH_ON_OFF = "switch_on_off"; // 开机状态
String OFF = "1"; // 开机 String OFF = "1.0"; // 开机
String ON = "0"; // 关机 String ON = "0"; // 关机
String ELECTRICITY_CONSUMPTION = "electricity_consumption"; // 用电量 String ELECTRICITY_CONSUMPTION = "electricity_consumption"; // 用电量

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealAttributeVo.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealAttributeVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.station.vo; package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealDeviceVo.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.station.vo; package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/RealStationVo.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.station.vo; package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/WeatherVo.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WeatherVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.station.vo; package com.hnac.hzims.operational.main.vo;
import lombok.Data; import lombok.Data;

1
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java

@ -53,6 +53,7 @@ public class MessageConstants {
DUTY("duty","值班消息"), DUTY("duty","值班消息"),
SAFE("safe","安全消息"), SAFE("safe","安全消息"),
ACCESS("access","检修消息"), ACCESS("access","检修消息"),
TICKETMESSAGE("ticket-message","工作票消息"),
; ;
@Getter @Getter
private String key; private String key;

132
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/WorkTicketConstants.java

@ -2,77 +2,85 @@ package com.hnac.hzims.ticket.constants;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
/** /**
* 工作票中所需常数定义 * 工作票中所需常数定义
*
* @author hx * @author hx
*/ */
public interface WorkTicketConstants { public interface WorkTicketConstants {
@AllArgsConstructor @AllArgsConstructor
enum WorkTicketMeasureTypeEnum { enum WorkTicketMeasureTypeEnum {
/**第一种安措**/ /** 第一种安措 **/
ONE("1","matterLibraryListOne"), ONE("1", "matterLibraryListOne"),
/**第二种安措**/ /** 第二种安措 **/
TWO("2","matterLibraryListTwo"), TWO("2", "matterLibraryListTwo"),
/**第三种安措**/ /** 第三种安措 **/
THREE("3","matterLibraryListThree"), THREE("3", "matterLibraryListThree"),
FOUR("4","matterLibraryListFour"), FOUR("4", "matterLibraryListFour"),
Five("5","matterLibraryListFive"), Five("5", "matterLibraryListFive"),
Flow("6","matterLibraryListFlow"), Flow("6", "matterLibraryListFlow"),
; //第二种工作票
@Getter SEVEN("7", "matterLibraryListSeven"),
private String type; //水力机器工作票
@Getter EIGHT("8", "matterLibraryListEight"),
private String convertAttributes; NINE("9", "matterLibraryListNine"),
} TEN("10", "matterLibraryListTen"),
;
@Getter
private String type;
@Getter
private String convertAttributes;
}
@AllArgsConstructor @AllArgsConstructor
enum FirstWorkTicketStatusEnum { enum FirstWorkTicketStatusEnum {
/**签发**/ /** 签发 **/
SIGN(1,"签发"), SIGN(1, "签发"),
/**收到工作票**/ /** 收到工作票 **/
RECEIVE(2,"收到工作票"), RECEIVE(2, "收到工作票"),
/**许可人许可**/ /** 许可人许可 **/
LICENSE(3,"许可人许可"), LICENSE(3, "许可人许可"),
/**确认条件具备**/ /** 确认条件具备 **/
CONFIRM_MEASURE(4,"确认条件具备"), CONFIRM_MEASURE(4, "确认条件具备"),
/**工作负责人确认工作**/ /** 工作负责人确认工作 **/
CONFIRM_WORK(5,"工作负责人确认工作"), CONFIRM_WORK(5, "工作负责人确认工作"),
/**许可人确认工作结束**/ /** 许可人确认工作结束 **/
WORK_FINISH(6,"许可人确认工作结束"), WORK_FINISH(6, "许可人确认工作结束"),
/**工作票终结**/ /** 工作票终结 **/
TICKET_FINISH(7,"工作票终结"), TICKET_FINISH(7, "工作票终结"),
/**结束**/ /** 结束 **/
FINISH(8,"结束"), FINISH(8, "结束"),
/**许可人延期确认**/ /** 许可人延期确认 **/
LICENSE_DELAY(9,"许可人延期确认"), LICENSE_DELAY(9, "许可人延期确认"),
/**负责人延期确认**/ /** 负责人延期确认 **/
CONFIRM_DELAY(10,"负责人延期确认"), CONFIRM_DELAY(10, "负责人延期确认"),
/**作废**/ /** 作废 **/
INVALID(11,"作废"), INVALID(11, "作废"),
/**逾期**/ /** 逾期 **/
OVERDUE(12,"逾期"), OVERDUE(12, "逾期"),
/**线下开票**/ /** 线下开票 **/
OFFLINE(13,"线下开票"), OFFLINE(13, "线下开票"),
/**线下执行任务**/ /** 线下执行任务 **/
OFFLINE_OPERATE(14,"线下执行任务"), OFFLINE_OPERATE(14, "线下执行任务"),
/**线下许可人许可**/ /** 线下许可人许可 **/
OFFLINE_LICENSE(15,"线下许可人许可"), OFFLINE_LICENSE(15, "线下许可人许可"),
/**线下结束**/ /** 线下结束 **/
OFFLINE_END(16,"线下结束") OFFLINE_END(16, "线下结束");
; @Getter
@Getter private Integer status;
private Integer status; @Getter
@Getter private String description;
private String description;
public static FirstWorkTicketStatusEnum getEnumByStatus(Integer status) { public static FirstWorkTicketStatusEnum getEnumByStatus(Integer status) {
Optional<FirstWorkTicketStatusEnum> statusOptional = Arrays.stream(FirstWorkTicketStatusEnum.class.getEnumConstants()) Optional<FirstWorkTicketStatusEnum> statusOptional = Arrays.stream(FirstWorkTicketStatusEnum.class.getEnumConstants())
.filter(e-> status.equals(e.getStatus())).findAny(); .filter(e -> status.equals(e.getStatus())).findAny();
return statusOptional.orElse(null); return statusOptional.orElse(null);
} }
} }
} }

11
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java

@ -316,8 +316,8 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
/** /**
* 工作条件false 停电 true 不停电 * 工作条件false 停电 true 不停电
*/ */
@ApiModelProperty("工作条件(false 停电 true 不停电)") @ApiModelProperty("工作条件(停电或不停电)")
private Boolean isPower; private String power;
/** /**
@ -414,6 +414,13 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
/** /**
* 用户Id
*/
@ApiModelProperty("用户Id")
private String flowUserId;
/**
* 当前任务名 * 当前任务名
*/ */
@ApiModelProperty("当前任务名") @ApiModelProperty("当前任务名")

65
hzims-service/hzims-scheduled/pom.xml

@ -2,15 +2,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>hzims-service</artifactId> <artifactId>hzims-service</artifactId>
<version>4.0.0-SNAPSHOT</version> <version>4.0.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hzims-scheduled</artifactId> <artifactId>hzims-scheduled</artifactId>
<packaging>jar</packaging>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
@ -81,42 +81,6 @@
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId> <artifactId>xxl-job-core</artifactId>
</dependency> </dependency>
<!-- 月报统计图表导出-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.24</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.hikvision.ga</groupId>
<artifactId>artemis-http-client</artifactId>
</dependency>
<!-- ApacheHttp请求工具 Start -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- ApacheHttp请求工具 End -->
<!-- freemark,用于导出word Start-->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<!-- freemark,用于导出word End-->
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>equipment-api</artifactId> <artifactId>equipment-api</artifactId>
@ -146,47 +110,22 @@
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId> <artifactId>javase</artifactId>
</dependency> </dependency>
<!--${bladex.project.version}-->
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-user-api</artifactId> <artifactId>blade-user-api</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId> <artifactId>commons-collections4</artifactId>
</dependency> </dependency>
<!-- spring-boot-websocket start -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-http -->
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId> <artifactId>hutool-http</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-core -->
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId> <artifactId>hutool-core</artifactId>
</dependency> </dependency>
<!--WebSocket核心依赖包-->
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
</dependency>
<!-- spring-boot-websocket end -->
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-resource-api</artifactId> <artifactId>blade-resource-api</artifactId>

59
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java

@ -1,59 +0,0 @@
// package com.hnac.hzims.scheduled.config;
//
// import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
// import lombok.extern.slf4j.Slf4j;
// import org.springframework.beans.factory.annotation.Value;
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.ComponentScan;
// import org.springframework.context.annotation.Configuration;
//
// /**
// * @Author WL
// * @Version v1.0
// * @Serial 1.0
// * @Date 2022/1/8 10:23
// */
// @Slf4j
// @Configuration
// //指定任务Handler所在包路径
// public class XxlJobConfig {
//
//
// @Value("${xxl.job.admin.addresses}")
// private String adminAddresses;
//
// @Value("${xxl.job.executor.appname}")
// private String appName;
//
// @Value("${xxl.job.executor.ip}")
// private String ip;
//
// @Value("${xxl.job.executor.port}")
// private int port;
//
// @Value("${xxl.job.accessToken}")
// private String accessToken;
//
// @Value("${xxl.job.executor.logpath}")
// private String logPath;
//
// @Value("${xxl.job.executor.logretentiondays}")
// private int logRetentionDays;
//
//
// @Bean(initMethod = "start", destroyMethod = "destroy")
// public XxlJobSpringExecutor xxlJobExecutor() {
// log.info("====xxl-job config init====");
// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
// xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
// xxlJobSpringExecutor.setAppName(appName);
// xxlJobSpringExecutor.setIp(ip);
// xxlJobSpringExecutor.setPort(port);
// xxlJobSpringExecutor.setAccessToken(accessToken);
// xxlJobSpringExecutor.setLogPath(logPath);
// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
// return xxlJobSpringExecutor;
// }
//
// }
//

10
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/WorkshopInfoMapper.java

@ -0,0 +1,10 @@
package com.hnac.hzims.scheduled.mapper.equipment;
import com.hnac.hzims.equipment.entity.WorkshopInfoEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface WorkshopInfoMapper extends UserDataScopeBaseMapper<WorkshopInfoEntity> {
}

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.java

@ -1,20 +1,14 @@
package com.hnac.hzims.scheduled.mapper.operation; package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List; import java.util.List;
/** /**
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:30
*/ */
public interface AbnormalAlarmMapper extends UserDataScopeBaseMapper<AbnormalAlarmEntity>{ public interface AbnormalAlarmMapper extends UserDataScopeBaseMapper<AbnormalAlarmEntity> {
AbnormalAlarmEntity getAbnormalAlarm(@Param("stationId") String stationId, @Param("type") String type); List<String> abnormalAlarms();
List<String> getAbnormalAlarmList();
} }

17
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/GenerateMapper.java

@ -0,0 +1,17 @@
package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
* @author ysj
* @date 2023/04/10 11:22:14
* @version 4.0.0
*/
public interface GenerateMapper extends UserDataScopeBaseMapper<GenerateEntity> {
List<GenerateEntity> records(@Param("date") String date,@Param("station") String station);
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.java

@ -1,21 +0,0 @@
package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:12
*/
public interface HistoryAbnormalAlarmMapper extends UserDataScopeBaseMapper<HistoryAbnormalAlarmEntity> {
List<HistoryAbnormalAlarmEntity> getHistoryAbnormalAlarm(@Param("stationId") String stationId, @Param("type") String type);
}

9
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HzimsAnalyzeModelStationMapper.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/ModelStationMapper.java

@ -3,11 +3,10 @@ package com.hnac.hzims.scheduled.mapper.operation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
/** /**
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/22 11:43
*/ */
public interface HzimsAnalyzeModelStationMapper extends BaseMapper<HzimsAnalyzeModelStationEntity> { public interface ModelStationMapper extends BaseMapper<HzimsAnalyzeModelStationEntity> {
} }

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PowerMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface PowerMapper extends UserDataScopeBaseMapper<PowerEntity> {
}

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/RecordMapper.java

@ -1,14 +1,17 @@
package com.hnac.hzims.scheduled.mapper.operation; package com.hnac.hzims.scheduled.mapper.operation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity;
import com.hnac.hzims.operational.config.vo.StAlarmRecordVo;
import java.util.List;
/** /**
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 15:47
*/ */
public interface StAlarmRecordMapper extends BaseMapper<StAlarmRecordEntity> { public interface RecordMapper extends BaseMapper<StAlarmRecordEntity> {
Long insertReturnId(StAlarmRecordEntity record); Long insertReturnId(StAlarmRecordEntity record);
} }

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StFocusPropertiesMapper.java

@ -1,13 +0,0 @@
package com.hnac.hzims.scheduled.mapper.operation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:28
*/
public interface StFocusPropertiesMapper extends BaseMapper<StFocusPropertiesEntity> {
}

6
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttrConfigMapper.java

@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity;
/** /**
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 16:09
*/ */
public interface StationAttrConfigMapper extends BaseMapper<StationAttrConfigEntity> { public interface StationAttrConfigMapper extends BaseMapper<StationAttrConfigEntity> {
} }

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationAttributeMapper.java

@ -1,13 +1,16 @@
package com.hnac.hzims.scheduled.mapper.operation; package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity; import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/** /**
* @Author WL * @author hx
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:39
*/ */
@Mapper
public interface StationAttributeMapper extends UserDataScopeBaseMapper<StationAttributeEntity> { public interface StationAttributeMapper extends UserDataScopeBaseMapper<StationAttributeEntity> {
List<StationAttributeEntity> PointUnit();
} }

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.java

@ -1,21 +1,12 @@
package com.hnac.hzims.scheduled.mapper.operation; package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/** /**
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:36
*/ */
public interface StationMapper extends UserDataScopeBaseMapper<StationEntity> { public interface StationMapper extends UserDataScopeBaseMapper<StationEntity> {
List<StationEntity> selectStationByType(Integer stationType, Integer serveType);
List<StationEntity> selectAll();
List<StationEntity> selectStationByInCode(List<String> codes);
} }

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/UseMapper.java

@ -0,0 +1,13 @@
package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
* @date 2023/04/10 11:22:14
* @version 4.0.0
*/
public interface UseMapper extends UserDataScopeBaseMapper<UseEntity> {
}

65
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java

@ -0,0 +1,65 @@
package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.operation.MonitorService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import static com.hnac.hzims.operational.main.constant.MainConstants.*;
/**
* @author ysj
*/
@Slf4j
@Component
public class MonitorScheduledTask {
@Autowired
private MonitorService service;
/**
* realId刷新
*/
@XxlJob(REAL_ID_DATA)
public ReturnT<String> loadRealId(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadRealId(param);
return new ReturnT<>("SUCCESS");
}
/**
* 实时数据刷新
* @return ReturnT<String>
*/
@XxlJob(REAL_TIME_DATA)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealData(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadRealData(param);
return new ReturnT<>("SUCCESS");
}
/**
* 集中监控数据处理
* @return ReturnT<String>
*/
@XxlJob(CENTRALIZED_MONITORING)
public ReturnT<String> loadMonitoring(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadMonitoring(param);
return new ReturnT<>("SUCCESS");
}
}

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

@ -0,0 +1,126 @@
package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.scheduled.service.operation.RealTargetService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
import static com.hnac.hzims.operational.main.constant.MainConstants.*;
/**
* @author ysj
*/
@Slf4j
@Component
public class RealTargetScheduledTask {
@Autowired
private RealTargetService service;
/**
* 水电站-机组实时加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
public ReturnT<String> loadHydropowerReal(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadHydropowerReal(param);
return new ReturnT<>("SUCCESS");
}
/**
* 水电站-机组指标加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
public ReturnT<String> loadHydropowerTarget(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadHydropowerTarget(param);
return new ReturnT<>("SUCCESS");
}
/**
* 水利-泵组实时加载
*/
@XxlJob(LOAD_WATER_PUMP_REAL)
public ReturnT<String> loadWaterPumpReal(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadWaterPumpReal(param);
return new ReturnT<>("SUCCESS");
}
/**
* 水利-泵组指标加载
*/
@XxlJob(LOAD_WATER_PUMP_TARGET)
public ReturnT<String> loadWaterPumpTarget(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadWaterPumpTarget(param);
return new ReturnT<>("SUCCESS");
}
/**
* 水利-站点水位数据
*/
@XxlJob(LOAD_WATER_LEVEL)
public ReturnT<String> loadWaterLevel(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadWaterLevel(param);
return new ReturnT<>("SUCCESS");
}
/**
* 光伏站-逆变器实时加载
*/
@XxlJob(LOAD_PHOTOVOLTAIC_REAL)
public ReturnT<String> loadPhotovoltaicReal(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadPhotovoltaicReal(param);
return new ReturnT<>("SUCCESS");
}
/**
* 光伏站-逆变器指标加载
*/
@XxlJob(LOAD_PHOTOVOLTAIC_TARGET)
public ReturnT<String> loadPhotovoltaicTarget(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadPhotovoltaicTarget(param);
return new ReturnT<>("SUCCESS");
}
/**
* 获取站点近3年发电量数据
*/
@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
public ReturnT<String> loadPowerData(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3);
return new ReturnT<>("SUCCESS");
}
}

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java

@ -0,0 +1,14 @@
package com.hnac.hzims.scheduled.scheduled;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author ysj
*/
@Slf4j
@Component
public class ReportScheduledTask {
}

54
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java

@ -1,54 +0,0 @@
package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.IWaterService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import static com.hnac.hzims.operational.main.constant.MainConstants.LOAD_WATER_LEVEL;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/22 11:21
*/
@Slf4j
@Component
public class ScheduledCreateTask {
@Autowired
private IWaterService waterService;
/**
* 水利-站点水位数据
* @return ReturnT<String>
*/
@XxlJob(LOAD_WATER_LEVEL)
public ReturnT<String> loadWaterLevel(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
waterService.loadWaterLevel(param);
return new ReturnT<>("SUCCESS");
}
/**
* 水利-站点水位数据
* @return ReturnT<String>
*/
@XxlJob("cheshi")
public ReturnT<String> cheshi(String param) throws Exception {
System.out.println("执行呢方法");
return new ReturnT<>("SUCCESS");
}
}

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java

@ -0,0 +1,14 @@
package com.hnac.hzims.scheduled.scheduled;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author ysj
*/
@Slf4j
@Component
public class ShowScheduledTask {
}

101
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StAlamRecordTask.java

@ -1,101 +0,0 @@
package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.AbnormalAlarmService;
import com.hnac.hzims.scheduled.service.IRealMonitorService;
import com.hnac.hzims.scheduled.service.StFocusPropertiesService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
import static com.hnac.hzims.operational.main.constant.MainConstants.*;
/**
* 集中监控
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:17
*/
@Slf4j
@Component
public class StAlamRecordTask {
@Value("${hzims.operation.comprehensiveD}")
public String path;
// @Autowired
private IRealMonitorService monitorService;
@Autowired
private AbnormalAlarmService abnormalAlarmService;
@Autowired
private StFocusPropertiesService stFocusPropertiesService;
/**
* 数据中断告警
* @return ReturnT<String>
*/
@XxlJob(ALARM_DATA_HANDLE)
public ReturnT<String> alarmDataHandle(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
abnormalAlarmService.alarmDataHandle(param);
return new ReturnT<>("SUCCESS");
}
/**
* realId获取
* @return ReturnT<String>
*/
@XxlJob(REAL_ID_DATA)
public ReturnT<String> realIdData(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
stFocusPropertiesService.getStationRealIds(param);
return new ReturnT<>("SUCCESS");
}
/**
* 站点实时数据
* @return ReturnT<String>
*/
@XxlJob(REAL_TIME_DATA)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> realTimeData(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
monitorService.realTimeData(param);
return new ReturnT<>("SUCCESS");
}
/**
* 集中监控数据处理
* @return ReturnT<String>
*/
@XxlJob(CENTRALIZED_MONITORING)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> centralizedMonitoring(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
monitorService.centralizedMonitoring(param);
return new ReturnT<>("SUCCESS");
}
}

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

@ -1,16 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:09
*/
public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormalAlarmEntity> {
HistoryAbnormalAlarmEntity getAbnormalAlarm(String station, String soeType);
}

17
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IHzimsAnalyzeModelStationService.java

@ -1,17 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/22 11:31
*/
public interface IHzimsAnalyzeModelStationService extends BaseService<HzimsAnalyzeModelStationEntity> {
}

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

@ -1,16 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 14:00
*/
public interface IMainSystemMonitoringService {
List<EminfoAndEmParamVo> getEmInfoList();
}

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IRealMonitorService.java

@ -1,13 +0,0 @@
package com.hnac.hzims.scheduled.service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:20
*/
public interface IRealMonitorService {
void realTimeData(String param);
void centralizedMonitoring(String param);
}

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

@ -1,16 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 16:06
*/
public interface IStationAttrConfigService extends BaseService<StationAttrConfigEntity> {
List<String> getHideList();
}

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationAttributeService.java

@ -1,13 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:34
*/
public interface IStationAttributeService extends BaseService<StationAttributeEntity> {
}

27
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IStationService.java

@ -1,27 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.hnac.hzims.operational.station.entity.StationEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.ArrayList;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:33
*/
public interface IStationService extends BaseService<StationEntity> {
List<StationEntity> getStationByType(Integer stationType, Integer serveType);
List<StationEntity> getAll();
List<StationEntity> getStationByInCode(List<String> strings);
List<StationEntity> getStationType(Integer serveType,List<Integer> typeList,List<Long> departIdList);
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/IWaterService.java

@ -1,11 +0,0 @@
package com.hnac.hzims.scheduled.service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/22 11:22
*/
public interface IWaterService {
void loadWaterLevel(String param);
}

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StAlamRecordService.java

@ -1,14 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 15:41
*/
public interface StAlamRecordService extends BaseService<StAlarmRecordEntity> {
Long insertAlert(String stationId, String monitorId);
}

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/StFocusPropertiesService.java

@ -1,14 +0,0 @@
package com.hnac.hzims.scheduled.service;
import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:21
*/
public interface StFocusPropertiesService extends BaseService<StFocusPropertiesEntity> {
void getStationRealIds(String param);
}

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/WorkshopInfoService.java

@ -0,0 +1,12 @@
package com.hnac.hzims.scheduled.service.equipment;
import com.hnac.hzims.equipment.entity.WorkshopInfoEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author hx
*/
public interface WorkshopInfoService extends BaseService<WorkshopInfoEntity> {
}

20
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java

@ -0,0 +1,20 @@
package com.hnac.hzims.scheduled.service.equipment.impl;
import com.hnac.hzims.equipment.entity.WorkshopInfoEntity;
import com.hnac.hzims.scheduled.mapper.equipment.WorkshopInfoMapper;
import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService;
import groovy.util.logging.Slf4j;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author hx
*/
@Service
@AllArgsConstructor
@Slf4j
public class WorkshopInfoServiceImpl extends BaseServiceImpl<WorkshopInfoMapper, WorkshopInfoEntity> implements WorkshopInfoService {
}

242
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/AbnormalAlarmServiceImpl.java

@ -1,242 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper;
import com.hnac.hzims.scheduled.service.AbnormalAlarmService;
import com.hnac.hzims.scheduled.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.scheduled.service.IStationService;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:29
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMapper, AbnormalAlarmEntity> implements AbnormalAlarmService {
private final IStationService stationService;
private final HistoryAbnormalAlarmService historyAbnormalAlarmService;
private final ISysClient sysClient;
private final ISoeClient soeClient;
private final IUserClient userClient;
private final IMessageClient messageClient;
/**
* 数据中断数据异常告警
* @param param
*/
@Override
public void alarmDataHandle(String param) {
// 查询代运维站点
List<StationEntity> stations = stationService.getStationByType(null, HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stations)){
return;
}
SoeQueryConditionByStation query = new SoeQueryConditionByStation();
query.setTypes(AbnormalAlarmConstant.SEND_MESSSAGE_TYPE_LIST);
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Calendar calendar = Calendar.getInstance();
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
calendar.add(Calendar.MINUTE,-2);
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false);
log.error("alarm_data_handle_param : {}",query);
Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query);
// 未查询到告警信息
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData().getRecords())){
return;
}
log.error("alarm_data_handle_begin_result : {}",result.getData().getRecords());
// 遍历告警信息
List<SoeData> list = new ArrayList<>(result.getData().getRecords().stream().sorted(Comparator.comparing(SoeData::getTs).reversed())
.collect(Collectors.toMap(o -> o.getStation() + o.getSoeType(), Function.identity(), (o1, o2) -> o1)).values());
log.error("alarm_data_handle_end_result : {}",list);
list.forEach(item -> {
AbnormalAlarmEntity queryEntity = this.baseMapper.getAbnormalAlarm(item.getStation(),item.getSoeType());
boolean flag = AbnormalAlarmConstant.ABNORMAL_STATUS.equals(item.getSoeAlarmType());
String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null);
if(ObjectUtil.isEmpty(queryEntity)){
AbnormalAlarmEntity entity = new AbnormalAlarmEntity();
entity.setStationId(item.getStation());
entity.setStationName(stationName);
entity.setRealId(item.getRealId());
entity.setSoeExplain(item.getSoeExplain());
entity.setType(item.getSoeType());
entity.setStartTime(item.getTs());
entity.setEndTime(null);
entity.setStatus(0);
if(flag){
entity.setStartTime(null);
entity.setEndTime(item.getTs());
entity.setStatus(1);
}
// 保存告警信息
this.save(entity);
return;
}
queryEntity.setSoeExplain(item.getSoeExplain());
queryEntity.setStationName(stationName);
queryEntity.setType(item.getSoeType());
queryEntity.setStartTime(queryEntity.getStartTime());
queryEntity.setUpdateTime(new Date());
queryEntity.setEndTime(null);
queryEntity.setStatus(0);
if(flag){
queryEntity.setEndTime(item.getTs());
queryEntity.setStatus(1);
}
this.updateById(queryEntity);
});
// 异步保存历史告警
CompletableFuture.supplyAsync(()-> this.saveHistoryAlarm(result.getData().getRecords(),stations));
}
/**
* 保存告警历史信息
* @param list
* @return
*/
private String saveHistoryAlarm(List<SoeData> list,List<StationEntity> stations) {
list.forEach(item -> {
Date ts = DateUtil.parse(DateUtil.format(item.getTs(),DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMAT);
// 历史数据异常查询
HistoryAbnormalAlarmEntity queryEntity = this.historyAbnormalAlarmService.getAbnormalAlarm(item.getStation(),item.getSoeType());
// 数据中断恢复
boolean flag = AbnormalAlarmConstant.ABNORMAL_STATUS.equals(item.getSoeAlarmType());
String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null);
if(ObjectUtil.isEmpty(queryEntity) || !flag){
HistoryAbnormalAlarmEntity entity = new HistoryAbnormalAlarmEntity();
entity.setAlarmId(item.getId());
entity.setStationId(item.getStation());
entity.setStationName(stationName);
entity.setRealId(item.getRealId());
entity.setSoeExplain(item.getSoeExplain());
entity.setType(item.getSoeType());
entity.setStartTime(ts);
entity.setStatus(0);
this.historyAbnormalAlarmService.save(entity);
// 消息推送
this.sendAlarmMessage(Collections.singletonList(entity),stations);
return;
}
queryEntity.setSoeExplain(item.getSoeExplain());
queryEntity.setUpdateTime(new Date());
queryEntity.setEndTime(ts);
queryEntity.setStatus(1);
this.historyAbnormalAlarmService.updateById(queryEntity);
});
return "success";
}
/**
* 告警消息推送
* @param entitys
*/
private void sendAlarmMessage(List<HistoryAbnormalAlarmEntity> entitys,List<StationEntity> stations) {
if(CollectionUtil.isEmpty(entitys)){
return;
}
// 告警等级 :事故、数据中断
List<HistoryAbnormalAlarmEntity> alarms = entitys.stream().filter(entity -> AbnormalAlarmConstant.SEND_MESSSAGE_TYPE_LIST.contains(entity.getType())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(alarms)){
return;
}
// 查询站点用户
entitys.forEach(entity->{
if(StringUtil.isEmpty(entity.getStationId())){
return;
}
List<Long> depts = stations.stream().filter(station -> station.getCode().equals(entity.getStationId())).map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(depts)){
return;
}
// 获取站点用户
R<List<User>> result = userClient.userListByDeptId(depts.get(0));
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return;
}
MessagePushRecordDto message = new MessagePushRecordDto();
message.setBusinessClassify("warning");
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey());
message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription());
message.setTaskId(entity.getId());
message.setTenantId("200000");
message.setContent(entity.getSoeExplain());
message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
message.setPushType(MessageConstants.IMMEDIATELY);
message.setDeptId(depts.get(0));
R<String> deptName = sysClient.getDeptName(depts.get(0));
if (deptName.isSuccess()) {
message.setDeptName(deptName.getData());
}
User admin = userClient.userByAccount("200000", "admin").getData();
message.setCreateDept(admin.getCreateDept());
message.setCreateUser(admin.getCreateUser());
result.getData().forEach(user->{
message.setPusher(String.valueOf(user.getId()));
message.setPusherName(user.getName());
message.setAccount(String.valueOf(user.getId()));
messageClient.sendMessage(message);
});
});
}
/**
* 查询实时告警数据
* @return
*/
@Override
public List<String> getAbnormalAlarmList() {
List<String> alarmList = this.baseMapper.getAbnormalAlarmList();
if(CollectionUtil.isEmpty(alarmList)){
return new ArrayList<>();
}
return alarmList;
}
}

41
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -1,41 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.scheduled.mapper.operation.HistoryAbnormalAlarmMapper;
import com.hnac.hzims.scheduled.service.HistoryAbnormalAlarmService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:12
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbnormalAlarmMapper, HistoryAbnormalAlarmEntity> implements HistoryAbnormalAlarmService {
/**
* 查询单条历史告警
*
* @param station
* @param soeType
* @return
*/
@Override
public HistoryAbnormalAlarmEntity getAbnormalAlarm(String station, String soeType) {
List<HistoryAbnormalAlarmEntity> alarms = this.baseMapper.getHistoryAbnormalAlarm(station, soeType);
if(CollectionUtil.isEmpty(alarms)){
return null;
}
return alarms.stream().sorted(Comparator.comparing(HistoryAbnormalAlarmEntity::getStartTime)).collect(Collectors.toList()).get(0);
}
}

17
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/HzimsAnalyzeModelStationServiceImpl.java

@ -1,17 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.scheduled.mapper.operation.HzimsAnalyzeModelStationMapper;
import com.hnac.hzims.scheduled.service.IHzimsAnalyzeModelStationService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/22 11:42
*/
@Service
public class HzimsAnalyzeModelStationServiceImpl extends BaseServiceImpl<HzimsAnalyzeModelStationMapper, HzimsAnalyzeModelStationEntity> implements IHzimsAnalyzeModelStationService {
}

51
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/MainSystemMonitoringServiceImpl.java

@ -1,51 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.scheduled.service.IMainSystemMonitoringService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 14:01
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringService {
private final RedisTemplate redisTemplate;
@Value("${hzims.equipment.emInfo.emInfoList}")
public String emInfoListPath;
/**
* 从Redis获取设备信息
*
* @return
*/
@Override
public List<EminfoAndEmParamVo> getEmInfoList() {
List<EminfoAndEmParamVo> list = new ArrayList<>();
Object json = redisTemplate.opsForValue().get(emInfoListPath);
if (ObjectUtil.isNotEmpty(json)) {
list = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() {
});
}
return list;
}
}

164
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StFocusPropertiesServiceImpl.java

@ -1,164 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import com.hnac.hzims.equipment.entity.WorkshopInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IWorkshopInfoClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.operation.StFocusPropertiesMapper;
import com.hnac.hzims.scheduled.service.IStationAttributeService;
import com.hnac.hzims.scheduled.service.IStationService;
import com.hnac.hzims.scheduled.service.StFocusPropertiesService;
import com.hnac.hzims.scheduled.vo.StationRealVo;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.RequiredArgsConstructor;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:27
*/
@Service
@RequiredArgsConstructor
public class StFocusPropertiesServiceImpl extends BaseServiceImpl<StFocusPropertiesMapper, StFocusPropertiesEntity> implements StFocusPropertiesService {
private final IStationService stationService;
private final IStationAttributeService attbtService;
private final IEmInfoClient emInfoClient;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final IWorkshopInfoClient workshopInfoClient;
private final RedisTemplate redisTemplate;
private final BladeLogger logger;
@Value("${hzims.operation.monitor.realId}")
public String moniter_realId_key;
@Value("${hzims.equipment.emInfo.emInfoList}")
public String em_info_list_path;
@Override
public void getStationRealIds(String param) {
// 所有站点
List<StationEntity> stationList = stationService.getAll();
if(CollectionUtil.isEmpty(stationList)){
return;
}
// 设备监测点list
Object json = redisTemplate.opsForValue().get(em_info_list_path);
List<EminfoAndEmParamVo> eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 厂房监测点list
List<AnalyzeCodeBySignagesVO> wsMonitorList = this.getRealIdByWsCodeAndSign();
// 实时监控监测点list
List<StationAttributeEntity> timeList = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{
eq(StationAttributeEntity::getIsDeleted, "0");
isNotNull(StationAttributeEntity::getMonitorId);
orderByAsc(StationAttributeEntity::getSort);
}});
// 监测点存储list
List<StationRealVo> list = new ArrayList<>();
stationList.forEach(station->{
StationRealVo stationRealVo = new StationRealVo();
stationRealVo.setStation(station.getCode());
List<String> realDeviceList = this.getRealDeviceList(station.getRefDept(),eminfoAndEmParams);
// 厂站匹配站点监测点集合
List<String> realWsList = wsMonitorList.stream().filter(
o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode())
).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList());
// 实时监控匹配站点监测点集合
List<String> realTimeList = timeList.stream().filter(o -> null != o.getStationId() && o.getStationId().equals(station.getCode())).map(StationAttributeEntity::getMonitorId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(realTimeList)){
realDeviceList.addAll(realTimeList);
}
if(CollectionUtil.isNotEmpty(realWsList)) {
realDeviceList.addAll(realWsList);
}
if(CollectionUtil.isEmpty(realDeviceList)){
return;
}
List<String> realList = realDeviceList.stream().distinct().collect(Collectors.toList());
String[] realArr = StringUtil.join(realList,",").split(",");
stationRealVo.setRealId(realArr);
list.add(stationRealVo);
});
redisTemplate.opsForValue().set(moniter_realId_key,list);
}
private List<AnalyzeCodeBySignagesVO> getRealIdByWsCodeAndSign() {
R<List<WorkshopInfoEntity>> wsInfoListR = workshopInfoClient.getAllWorkshop();
List<WorkshopInfoEntity> wsInfoList = Optional.ofNullable(wsInfoListR).filter(r -> r.isSuccess() && CollectionUtil.isNotEmpty(wsInfoListR.getData()))
.map(R::getData).orElse(null);
if(CollectionUtil.isEmpty(wsInfoList)) {
return Lists.newArrayList();
}
Function<String, MultiAnalyzeCodePO> getAnalyzeCodePO = wsCode -> {
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(wsCode);
multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY,HomePageConstant.PV_REACTIVE_POWER,HomePageConstant.PV_GENERATION_CAPACITY));
return multiAnalyzeCodePO;
};
List<MultiAnalyzeCodePO> analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList());
R<List<AnalyzeCodeBySignagesVO>> analyzeCodeBySignages = analyseDataSearchClient.getAnalyzeCodeBySignages(analyzeCodePOList);
return Optional.ofNullable(analyzeCodeBySignages).filter(r -> r.isSuccess()).map(R::getData).orElse(Lists.newArrayList());
}
/**
* 获取站点realId
* @param refDept
* @param eminfoAndEmParams
* @return
*/
private List<String> getRealDeviceList(Long refDept, List<EminfoAndEmParamVo> eminfoAndEmParams) {
// 参数检查
if(CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)){
return new ArrayList<>();
}
// 有效设备
List<EminfoAndEmParamVo> filters = eminfoAndEmParams.stream().filter(o-> o.getCreateDept().equals(refDept)).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filters)){
return new ArrayList<>();
}
// 遍历设备
List<String> result = new ArrayList<>();
for(EminfoAndEmParamVo device : filters){
result.addAll(device.getPoint().values());
}
return result;
}
}

22
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttributeServiceImpl.java

@ -1,22 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.scheduled.mapper.operation.StationAttributeMapper;
import com.hnac.hzims.scheduled.service.IStationAttributeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:39
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttributeMapper, StationAttributeEntity> implements IStationAttributeService {
}

60
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationServiceImpl.java

@ -1,60 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.operation.StationMapper;
import com.hnac.hzims.scheduled.service.IStationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:36
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEntity> implements IStationService {
@Override
public List<StationEntity> getStationByType(Integer stationType, Integer serveType) {
return this.baseMapper.selectStationByType(stationType, serveType);
}
@Override
public List<StationEntity> getAll() {
return this.baseMapper.selectAll();
}
@Override
public List<StationEntity> getStationByInCode(List<String> codes) {
return this.baseMapper.selectStationByInCode(codes);
}
@Override
public List<StationEntity> getStationType(Integer serveType, List<Integer> typeList, List<Long> departIdList) {
return this.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getIsDeleted, 0);
if (ObjectUtil.isNotEmpty(serveType)) {
eq(StationEntity::getServeType, serveType);
}
if (CollectionUtil.isNotEmpty(typeList)) {
in(StationEntity::getType, typeList);
}
if (CollectionUtil.isNotEmpty(departIdList)) {
in(StationEntity::getRefDept, departIdList);
}
}});
}
}

201
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/WaterServiceImpl.java

@ -1,201 +0,0 @@
package com.hnac.hzims.scheduled.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.WaterLevelVo;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.IHzimsAnalyzeModelStationService;
import com.hnac.hzims.scheduled.service.IStationService;
import com.hnac.hzims.scheduled.service.IWaterService;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/22 11:23
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class WaterServiceImpl implements IWaterService {
private final IStationService stationService;
private final IHzimsAnalyzeModelStationService modelStationService;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final RedisTemplate redisTemplate;
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
/**
* 水利-站点水位数据
* @param param
*/
@Override
public void loadWaterLevel(String param) {
// 有效站点模型
List<HzimsAnalyzeModelStationEntity> modelList = getModelStationList();
if(CollectionUtil.isEmpty(modelList)){
return;
}
List<WaterLevelVo> list = new ArrayList<>();
modelList.forEach(item -> {
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = new ArrayList<>();
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode());
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return;
}
WaterLevelVo waterLevelVo = new WaterLevelVo();
waterLevelVo.setStationCode(item.getStationId());
// 前水位
double frontWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
waterLevelVo.setFrontWaterLevel(frontWaterLevel);
// 后水位
double rearWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
waterLevelVo.setRearWaterLevel(rearWaterLevel);
// 前水位当日曲线
Map<Integer,String> frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
waterLevelVo.setFrontCurveMap(frontCurveMap);
// 后水位当日曲线
Map<Integer,String> rearCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
waterLevelVo.setRearCurveMap(rearCurveMap);
list.add(waterLevelVo);
});
redisTemplate.opsForValue().set(loadwater_level_key,list);
}
/**
* 获取水位实时数据
* @param instanceCode
* @param signage
* @return
*/
private double getWaterLevel(String instanceCode, String signage) {
RealDataSearchPO realData = new RealDataSearchPO();
realData.setAnalyzeCode(instanceCode);
List<String> signages = Collections.singletonList(signage);
realData.setSignages(signages);
// 调用fegin接口查询实时数据
R<List<FieldsData>> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
return 0.0;
}
// 时间限制
String time = R.getData().get(0).getTime();
if(StringUtil.isEmpty(time) || "-".equals(time)){
return 0.0;
}
Date date = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss.sss");
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
return 0.0;
}
return Double.parseDouble(R.getData().get(0).getValue());
}
/**
* 获取水位当年数据
* @param instanceCode
* @param signage
* @return
*/
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER);
LocalDateTime endTime = LocalDateTime.now();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
analyzeDataConditionPO.setSignages(signage);
// 取数规则: 0=(整点值/最早值)、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值) 6=最新值
analyzeDataConditionPO.setAccessRules(EquipmentConstants.AccessRulesEnum.FINAL_CYCLE.getType());
// 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年)
analyzeDataConditionPO.setSaveTimeType(2);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(beginTime);
analyzeDataConditionPO.setEndTime(endTime);
signboardConditions.add(analyzeDataConditionPO);
po.setDeviceCode(instanceCode);
po.setSignboardConditions(signboardConditions);
R<List<AnalyzeDataConditionVO>> R = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
return null;
}
if(CollectionUtil.isEmpty(R.getData().get(0).getList())){
return null;
}
return R.getData().get(0).getList().stream().collect(Collectors.toMap(key-> {
Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s");
return dateTime.getHours();
}, value -> {
if(StringUtil.isBlank(value.getVal())){
return "0";
}
return value.getVal();
}));
}
/**
* 获取有效站点模型
* @return
*/
private List<HzimsAnalyzeModelStationEntity> getModelStationList() {
// 水利站点(All)
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, null, null);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
// 站点code集合
List<String> codes = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(codes)){
return null;
}
// 查询站点模型列表
List<HzimsAnalyzeModelStationEntity> list = modelStationService.list(new LambdaQueryWrapper<HzimsAnalyzeModelStationEntity>() {{
in(HzimsAnalyzeModelStationEntity::getStationId, codes);
}});
if(CollectionUtil.isEmpty(list)){
return null;
}
return list;
}
}

10
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/AbnormalAlarmService.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AbnormalAlarmService.java

@ -1,4 +1,4 @@
package com.hnac.hzims.scheduled.service; package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
@ -7,13 +7,9 @@ import java.util.List;
/** /**
* 告警处理接口 * 告警处理接口
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 10:20
*/ */
public interface AbnormalAlarmService extends BaseService<AbnormalAlarmEntity> { public interface AbnormalAlarmService extends BaseService<AbnormalAlarmEntity> {
void alarmDataHandle(String param);
List<String> getAbnormalAlarmList(); List<String> abnormalAlarms();
} }

22
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java

@ -0,0 +1,22 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import java.util.List;
import java.util.function.Function;
/**
* @author ysj
*/
public interface AnalyseDataService {
<T> List<AnalyzeCodeBySignagesVO> getAnalyzeCodeBySignages(Function<T, MultiAnalyzeCodePO> convert, T resource);
List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);
Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages);
}

25
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/GenerateService.java

@ -0,0 +1,25 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
public interface GenerateService extends BaseService<GenerateEntity> {
// 查询填报用电量
Float generate(String date,String station);
// 查询30天填报用电量
List<GenerationPowerVo> generate30Day(String day, String station);
// 获取站点填报发电量
List<PowerMonthVo> generateThreeYear(String start, String end, String station);
}

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ModelStationService.java

@ -0,0 +1,12 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface ModelStationService extends BaseService<HzimsAnalyzeModelStationEntity> {
}

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

@ -0,0 +1,16 @@
package com.hnac.hzims.scheduled.service.operation;
/**
* WEB水电站首页接口
* @author ysj
*/
public interface MonitorService {
// realId刷新
void loadRealId(String param);
// 集中监控数据处理
void loadMonitoring(String param);
void loadRealData(String param);
}

17
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PowerService.java

@ -0,0 +1,17 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @author ysj
*/
public interface PowerService extends BaseService<PowerEntity> {
Double generate(String date,Long station);
List<PowerMonthVo> generateThreeYear(String start,String end,Long station);
}

34
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java

@ -0,0 +1,34 @@
package com.hnac.hzims.scheduled.service.operation;
import java.util.List;
/**
* WEB水电站首页接口
* @author ysj
*/
public interface RealTargetService {
// 水电站实时数据加载
void loadHydropowerReal(String param);
// 水电站指标数据加载
void loadHydropowerTarget(String param);
// 泵站实时数据加载
void loadWaterPumpReal(String param);
// 泵站指标数据加载
void loadWaterPumpTarget(String param);
// 站点水位指标数据
void loadWaterLevel(String param);
// 光伏站实时数据加载
void loadPhotovoltaicReal(String param);
// 光伏站指标数据加载
void loadPhotovoltaicTarget(String param);
// 光伏、水电站近3年发电量
void loadPowerData(String param, List<Integer> types, Integer serveType, int year);
}

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RecordService.java

@ -0,0 +1,13 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface RecordService extends BaseService<StAlarmRecordEntity> {
Long insertAlert(String stationId, String monitorId);
}

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttrConfigService.java

@ -0,0 +1,14 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @author ysj
*/
public interface StationAttrConfigService extends BaseService<StationAttrConfigEntity> {
List<String> getHideList();
}

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationAttributeService.java

@ -0,0 +1,14 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.Map;
/**
* @author hx
*/
public interface StationAttributeService extends BaseService<StationAttributeEntity> {
Map<String,String> PointUnit();
}

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/StationService.java

@ -0,0 +1,12 @@
package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzims.operational.station.entity.StationEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface StationService extends BaseService<StationEntity> {
}

29
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/UseService.java

@ -0,0 +1,29 @@
package com.hnac.hzims.scheduled.service.operation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.UseVo;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
public interface UseService extends BaseService<UseEntity> {
// 查询填报用电量
Float use(String date,String station);
// 查询30天填报用电量
List<UsrPowerVo> use30Day(String day, String station);
Map<String, Float> generateThreeYear(String start, String end, String station);
}

33
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AbnormalAlarmServiceImpl.java

@ -0,0 +1,33 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity;
import com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper;
import com.hnac.hzims.scheduled.service.operation.AbnormalAlarmService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 告警实现类
* @author ysj
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMapper, AbnormalAlarmEntity> implements AbnormalAlarmService {
@Override
public List<String> abnormalAlarms() {
List<String> alarmList = this.baseMapper.abnormalAlarms();
if(CollectionUtil.isEmpty(alarmList)){
return new ArrayList<>();
}
return alarmList;
}
}

139
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java

@ -0,0 +1,139 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.google.common.collect.Lists;
import com.hnac.hzims.scheduled.service.operation.AnalyseDataService;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author hx
*/
@Service
@AllArgsConstructor
@Slf4j
public class AnalyseDataServiceImpl implements AnalyseDataService {
private final IAnalyseDataSearchClient analyseDataSearchClient;
@Override
public <T> List<AnalyzeCodeBySignagesVO> getAnalyzeCodeBySignages(Function<T, MultiAnalyzeCodePO> convert, T resource) {
List<AnalyzeCodeBySignagesVO> result = Lists.newArrayList();
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = Lists.newArrayList(resource).stream().map(convert).collect(Collectors.toList());
R<List<AnalyzeCodeBySignagesVO>> analyzeCodeBySignResult = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
if(analyzeCodeBySignResult.isSuccess() && CollectionUtil.isNotEmpty(analyzeCodeBySignResult.getData())) {
result = analyzeCodeBySignResult.getData();
}
return result;
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param signages 指标
* @return
*/
@Override
public List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
po.setDeviceCode(deviceCode);
analyzeDataConditionPO.setSignages(signages);
analyzeDataConditionPO.setKeepFigures(2);
analyzeDataConditionPO.setAccessRules(accessRules);
analyzeDataConditionPO.setSaveTimeType(cycleType);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
signboardConditions.add(analyzeDataConditionPO);
po.setSignboardConditions(signboardConditions);
log.error("period_target_data_request {}",po);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return new ArrayList<>();
}
log.error("period_target_data_resp {}",result);
return result.getData().get(0).getList();
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param ride 配电比
* @param signages 指标
* @return
*/
@Override
public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Integer ride,String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
po.setDeviceCode(deviceCode);
analyzeDataConditionPO.setSignages(signages);
analyzeDataConditionPO.setKeepFigures(2);
analyzeDataConditionPO.setAccessRules(accessRules);
analyzeDataConditionPO.setSaveTimeType(cycleType);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
signboardConditions.add(analyzeDataConditionPO);
po.setSignboardConditions(signboardConditions);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return 0f;
}
List<AnalyzeDataConditionVO> records = result.getData();
if(CollectionUtil.isEmpty(records)){
return 0f;
}
AnalyzeDataConditionVO analyzeDataConditionVO = records.get(0);
if (ObjectUtil.isEmpty(analyzeDataConditionVO)) {
return 0f;
}
List<AnalyseDataTaosVO> analyseDataTaosVOList = analyzeDataConditionVO.getList();
if (CollectionUtil.isEmpty(analyseDataTaosVOList)) {
return 0f;
}
AnalyseDataTaosVO analyseDataTaosVO = analyzeDataConditionVO.getList().get(0);
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return 0f;
}
return Float.parseFloat(Optional.ofNullable(analyseDataTaosVO.getVal()).orElse("0")) * ride;
}
}

112
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/GenerateServiceImpl.java

@ -0,0 +1,112 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import com.hnac.hzims.scheduled.mapper.operation.GenerateMapper;
import com.hnac.hzims.scheduled.service.operation.GenerateService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
@Slf4j
@Service
@AllArgsConstructor
public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, GenerateEntity> implements GenerateService {
/**
* 根据时间机构查询用电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Float generate(String date, String station) {
List<GenerateEntity> powers = this.list(Wrappers.<GenerateEntity>lambdaQuery()
.likeRight(GenerateEntity::getFillDate,date)
.eq(GenerateEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(powers)){
return 0f;
}
return (float) powers.stream().mapToDouble(GenerateEntity::getGenerate).sum();
}
/**
* 查询30天填报用电量
* @param day : 结束日期 yyyy-MM-dd
* @param station 站点编码
* @return
*/
@Override
public List<GenerationPowerVo> generate30Day(String day, String station) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse(day,DateUtil.PATTERN_DATE));
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);
List<GenerateEntity> records = this.list(Wrappers.<GenerateEntity>lambdaQuery()
.between(GenerateEntity::getFillDate,start,end)
.eq(GenerateEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
return records.stream().map(record->{
GenerationPowerVo generate = new GenerationPowerVo();
generate.setDate(record.getFillDate());
if(Math.abs(record.getGenerate()) <= 0){
generate.setGenerate(0f);
}else{
generate.setGenerate(Float.parseFloat(record.getGenerate().toString()));
}
return generate;
}).collect(Collectors.toList());
}
/**
*
* @param start 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param end 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 站点编码
* @return
*/
@Override
public List<PowerMonthVo> generateThreeYear(String start, String end, String station) {
List<GenerateEntity> records = this.list(Wrappers.<GenerateEntity>lambdaQuery()
.eq(GenerateEntity::getStationCode,station)
.between(GenerateEntity::getFillDate,start,end)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
// 返回结果
return records.stream().peek(
record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01")
).collect(Collectors.toMap(GenerateEntity::getFillDate,GenerateEntity::getGenerate,Double::sum)).
entrySet().stream().map(entry->{
PowerMonthVo mon = new PowerMonthVo();
mon.setStrMonth(entry.getKey());
if(Math.abs(entry.getValue()) <= 0){
mon.setPower(0f);
}else{
mon.setPower(Float.parseFloat(entry.getValue().toString()));
}
return mon;
}).collect(Collectors.toList());
}
}

16
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ModelStationServiceImpl.java

@ -0,0 +1,16 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.scheduled.mapper.operation.ModelStationMapper;
import com.hnac.hzims.scheduled.service.operation.ModelStationService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Service
public class ModelStationServiceImpl extends BaseServiceImpl<ModelStationMapper, HzimsAnalyzeModelStationEntity> implements ModelStationService {
}

581
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/RealMonitorServiceImpl.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java

@ -1,125 +1,150 @@
package com.hnac.hzims.scheduled.service.impl; package com.hnac.hzims.scheduled.service.operation.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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.WorkshopInfoEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.fdp.vo.FdpFaultStatusVo; import com.hnac.hzims.fdp.vo.FdpFaultStatusVo;
import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity;
import com.hnac.hzims.operational.config.enume.ConfigStatus; import com.hnac.hzims.operational.config.enume.ConfigStatus;
import com.hnac.hzims.operational.config.vo.StationRealVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.RealAttributeVo;
import com.hnac.hzims.operational.main.vo.RealDeviceVo;
import com.hnac.hzims.operational.main.vo.RealStationVo;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity; import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.*; import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService;
import com.hnac.hzims.scheduled.vo.RealAttributeVo; import com.hnac.hzims.scheduled.service.operation.*;
import com.hnac.hzims.scheduled.vo.RealDeviceVo; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzims.scheduled.vo.RealStationVo; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzims.scheduled.vo.StationRealVo; import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import com.hnac.hzinfo.sdk.v5.redis.RedisClient; import com.hnac.hzinfo.sdk.v5.redis.RedisClient;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.*;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
/** /**
* @Author WL * 集中监控数据获取实现类
* @Version v1.0 * @author ysj
* @Serial 1.0
* @Date 2023/5/19 13:54
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class RealMonitorServiceImpl implements IRealMonitorService { public class MonitorServiceImpl implements MonitorService {
@NotNull
private final IStationAttributeService attbtService;
private final RecordService alertService;
private final StationService stationService;
private final StationAttributeService attbtService;
private final WorkshopInfoService workshopInfoService;
private final AbnormalAlarmService abnormalAlarmService; private final AbnormalAlarmService abnormalAlarmService;
private final StationAttrConfigService attrConfigService;
private final StAlamRecordService alertService;
@NotNull
private final IStationService stationService;
@NotNull
private final IMainSystemMonitoringService maintenanceTaskService;
@NotNull
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final IMainSystemMonitoringService systemMonitoringService;
private final RedisClient redisClient;
@NotNull
private final ISysClient sysClient; private final ISysClient sysClient;
private final RedisClient redisClient;
private final IAnalyseDataSearchClient analyseDataSearchClient;
@Value("${hzims.equipment.emInfo.emInfoList}")
public String device_cache_final;
private final IStationAttrConfigService stationAttrConfigService; @Value("${hzims.operation.realIdKey}")
public String real_cache_final;
@Value("${hzims.operation.monitor.realId}") @Value("${hzims.operation.realIdKeyGather}")
public String moniter_realId_key; public String real_gather_cache_final;
@Value("${hzims.operation.monitor.station}") @Value("${hzims.operation.realIdKeyGather}")
public String moniter_station_key; public String real_data_cache_final;
@Value("${hzims.equipment.fdp.redisData}") @Value("${hzims.equipment.fdp.redisData}")
public String fdp_fault_data_key; public String fdp_fault_cache_final;
@Value("${hzims.operation.homePage.activePowerKey}") @Value("${hzims.equipment.fdp.lessThan}")
public String active_power_key; public Double less_than_cache_final;
@Value("${hzims.equipment.fdp.greaterThan}") @Value("${hzims.equipment.fdp.greaterThan}")
public Double greater_than; public Double greater_than_cache_final;
@Value("${hzims.equipment.fdp.lessThan}") @Value("${hzims.operation.monitor.realId}")
public Double less_than; public String moniter_realId_cache_final;
@Value("${hzims.operation.monitor.station}")
public String moniter_station_cache_final;
@Value("${hzims.equipment.fdp.beEqualOrGreaterThan}") @Value("${hzims.equipment.fdp.beEqualOrGreaterThan}")
public Double be_equal_or_greater_than; public Double be_equa_cache_final;
@Value("${hzims.operation.region.deviceClassifyKey}") @Value("${hzims.operation.region.deviceClassifyKey}")
private String device_classify_key; private String device_classify_cache_final;
@Value("${hzims.operation.realIdKeyGather}")
public String real_id_key_gather_path;
@Value("${hzims.operation.realIdKey}")
public String real_id_key_path;
@Value("${hzims.operation.homePage.jointRelayKey}")
public String joint_relay_key;
/**
* 10站点为一组数据
*/
private static final Integer MAX_SEND = 5;
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
@Override
public void loadRealId(String param) {
// 所有站点
List<StationEntity> stationList = stationService.list();
if(CollectionUtil.isEmpty(stationList)){
return;
}
// 设备监测点list
Object json = redisTemplate.opsForValue().get(device_cache_final);
List<EminfoAndEmParamVo> eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 厂房监测点list
List<AnalyzeCodeBySignagesVO> wsMonitorList = this.getRealIdByWsCodeAndSign();
// 实时监控监测点list
List<StationAttributeEntity> timeList = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{
eq(StationAttributeEntity::getIsDeleted, "0");
isNotNull(StationAttributeEntity::getMonitorId);
orderByAsc(StationAttributeEntity::getSort);
}});
// 监测点存储list
List<StationRealVo> list = new ArrayList<>();
stationList.forEach(station->{
StationRealVo stationRealVo = new StationRealVo();
stationRealVo.setStation(station.getCode());
List<String> realDeviceList = this.getRealDeviceList(station.getRefDept(),eminfoAndEmParams);
// 厂站匹配站点监测点集合
List<String> realWsList = wsMonitorList.stream().filter(
o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode())
).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList());
// 实时监控匹配站点监测点集合
List<String> realTimeList = timeList.stream().filter(o -> null != o.getStationId() && o.getStationId().equals(station.getCode())).map(StationAttributeEntity::getMonitorId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(realTimeList)){
realDeviceList.addAll(realTimeList);
}
if(CollectionUtil.isNotEmpty(realWsList)) {
realDeviceList.addAll(realWsList);
}
if(CollectionUtil.isEmpty(realDeviceList)){
return;
}
List<String> realList = realDeviceList.stream().distinct().collect(Collectors.toList());
String[] realArr = StringUtil.join(realList,",").split(",");
stationRealVo.setRealId(realArr);
list.add(stationRealVo);
});
redisTemplate.opsForValue().set(moniter_realId_cache_final,list);
}
@Override @Override
public void realTimeData(String param) { public void loadRealData(String param) {
Long beginTime = System.currentTimeMillis();
// 获取设备 // 获取设备
List<EminfoAndEmParamVo> devices = systemMonitoringService.getEmInfoList(); List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});;
// 设备开关机集合监测点 // 设备开关机集合监测点
List<String> switchOnOff = devices.stream().map(o->{ List<String> switchOnOff = devices.stream().map(o->{
Map<String,String> points = o.getPoint(); Map<String,String> points = o.getPoint();
@ -137,13 +162,13 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
return ""; return "";
}).collect(Collectors.toList()); }).collect(Collectors.toList());
// 获取站点缓存数据 // 获取站点缓存数据
List<StationRealVo> stationRealVos = (List<StationRealVo>) redisTemplate.opsForValue().get(moniter_realId_key); List<StationRealVo> stationRealVos = (List<StationRealVo>) redisTemplate.opsForValue().get(moniter_realId_cache_final);
if(CollectionUtil.isEmpty(stationRealVos)){ if(CollectionUtil.isEmpty(stationRealVos)){
return; return;
} }
// 数据切割 // 数据切割
int limit = countStep(stationRealVos.size()); int limit = countStep(stationRealVos.size());
List<List<StationRealVo>> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * MAX_SEND).limit(MAX_SEND).parallel().collect(Collectors.toList())).collect(Collectors.toList()); List<List<StationRealVo>> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList());
ExecutorService pool = Executors.newFixedThreadPool(limit); ExecutorService pool = Executors.newFixedThreadPool(limit);
// <real,value> // <real,value>
Map<String,String> valueMap = new ConcurrentHashMap<>(); Map<String,String> valueMap = new ConcurrentHashMap<>();
@ -187,23 +212,17 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
} }
pool.shutdown(); pool.shutdown();
// redis 存储 // redis 存储
redisTemplate.opsForValue().set(real_id_key_path,JSONObject.toJSONString(valueMap)); redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap));
redisTemplate.opsForValue().set(real_id_key_gather_path,JSONObject.toJSONString(keyMap)); redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap));
Long endTime = System.currentTimeMillis();
Long time = endTime - beginTime;
log.error("处理redis实时数据 耗时 : {}",time);
} }
/** /**
* 计算切分次数 * 计算切分次数
*/ */
private static Integer countStep(Integer size) { private static Integer countStep(Integer size) {
return (size + MAX_SEND - 1) / MAX_SEND; return (size + 5 - 1) / 5;
} }
/** /**
* 监测点过期数据检查 * 监测点过期数据检查
* @param value * @param value
@ -225,18 +244,14 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
} }
} }
/** /**
* 集中监控数据处理 * 集中监控数据处理
* @param param * @param param
*/ */
@Override @Override
public void centralizedMonitoring(String param) { public void loadMonitoring(String param) {
long beginTime = System.currentTimeMillis();
Thread thread = Thread.currentThread(); Thread thread = Thread.currentThread();
Object json = redisTemplate.opsForValue().get(real_id_key_gather_path); Object json = redisTemplate.opsForValue().get(real_data_cache_final);
if (ObjectUtil.isEmpty(json)) { if (ObjectUtil.isEmpty(json)) {
return; return;
} }
@ -245,8 +260,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
if (MapUtils.isEmpty(map)) { if (MapUtils.isEmpty(map)) {
return; return;
} }
log.info(thread.getName() + "步骤1获取检测点数据耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 获取所有设备重点属性 // 获取所有设备重点属性
List<StationAttributeEntity> list = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{ List<StationAttributeEntity> list = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{
isNotNull(StationAttributeEntity::getStationId); isNotNull(StationAttributeEntity::getStationId);
@ -256,48 +269,32 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
return; return;
} }
log.info(thread.getName() + "步骤2获取监控配置监测点 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 获取所有告警记录 // 获取所有告警记录
List<StAlarmRecordEntity> alertList = alertService.list(new LambdaQueryWrapper<StAlarmRecordEntity>() {{ List<StAlarmRecordEntity> alertList = alertService.list(new LambdaQueryWrapper<StAlarmRecordEntity>() {{
orderByDesc(StAlarmRecordEntity::getCreateTime); orderByDesc(StAlarmRecordEntity::getCreateTime);
}}); }});
log.info(thread.getName() + "步骤3获取告警记录 耗时 : {}",System.currentTimeMillis() - beginTime); List<String> alarmList = abnormalAlarmService.abnormalAlarms();
beginTime = System.currentTimeMillis();
List<String> alarmList = abnormalAlarmService.getAbnormalAlarmList();
log.info(thread.getName() + "步骤4获取数据中断告警记录 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 获取所有故障记录 // 获取所有故障记录
List<FdpFaultStatusVo> faultList = this.getFdpFaultAll(); List<FdpFaultStatusVo> faultList = this.getFdpFaultAll();
log.info(thread.getName() + "步骤5获取故障记录 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 所有设备分类 // 所有设备分类
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key); Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_cache_final);
log.info(thread.getName() + "步骤6获取设备分类 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 所有设备 // 所有设备
List<EminfoAndEmParamVo> emList = maintenanceTaskService.getEmInfoList(); List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
log.info(thread.getName() + "步骤7获取设备信息 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 根据站点分组 // 根据站点分组
Map<String, List<StationAttributeEntity>> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); Map<String, List<StationAttributeEntity>> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId));
// 获取站点列表 // 获取站点列表
List<StationEntity> stationEntityList = stationService.getStationByInCode(new ArrayList<>(stationAttbtMap.keySet())); List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery()
log.info(thread.getName() + "步骤8站点列表 耗时 : {}",System.currentTimeMillis() - beginTime); .in(StationEntity::getCode,new ArrayList<>(stationAttbtMap.keySet())));
beginTime = System.currentTimeMillis();
// 隐藏设备列表 // 隐藏设备列表
List<String> hideList = stationAttrConfigService.getHideList(); List<String> hideList = attrConfigService.getHideList();
// 分割,每个map限制10个长度 // 分割,每个map限制10个长度
List<Map<String, List<StationAttributeEntity>>> handleList = this.mapChunk(stationAttbtMap); List<Map<String, List<StationAttributeEntity>>> handleList = this.mapChunk(stationAttbtMap);
log.info(thread.getName() + "步骤9监测点数据切割 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 创建线程池 // 创建线程池
ExecutorService pool = Executors.newFixedThreadPool(handleList.size()); ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
CountDownLatch countDownLatch = new CountDownLatch(handleList.size()); CountDownLatch countDownLatch = new CountDownLatch(handleList.size());
log.info(thread.getName() +"步骤10创建线程 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 所有机构 // 所有机构
R<List<Dept>> deptAll = sysClient. getDeptList(); R<List<Dept>> deptAll = sysClient.getDeptList();
// 存储数据节点 // 存储数据节点
List<RealStationVo> stationList = new CopyOnWriteArrayList<>(); List<RealStationVo> stationList = new CopyOnWriteArrayList<>();
pool.execute(()->{ pool.execute(()->{
@ -325,15 +322,13 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
deviceList.add(deviceVo); deviceList.add(deviceVo);
}); });
// 设备状态 // 设备状态
this.getDeviceParam(emList, deviceClassifyMap, deviceList); this.getDeviceParam(devices, deviceClassifyMap, deviceList);
station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList()));
stationList.add(station); stationList.add(station);
}); });
countDownLatch.countDown(); countDownLatch.countDown();
} }
}); });
log.info(thread.getName() + "步骤11线程数据处理 耗时 : {}",System.currentTimeMillis() - beginTime);
beginTime = System.currentTimeMillis();
// 等待所有线程执行完成 // 等待所有线程执行完成
try { try {
countDownLatch.await(); countDownLatch.await();
@ -342,57 +337,85 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
pool.shutdown(); pool.shutdown();
log.info(thread.getName() + "步骤12所有线程完成 耗时 : {}",System.currentTimeMillis() - beginTime); redisTemplate.opsForValue().set(moniter_station_cache_final, stationList);
redisTemplate.opsForValue().set(moniter_station_key, stationList);
} }
/** /**
* map分割 * 设备处理
* *
* @param <k> * @param list
* @param <v> * @param map
* @param chunkMap * @param device
* @return
*/ */
private <k, v> List<Map<k, v>> mapChunk(Map<k, v> chunkMap) { private void handleDevice(List<StationAttributeEntity> list, Map<String, Map<String, String>> map,
if (chunkMap == null || RealMonitorServiceImpl.MAX_SEND <= 0) { RealDeviceVo device, List<StAlarmRecordEntity> alertList,
List<Map<k, v>> list = new ArrayList<>(); List<FdpFaultStatusVo> faultList) {
list.add(chunkMap); if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) {
return list; return;
} }
Set<k> keySet = chunkMap.keySet(); List<RealAttributeVo> attbtList = new ArrayList<>();
Iterator<k> iterator = keySet.iterator(); list.forEach(item -> {
int i = 1; RealAttributeVo realAttributeVo = new RealAttributeVo();
List<Map<k, v>> total = new ArrayList<>(); // 设备重点属性处理 : 单条-item
Map<k, v> tem = new HashMap<>(); Map<String, String> real = map.get(item.getMonitorId());
while (iterator.hasNext()) { if(MapUtils.isEmpty(real)){
k next = iterator.next(); realAttributeVo.setName(item.getAttributes());
tem.put(next, chunkMap.get(next)); realAttributeVo.setType(item.getAttributeType());
if (i == RealMonitorServiceImpl.MAX_SEND) { realAttributeVo.setRealId(item.getMonitorId());
total.add(tem); realAttributeVo.setQuality(-1);
tem = new HashMap<>(); realAttributeVo.setStatus(0);
i = 0; realAttributeVo.setValue("0");
realAttributeVo.setUnit(item.getUnit());
attbtList.add(realAttributeVo);
return;
} }
i++; realAttributeVo = handleAttbt(item, real, alertList, faultList);
if (ObjectUtil.isEmpty(realAttributeVo)) {
return;
}
attbtList.add(realAttributeVo);
});
device.setAttbtList(attbtList);
}
/**
* 获取站点属性
* @param stationEntityList
* @param item
*/
private void stationParam(List<StationEntity> stationEntityList, RealStationVo item,List<Dept> deptAll) {
if(CollectionUtil.isEmpty(stationEntityList)){
return;
} }
if (!CollectionUtil.isEmpty(tem)) { List<StationEntity> filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList());
total.add(tem); if(CollectionUtil.isEmpty(filterList)){
return;
} }
return total; StationEntity station = filterList.get(0);
if(ObjectUtil.isEmpty(station)){
return;
}
item.setStationName(station.getName());
item.setWaterLevelMax(station.getLimitWaterLevel());
item.setServerType(station.getServeType());
item.setStationDeptId(station.getRefDept());
// 排序
List<Dept> list = deptAll.stream().filter(o-> station.getRefDept().equals(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
item.setSort(list.get(0).getSort());
} }
/** /**
* 设备参数设置 * 设备参数设置
* *
* @param emList * @param devices
* @param deviceClassifyMap * @param deviceClassifyMap
* @param deviceList * @param deviceList
*/ */
private void getDeviceParam(List<EminfoAndEmParamVo> emList, Map<String, List<String>> deviceClassifyMap, List<RealDeviceVo> deviceList) { private void getDeviceParam(List<EminfoAndEmParamVo> devices, Map<String, List<String>> deviceClassifyMap, List<RealDeviceVo> deviceList) {
if (CollectionUtil.isEmpty(emList) || CollectionUtil.isEmpty(deviceList) || MapUtils.isEmpty(deviceClassifyMap)) { if (CollectionUtil.isEmpty(devices) || CollectionUtil.isEmpty(deviceList) || MapUtils.isEmpty(deviceClassifyMap)) {
return; return;
} }
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT); List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT);
@ -405,7 +428,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
device.setState(-1); device.setState(-1);
return; return;
} }
List<EminfoAndEmParamVo> list = emList.stream().filter(o -> null != o.getId() && o.getId().toString().equals(device.getDeviceCode())).collect(Collectors.toList()); List<EminfoAndEmParamVo> list = devices.stream().filter(o -> null != o.getId() && o.getId().toString().equals(device.getDeviceCode())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
device.setState(-1); device.setState(-1);
return; return;
@ -436,104 +459,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
} }
}); });
} }
/**
* 获取所有告警记录
*
* @return
*/
private List<FdpFaultStatusVo> getFdpFaultAll() {
Object json = redisTemplate.opsForValue().get(fdp_fault_data_key);
if (ObjectUtil.isEmpty(json)) {
return new ArrayList<>();
}
return (List<FdpFaultStatusVo>) json;
}
/**
* 设置站点状态
* @param alarmList
* @param station
* @param key
*/
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) {
station.setStatus(0);
if(alarmList.contains(key)){
station.setStatus(1);
}
}
/**
* 获取站点属性
* @param stationEntityList
* @param item
*/
private void stationParam(List<StationEntity> stationEntityList, RealStationVo item,List<Dept> deptAll) {
if(CollectionUtil.isEmpty(stationEntityList)){
return;
}
List<StationEntity> filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filterList)){
return;
}
StationEntity station = filterList.get(0);
if(ObjectUtil.isEmpty(station)){
return;
}
item.setStationName(station.getName());
item.setWaterLevelMax(station.getLimitWaterLevel());
item.setServerType(station.getServeType());
item.setStationDeptId(station.getRefDept());
// 排序
List<Dept> list = deptAll.stream().filter(o-> station.getRefDept().equals(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
item.setSort(list.get(0).getSort());
}
/**
* 设备处理
*
* @param list
* @param map
* @param device
*/
private void handleDevice(List<StationAttributeEntity> list, Map<String, Map<String, String>> map,
RealDeviceVo device, List<StAlarmRecordEntity> alertList,
List<FdpFaultStatusVo> faultList) {
if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) {
return;
}
List<RealAttributeVo> attbtList = new ArrayList<>();
list.forEach(item -> {
RealAttributeVo realAttributeVo = new RealAttributeVo();
// 设备重点属性处理 : 单条-item
Map<String, String> real = map.get(item.getMonitorId());
if(MapUtils.isEmpty(real)){
realAttributeVo.setName(item.getAttributes());
realAttributeVo.setType(item.getAttributeType());
realAttributeVo.setRealId(item.getMonitorId());
realAttributeVo.setQuality(-1);
realAttributeVo.setStatus(0);
realAttributeVo.setValue("0");
realAttributeVo.setUnit(item.getUnit());
attbtList.add(realAttributeVo);
return;
}
realAttributeVo = handleAttbt(item, real, alertList, faultList);
if (ObjectUtil.isEmpty(realAttributeVo)) {
return;
}
attbtList.add(realAttributeVo);
});
device.setAttbtList(attbtList);
}
/** /**
* 设备单条重点属性处理 * 设备单条重点属性处理
@ -580,6 +505,39 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
} }
/** /**
* 设置重点属性参数
*
* @param attest
* @param real
*/
private void setAttbtParam(RealAttributeVo attest, Map<String, String> real) {
if (CollectionUtil.isEmpty(real)) {
return;
}
real.forEach((key, value) -> {
if (StringUtil.isBlank(value)) {
return;
}
switch (key) {
case "q":
attest.setQuality(Integer.parseInt(value));
break;
case "realId":
attest.setRealId(value);
break;
case "value":
attest.setValue(Optional.ofNullable(value).orElse("-"));
break;
case "time":
attest.setTime(value);
break;
default:
break;
}
});
}
/**
* 故障信息设置 * 故障信息设置
* *
* @param attest * @param attest
@ -596,10 +554,10 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
} }
FdpFaultStatusVo fdpFaultStatusVo = fault.get(0); FdpFaultStatusVo fdpFaultStatusVo = fault.get(0);
// 黄色 // 黄色
if (fdpFaultStatusVo.getValue() > greater_than && fdpFaultStatusVo.getValue() < less_than) { if (fdpFaultStatusVo.getValue() > greater_than_cache_final && fdpFaultStatusVo.getValue() < less_than_cache_final) {
attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus());
// 橙色 // 橙色
} else if (fdpFaultStatusVo.getValue() >= be_equal_or_greater_than) { } else if (fdpFaultStatusVo.getValue() >= be_equa_cache_final) {
attest.setStatus(ConfigStatus.ConfigStatusEnum.ORANGE.getStatus()); attest.setStatus(ConfigStatus.ConfigStatusEnum.ORANGE.getStatus());
} }
attest.setFdpRate(fdpFaultStatusVo.getValue()); attest.setFdpRate(fdpFaultStatusVo.getValue());
@ -680,34 +638,107 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
} }
} }
} }
/** /**
* 设置重点属性参数 * 设置站点状态
* @param alarmList
* @param station
* @param key
*/
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) {
station.setStatus(0);
if(alarmList.contains(key)){
station.setStatus(1);
}
}
/**
* 获取所有告警记录
* *
* @param attest * @return
* @param real
*/ */
private void setAttbtParam(RealAttributeVo attest, Map<String, String> real) { private List<FdpFaultStatusVo> getFdpFaultAll() {
if (CollectionUtil.isEmpty(real)) { Object json = redisTemplate.opsForValue().get(fdp_fault_cache_final);
return; if (ObjectUtil.isEmpty(json)) {
return new ArrayList<>();
} }
real.forEach((key, value) -> { return (List<FdpFaultStatusVo>) json;
if (StringUtil.isBlank(value)) { }
return;
} /**
switch (key) { * map分割
case "q": *
attest.setQuality(Integer.parseInt(value)); * @param <k>
break; * @param <v>
case "realId": * @param chunkMap
attest.setRealId(value); * @return
break; */
case "value": private <k, v> List<Map<k, v>> mapChunk(Map<k, v> chunkMap) {
attest.setValue(Optional.ofNullable(value).orElse("-")); if (chunkMap == null) {
break; return Lists.newArrayList();
case "time": }
attest.setTime(value); Set<k> keySet = chunkMap.keySet();
break; Iterator<k> iterator = keySet.iterator();
int i = 1;
List<Map<k, v>> total = new ArrayList<>();
Map<k, v> tem = new HashMap<>();
while (iterator.hasNext()) {
k next = iterator.next();
tem.put(next, chunkMap.get(next));
if (i == 5) {
total.add(tem);
tem = new HashMap<>();
i = 0;
} }
}); i++;
}
if (!CollectionUtil.isEmpty(tem)) {
total.add(tem);
}
return total;
}
/**
* 获取厂房监测点
* @return
*/
private List<AnalyzeCodeBySignagesVO> getRealIdByWsCodeAndSign() {
List<WorkshopInfoEntity> wsInfoList = workshopInfoService.list();
if(CollectionUtil.isEmpty(wsInfoList)) {
return Lists.newArrayList();
}
Function<String, MultiAnalyzeCodePO> getAnalyzeCodePO = wsCode -> {
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(wsCode);
multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY,HomePageConstant.PV_REACTIVE_POWER,HomePageConstant.PV_GENERATION_CAPACITY));
return multiAnalyzeCodePO;
};
List<MultiAnalyzeCodePO> analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList());
R<List<AnalyzeCodeBySignagesVO>> analyzeCodeBySignages = analyseDataSearchClient.getAnalyzeCodeBySignages(analyzeCodePOList);
return Optional.ofNullable(analyzeCodeBySignages).filter(r -> r.isSuccess()).map(R::getData).orElse(Lists.newArrayList());
}
/**
* 获取站点realId
* @param refDept
* @param eminfoAndEmParams
* @return
*/
private List<String> getRealDeviceList(Long refDept, List<EminfoAndEmParamVo> eminfoAndEmParams) {
// 参数检查
if(CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)){
return new ArrayList<>();
}
// 有效设备
List<EminfoAndEmParamVo> filters = eminfoAndEmParams.stream().filter(o-> o.getCreateDept().equals(refDept)).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filters)){
return new ArrayList<>();
}
// 遍历设备
List<String> result = new ArrayList<>();
for(EminfoAndEmParamVo device : filters){
result.addAll(device.getPoint().values());
}
return result;
} }
} }

77
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PowerServiceImpl.java

@ -0,0 +1,77 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import com.hnac.hzims.scheduled.mapper.operation.PowerMapper;
import com.hnac.hzims.scheduled.service.operation.PowerService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@AllArgsConstructor
public class PowerServiceImpl extends BaseServiceImpl<PowerMapper, PowerEntity> implements PowerService {
/**
* 根据时间机构查询发电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Double generate(String date, Long station) {
List<PowerEntity> powers = this.list(Wrappers.<PowerEntity>lambdaQuery()
.likeRight(PowerEntity::getMon,date)
.eq(PowerEntity::getCreateDept,station)
// 类型: 光伏
.eq(PowerEntity::getType,1)
);
if(CollectionUtil.isEmpty(powers)){
return 0.0;
}
return powers.stream().mapToDouble(PowerEntity::getPowerMon).sum();
}
/**
*
* @param start 开始时间 : yyyy-mm
* @param end 结束时间 : yyyy-mm
* @param station 所属机构
* @return
*/
@Override
public List<PowerMonthVo> generateThreeYear(String start, String end, Long station) {
List<PowerEntity> fills = this.list(Wrappers.<PowerEntity>lambdaQuery()
.between(PowerEntity::getMon,start,end)
.eq(PowerEntity::getCreateDept,station)
// 类型: 光伏
.eq(PowerEntity::getType,1)
);
if(CollectionUtil.isEmpty(fills)){
return new ArrayList<>();
}
return fills.stream().map(fill->{
PowerMonthVo mon = new PowerMonthVo();
mon.setStrMonth(DateUtil.format(DateUtil.parse(fill.getMon(),"yyyy-MM"),DateUtil.PATTERN_DATE));
if(Math.abs(fill.getPowerMon()) <= 0){
mon.setPower(0f);
}else{
mon.setPower(Float.parseFloat(fill.getPowerMon().toString()));
}
return mon;
}).collect(Collectors.toList());
}
}

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

File diff suppressed because it is too large Load Diff

16
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StAlamRecordServiceImpl.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RecordServiceImpl.java

@ -1,8 +1,8 @@
package com.hnac.hzims.scheduled.service.impl; package com.hnac.hzims.scheduled.service.operation.impl;
import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity;
import com.hnac.hzims.scheduled.mapper.operation.StAlarmRecordMapper; import com.hnac.hzims.scheduled.mapper.operation.RecordMapper;
import com.hnac.hzims.scheduled.service.StAlamRecordService; import com.hnac.hzims.scheduled.service.operation.RecordService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
@ -11,16 +11,12 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
/** /**
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 15:46
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper, StAlarmRecordEntity> implements StAlamRecordService { public class RecordServiceImpl extends BaseServiceImpl<RecordMapper, StAlarmRecordEntity> implements RecordService {
/** /**
* 添加告警 * 添加告警
@ -35,8 +31,6 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
record.setRealId(realId); record.setRealId(realId);
record.setStatus(0); record.setStatus(0);
record.setCreateTime(new Date()); record.setCreateTime(new Date());
log.info("insert_alert_entity:{}",record);
return this.baseMapper.insertReturnId(record); return this.baseMapper.insertReturnId(record);
} }
} }

18
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/impl/StationAttrConfigServiceImpl.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttrConfigServiceImpl.java

@ -1,10 +1,9 @@
package com.hnac.hzims.scheduled.service.impl; package com.hnac.hzims.scheduled.service.operation.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity;
import com.hnac.hzims.scheduled.mapper.operation.StationAttrConfigMapper; import com.hnac.hzims.scheduled.mapper.operation.StationAttrConfigMapper;
import com.hnac.hzims.scheduled.service.IStationAttrConfigService; import com.hnac.hzims.scheduled.service.operation.StationAttrConfigService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
@ -15,17 +14,11 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @Author WL * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 16:07
*/ */
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor public class StationAttrConfigServiceImpl extends BaseServiceImpl<StationAttrConfigMapper, StationAttrConfigEntity> implements StationAttrConfigService {
public class StationAttrConfigServiceImpl extends BaseServiceImpl<StationAttrConfigMapper, StationAttrConfigEntity>
implements IStationAttrConfigService {
@Override @Override
public List<String> getHideList() { public List<String> getHideList() {
@ -38,5 +31,4 @@ public class StationAttrConfigServiceImpl extends BaseServiceImpl<StationAttrCon
} }
return list.stream().map(StationAttrConfigEntity::getEmName).collect(Collectors.toList()); return list.stream().map(StationAttrConfigEntity::getEmName).collect(Collectors.toList());
} }
}
}

36
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationAttributeServiceImpl.java

@ -0,0 +1,36 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.scheduled.mapper.operation.StationAttributeMapper;
import com.hnac.hzims.scheduled.service.operation.StationAttributeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author hx
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttributeMapper, StationAttributeEntity> implements StationAttributeService {
/**
* 获取集中监控监测点单位
* @return
*/
@Override
public Map<String, String> PointUnit() {
List<StationAttributeEntity> list = this.baseMapper.PointUnit();
if(CollectionUtil.isEmpty(list)){
return null;
}
return list.stream().collect(Collectors.toMap(StationAttributeEntity::getAttributes, StationAttributeEntity::getUnit));
}
}

19
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/StationServiceImpl.java

@ -0,0 +1,19 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.operation.StationMapper;
import com.hnac.hzims.scheduled.service.operation.StationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author hx
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEntity> implements StationService {
}

99
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/UseServiceImpl.java

@ -0,0 +1,99 @@
package com.hnac.hzims.scheduled.service.operation.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import com.hnac.hzims.scheduled.mapper.operation.UseMapper;
import com.hnac.hzims.scheduled.service.operation.UseService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
@Slf4j
@Service
@AllArgsConstructor
public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implements UseService {
/**
* 根据时间机构查询用电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Float use(String date, String station) {
List<UseEntity> powers = this.list(Wrappers.<UseEntity>lambdaQuery()
.likeRight(UseEntity::getFillDate,date)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(powers)){
return 0f;
}
return (float) powers.stream().mapToDouble(UseEntity::getEmploy).sum();
}
/**
* 查询30天填报用电量
* @param day : 结束日期 yyyy-MM-dd
* @param station 站点编码
* @return
*/
@Override
public List<UsrPowerVo> use30Day(String day, String station) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse(day,DateUtil.PATTERN_DATE));
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);
List<UseEntity> records = this.list(Wrappers.<UseEntity>lambdaQuery()
.between(UseEntity::getFillDate,start,end)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
return records.stream().map(record->{
UsrPowerVo use = new UsrPowerVo();
use.setDate(record.getFillDate());
if(Math.abs(record.getEmploy()) <= 0){
use.setUsrPower(0f);
}else{
use.setUsrPower(Float.parseFloat(record.getEmploy().toString()));
}
return use;
}).collect(Collectors.toList());
}
/**
* 查询近3年的填报用电量
* @param start
* @param end
* @param station
* @return
*/
@Override
public Map<String, Float> generateThreeYear(String start, String end, String station) {
List<UseEntity> records = this.list(Wrappers.<UseEntity>lambdaQuery()
.between(UseEntity::getFillDate,start,end)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new HashMap<>();
}
return records.stream().peek(record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01")).
collect(Collectors.toMap(UseEntity::getFillDate, value->Float.parseFloat(value.getEmploy().toString()),Float::sum));
}
}

52
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealAttributeVo.java

@ -1,52 +0,0 @@
package com.hnac.hzims.scheduled.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 15:27
*/
@Data
public class RealAttributeVo implements Serializable {
@ApiModelProperty("属性名称")
private String name;
@ApiModelProperty("属性数值")
private String value;
@ApiModelProperty("属性单位")
private String unit;
@ApiModelProperty("属性类型:1-遥信 2-遥测")
private Integer type;
@ApiModelProperty("属性实时数据Id")
private String realId;
@ApiModelProperty("告警Id")
private Long id;
@ApiModelProperty("属性状态:0:正常、1:预警、2:告警、3:空值、4:黄色、5:橙色")
private int status;
@ApiModelProperty("属性质量")
private int quality;
@ApiModelProperty("属性时间")
private String time;
@ApiModelProperty("属性故障ID")
private String fdpFaultId;
@ApiModelProperty("监测点")
private String fdpMonitorId;
@ApiModelProperty("属性故障值")
private Double fdpRate;
}

33
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealDeviceVo.java

@ -1,33 +0,0 @@
package com.hnac.hzims.scheduled.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 15:26
*/
@Data
public class RealDeviceVo implements Serializable {
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("设备名称")
private String deviceName;
@ApiModelProperty("设备状态")
private Integer state;
@ApiModelProperty("排序字段")
private Integer sort;
@ApiModelProperty("设备属性集合")
private List<RealAttributeVo> attbtList;
}

54
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/RealStationVo.java

@ -1,54 +0,0 @@
package com.hnac.hzims.scheduled.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 15:24
*/
@Data
public class RealStationVo implements Serializable {
@ApiModelProperty("站点Id")
private String stationCode;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("站点机构Id")
private Long stationDeptId;
@ApiModelProperty("站点类型")
private String serverType;
@ApiModelProperty("当前天气")
private WeatherVo nowWater;
@ApiModelProperty("总有功率")
private Double powerSum;
@ApiModelProperty("降水")
private String precipitation;
@ApiModelProperty("最大前池水位")
private Double waterLevelMax;
@ApiModelProperty("前池水位")
private Double waterLevel;
@ApiModelProperty("设备集合")
private List<RealDeviceVo> deviceList;
@ApiModelProperty("站点状态 : 0-正常 1-数据中断")
private Integer status;
@ApiModelProperty("排序")
private Integer sort;
}

17
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/StationRealVo.java

@ -1,17 +0,0 @@
package com.hnac.hzims.scheduled.vo;
import lombok.Data;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 11:43
*/
@Data
public class StationRealVo {
private String station;
private String[] realId;
}

30
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/vo/WeatherVo.java

@ -1,30 +0,0 @@
package com.hnac.hzims.scheduled.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 15:25
*/
@Data
public class WeatherVo implements Serializable {
/**当前天气状况和图标的代码,图标可通过天气状况和图标下载; //100**/
private String icon;
/**实况温度,默认单位:摄氏度; //21**/
private String temp;
/**实况天气状况的文字描述,包括阴晴雨雪等天气状态的描述; //晴**/
private String text;
/**预报当天最高温度; //4**/
private String tempMax;
/**预报当天最低温度; //-5**/
private String tempMin;
}

208
hzims-service/hzims-scheduled/src/main/resources/application.yml

@ -1,208 +0,0 @@
#服务器端口
server:
port: 8501
#数据源配置
spring:
cloud:
nacos:
discovery:
server-addr: 175.6.40.67:10056
config:
server-addr: 175.6.40.67:10056
application:
name: hzims-scheduled
main:
allow-bean-definition-overriding: true
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
primary: operational #设置默认的数据源或者数据源组,默认值即为master
strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
operational:
url: jdbc:mysql://192.168.1.3:3576/dev_hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: root
password: 123
redis:
# redis数据库索引(默认为0),我们使用索引为0的数据库,避免和其他数据库冲突
database: 0
# redis服务器地址(默认为localhost)
host: 192.168.1.3
# redis端口(默认为6379)
port: 3577
# redis访问密码(默认为空)
password: 1qaz2WSX@redis
#xxl:
# job:
# accessToken: ''
# admin:
# addresses: http://192.168.1.3:7009/xxl-job-admin
# executor:
# appname: hzims-operational
# ip: 192.168.1.3
# logpath: /data/applogs/xxl-job/jobhandler
# logretentiondays: -1
# port: 28501
xxl:
job:
accessToken: ''
admin:
addresses: http://192.168.5.128:9080/xxl-job-admin
executor:
appname: hzims-operational
ip: 192.168.18.232
logpath: /data/applogs/xxl-job/jobhandler
logretentiondays: -1
port: 28501
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
# typeAliasesPackage: com.hnac.hzims.**.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#swagger扫描路径配置
swagger:
base-packages:
- org.springbalde
- com.hnac
hzims:
# 视频配置地址随机码
video:
random-code: qnrld30yto85cji5
# 视频配置秘钥属性
videoProperties:
appKey: 21111042
videoHost: 42.192.39.246:443
appSecret: QXRevZ2AQeXtmlYZT6Rf
equipment:
emInfo:
code: hzims:equipment:emInfo:deviceCode.stationDeviceCode
emInfoList: hzims:equipment:emInfo:deviceCode.emInfoList
fdp:
redisData: hzims:equipment:fdp:fault.data.realIdAndValueList
greaterThan: 0.3
lessThan: 0.9
beEqualOrGreaterThan: 0.9
alert:
# 接收告警的websocket url
ws-url: wss://175.6.40.67:9036/api/hzinfo-data-socket/websocket/soe
config:
#接收遥测或遥信实时数据的websocket url
ws-url: wss://175.6.40.67:9036/api/hzinfo-data-socket/websocket/data
level:
ws-url: wss://175.6.40.67:9036/api/hzinfo-data-socket/websocket/alarm
pdf:
# pdf文件存储路径,请配置绝对路径
#file-path: /data/inspect/pdf/file
file-path: D:/data/hzinfo/file # windows
operation:
access:
task-key: hzims:operation:access:task
alert:
saveDefectIsOpen: true
save:
area:
url: http://49.234.126.72:8255/apiIntroduction/demo/saveHzimsArea
station:
url: http://49.234.126.72:8255/apiIntroduction/demo/saveHzimsStation
defect:
repair: /data/hzims/operational/defect/repair/应急抢修单.docx
area:
report: hzims.operation.area.report
monitor:
station: hzims:operation:monitor:station
realId : hzims:operation:monitor:realId
region:
areaDutyInfoKey: hzims:operation:region:areaDutyInfoKey
deviceClassifyKey: hzims.operation.region.deviceClassifyKey
projectDepartmentId: 200000000000101
projectDepartmentName: 智能运维事业部
notInDept: 2000000000001010048,2000000000001010049,2000000000001010050
tenantId: 200000
#工单返回记录(暂存)
workOrder:
access: hzims:operation:workOrder.access
defect: hzims:operation:workOrder.defect
task:
# 消息推送存入redis的key值
templateCode:
maintenance:
taskDispose: hzinfo:operation:maintenance:task
# 消息推送code
jgPushCode: ops-push
comprehensiveD: hzims:operation:comprehensiveD:real.time
realIdKey: hzims:operation:comprehensiveD:realIdKey.realData
lastDayRealIdKey: hzims:operation:comprehensiveD:lastDayRealIdKey.realData
realIdKeyGather: hzims:operation:comprehensiveD:realIdKeyGather.realData
homePage:
charge:
url: https://www.hznychh.cn/api/charging-manage/manage/external/provide?secretKey=f5aee9fe24e4d1d80eb7564414392bc3
activePowerKey: hzims:operation:homePage:activePowerKey
jointRelayKey: hzims:operation:homePage:jointRelayKey
systemMonitoring:
hydropowerStation:
hisData: hzims:operation:homePage:systemMonitoring:hydropowerStation:hisData:.
hisDataActivePower: hzims:operation:homePage:systemMonitoring:hydropowerStation:hisDataActivePower:.
theDayHydrograph: hzims:operation:homePage:systemMonitoring:hydropowerStation:theDayHydrograph:.
yearGeneration: hzims:operation:homePage:systemMonitoring:hydropowerStation:yearGeneration.data
hisDataNew: hzims:operation:homePage:systemMonitoring:hydropowerStation:hisDataNew
theDayHydrographNew: hzims:operation:homePage:systemMonitoring:hydropowerStation:theDayHydrographNew
alarm:
# "0-默认", "1-系统", "2-告警", "3-故障", "4-用户操作", "5-遥测越限", "6-遥信变位", "7-注册信息", "8-信息提示", "9-设备巡检", "10-遥控操作", "11-遥测越限恢复","12-未定义","13-通讯中断","14-数据异常"
types: 3,2,5,13,14
category:
id: 1384429129110360065
sanya:
one: 2000000000001010048
tow: 2000000000001010049
hoop: 2000000000001010050
defect:
# 超时自动甄别时间间隔:单位(小时)
discriminateDeadline: 1
# 默认计划工时:单位(小时)
defaultPlanHoure: 8
blade:
data:
sdk:
enabled: true
url: http://175.6.40.67:37681/api/hzinfo-data-config
appId: '1635888805125099521'
appSecret: f4b6a4dc696b36445d2e5d38bbab2417
redisIp: 192.168.1.13
redisPort: 3577
password: L_MM&h=+Nm&p)U9sk.uH
maxKeys: 1000
data-scope:
enabled: false
lock:
enabled: true
address: redis://192.168.1.3:3577
password:
database: 0
ssl: false
url:
video:
stationsPath: http://localhost:10001/stations
monitorsPath: http://localhost:10001/monitor
login: https://175.6.40.67:9300/hzApi/auth/mix/login?tenantId=200000&account=videoViewers&pwd=e10adc3949ba59abbe56e057f20f883e&grant_type=password&scope=all&type=account
water-out:
#工单受理
orderCrtPackage: http://175.6.40.67:9021/api/water-out/orderCrt/package
orderCrtGrabPackage: http://175.6.40.67:9021/api/water-out/orderCrt/grabPackage

5
hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/WorkshopInfoMapper.xml

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

12
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml

@ -2,16 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper"> <mapper namespace="com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper">
<select id="getAbnormalAlarm" resultType="com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity"> <select id="abnormalAlarms" resultType="java.lang.String">
select * from hzims_abnormal_alarm
where station_id = #{stationId}
and type = #{type}
and is_deleted = 0
</select>
<select id="getAbnormalAlarmList" resultType="java.lang.String">
select distinct station_id from hzims_abnormal_alarm select distinct station_id from hzims_abnormal_alarm
where is_deleted = 0 where is_deleted = 0
and type in (13,14) and type in (13,14)
and `STATUS` = 0 and `STATUS` = 0
</select> </select>
</mapper> </mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/GenerateMapper.xml

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

21
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/ModelStationMapper.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.ModelStationMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity">
<id column="ID" property="id" />
<result column="TENANT_ID" property="tenantId" />
<result column="STATION_ID" property="stationId" />
<result column="INSTANCE_CODE" property="instanceCode" />
<result column="REMARK" property="remark" />
<result column="CREATE_TIME" property="createTime" />
<result column="UPDATE_TIME" property="updateTime" />
<result column="CREATE_USER" property="createUser" />
<result column="UPDATE_USER" property="updateUser" />
<result column="IS_DELETED" property="isDeleted" />
<result column="STATUS" property="status" />
<result column="CREATE_DEPT" property="createDept" />
</resultMap>
</mapper>

32
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PowerMapper.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.PowerMapper">
<resultMap id="BaseResultMap" type="com.hnac.hzims.operational.fill.entity.PowerEntity">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="MON" property="mon" jdbcType="VARCHAR"/>
<result column="INSTALLED_CAPACITY" property="installedCapacity" jdbcType="DOUBLE"/>
<result column="PLANNED_POWER_YEAR" property="plannedPowerYear" jdbcType="DOUBLE"/>
<result column="PLANNED_POWER_MON" property="plannedPowerMon" jdbcType="DOUBLE"/>
<result column="POWER_MON" property="powerMon" jdbcType="DOUBLE"/>
<result column="POWER_RATE_MON" property="powerRateMon" jdbcType="VARCHAR"/>
<result column="POWER_YEAR" property="powerYear" jdbcType="DOUBLE"/>
<result column="POWER_RATE_YEAR" property="powerRateYear" jdbcType="DOUBLE"/>
<result column="DOUBLE_QUALIFY_RATE" property="doubleQualifyRate" jdbcType="VARCHAR"/>
<result column="TYPE" property="type" jdbcType="INTEGER"/>
<result column="TENANT_ID" property="tenantId" jdbcType="VARCHAR"/>
<result column="STATUS" property="status" jdbcType="TINYINT"/>
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/>
<result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="CREATE_USER" property="createUser" jdbcType="BIGINT"/>
<result column="UPDATE_USER" property="updateUser" jdbcType="BIGINT"/>
<result column="IS_DELETED" property="isDeleted" jdbcType="TINYINT"/>
<result column="CREATE_DEPT" property="createDept" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
ID, MON, INSTALLED_CAPACITY , PLANNED_POWER_YEAR , PLANNED_POWER_MON , POWER_MON , POWER_RATE_MON ,POWER_YEAR ,
POWER_RATE_YEAR , DOUBLE_QUALIFY_RATE , TYPE , TENANT_ID, STATUS, CREATE_TIME, UPDATE_TIME, CREATE_USER, UPDATE_USER,
IS_DELETED, CREATE_DEPT
</sql>
</mapper>

29
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/RecordMapper.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.RecordMapper">
<resultMap id="BaseResultMap" type="com.hnac.hzims.operational.config.entity.StAlarmRecordEntity">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="station_id" property="stationId" jdbcType="VARCHAR"/>
<result column="real_id" property="realId" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="TINYINT"/>
<result column="phone_record" property="phoneRecord" jdbcType="VARCHAR"/>
<result column="process_desc" property="processDesc" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="processor" property="processor" jdbcType="VARCHAR"/>
<result column="process_time" property="processTime" jdbcType="TIMESTAMP"/>
</resultMap>
<insert id="insertReturnId" parameterType="com.hnac.hzims.operational.config.entity.StAlarmRecordEntity">
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID() AS id
</selectKey>
insert into hy_st_alarm_record (id, station_id, real_id,
status, phone_record, process_desc,
create_time, processor, process_time
)
values (#{id,jdbcType=BIGINT}, #{stationId,jdbcType=VARCHAR}, #{realId,jdbcType=VARCHAR},
#{status,jdbcType=TINYINT}, #{phoneRecord,jdbcType=VARCHAR}, #{processDesc,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{processor,jdbcType=VARCHAR}, #{processTime,jdbcType=TIMESTAMP}
)
</insert>
</mapper>

19
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.StAlarmRecordMapper">
<insert id="insertReturnId" parameterType="com.hnac.hzims.operational.config.entity.StAlarmRecordEntity">
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID() AS id
</selectKey>
insert into hy_st_alarm_record (id, station_id, real_id,
status, phone_record, process_desc,
create_time, processor, process_time
)
values (#{id,jdbcType=BIGINT}, #{stationId,jdbcType=VARCHAR}, #{realId,jdbcType=VARCHAR},
#{status,jdbcType=TINYINT}, #{phoneRecord,jdbcType=VARCHAR}, #{processDesc,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{processor,jdbcType=VARCHAR}, #{processTime,jdbcType=TIMESTAMP}
)
</insert>
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttrConfigMapper.xml

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

15
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationAttributeMapper.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.StationAttributeMapper">
<select id="PointUnit" resultType="com.hnac.hzims.operational.station.entity.StationAttributeEntity">
select UPPER(CONCAT(EM_CODE,'-',ATTRIBUTES)) as ATTRIBUTES,unit
from hzims_station_attribute
where is_deleted = 0
and attributes in ('p','ia','uab','q')
and EM_CODE is not null and EM_CODE != ''
and not monitor_id is null and monitor_id != ''
and not unit is null and unit != ''
</select>
</mapper>

6
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StationMapper.xml

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

4
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/UseMapper.xml

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

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java

@ -3,7 +3,7 @@ package com.hnac.hzims.operational.config.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.config.service.CentralMonitorService; import com.hnac.hzims.operational.config.service.CentralMonitorService;
import com.hnac.hzims.operational.station.service.IRealMonitorService; import com.hnac.hzims.operational.station.service.IRealMonitorService;
import com.hnac.hzims.operational.station.vo.RealStationVo; import com.hnac.hzims.operational.main.vo.RealStationVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java

@ -1,7 +1,7 @@
package com.hnac.hzims.operational.config.service; package com.hnac.hzims.operational.config.service;
import com.hnac.hzims.operational.station.vo.RealStationVo; import com.hnac.hzims.operational.main.vo.RealStationVo;
import java.util.List; import java.util.List;

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

@ -4,7 +4,7 @@ import com.hnac.hzims.operational.config.service.CentralMonitorService;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.RealStationVo; import com.hnac.hzims.operational.main.vo.RealStationVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;

18
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -236,7 +236,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
if (null != data.getQ()) { if (null != data.getQ()) {
if (0 == data.getQ() && (Double.valueOf(value) > stFocusPropertiesEntity.getUpperUpperLimit() || Double.valueOf(value) < stFocusPropertiesEntity.getLowerLowerLimit())) { if (0 == data.getQ() && (Double.valueOf(value) > stFocusPropertiesEntity.getUpperUpperLimit() || Double.valueOf(value) < stFocusPropertiesEntity.getLowerLowerLimit())) {
if (alarmList.size() > 0) { if (alarmList.size() > 0) {
time = new Date().getTime() - alarmList.get(0).getProcessTime().getTime(); time = System.currentTimeMillis() - alarmList.get(0).getProcessTime().getTime();
} }
if ((recordList.size() == 0 && alarmList.size() == 0) || (time / 1000 / 60 > 30 && recordList.size() == 0)) { if ((recordList.size() == 0 && alarmList.size() == 0) || (time / 1000 / 60 > 30 && recordList.size() == 0)) {
isWarn = setStAlarmRecordEntity(dataSet, stFocusPropertiesEntity, isWarn, 2, true); isWarn = setStAlarmRecordEntity(dataSet, stFocusPropertiesEntity, isWarn, 2, true);
@ -251,7 +251,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
} }
} else if (0 == data.getQ() && ((Double.valueOf(value) > stFocusPropertiesEntity.getUpperLimit() && Double.valueOf(value) < stFocusPropertiesEntity.getUpperUpperLimit()) || (Double.valueOf(value) > stFocusPropertiesEntity.getLowerLowerLimit() && Double.valueOf(value) < stFocusPropertiesEntity.getLowerLimit()))) { } else if (0 == data.getQ() && ((Double.valueOf(value) > stFocusPropertiesEntity.getUpperLimit() && Double.valueOf(value) < stFocusPropertiesEntity.getUpperUpperLimit()) || (Double.valueOf(value) > stFocusPropertiesEntity.getLowerLowerLimit() && Double.valueOf(value) < stFocusPropertiesEntity.getLowerLimit()))) {
if (alarmList.size() > 0) { if (alarmList.size() > 0) {
time = new Date().getTime() - alarmList.get(0).getProcessTime().getTime(); time = System.currentTimeMillis() - alarmList.get(0).getProcessTime().getTime();
} }
if ((recordList.size() == 0 && alarmList.size() == 0) || (time / 1000 / 60 > 30 && recordList.size() == 0)) { if ((recordList.size() == 0 && alarmList.size() == 0) || (time / 1000 / 60 > 30 && recordList.size() == 0)) {
isWarn = setStAlarmRecordEntity(dataSet, stFocusPropertiesEntity, isWarn, ConfigStatus.ConfigStatusEnum.RED.getStatus(), false); isWarn = setStAlarmRecordEntity(dataSet, stFocusPropertiesEntity, isWarn, ConfigStatus.ConfigStatusEnum.RED.getStatus(), false);
@ -737,15 +737,15 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
} }
List<FaultVo> list = JSONArray.parseArray(result,FaultVo.class); List<FaultVo> list = JSONArray.parseArray(result,FaultVo.class);
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(list)){
return new ArrayList<>(); return null;
} }
log.error("fault_list_stations: {}",stations);
log.error("fault_list_list: {}",list);
Map<String,String> map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName)); Map<String,String> map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName));
// 查询已处理预警数据 return list.stream().filter(fault -> map.containsKey(fault.getStation())).map(o->{
List<AlarmHandleEntity> handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),null); o.setStationName(map.get(o.getStation()));
if(CollectionUtil.isEmpty(handles)){ return o;
return list.stream().filter(fault -> map.containsKey(fault.getStation())).peek(o-> o.setStationName(map.get(o.getStation()))).collect(Collectors.toList()); }).collect(Collectors.toList());
}
return list.stream().filter(fault -> !handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(fault.getFaultId()) && map.containsKey(fault.getStation())).peek(o-> o.setStationName(map.get(o.getStation()))).collect(Collectors.toList());
} }

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

@ -269,6 +269,7 @@ public class HydropowerServiceImpl implements HydropowerService {
stationList.forEach(station -> { stationList.forEach(station -> {
// 站点设备集合 // 站点设备集合
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
log.error("load_power_data station :" + station.getCode() + "==== device :" + stationDevices );
Map<String, Float> generateMap = this.getGenerateYear(station,stationDevices,start,end); Map<String, Float> generateMap = this.getGenerateYear(station,stationDevices,start,end);
if(MapUtils.isEmpty(generateMap)){ if(MapUtils.isEmpty(generateMap)){
return; return;

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

@ -27,10 +27,10 @@ import com.hnac.hzims.operational.station.service.IRealMonitorService;
import com.hnac.hzims.operational.station.service.IStationAttrConfigService; import com.hnac.hzims.operational.station.service.IStationAttrConfigService;
import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.RealAttributeVo; import com.hnac.hzims.operational.main.vo.RealAttributeVo;
import com.hnac.hzims.operational.station.vo.RealDeviceVo; import com.hnac.hzims.operational.main.vo.RealDeviceVo;
import com.hnac.hzims.operational.station.vo.RealStationVo; import com.hnac.hzims.operational.main.vo.RealStationVo;
import com.hnac.hzims.operational.station.vo.WeatherVo; import com.hnac.hzims.operational.main.vo.WeatherVo;
import com.hnac.hzinfo.sdk.v5.redis.RedisClient; import com.hnac.hzinfo.sdk.v5.redis.RedisClient;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

5
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java

@ -10,5 +10,8 @@ package com.hnac.hzims.ticket.processflow.constant;
*/ */
public class TicketProcessConstant { public class TicketProcessConstant {
public final static String STARTEVENT = "workTicketFlow"; /**
* 第一种工作票的key
*/
public static final String FIRST_TICKET_KEY = "networking";
} }

44
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessDictController.java

@ -0,0 +1,44 @@
package com.hnac.hzims.ticket.processflow.controller;
import com.hnac.hzims.ticket.processflow.entity.ProcessDict;
import com.hnac.hzims.ticket.processflow.service.ProcessDictService;
import groovy.util.logging.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/6/5 9:35
*/
@Slf4j
@RequestMapping("/process-dict")
@RestController
@RequiredArgsConstructor
public class ProcessDictController {
private final ProcessDictService processDictService;
@GetMapping("/test")
public void test(){
ProcessDict processDict = new ProcessDict();
processDict.setDictKey("networking");
processDict.setDictSort(0);
processDict.setDictValue("workTicketFlow");
processDict.setDictLabel("第一种工作票");
processDict.setIsDefault("Y");
processDict.setRemark("第一种工作票");
processDict.setDictType("工作票");
processDictService.save(processDict);
}
}

115
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java

@ -0,0 +1,115 @@
package com.hnac.hzims.ticket.processflow.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.tenant.mp.TenantEntity;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 票据字典表
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/6/5 8:33
*/
@Data
@ApiModel(value = "ProcessDict",description = "票据字典表")
@Accessors(chain = true)
@TableName("process_dict")
public class ProcessDict {
/**
* 票据编码
*/
@TableId(type = IdType.AUTO)
@ApiModelProperty("票据编码")
private Long dictCode;
/**
*票据排序
*/
@ApiModelProperty("票据排序")
private Integer dictSort;
/**
*票据字典码
*/
@ApiModelProperty("票据字典码")
private String dictKey;
/**
*票据流程标识
*/
@ApiModelProperty("票据流程标识")
private String dictValue;
/**
*票据标签
*/
@ApiModelProperty("票据标签")
private String dictLabel;
/**
*票据类型
*/
@ApiModelProperty("票据类型")
private String dictType;
/**
*是否默认Y是 N否
*/
@ApiModelProperty("是否默认(Y是 N否)")
private String isDefault;
/**
*状态0正常 1停用
*/
@ApiModelProperty("状态(0正常 1停用)")
private Integer status;
/**
* 所属机构
*/
@ApiModelProperty("所属机构")
private Long createDept;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
/**
* 票据备注
*/
@ApiModelProperty("票据备注")
private String remark;
}

14
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/ProcessDictMapper.java

@ -0,0 +1,14 @@
package com.hnac.hzims.ticket.processflow.mapper;
import com.hnac.hzims.ticket.processflow.entity.ProcessDict;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/6/5 8:49
*/
public interface ProcessDictMapper extends UserDataScopeBaseMapper<ProcessDict> {
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save