Compare commits

...

7 Commits

  1. 48
      hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/IrrBDGate.java
  2. 14
      hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/IrrBDGateRefData.java
  3. 64
      hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/StRsrBsin.java
  4. 62
      hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/StRsrHych.java
  5. 1
      hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java
  6. 38
      hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/vo/StRsrBsinVo.java
  7. 10
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  8. 10
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  9. 3
      hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/MessageTypeEnum.java
  10. 3
      hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/TemplateTypeEnum.java
  11. 2
      hzims-service-api/pom.xml
  12. 31
      hzims-service-api/suichang-api/pom.xml
  13. 10
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/entity/Demo.java
  14. 29
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/feign/ISuichangClient.java
  15. 138
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/util/DateUtil.java
  16. 39
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/util/MemoryPagination.java
  17. 43
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorCountVo.java
  18. 29
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorReq.java
  19. 54
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorVo.java
  20. 80
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/EcologicalFlowVo.java
  21. 37
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowDataReq.java
  22. 60
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportDayVo.java
  23. 33
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportDetailVo.java
  24. 49
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportVo.java
  25. 26
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/FlowWarnQueryDTO.java
  26. 45
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/FlowWarnVo.java
  27. 33
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ImageReq.java
  28. 28
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ImageVo.java
  29. 22
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/MissingImagesRes.java
  30. 46
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorExportDTO.java
  31. 27
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorRes.java
  32. 27
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorSingleInfoReq.java
  33. 25
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorSingleInfoVo.java
  34. 47
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorVo.java
  35. 21
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationQueryReq.java
  36. 25
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationTreeRes.java
  37. 70
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationTypeVo.java
  38. 45
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationVo.java
  39. 40
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataDetailVo.java
  40. 29
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataReq.java
  41. 37
      hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataVo.java
  42. 6
      hzims-service-api/weather-api/README.md
  43. 6
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/BaseInfoApplication.java
  44. 165
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/GateInfoController.java
  45. 165
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StRsrBsinController.java
  46. 28
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java
  47. 2
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/feign/BaseInfoClient.java
  48. 16
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateMapper.java
  49. 49
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateMapper.xml
  50. 14
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateRefDataMapper.java
  51. 78
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateRefDataMapper.xml
  52. 15
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrBsinMapper.java
  53. 29
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrBsinMapper.xml
  54. 7
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrHychMapper.java
  55. 5
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrHychMapper.xml
  56. 4
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java
  57. 25
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/IGateInfoService.java
  58. 11
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/IStRsrBsinService.java
  59. 10
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/IStRsrHychService.java
  60. 3
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java
  61. 75
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/GateInfoServiceImpl.java
  62. 1
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java
  63. 3
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/ReservoirDataServiceImpl.java
  64. 19
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StRsrBsinServiceImpl.java
  65. 23
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StRsrHychServiceImpl.java
  66. 6
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StZvarlBServiceImpl.java
  67. 32
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/wrapper/StRsrBsinWrapper.java
  68. 34
      hzims-service/base-info/src/main/resources/application-dev.yml
  69. 52
      hzims-service/base-info/src/main/resources/application-prod.yml
  70. 8
      hzims-service/base-info/src/main/resources/application.yml
  71. 2
      hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/service/impl/DamSafetyDataServiceImpl.java
  72. 7
      hzims-service/digital-twin-display/pom.xml
  73. 2
      hzims-service/digital-twin-display/src/main/resources/application-dev.yml
  74. 194
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmOreanizationController.java
  75. 31
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  76. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmOreanizationClient.java
  77. 21
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmOreanizationMapper.java
  78. 47
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmOreanizationMapper.xml
  79. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_attach.sql
  80. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_info.sql
  81. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_model.sql
  82. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_model_param.sql
  83. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_oreanization.sql
  84. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_param.sql
  85. 32
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmOreanizationService.java
  86. 162
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmOreanizationServiceImpl.java
  87. 6
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/MessageAlarmCenterApplication.java
  88. 5
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/MessageReceiveInfoController.java
  89. 14
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/PlanParamInfoController.java
  90. 3
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.java
  91. 12
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml
  92. 8
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml
  93. 33
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mqtt/MessageFlowWranConsumer.java
  94. 9
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java
  95. 52
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/impl/MessageStrategyServiceImpl.java
  96. 191
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/strategy/FlowWarnStrategy.java
  97. 227
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/xxljob/MessageMonitorObjJob.java
  98. 2
      hzims-service/message-alarm-service/src/main/resources/application-dev.yml
  99. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/huosan/service/impl/HuoSanTargetServiceImpl.java
  100. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  101. Some files were not shown because too many files have changed in this diff Show More

48
hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/IrrBDGate.java

@ -0,0 +1,48 @@
package com.hnac.hzims.baseinfo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springblade.core.mp.base.BaseEntity;
@Data
@TableName("irrbdgate")
public class IrrBDGate extends BaseEntity {
private String strobeCode;
private String stcd;
private String watergateCode;
private String producingArea;
private String factory;
private String strobeType;
private String strobeMaterial;
private Double height;
private Double width;
private Double thickness;
private String motivity;
private String type;
private Short velocity;
private String areaCode;
private String lrcd;
private String szhldm;
private Float dongj;
private Float beiw;
private Float discharge;
}

14
hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/IrrBDGateRefData.java

@ -0,0 +1,14 @@
package com.hnac.hzims.baseinfo.entity;
import lombok.Data;
@Data
public class IrrBDGateRefData {
private String strobeCode;
private String refstcd;
private String refqpoint;
private String refzpoint;
}

64
hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/StRsrBsin.java

@ -0,0 +1,64 @@
package com.hnac.hzims.baseinfo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
/**
* 水库信息表
*/
@Data
@TableName("st_rsr_bsin")
public class StRsrBsin extends BaseEntity {
@ApiModelProperty("水库代码")
private String rscd;
@ApiModelProperty("水库名称")
private String rtunm;
@ApiModelProperty("主管部门")
private String cmdp;
@ApiModelProperty("主管部门联系电话")
private String cmdptel;
@ApiModelProperty("河流名称")
private String rvcd;
@ApiModelProperty("水系名称")
private String hnnm;
@ApiModelProperty("流域名称")
private String ctcd;
@ApiModelProperty("东经")
private Double eslg;
@ApiModelProperty("北纬")
private Double nrlt;
@ApiModelProperty("站址")
private String stlc;
@ApiModelProperty("行政区划码")
private String addvcd;
@ApiModelProperty("基面名称")
private String dtmnm;
@ApiModelProperty("基面高程")
private Double dtmel;
@ApiModelProperty("基面修正值")
private Double dtpr;
@ApiModelProperty("报汛等级")
private String frgrd;
@ApiModelProperty("集水面积")
private Double drna;
@ApiModelProperty("拼音码")
private String phcd;
@ApiModelProperty("启用标志")
private String usfl;
@ApiModelProperty("备注")
private String comments;
@ApiModelProperty("建成时间")
private Date buildTime;
@ApiModelProperty("最大坝高")
private Double maxdmhg;
@ApiModelProperty("坝型")
private String dmtp;
@ApiModelProperty("库区GIS范围")
private String gisRange;
@ApiModelProperty("水库功能(可多选)")
private String rsfn;
}

62
hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/entity/StRsrHych.java

@ -0,0 +1,62 @@
package com.hnac.hzims.baseinfo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 水库防洪信息
*/
@Data
@TableName("st_rsr_hych")
public class StRsrHych implements Serializable {
@ApiModelProperty("水库代码")
@TableId(type = IdType.INPUT)
private String rscd;
@ApiModelProperty("水库类型")
private String rsvrtp;
@ApiModelProperty("坝顶高程")
private Double damel;
@ApiModelProperty("控制流域面积")
private Double cnctar;
@ApiModelProperty("校核洪水位")
private Double chfl;
@ApiModelProperty("设计洪水位")
private Double dsfl;
@ApiModelProperty("正常高水位")
private Double normz;
@ApiModelProperty("死水位")
private Double ddwz;
@ApiModelProperty("汛限水位")
private Double mjfl;
@ApiModelProperty("兴利水位")
private Double actz;
@ApiModelProperty("总库容")
private Double ttcp;
@ApiModelProperty("防洪库容")
private Double fldcp;
@ApiModelProperty("兴利库容")
private Double actcp;
@ApiModelProperty("死库容")
private Double ddcp;
@ApiModelProperty("历史最高库水位")
private Double hhrz;
@ApiModelProperty("历史最大蓄水量")
private Double hmxw;
@ApiModelProperty("历史最高库水位(蓄水量)时间")
private Date maxleveltime;
@ApiModelProperty("低水位告警值")
private Double laz;
@ApiModelProperty("启动预报流量标准")
private Double sfq;
@ApiModelProperty("时间戳")
private Date moditime;
@ApiModelProperty("更新时间")
private Date dtuptm;
}

1
hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java

@ -8,7 +8,6 @@ public class ConvertUtil {
static {
convertMap.put("ph","PH");
convertMap.put("has","高锰酸盐指数");
convertMap.put("dox","溶解氧");
convertMap.put("cu","铜");
convertMap.put("zn","锌");
convertMap.put("se","硒");

38
hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/vo/StRsrBsinVo.java

@ -0,0 +1,38 @@
package com.hnac.hzims.baseinfo.vo;
import com.hnac.hzims.baseinfo.entity.StRsrBsin;
public class StRsrBsinVo extends StRsrBsin {
//行政区划名称
private String addvcdnm;
/*** 水位*/
private String waterLevel;
/*** 库容*/
private String capacity;
public String getAddvcdnm() {
return addvcdnm;
}
public void setAddvcdnm(String addvcdnm) {
this.addvcdnm = addvcdnm;
}
public String getWaterLevel() {
return waterLevel;
}
public void setWaterLevel(String waterLevel) {
this.waterLevel = waterLevel;
}
public String getCapacity() {
return capacity;
}
public void setCapacity(String capacity) {
this.capacity = capacity;
}
}

10
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -87,7 +87,7 @@ public interface IEmInfoClient {
String GET_STRUCT_TREE_BY_STATION = API_PREFIX + "/getStructTreeByStation";
String DEVICE_BY_TYPE = API_PREFIX + "/deviceByType";
String DEVICE_BY_TYPE = API_PREFIX + "/deviceByTyep";
@PostMapping(DETAIL)
EmInfoEntity getByCode(@RequestParam("code") String id);
@ -101,14 +101,6 @@ public interface IEmInfoClient {
@GetMapping(LIST_BY_DEPT_ID)
List<EmInfoEntity> list();
String listByRefOreanization = API_PREFIX + "/listByRefOreanization";
@GetMapping(listByRefOreanization)
R<List<EmInfoEntity>> listByRefOreanization(Long refOreanization);
String getByEquipmentId = API_PREFIX + "/getByEquipmentId";
@GetMapping(getByEquipmentId)
EmInfoVO getByEquipmentId(Long id);
/**
* 根据机构ID获取设备Code
*

10
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -36,16 +36,6 @@ public class IEmInfoClientBack implements IEmInfoClient {
}
@Override
public R<List<EmInfoEntity>> listByRefOreanization(Long refOreanization) {
return null;
}
@Override
public EmInfoVO getByEquipmentId(Long id) {
return null;
}
@Override
public R<List<String>> getEmCodeByDeptId(Long deptId) {
return R.data(new ArrayList<>());
}

3
hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/MessageTypeEnum.java

@ -2,7 +2,8 @@ package com.hnac.hzims.message_alarm.enums;
//消息类型
public enum MessageTypeEnum {
NOTIFY("notify","通知消息"),
ALARM("alarm","告警消息");
ALARM("alarm","告警消息"),
FLOW_WARN("flowWarn","流量告警消息");
String code;
String name;

3
hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/TemplateTypeEnum.java

@ -4,7 +4,8 @@ public enum TemplateTypeEnum {
REPORT("report","通知消息"),
NOTIFY("notify","通知消息"),
SOE("soe","设备soe"),
ALARM("alarm","告警消息");
ALARM("alarm","告警消息"),
FLOW_WARN("flowWarn","生态流量告警消息");
String code;
String name;

2
hzims-service-api/pom.xml

@ -28,12 +28,12 @@
<module>common-api</module>
<module>middle-api</module>
<module>base-info-api</module>
<module>digital-twin-display-api</module>
<module>dam-safety-api</module>
<module>video-image-api</module>
<module>water-quality-api</module>
<module>water-rain-api</module>
<module>message-alarm-api</module>
<module>suichang-api</module>
</modules>
<dependencies>

31
hzims-service-api/suichang-api/pom.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-service-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>suichang-api</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.5</version>
</dependency>
</dependencies>
</project>

10
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/entity/Demo.java

@ -0,0 +1,10 @@
package com.hnac.hzims.suichang.entity;
/**
* @Author: liangfan
* @Date: 2024-03-08 15:06
* @Description:
*/
public class Demo {
}

29
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/feign/ISuichangClient.java

@ -0,0 +1,29 @@
package com.hnac.hzims.suichang.feign;
import com.hnac.hzims.suichang.vo.StationQueryReq;
import com.hnac.hzims.suichang.vo.StationVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@FeignClient(
value = "suichang"
)
public interface ISuichangClient {
String API_PREFIX = "/suichangClient";
String GET_STATION_BY_REQ = API_PREFIX + "/getStationListByReq";
String GET_DATA = API_PREFIX + "/getData";
@GetMapping(GET_STATION_BY_REQ)
List<StationVo> getStationListByReq(StationQueryReq req);
@GetMapping(GET_DATA)
List<Map<String, Object>> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime startTime, LocalDateTime endTime);
}

138
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/util/DateUtil.java

@ -0,0 +1,138 @@
package com.hnac.hzims.suichang.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class DateUtil {
public static Map<String, Date> getStartEnd(String yearMonth) {
Map<String, Date> data = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date begin = sdf.parse(yearMonth + "-01 00:00:00");
// 最大天数
Date endSt = sdf.parse(yearMonth + "-" + getMaxDayByYearMonth(begin) + " 23:59:59");
data.put("start", begin);
data.put("end", endSt);
} catch (ParseException e) {
e.printStackTrace();
}
return data;
}
public static int getMaxDayByYearMonth(Date start) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(start);
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
}
public static LocalDateTime getStartOfLastQuarter(LocalDateTime dateTime) {
int currentMonth = dateTime.getMonthValue();
int currentYear = dateTime.getYear();
// 计算上个季度的开始月份
int startMonthOfLastQuarter = (currentMonth - 1) / 3 * 3 + 1;
if (startMonthOfLastQuarter > currentMonth) {
// 如果当前月份在上个季度之后,则回到上一年的相应季度
startMonthOfLastQuarter -= 3;
currentYear--;
}
// 获取上个季度的开始时间(该季度的第一个月的第一天午夜)
return LocalDateTime.of(currentYear, startMonthOfLastQuarter, 1, 0, 0);
}
public static LocalDateTime getEndOfLastQuarter(LocalDateTime dateTime) {
LocalDateTime startOfLastQuarter = getStartOfLastQuarter(dateTime);
// 获取上个季度的结束时间(该季度的最后一个月的最后一天午夜)
int endMonthOfLastQuarter = startOfLastQuarter.getMonthValue() + 2;
int endYearOfLastQuarter = startOfLastQuarter.getYear();
if (endMonthOfLastQuarter > 12) {
// 如果结束月份超过12,则回到下一年的相应月份
endMonthOfLastQuarter -= 12;
endYearOfLastQuarter++;
}
return LocalDateTime.of(endYearOfLastQuarter, endMonthOfLastQuarter, 1, 0, 0);
}
public static LocalDateTime getStartOfHalfYear(LocalDateTime dateTime) {
int month = dateTime.getMonthValue();
int year = dateTime.getYear();
if (month <= 6) {
// 如果是上半年,则获取去年下半年的开始时间(7月1日)
year--;
return LocalDateTime.of(year, Month.JULY, 1, 0, 0);
} else {
return LocalDateTime.of(year, Month.JANUARY, 1, 0, 0);
}
}
public static LocalDateTime getEndOfHalfYear(LocalDateTime dateTime) {
int month = dateTime.getMonthValue();
int year = dateTime.getYear();
if (month <= 6) {
// 如果是上半年,则获取去年下半年的结束时间(1月1日)
return LocalDateTime.of(year, Month.JANUARY, 1, 0, 0, 0);
} else {
return LocalDateTime.of(year, Month.JULY, 1, 0, 0, 0);
}
}
public static long getHoursPassedToday() {
// 获取当前时间
LocalTime currentTime = LocalTime.now();
// 获取今天的开始时间(午夜0点)
LocalTime midnight = LocalTime.MIDNIGHT;
// 计算时间差,单位为小时
return ChronoUnit.HOURS.between(midnight, currentTime);
}
public static LocalDateTime getEndTime(String time) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
java.time.LocalDate timeDate = java.time.LocalDate.parse(time, formatter);
LocalDateTime resultTime = LocalDateTime.of(timeDate, LocalTime.MIDNIGHT);
// 比较两个时间的大小
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
if (now.compareTo(resultTime) > 0) {
resultTime = LocalDateTime.of(timeDate, LocalTime.MAX);
} else {
resultTime = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
}
return resultTime;
}
public static LocalDateTime getEndTimeByDay(String time) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
java.time.LocalDate timeDate = java.time.LocalDate.parse(time, formatter);
return LocalDateTime.of(timeDate, LocalTime.MIDNIGHT).plusDays(1);
}
public static LocalDateTime getStartTime(String time) {
// 创建一个 DateTimeFormatter 对象来解析日期字符串
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
java.time.LocalDate startDate = java.time.LocalDate.parse(time, formatter);
// 结合 LocalDate 和 LocalTime 创建 LocalDateTime 对象
LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIDNIGHT);
return startTime;
}
public static String getStringTime(LocalDateTime time) {
// 创建一个 DateTimeFormatter 对象,用于定义你想要的格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 使用 formatter 将 LocalDateTime 转换为 String
return time.format(formatter);
}
}

39
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/util/MemoryPagination.java

@ -0,0 +1,39 @@
package com.hnac.hzims.suichang.util;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author tanghaihao
* @date 2023年07月12日 17:15
*/
public class MemoryPagination {
/**
* 内存分页
*
* @param records 待分页的数据
* @param pageNum 当前页码
* @param pageSize 每页显示的条数
* @return 分页之后的数据
*/
public static <T> List<T> pagination(List<T> records, int pageNum, int pageSize) {
if (CollectionUtils.isEmpty(records)) {
return Collections.emptyList();
}
int totalCount = records.size() ;
int remainder = totalCount % pageSize;
int pageCount = (remainder > 0) ? totalCount / pageSize + 1 : totalCount / pageSize;
if (remainder == 0) {
return records.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
} else {
if (pageNum == pageCount) {
return records.stream().skip((pageNum - 1) * pageSize).limit(totalCount).collect(Collectors.toList());
} else {
return records.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
}
}
}
}

43
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorCountVo.java

@ -0,0 +1,43 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class AvgMonitorCountVo {
/**
* 电站名称
*/
private String name;
/**
* 核定下限流量
*/
private BigDecimal flowValue;
/**
* 考核天数
*/
private Long count;
/**
* 合格天数
*/
private Integer passCount;
/**
* 合格率
*/
private String passPre;
private List<RealMonitorSingleInfoVo> infos;
}

29
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorReq.java

@ -0,0 +1,29 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import org.springblade.core.mp.support.Query;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class AvgMonitorReq extends Query {
/**
* 电站名称
*/
private String name;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
}

54
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorVo.java

@ -0,0 +1,54 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class AvgMonitorVo {
/**
* 电站名称
*/
private String name;
/**
* 核定下限流量
*/
private BigDecimal flowValue;
/**
* 日均流量
*/
private String avgFlow;
/**
* 实时流量
*/
private String realFlow;
/**
* 现在的时间
*/
private String dateNow;
/**
* 经度(东经)
*/
private BigDecimal lgtd;
/**
* 纬度(北纬)
*/
private BigDecimal lttd;
/**
* 类型 1无节制电站 2流量计电站
*/
private String stationType;
/**
* 上报率
*/
private String passPre;
}

80
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/EcologicalFlowVo.java

@ -0,0 +1,80 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class EcologicalFlowVo {
/**
* 电站数
*/
private Integer allStationListSize;
/**
* 无节制电站
*/
private Integer noLimitStationListSize;
/**
* 流量计电站
*/
private Integer flowStationListSize;
/**
* 昨日达标率
*/
private String yesterdayFinishPer;
/**
* 昨日达标数量
*/
private Integer yesterdayFinishCount;
/**
* 上月达标数量
*/
private Integer monthFinishCount;
/**
* 上月达标率
*/
private String monthFinishPer;
/**
* 周达标率
*/
private String weekFinishPer;
/**
* 季达标率
*/
private String quarterFinishPer;
/**
* 半年达标率
*/
private String halfYearFinishPer;
/**
* 年达标率
*/
private String yearFinishPer;
/**
* 今天上报率
*/
private String reportTodayPre;
/**
* 今天预警数
*/
private Integer warnTodayCount;
/**
* 昨天上报率
*/
private String reportYesTerdayPre;
/**
* 昨天预警数
*/
private Integer warnYesTerdayCount;
}

37
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowDataReq.java

@ -0,0 +1,37 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import org.springblade.core.mp.support.Query;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class ExamStationFlowDataReq extends Query {
/**
* 电站名称
*/
private String name;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 1 无节制电站 2 流量计电站
*/
private String stationType;
/**
* 是否达标
*/
private String isPass;
}

60
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportDayVo.java

@ -0,0 +1,60 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author: liangfan
* @Date: 2024-03-15 18:33
* @Description:
*/
@Data
public class ExamStationFlowReportDayVo {
/**
* 电站名称
*/
private String name;
/**
* 所属区域
*/
private String areaName;
/**
* 状态
*/
private String status;
/**
* 日泄放比
*/
private String dayOutFlowPre;
/**
* 核定流量
*/
private BigDecimal flowValue;
/**
* 前日日均流量
*/
private BigDecimal yesTerDayAvgFlowValue;
/**
* 瞬时流量
*/
private BigDecimal realFlowValue;
/**
* 今日平均流量
*/
private BigDecimal toDayAvgFlowValue;
/**
* 实际下泄流量
*/
private BigDecimal realOutFlow;
/**
* 核定下泄流量
*/
private BigDecimal outFlow;
}

33
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportDetailVo.java

@ -0,0 +1,33 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author: liangfan
* @Date: 2024-03-15 18:41
* @Description:
*/
@Data
public class ExamStationFlowReportDetailVo {
/**
* 核定流量
*/
private BigDecimal ecologicalFlowValue;
/**
* 日均流量
*/
private BigDecimal flowValue;
/**
* 时间
*/
private String tm;
/**
* 是否合格
*/
private String isPass;
}

49
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportVo.java

@ -0,0 +1,49 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author: liangfan
* @Date: 2024-03-15 18:33
* @Description:
*/
@Data
public class ExamStationFlowReportVo {
/**
* 电站名称
*/
private String name;
/**
* 所属区域
*/
private String areaName;
/**
* 核定下限流量
*/
private BigDecimal flowValue;
/**
* 考核天数
*/
private Long count;
/**
* 合格天数
*/
private Integer passCount;
/**
* 合格率
*/
private String passPre;
/**
* 是否合格
*/
private String isPass;
private List<ExamStationFlowReportDetailVo> infos;
}

26
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/FlowWarnQueryDTO.java

@ -0,0 +1,26 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
/**
* @Author: liangfan
* @Date: 2024-03-20 17:23
* @Description:
*/
@Data
public class FlowWarnQueryDTO {
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 站点id
*/
private String objectCode;
}

45
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/FlowWarnVo.java

@ -0,0 +1,45 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
/**
* @Author: liangfan
* @Date: 2024-03-19 10:00
* @Description:
*/
@Data
public class FlowWarnVo {
/**
* 站点名称
*/
String name;
/**
* 消息内容
*/
String content;
/**
* 发送时间
*/
String sendTime;
/**
* 发送人id
*/
String receiveUserId;
/**
* 发送人姓名
*/
String receiveUserName;
/**
* 业务对象来源(数据平台水库等)
*/
String objectSource;
/**
* 业务对象编码
*/
String objectCode;
String alarmLevel;
}

33
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ImageReq.java

@ -0,0 +1,33 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
/**
* @Author: liangfan
* @Date: 2024-03-21 19:04
* @Description:
*/
@Data
public class ImageReq {
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 站点名称
*/
private String name;
/**
* 设备编码
*/
private String deviceCode;
/**
* 正常 异常
*/
private String status;
}

28
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/ImageVo.java

@ -0,0 +1,28 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
/**
* @Author: liangfan
* @Date: 2024-03-21 19:04
* @Description:
*/
@Data
public class ImageVo {
private Long id;
private String stcd;
private String time;
private String data;
private String manualpath;
private String name;
private String status;
}

22
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/MissingImagesRes.java

@ -0,0 +1,22 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
/**
* @Author: liangfan
* @Date: 2024-03-21 19:33
* @Description:
*/
@Data
public class MissingImagesRes {
String deviceCode;
String name;
String area;
String month;
String monthMissingPre;
}

46
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorExportDTO.java

@ -0,0 +1,46 @@
package com.hnac.hzims.suichang.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class RealMonitorExportDTO {
/**
* 电站名称
*/
@ExcelProperty(value = "电站名称", index = 0)
private String name;
/**
* 核定下限流量
*/
@ExcelProperty(value = "核定流量(m³/s)", index = 1)
private BigDecimal flowValue;
/**
* 监测流量
*/
@ExcelProperty(value = "监测流量(m³/s)", index = 2)
private String realFlow;
/**
* 上报个数
*/
@ExcelProperty(value = "上报数(个)", index = 3)
private Integer reportCount;
/**
* 时间
*/
@ExcelProperty(value = "时间", index = 4)
private String dateNow;
}

27
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorRes.java

@ -0,0 +1,27 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class RealMonitorRes {
/**
* 电站名称
*/
private List<RealMonitorVo> realMonitorVos;
/**
* 应上报条数
*/
private Long reportCount;
}

27
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorSingleInfoReq.java

@ -0,0 +1,27 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import org.springblade.core.mp.support.Query;
/**
* @Author: liangfan
* @Date: 2024-03-14 09:56
* @Description:
*/
@Data
public class RealMonitorSingleInfoReq extends Query {
/**
* 设备编号
*/
private String deviceCode;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
}

25
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorSingleInfoVo.java

@ -0,0 +1,25 @@
package com.hnac.hzims.suichang.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* @Author: liangfan
* @Date: 2024-03-14 09:56
* @Description:
*/
@Data
public class RealMonitorSingleInfoVo {
/**
* 实时值
*/
@ExcelProperty(value = "流量值", index = 0)
private String value;
/**
* 时间
*/
@ExcelProperty(value = "监测时间", index = 1)
private String tm;
}

47
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorVo.java

@ -0,0 +1,47 @@
package com.hnac.hzims.suichang.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class RealMonitorVo {
/**
* 设备编号
*/
private String deviceCode;
/**
* 电站名称
*/
private String name;
/**
* 核定下限流量
*/
private BigDecimal flowValue;
/**
* 监测流量
*/
private String realFlow;
/**
* 上报个数
*/
private Integer reportCount;
/**
* 时间
*/
private String dateNow;
private String areaName;
}

21
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationQueryReq.java

@ -0,0 +1,21 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class StationQueryReq {
/**
* 电站名称
*/
private String name;
private String stationType;
}

25
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationTreeRes.java

@ -0,0 +1,25 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.util.List;
/**
* @Author: liangfan
* @Date: 2024-03-25 17:21
* @Description:
*/
@Data
public class StationTreeRes {
StationVo stationVo;
/**
* 数量
*/
int count;
/**
* 视频点位list
*/
List<StationTypeVo> child;
}

70
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationTypeVo.java

@ -0,0 +1,70 @@
package com.hnac.hzims.suichang.vo;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.support.QueryField;
/**
* @Author: liangfan
* @Date: 2024-03-25 17:11
* @Description:
*/
@Data
public class StationTypeVo {
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("视频源配置名称")
private String name;
@ApiModelProperty("站点ID")
private String stationId;
@ApiModelProperty("机构ID")
private Long deptId;
@ApiModelProperty("是否平台接入")
private Integer isHikvideo;
@ApiModelProperty("类型")
private String type;
@ApiModelProperty("视频类型;暂只包括清污机类型")
private String videoType;
@ApiModelProperty("数据源地址")
private String liveSourceAddress;
@ApiModelProperty("视频源编码")
private String pointCode;
@ApiModelProperty("代理API网关nginx服务器ip端口")
private String videoHost;
@ApiModelProperty("秘钥appkey")
private String appKey;
@ApiModelProperty("秘钥appSecret")
private String appSecret;
@ApiModelProperty("排序")
private Integer sort;
@ApiModelProperty("站點排序")
private Integer stationSort;
@ApiModelProperty("萤石云地址")
private String ysyUrl;
@ApiModelProperty("视频归属类型 1代表防汛安全,2代表运行安全,3生态流量监视")
private Integer videoOwerType;
@ApiModelProperty("拼音")
private String pingyin;
}

45
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StationVo.java

@ -0,0 +1,45 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class StationVo {
/**
* 名称
*/
private String name;
/**
* 设备编号
*/
private String deviceCode;
/**
* 核定流量
*/
private BigDecimal flowValue;
/**
* 电站类型 1 无节制电站 2流量计电站
*/
private String stationType;
/**
* 经度(东经)
*/
private BigDecimal lgtd;
/**
* 纬度(北纬)
*/
private BigDecimal lttd;
}

40
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataDetailVo.java

@ -0,0 +1,40 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class StatisticsFlowDataDetailVo {
/**
* 电站名称
*/
private String name;
/**
* 核定流量
*/
private String flowValue;
/**
* 考核天数
*/
private Integer examDays;
/**
* 合格天数
*/
private Integer examPassDays = 0;
/**
* 合格率
*/
private String examPassDayPre = "0.00%";
}

29
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataReq.java

@ -0,0 +1,29 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import org.springblade.core.mp.support.Query;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class StatisticsFlowDataReq extends Query {
/**
* 电站名称
*/
private String name;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
}

37
hzims-service-api/suichang-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataVo.java

@ -0,0 +1,37 @@
package com.hnac.hzims.suichang.vo;
import lombok.Data;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/31 9:37
*/
@Data
public class StatisticsFlowDataVo {
/**
* 区域名称
*/
private String areaName;
/**
* 考核电站个数
*/
private Integer examCount;
/**
* 达标电站个数
*/
private Integer passCount;
/**
* 达标率
*/
private String passPre;
/**
* 报表数据
*/
private List<StatisticsFlowDataDetailVo> detail;
}

6
hzims-service-api/weather-api/README.md

@ -0,0 +1,6 @@
# 工程简介
# 延伸阅读

6
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/BaseInfoApplication.java

@ -18,6 +18,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public class BaseInfoApplication extends SpringBootServletInitializer {
public final static String APP_NAME = "base-info";
// static {
// System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.config.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.username", "nacos");
// System.setProperty("spring.cloud.nacos.password", "nacos");
// }
public static void main(String[] args) {
BladeApplication.run(APP_NAME, BaseInfoApplication.class, args);

165
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/GateInfoController.java

@ -0,0 +1,165 @@
package com.hnac.hzims.baseinfo.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.IrrBDGate;
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData;
import com.hnac.hzims.baseinfo.service.IGateInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
@RequestMapping("/reservoirBaseInfo/gateInfo")
@AllArgsConstructor
@Api(value = "闸门信息", tags = "闸门信息接口")
public class GateInfoController {
private final IGateInfoService gateInfoService;
@RequestMapping(value = "save", method = {RequestMethod.POST})
@ResponseBody
@ApiOperation("添加闸门")
public R addGate(@RequestBody IrrBDGate irrBDGate) {
String deptId = AuthUtil.getDeptId();
IrrBDGate tmp = new IrrBDGate();
tmp.setStrobeCode(irrBDGate.getStrobeCode());
tmp.setStcd(irrBDGate.getStcd());
List<IrrBDGate> page = gateInfoService.list(tmp);
if (page != null && !page.isEmpty()) {
return R.fail(500, "存在重复的闸门代码为:" + irrBDGate.getStrobeCode() + "的数据");
}
return R.data(gateInfoService.addGate(irrBDGate));
}
@RequestMapping(value = "remove", method = {RequestMethod.POST})
@ResponseBody
@ApiOperation("删除闸门")
public R deleteGate(@ApiParam(value = "闸门id") @RequestParam Long id) {
boolean i = gateInfoService.removeById(id);
if (i) {
return R.data(true, "删除成功");
}
return R.fail(500, "不存在此记录");
}
@RequestMapping(value = "updateGate", method = {RequestMethod.POST})
@ResponseBody
@ApiOperation("修改闸门")
public R updateGate(@RequestBody IrrBDGate irrBDGate) {
irrBDGate.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
int i = gateInfoService.updateGate(irrBDGate);
if (i>0) {
return R.data(true, "修改成功");
}
return R.fail(500, "修改失败");
}
@RequestMapping(value = "pageList", method = {RequestMethod.GET})
@ResponseBody
@ApiOperation("查询闸门")
public R pageList(@ModelAttribute IrrBDGate irrBDGate, HttpServletRequest request, Query query) {
String deptId=request.getHeader("dept-id");
if(StringUtil.isEmpty(deptId)) {
deptId =AuthUtil.getDeptId();
}
if(StringUtil.isNotBlank(deptId)) {
irrBDGate.setCreateDept(Long.valueOf(deptId));
}
IPage<IrrBDGate> page = gateInfoService.selectGate(irrBDGate, Condition.getPage(query));
return R.data(page, "查询成功");
}
@RequestMapping(value = "list", method = {RequestMethod.GET})
@ResponseBody
@ApiOperation("查询闸门")
public R list(@ModelAttribute IrrBDGate irrBDGate) {
irrBDGate.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
List<IrrBDGate> list = gateInfoService.list(irrBDGate);
return R.data(list, "查询成功");
}
/**
* 修改闸门配置
*
* @return
*/
@RequestMapping(value = "saveRef", method = {RequestMethod.POST})
@ResponseBody
@ApiOperation("修改闸门配置")
public R saveRef(@RequestBody IrrBDGateRefData irrBDGateRef) {
int i = gateInfoService.addGateRef(irrBDGateRef);
if (i > 0) {
return R.data(true, "修改成功");
}
return R.fail(500, "修改失败");
}
/**
* 删除闸门配置
*
* @return
*/
@RequestMapping(value = "removeRef", method = {RequestMethod.POST})
@ResponseBody
@ApiOperation("删除闸门配置")
public R deleteGateRef(@ApiParam(value = "闸门编码") @RequestParam String gateCode) {
int i = gateInfoService.deleteGateRef(gateCode);
if (i > 0) {
return R.data(true, "删除成功");
}
return R.fail(500, "删除失败");
}
/**
* 修改闸门配置
*
* @return
*/
@RequestMapping(value = "updateRef", method = {RequestMethod.POST})
@ResponseBody
@ApiOperation("修改闸门配置")
public R updateGateRef(@RequestBody IrrBDGateRefData irrBDGateRef) {
int i = gateInfoService.updateGateRef(irrBDGateRef);
if (i > 0) {
return R.data(true, "修改成功");
}
return R.fail(500, "修改失败");
}
/**
* 查询闸门配置
*
* @return
*/
@RequestMapping(value = "detailRef", method = {RequestMethod.GET})
@ResponseBody
@ApiOperation("查询闸门配置")
public R listRef(@ApiParam(value = "闸门编码") @RequestParam String gateCode) {
IrrBDGateRefData res = gateInfoService.detailRef(gateCode);
return R.data(res, "查询成功");
}
}

165
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StRsrBsinController.java

@ -0,0 +1,165 @@
package com.hnac.hzims.baseinfo.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.baseinfo.entity.StRsrBsin;
import com.hnac.hzims.baseinfo.entity.StRsrHych;
import com.hnac.hzims.baseinfo.service.IStRsrBsinService;
import com.hnac.hzims.baseinfo.service.IStRsrHychService;
import com.hnac.hzims.baseinfo.vo.StRsrBsinVo;
import com.hnac.hzims.baseinfo.wrapper.StRsrBsinWrapper;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/reservoir/stRsrBsin")
@AllArgsConstructor
@Api(value = "水库信息", tags = "水库信息接口")
public class StRsrBsinController extends BladeController implements CacheNames {
private final IStRsrBsinService stRsrBsinService;
private final IStRsrHychService stRsrHychService;
/**
* 分页
*/
@GetMapping("/pageList")
@ApiImplicitParams({
@ApiImplicitParam(name = "rscd", value = "水库代码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "rtunm", value = "水库名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入stRsrBsin")
public R<IPage<StRsrBsinVo>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletRequest request) {
LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper();
if(param.get("rscd")!=null) {
wrapper.like(StRsrBsin::getRscd,param.get("rscd"));
}
if(param.get("rtunm")!=null) {
wrapper.like(StRsrBsin::getRtunm,param.get("rtunm"));
}
String deptId=request.getHeader("dept-id");
if(StringUtil.isEmpty(deptId)) {
deptId =AuthUtil.getDeptId();
}
if(StringUtil.isNotBlank(deptId)) {
wrapper.like(StRsrBsin::getCreateDept,deptId);
}
IPage<StRsrBsin> pages = stRsrBsinService.page(Condition.getPage(query), wrapper);
return R.data(StRsrBsinWrapper.build().pageVO(pages));
}
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "rscd", value = "水库代码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "rtunm", value = "水库名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入stRsrBsin")
public R<List<StRsrBsinVo>> list(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletRequest request) {
LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper();
if(param.get("rscd")!=null) {
wrapper.like(StRsrBsin::getRscd,param.get("rscd"));
}
if(param.get("rtunm")!=null) {
wrapper.like(StRsrBsin::getRtunm,param.get("rtunm"));
}
String deptId = request.getHeader("dept-id");
if (StringUtil.isEmpty(deptId)) {
deptId = AuthUtil.getDeptId();
}
if (StringUtil.isNotBlank(deptId)) {
wrapper.like(StRsrBsin::getCreateDept, deptId);
}
List<StRsrBsin> list = stRsrBsinService.list(wrapper);
return R.data(StRsrBsinWrapper.build().listVO(list));
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入stRsrBsin")
public R<Map<String,Object>> detail(StRsrBsin stRsrBsin) {
Map<String,Object> data=new HashMap<>();
StRsrBsin detail = stRsrBsinService.getOne(Condition.getQueryWrapper(stRsrBsin));
data.put("stRsrBsin", StRsrBsinWrapper.build().entityVO(detail));
//防洪信息
StRsrHych param=new StRsrHych();
param.setRscd(stRsrBsin.getRscd());
StRsrHych stRsrHych=stRsrHychService.getOne(Condition.getQueryWrapper(param));
data.put("stRsrHych",stRsrHych);
return R.data(data);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入stRsrBsin")
public R save(@RequestBody StRsrBsin stRsrBsin) {
if(stRsrBsin==null){
return R.fail("水库信息不能为空");
}
LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper();
wrapper.eq(StRsrBsin::getRscd,stRsrBsin.getRscd());
List<StRsrBsin> list =stRsrBsinService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("水库编码已存在");
}
wrapper=new LambdaQueryWrapper();
wrapper.eq(StRsrBsin::getRtunm,stRsrBsin.getRtunm());
list =stRsrBsinService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("水库名称已存在");
}
return R.status(stRsrBsinService.save(stRsrBsin));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入stRsrBsin")
public R update(@RequestBody StRsrBsin stRsrBsin) {
return R.status(stRsrBsinService.updateById(stRsrBsin));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = stRsrBsinService.deleteLogic(Func.toLongList(ids));
return R.status(temp);
}
}

28
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java

@ -1,18 +1,21 @@
package com.hnac.hzims.baseinfo.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.baseinfo.entity.StZvarlB;
import com.hnac.hzims.baseinfo.service.StZvarlBService;
import com.hnac.hzims.common.utils.Condition;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.*;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@RestController
@Api(description = "库(湖)容曲线控制器")
@ -22,6 +25,25 @@ public class StZvarlBController {
@Autowired
private StZvarlBService stZvarlBService;
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "rscd", value = "库(湖)编码", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入stZvarlB")
public R<List<StZvarlB>> list(@ApiIgnore @RequestParam Map<String, Object> param) {
LambdaQueryWrapper<StZvarlB> wrapper = new LambdaQueryWrapper();
if (param.get("stcd") != null) {
wrapper.like(StZvarlB::getStcd, param.get("stcd"));
}
wrapper.orderByAsc(StZvarlB::getPtno);
List<StZvarlB> list = stZvarlBService.list(wrapper);
return R.data(list);
}
@ApiOperation(notes = "获取库(湖)容曲线列表数据接口", value = "获取库(湖)容曲线列表数据接口")
@RequestMapping(value = "bindStZvarlBs", method = RequestMethod.GET)

2
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/feign/BaseInfoClient.java

@ -72,13 +72,11 @@ public class BaseInfoClient implements IBaseInfoClient {
return R.data(stZvarlBService.getStZvarlBs(stcd));
}
@Override
public void savePreviewInfo(PreviewInfo previewInfo) {
log.info("===previewInfo==={}", previewInfo);
previewInfoService.save(previewInfo);
}
@Override
public R<List<Map<String,String>>> getHistoryDataBySignage(String stcd, Date start, Date end, String type, String col){
return R.data(reservoirDataService.getHistoryDataBySignage(stcd,start,end,type,col));
}

16
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateMapper.java

@ -0,0 +1,16 @@
package com.hnac.hzims.baseinfo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.IrrBDGate;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IrrBDGateMapper extends BaseMapper<IrrBDGate> {
IPage<IrrBDGate> selectByExample(@Param("example") IrrBDGate example, IPage<IrrBDGate> page);
List<IrrBDGate> selectByExample(@Param("example") IrrBDGate example);
}

49
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateMapper.xml

@ -0,0 +1,49 @@
<?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.baseinfo.mapper.IrrBDGateMapper">
<resultMap id="BaseResultMap" type="com.hnac.hzims.baseinfo.entity.IrrBDGate" >
<id column="ID" property="id" jdbcType="BIGINT" />
<result column="STROBE_CODE" property="strobeCode" jdbcType="VARCHAR" />
<result column="WATERGATE_CODE" property="watergateCode" jdbcType="CHAR" />
<result column="PRODUCING_AREA" property="producingArea" jdbcType="VARCHAR" />
<result column="FACTORY" property="factory" jdbcType="VARCHAR" />
<result column="STROBE_TYPE" property="strobeType" jdbcType="CHAR" />
<result column="STROBE_MATERIAL" property="strobeMaterial" jdbcType="CHAR" />
<result column="HEIGHT" property="height" jdbcType="DECIMAL" />
<result column="WIDTH" property="width" jdbcType="DECIMAL" />
<result column="THICKNESS" property="thickness" jdbcType="DECIMAL" />
<result column="MOTIVITY" property="motivity" jdbcType="CHAR" />
<result column="TYPE" property="type" jdbcType="CHAR" />
<result column="VELOCITY" property="velocity" jdbcType="DECIMAL" />
<result column="AREA_CODE" property="areaCode" jdbcType="VARCHAR" />
<result column="LRCD" property="lrcd" jdbcType="VARCHAR" />
<result column="SZHLDM" property="szhldm" jdbcType="VARCHAR" />
<result column="DONGJ" property="dongj" jdbcType="REAL" />
<result column="BEIW" property="beiw" jdbcType="REAL" />
<result column="DISCHARGE" property="discharge" jdbcType="REAL" />
<result column="STCD" property="stcd" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
ID,STROBE_CODE, WATERGATE_CODE, PRODUCING_AREA, FACTORY, STROBE_TYPE, STROBE_MATERIAL,
HEIGHT, WIDTH, THICKNESS, MOTIVITY, TYPE, VELOCITY, AREA_CODE, LRCD, SZHLDM, DONGJ,
BEIW, DISCHARGE,STCD
</sql>
<select id="selectByExample" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from irrbdgate
where is_deleted = 0
<if test="example.createDept!=null">
and CREATE_DEPT like concat(#{example.createDept},'%')
</if>
<if test="example.strobeCode!=null">
and STROBE_CODE = #{example.strobeCode}
</if>
<if test="example.stcd!=null">
and STCD = #{example.stcd}
</if>
</select>
</mapper>

14
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateRefDataMapper.java

@ -0,0 +1,14 @@
package com.hnac.hzims.baseinfo.mapper;
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData;
public interface IrrBDGateRefDataMapper {
int insertSelective(IrrBDGateRefData record);
int updateByPrimaryKeySelective(IrrBDGateRefData record);
IrrBDGateRefData selectByPrimaryKey(String strobeCode);
int deleteByPrimaryKey(String strobeCode);
}

78
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/IrrBDGateRefDataMapper.xml

@ -0,0 +1,78 @@
<?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.baseinfo.mapper.IrrBDGateRefDataMapper">
<resultMap id="BaseResultMap" type="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" >
<id column="STROBE_CODE" property="strobeCode" jdbcType="CHAR" />
<result column="REFSTCD" property="refstcd" jdbcType="CHAR" />
<result column="REFQPOINT" property="refqpoint" jdbcType="VARCHAR" />
<result column="REFZPOINT" property="refzpoint" jdbcType="CHAR" />
</resultMap>
<sql id="Base_Column_List" >
STROBE_CODE, REFSTCD, REFQPOINT, REFZPOINT
</sql>
<insert id="insertSelective" parameterType="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" >
insert into irrbdgate_refdata
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="strobeCode != null" >
STROBE_CODE,
</if>
<if test="refstcd != null" >
REFSTCD,
</if>
<if test="refqpoint != null" >
REFQPOINT,
</if>
<if test="refzpoint != null" >
REFZPOINT,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="strobeCode != null" >
#{strobeCode,jdbcType=CHAR},
</if>
<if test="refstcd != null" >
#{refstcd,jdbcType=CHAR},
</if>
<if test="refqpoint != null" >
#{refqpoint,jdbcType=VARCHAR},
</if>
<if test="refzpoint != null" >
#{refzpoint,jdbcType=CHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" >
update irrbdgate_refdata
<set >
<if test="refstcd != null" >
REFSTCD = #{refstcd,jdbcType=CHAR},
</if>
<if test="refqpoint != null" >
REFQPOINT = #{refqpoint,jdbcType=VARCHAR},
</if>
<if test="refzpoint != null" >
REFZPOINT = #{refzpoint,jdbcType=CHAR},
</if>
</set>
where STROBE_CODE = #{strobeCode,jdbcType=CHAR}
</update>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from irrbdgate_refdata
where STROBE_CODE = #{strobeCode,jdbcType=CHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from irrbdgate_refdata
where STROBE_CODE = #{strobeCode,jdbcType=CHAR}
</delete>
</mapper>

15
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrBsinMapper.java

@ -0,0 +1,15 @@
package com.hnac.hzims.baseinfo.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.StRsrBsin;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
import java.util.Map;
public interface StRsrBsinMapper extends UserDataScopeBaseMapper<StRsrBsin> {
IPage<Map<String,Object>> selectByParam(IPage page, @Param("param") Map<String,Object> param);
List<Map<String,Object>> selectByParam(@Param("param") Map<String,Object> param);
}

29
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrBsinMapper.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.baseinfo.mapper.StRsrBsinMapper">
<select id="selectByParam" resultType="java.util.HashMap">
select bsin.id,bsin.rscd,hych.rsvrtp,bsin.RTUNM,bsin.ESLG,bsin.NRLT,
bsin.GIS_RANGE as gisRange,bsin.rvcd,bsin.stlc,hych.mjfl from st_rsr_bsin bsin
left join st_rsr_hych hych on bsin.rscd=hych.RSCD
WHERE bsin.IS_DELETED = 0
<if test=" param.deptId!=null and param.deptId!='' ">
and bsin.CREATE_DEPT like concat(#{param.deptId},'%')
</if>
<if test=" param.rtunm!=null and param.rtunm!='' ">
and bsin.RTUNM like concat('%',#{param.rtunm},'%')
</if>
<if test=" param.dmtp!=null and param.dmtp!='' ">
and bsin.DMTP=#{param.dmtp}
</if>
<if test=" param.rsfn!=null and param.rsfn!='' ">
and bsin.RSFN=#{param.rsfn}
</if>
<if test=" param.rsvrtp!=null">
and hych.RSVRTP=#{param.rsvrtp}
</if>
<if test=" param.areaCode!=null">
and bsin.ADDVCD like concat(#{param.areaCode},'%')
</if>
</select>
</mapper>

7
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrHychMapper.java

@ -0,0 +1,7 @@
package com.hnac.hzims.baseinfo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.baseinfo.entity.StRsrHych;
public interface StRsrHychMapper extends BaseMapper<StRsrHych> {
}

5
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StRsrHychMapper.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.baseinfo.mapper.StRsrHychMapper">
</mapper>

4
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java

@ -1,12 +1,14 @@
package com.hnac.hzims.baseinfo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.StZvarlB;
import com.hnac.hzims.baseinfo.entity.StZvarlBExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface StZvarlBMapper {
public interface StZvarlBMapper extends BaseMapper<StZvarlB> {
int deleteByPrimaryKey(Integer id);
int insert(StZvarlB record);

25
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/IGateInfoService.java

@ -0,0 +1,25 @@
package com.hnac.hzims.baseinfo.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.baseinfo.entity.IrrBDGate;
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData;
import java.util.List;
public interface IGateInfoService extends IService<IrrBDGate> {
boolean addGate(IrrBDGate irrBDGate);
int updateGate(IrrBDGate irrBDGate);
IPage<IrrBDGate> selectGate(IrrBDGate irrBDGate, IPage<IrrBDGate> page);
int addGateRef(IrrBDGateRefData irrBDGateRefdata);
int deleteGateRef(String gateCode);
int updateGateRef(IrrBDGateRefData irrBDGateRefdata);
IrrBDGateRefData detailRef(String gateCode);
List<IrrBDGate> list(IrrBDGate irrBDGate);
}

11
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/IStRsrBsinService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.baseinfo.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.StRsrBsin;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
import java.util.Map;
public interface IStRsrBsinService extends BaseService<StRsrBsin> {
}

10
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/IStRsrHychService.java

@ -0,0 +1,10 @@
package com.hnac.hzims.baseinfo.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.hzims.baseinfo.entity.StRsrHych;
public interface IStRsrHychService {
StRsrHych getOne(QueryWrapper<StRsrHych> wrapper);
}

3
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java

@ -1,5 +1,6 @@
package com.hnac.hzims.baseinfo.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.StZvarlB;
import org.springblade.core.tool.api.R;
@ -10,6 +11,8 @@ import java.util.List;
public interface StZvarlBService {
List<StZvarlB> list(LambdaQueryWrapper<StZvarlB> wrapper);
IPage<StZvarlB> bindStZvarlBs(String stcd, IPage<StZvarlB> page);
R addOrEditStZvarlB(StZvarlB stZvarlB);

75
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/GateInfoServiceImpl.java

@ -0,0 +1,75 @@
package com.hnac.hzims.baseinfo.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.baseinfo.entity.IrrBDGate;
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData;
import com.hnac.hzims.baseinfo.mapper.IrrBDGateMapper;
import com.hnac.hzims.baseinfo.mapper.IrrBDGateRefDataMapper;
import com.hnac.hzims.baseinfo.service.IGateInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GateInfoServiceImpl extends ServiceImpl<IrrBDGateMapper, IrrBDGate> implements IGateInfoService {
@Autowired
IrrBDGateMapper irrBDGateMapper;
@Autowired
IrrBDGateRefDataMapper irrBDGateRefDataMapper;
@Override
public boolean addGate(IrrBDGate irrBDGate) {
return this.save(irrBDGate);
}
@Override
public int updateGate(IrrBDGate irrBDGate) {
//编辑时如果站点更换清除之前数据配置
IrrBDGate judgeGate = this.getById(irrBDGate.getId());
this.updateById(irrBDGate);
if (!irrBDGate.getCreateDept().equals(judgeGate.getCreateDept())) {
irrBDGateRefDataMapper.deleteByPrimaryKey(irrBDGate.getStrobeCode());
}
return 1;
}
@Override
public IPage<IrrBDGate> selectGate(IrrBDGate irrBDGate, IPage<IrrBDGate> page) {
IPage<IrrBDGate> irrBDGates = irrBDGateMapper.selectByExample(irrBDGate, page);
return irrBDGates;
}
@Override
public int addGateRef(IrrBDGateRefData irrBDGateRefdata) {
int i = irrBDGateRefDataMapper.insertSelective(irrBDGateRefdata);
return i;
}
@Override
public int deleteGateRef(String gateCode) {
int i = irrBDGateRefDataMapper.deleteByPrimaryKey(gateCode);
return i;
}
@Override
public int updateGateRef(IrrBDGateRefData irrBDGateRefdata) {
int i = irrBDGateRefDataMapper.updateByPrimaryKeySelective(irrBDGateRefdata);
return i;
}
@Override
public IrrBDGateRefData detailRef(String gateCode) {
IrrBDGateRefData res = irrBDGateRefDataMapper.selectByPrimaryKey(gateCode);
return res;
}
@Override
public List<IrrBDGate> list(IrrBDGate irrBDGate) {
List<IrrBDGate> irrBDGates = irrBDGateMapper.selectByExample(irrBDGate);
return irrBDGates;
}
}

1
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java

@ -37,7 +37,6 @@ public class PreviewInfoServiceImpl extends ServiceImpl<PreviewInfoMapper, Previ
queryWrapper.eq(StringUtils.isNotBlank(stcd), "a.stcd", stcd);
queryWrapper.ge(StringUtils.isNotBlank(createTimeS), "a.create_time", createTimeS);
queryWrapper.le(StringUtils.isNotBlank(createTimeE), "a.create_time", createTimeE);
queryWrapper.orderByDesc("a.create_time");
IPage<PreviewInfo> previewInfosPage = previewInfoMapper.queryList(pageParam,queryWrapper);
List<PreviewInfo> previewInfos = previewInfosPage.getRecords();
if (CollectionUtils.isNotEmpty(previewInfos)) {

3
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/ReservoirDataServiceImpl.java

@ -73,9 +73,6 @@ public class ReservoirDataServiceImpl implements IReservoirDataService {
}
po.setSignages(signages);
Result<List<FieldsData>> result=realDataSearchClient.getRealDataByDeviceCode(po);
if(result==null || !result.isSuccess()){
return null;
}
return result.getData();
}

19
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StRsrBsinServiceImpl.java

@ -0,0 +1,19 @@
package com.hnac.hzims.baseinfo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.StRsrBsin;
import com.hnac.hzims.baseinfo.mapper.StRsrBsinMapper;
import com.hnac.hzims.baseinfo.service.IStRsrBsinService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class StRsrBsinServiceImpl extends BaseServiceImpl<StRsrBsinMapper, StRsrBsin> implements IStRsrBsinService {
}

23
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StRsrHychServiceImpl.java

@ -0,0 +1,23 @@
package com.hnac.hzims.baseinfo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.hzims.baseinfo.entity.StRsrHych;
import com.hnac.hzims.baseinfo.mapper.StRsrHychMapper;
import com.hnac.hzims.baseinfo.service.IStRsrHychService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class StRsrHychServiceImpl implements IStRsrHychService {
@Resource
StRsrHychMapper stRsrHychMapper;
@Override
public StRsrHych getOne(QueryWrapper<StRsrHych> wrapper) {
return stRsrHychMapper.selectOne(wrapper);
}
}

6
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StZvarlBServiceImpl.java

@ -1,7 +1,9 @@
package com.hnac.hzims.baseinfo.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.baseinfo.entity.StZvarlB;
import com.hnac.hzims.baseinfo.mapper.StZvarlBMapper;
import com.hnac.hzims.baseinfo.service.StZvarlBService;
@ -21,6 +23,10 @@ public class StZvarlBServiceImpl implements StZvarlBService {
@Override
public List<StZvarlB> list(LambdaQueryWrapper<StZvarlB> wrapper) {
return stZvarlBMapper.selectList(wrapper);
}
@Override
public IPage<StZvarlB> bindStZvarlBs(String stcd, IPage<StZvarlB> page) {
IPage<StZvarlB> records = stZvarlBMapper.selectByStcd(stcd, page);
return records;

32
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/wrapper/StRsrBsinWrapper.java

@ -0,0 +1,32 @@
package com.hnac.hzims.baseinfo.wrapper;
import com.hnac.hzims.baseinfo.entity.StRsrBsin;
import com.hnac.hzims.baseinfo.vo.StRsrBsinVo;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.cache.RegionCache;
import org.springblade.system.entity.Region;
import java.util.Objects;
public class StRsrBsinWrapper extends BaseEntityWrapper<StRsrBsin, StRsrBsinVo> {
public StRsrBsinWrapper() {
}
public static StRsrBsinWrapper build() {
return new StRsrBsinWrapper();
}
@Override
public StRsrBsinVo entityVO(StRsrBsin entity) {
if(entity == null){
return null;
}
StRsrBsinVo stRsrBsinVo = Objects.requireNonNull(BeanUtil.copy(entity, StRsrBsinVo.class));
Region region=RegionCache.getByCode(entity.getAddvcd());
if(region!=null) {
stRsrBsinVo.setAddvcdnm(region.getName());
}
return stRsrBsinVo;
}
}

34
hzims-service/base-info/src/main/resources/application-dev.yml

@ -1,4 +1,30 @@
#服务器端口
server:
port: 8203
##服务器端口
#server:
# port: 8200
#
##数据源配置
##spring:
## datasource:
## url: ${blade.datasource.dev.url}
## username: ${blade.datasource.dev.username}
## password: ${blade.datasource.dev.password}
#
#spring:
# #排除DruidDataSourceAutoConfigure
# autoconfigure:
# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
# datasource:
# dynamic:
# #设置默认的数据源或者数据源组,默认值即为master
# primary: master
# datasource:
# master:
# url: jdbc:mysql://127.0.0.1:3306/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
# username: root
# password: 123456
# slave:
# url: jdbc:mysql://127.0.0.1:3306/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
# username: root
# password: 123456
#demo:
# name: aaa

52
hzims-service/base-info/src/main/resources/application-prod.yml

@ -1,28 +1,28 @@
#服务器端口
server:
port: 8200
#数据源配置
##服务器端口
#server:
# port: 8200
#
##数据源配置
##spring:
## datasource:
## url: ${blade.datasource.prod.url}
## username: ${blade.datasource.prod.username}
## password: ${blade.datasource.prod.password}
#
#spring:
# #排除DruidDataSourceAutoConfigure
# autoconfigure:
# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
# datasource:
# url: ${blade.datasource.prod.url}
# username: ${blade.datasource.prod.username}
# password: ${blade.datasource.prod.password}
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
dynamic:
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
url: ${blade.datasource.demo.master.url}
username: ${blade.datasource.demo.master.username}
password: ${blade.datasource.demo.master.password}
slave:
url: ${blade.datasource.demo.slave.url}
username: ${blade.datasource.demo.slave.username}
password: ${blade.datasource.demo.slave.password}
# dynamic:
# #设置默认的数据源或者数据源组,默认值即为master
# primary: master
# datasource:
# master:
# url: ${blade.datasource.demo.master.url}
# username: ${blade.datasource.demo.master.username}
# password: ${blade.datasource.demo.master.password}
# slave:
# url: ${blade.datasource.demo.slave.url}
# username: ${blade.datasource.demo.slave.username}
# password: ${blade.datasource.demo.slave.password}

8
hzims-service/base-info/src/main/resources/application.yml

@ -1,3 +1,11 @@
spring:
profiles:
active: dev
# datasource:
# url: jdbc:mysql://175.6.40.67:50311/blade_huoshan_business?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
# username: root
# password: 123
# driver-class-name: com.mysql.jdbc.Driver
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml

2
hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/service/impl/DamSafetyDataServiceImpl.java

@ -812,7 +812,7 @@ public class DamSafetyDataServiceImpl implements IDamSafetyDataService {
AnalyseCodeByAnalyseDataPO analyse = this.analyseParam(device,hydrograph.getAccessRules(),signages.stream().map(AnalyzeInstanceFieldVO::getSignage).collect(Collectors.toList()), hydrograph.getBeginTime(),hydrograph.getEndTime(),hydrograph.getDateType());
// 调用降维接口
Result<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(analyse);
if(result ==null || !result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
continue;
}
// 结构数据转换

7
hzims-service/digital-twin-display/pom.xml

@ -49,13 +49,6 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>digital-twin-display-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>

2
hzims-service/digital-twin-display/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口
server:
port: 8206
port: 8200
#数据源配置
#spring:

194
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmOreanizationController.java

@ -0,0 +1,194 @@
package com.hnac.hzims.equipment.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmTreeNode;
import com.hnac.hzims.equipment.service.IEmInfoService;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.boot.ctrl.BladeController;
import com.hnac.hzims.common.constant.CommonConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.node.TreeNode;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import springfox.documentation.annotations.ApiIgnore;
import com.hnac.hzims.equipment.entity.EmOreanizationEntity;
import com.hnac.hzims.equipment.vo.EmOreanizationVO;
import com.hnac.hzims.equipment.wrapper.EmOreanizationWrapper;
import com.hnac.hzims.equipment.service.IEmOreanizationService;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 设备组织控制器
*
* @author moze
*/
@RestController
@AllArgsConstructor
@RequestMapping("/em/oreanization")
@Api(value = "设备组织结构", tags = "设备组织结构")
public class EmOreanizationController extends BladeController {
private final IEmOreanizationService em_oreanizationService;
private final IEmInfoService emInfoService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入ID")
public R<EmOreanizationEntity> detail(@ApiParam(value = "主键", required = true) @RequestParam String id) {
EmOreanizationEntity detail = em_oreanizationService.getById(Func.toLong(id));
return R.data(detail);
}
/**
* 加载当前站点设备的组织结构
*/
/*@GetMapping("/initLoad")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "初始化加载", notes = "加载当前站点设备的组织结构")
public R<List<TreeNode>> init() {
return R.data(em_oreanizationService.initLoad(AuthUtil.getTenantId()));
}*/
@ApiOperation("获取目录树形结构")
@GetMapping("/initLoad")
public R<List<EmTreeNode>> getStructTree() {
return em_oreanizationService.groupTree();
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "新增", notes = "传入em_oreanization")
public R save(@Valid @RequestBody EmOreanizationEntity em_oreanization) {
if (StringUtil.isNotBlank(em_oreanization.getPid() + "")) {
List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{
//eq("PID", em_oreanization.getPid());
eq("NAME", em_oreanization.getName());
}});
if (CollectionUtil.isNotEmpty(emOreanizationEntities)) {
return R.fail("名称已存在!");
}
}
em_oreanization.setSort(em_oreanizationService.sort(em_oreanization.getPid()));
return R.status(em_oreanizationService.save(em_oreanization));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "修改", notes = "传入em_oreanization")
public R update(@Valid @RequestBody EmOreanizationEntity em_oreanization) {
List<EmOreanizationEntity> list = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{
eq("ID", em_oreanization.getId());
eq("NAME", em_oreanization.getName());
}});
if (CollectionUtil.isEmpty(list)) {
List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{
eq("PID", em_oreanization.getPid());
eq("NAME", em_oreanization.getName());
}});
if (CollectionUtil.isNotEmpty(emOreanizationEntities)) {
return R.fail("同级名称已存在!");
}
}
return R.status(em_oreanizationService.updateOrg(em_oreanization));
}
/**
* 备用-新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "新增或修改", notes = "传入em_oreanization")
public R submit(@Valid @RequestBody EmOreanizationEntity em_oreanization) {
if (StringUtil.isNotBlank(em_oreanization.getPid() + "")) {
List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{
eq("NAME", em_oreanization.getName());
eq("PID", em_oreanization.getPid());
}});
if (CollectionUtil.isNotEmpty(emOreanizationEntities)) {
return R.fail("同级名称已存在!");
}
}
return R.status(em_oreanizationService.saveOrUpdate(em_oreanization));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
String[] split = ids.split(",");
for (String id : split) {
List<EmOreanizationEntity> isThere = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{
eq("PID", id);
}});
if (CollectionUtil.isNotEmpty(isThere)) {
return R.fail("请先删除子组织");
}
List<EmInfoEntity> refOreanization = emInfoService.list(new QueryWrapper<EmInfoEntity>() {{
eq("REF_OREANIZATION", id);
}});
if (CollectionUtil.isNotEmpty(refOreanization)) {
return R.fail("请先删除设备信息");
}
}
return R.status(em_oreanizationService.deleteLogic(Func.toLongList(ids)));
}
/**
* 下移
*/
@PostMapping("/down")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "下移", notes = "传入ID")
public R down(@ApiParam(value = "主键", required = true) @RequestParam String id1, @ApiParam(value = "主键", required = true) @RequestParam String id2) {
return R.status(em_oreanizationService.translocation(Func.toLong(id1), Func.toLong(id2)));
}
/**
* 上移
*/
@PostMapping("/up")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "上移", notes = "传入ID")
public R up(@ApiParam(value = "主键", required = true) @RequestParam String id1, @ApiParam(value = "主键", required = true) @RequestParam String id2) {
return R.status(em_oreanizationService.translocation(Func.toLong(id1), Func.toLong(id2)));
}
}

31
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -30,11 +30,11 @@ import java.util.stream.Collectors;
@RestController
public class EmInfoClient implements IEmInfoClient {
@Autowired
IEmInfoService service;
private IEmInfoService service;
@Autowired
IEmParamService paramService;
private IEmParamService paramService;
@Autowired
IEmAttachService attachService;
private IEmAttachService attachService;
@RequestMapping(value = DETAIL)
@ -67,31 +67,6 @@ public class EmInfoClient implements IEmInfoClient {
return service.list();
}
@Override
public R<List<EmInfoEntity>> listByRefOreanization(Long refOreanization) {
return R.data(service.list(new LambdaQueryWrapper<EmInfoEntity>() {{
eq(EmInfoEntity::getRefOreanization, refOreanization);
}}));
}
@Override
public EmInfoVO getByEquipmentId(Long id) {
EmInfoVO vo=new EmInfoVO();
vo.setInfo(service.getById(id));
LambdaQueryWrapper<EmInfoEntity> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(EmInfoEntity::getGpid,id);
List<EmInfoEntity> child=service.list(wrapper);
vo.setChildren(child);
LambdaQueryWrapper<EmAttachEntity> wrapper1=new LambdaQueryWrapper<>();
wrapper1.eq(EmAttachEntity::getEmId,id);
vo.setAttachs(attachService.list(wrapper1));
LambdaQueryWrapper<EmParamEntity> wrapper2=new LambdaQueryWrapper<>();
wrapper2.eq(EmParamEntity::getInfoId,id);
vo.setParams(paramService.list(wrapper2));
return vo;
}
@GetMapping(value = GET_EM_CODE_BY_DEPT_ID)
@Override
public R<List<String>> getEmCodeByDeptId(Long deptId) {

4
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmOreanizationClient.java

@ -2,7 +2,7 @@ package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.equipment.entity.EmOreanizationEntity;
import com.hnac.hzims.equipment.entity.EmTreeNode;
import com.hnac.hzims.equipment.service.IEmOrganizationService;
import com.hnac.hzims.equipment.service.IEmOreanizationService;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -26,7 +26,7 @@ import java.util.List;
@Slf4j
public class EmOreanizationClient implements IEmOreanizationClient {
private final IEmOrganizationService em_oreanizationService;
private final IEmOreanizationService em_oreanizationService;
@Override
@GetMapping(INIT_LOAD)

21
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmOreanizationMapper.java

@ -0,0 +1,21 @@
package com.hnac.hzims.equipment.mapper;
import org.springblade.core.datascope.annotation.UserDataAuth;
import com.hnac.hzims.equipment.entity.EmOreanizationEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import org.springblade.core.tool.node.TreeNode;
import java.util.List;
/**
* Mapper 接口
*
* @author Chill
*/
public interface EmOreanizationMapper extends UserDataScopeBaseMapper<EmOreanizationEntity> {
@UserDataAuth
List<TreeNode> selectTreeList(String tenantId);
int selectMaxSort(Long pid);
}

47
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmOreanizationMapper.xml

@ -0,0 +1,47 @@
<?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.equipment.mapper.EmOreanizationMapper">
<!-- 通用查询映射结果 -->
<resultMap id="em_oreanizationResultMap" type="com.hnac.hzims.equipment.entity.EmOreanizationEntity">
<result column="ID" property="id"/>
<result column="PID" property="pid"/>
<result column="STATUS" property="status"/>
<result column="NAME" property="name"/>
<result column="TYPE_CODE" property="typeCode"/>
<result column="SORT" property="sort"/>
<result column="REMARK" property="remark"/>
<result column="TENANT_ID" property="tenantId"/>
<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="CREATE_DEPT" property="createDept"/>
</resultMap>
<select id="selectTreeList" resultType="org.springblade.core.tool.node.TreeNode" parameterType="string">
SELECT
ID AS 'key',
PID AS parentId,
NAME AS title,
ID AS 'value',
Id,
CREATE_USER,
CREATE_DEPT
FROM
HZIMS_EM_OREANIZATION
WHERE IS_DELETED=0
and TENANT_ID = #{tenantId}
ORDER BY
PID,
SORT
</select>
<select id="selectMaxSort" resultType="integer">
SELECT IFNULL(MAX(SORT),0)
FROM HZIMS_EM_OREANIZATION
WHERE PID=#{pid}
</select>
</mapper>

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_attach.sql

@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563307857514502', 0, 'equipment', 'em_attach', 'menu', '/equipment/em_attach', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563307857514503', '1369563307857514502', 'em_attach_add', '新增', 'add', '/equipment/em_attach/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563307857514504', '1369563307857514502', 'em_attach_edit', '修改', 'edit', '/equipment/em_attach/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563307857514505', '1369563307857514502', 'em_attach_delete', '删除', 'delete', '/api/equipment/em_attach/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563307857514506', '1369563307857514502', 'em_attach_view', '查看', 'view', '/equipment/em_attach/view', 'file-text', 4, 2, 2, 1, NULL, 0);

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_info.sql

@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306376925191', 0, 'equipment', 'em_info', 'menu', '/equipment/em_info', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306376925192', '1369563306376925191', 'em_info_add', '新增', 'add', '/equipment/em_info/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306376925193', '1369563306376925191', 'em_info_edit', '修改', 'edit', '/equipment/em_info/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306376925194', '1369563306376925191', 'em_info_delete', '删除', 'delete', '/api/equipment/em_info/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306376925195', '1369563306376925191', 'em_info_view', '查看', 'view', '/equipment/em_info/view', 'file-text', 4, 2, 2, 1, NULL, 0);

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_model.sql

@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369816257129451526', 0, 'equipment', 'em_model', 'menu', '/equipment/em_model', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369816257129451527', '1369816257129451526', 'em_model_add', '新增', 'add', '/equipment/em_model/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369816257129451528', '1369816257129451526', 'em_model_edit', '修改', 'edit', '/equipment/em_model/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369816257129451529', '1369816257129451526', 'em_model_delete', '删除', 'delete', '/api/equipment/em_model/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369816257129451530', '1369816257129451526', 'em_model_view', '查看', 'view', '/equipment/em_model/view', 'file-text', 4, 2, 2, 1, NULL, 0);

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_model_param.sql

@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563308268556289', 0, 'equipment', 'em_model_param', 'menu', '/equipment/em_model_param', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563308268556290', '1369563308268556289', 'em_model_param_add', '新增', 'add', '/equipment/em_model_param/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563308268556291', '1369563308268556289', 'em_model_param_edit', '修改', 'edit', '/equipment/em_model_param/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563308268556292', '1369563308268556289', 'em_model_param_delete', '删除', 'delete', '/api/equipment/em_model_param/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563308268556293', '1369563308268556289', 'em_model_param_view', '查看', 'view', '/equipment/em_model_param/view', 'file-text', 4, 2, 2, 1, NULL, 0);

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_oreanization.sql

@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563305466761217', 0, 'equipment', 'em_oreanization', 'menu', '/equipment/em_oreanization', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563305466761218', '1369563305466761217', 'em_oreanization_add', '新增', 'add', '/equipment/em_oreanization/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563305466761219', '1369563305466761217', 'em_oreanization_edit', '修改', 'edit', '/equipment/em_oreanization/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563305466761220', '1369563305466761217', 'em_oreanization_delete', '删除', 'delete', '/api/equipment/em_oreanization/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563305466761221', '1369563305466761217', 'em_oreanization_view', '查看', 'view', '/equipment/em_oreanization/view', 'file-text', 4, 2, 2, 1, NULL, 0);

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/em_param.sql

@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306804744193', 0, 'equipment', 'em_param', 'menu', '/equipment/em_param', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306804744194', '1369563306804744193', 'em_param_add', '新增', 'add', '/equipment/em_param/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306804744195', '1369563306804744193', 'em_param_edit', '修改', 'edit', '/equipment/em_param/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306804744196', '1369563306804744193', 'em_param_delete', '删除', 'delete', '/api/equipment/em_param/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1369563306804744197', '1369563306804744193', 'em_param_view', '查看', 'view', '/equipment/em_param/view', 'file-text', 4, 2, 2, 1, NULL, 0);

32
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmOreanizationService.java

@ -0,0 +1,32 @@
package com.hnac.hzims.equipment.service;
import com.hnac.hzims.equipment.entity.EmTreeNode;
import com.hnac.hzims.equipment.vo.EmOreanizationVO;
import org.springblade.core.mp.base.BaseService;
import com.hnac.hzims.equipment.entity.EmOreanizationEntity;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.node.TreeNode;
import javax.validation.Valid;
import java.util.List;
/**
* 服务类
*
* @author moze
*/
public interface IEmOreanizationService extends BaseService<EmOreanizationEntity> {
List<TreeNode> initLoad(String tenantId);
boolean translocation(long id1, long id2);
boolean updateOrg(@Valid EmOreanizationEntity em_oreanization);
boolean saveOrg(@Valid EmOreanizationEntity em_oreanization);
R<List<EmTreeNode>> groupTree();
Integer sort(Long id);
}

162
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmOreanizationServiceImpl.java

@ -0,0 +1,162 @@
package com.hnac.hzims.equipment.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.hzims.equipment.entity.EmTreeNode;
import org.springblade.core.mp.base.BaseServiceImpl;
import com.hnac.hzims.equipment.entity.EmOreanizationEntity;
import com.hnac.hzims.equipment.mapper.EmOreanizationMapper;
import com.hnac.hzims.equipment.service.IEmOreanizationService;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.node.TreeNode;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 服务实现类
*
* @author Chill
*/
@Service
public class EmOreanizationServiceImpl extends BaseServiceImpl<EmOreanizationMapper, EmOreanizationEntity> implements IEmOreanizationService {
@Autowired
private EmOreanizationMapper oreanizationMapper;
@Override
public List<TreeNode> initLoad(String tenantId) {
List<TreeNode> treeList = oreanizationMapper.selectTreeList(tenantId);
return ForestNodeMerger.merge(treeList);
}
@Override
public boolean translocation(long id1, long id2) {
EmOreanizationEntity org1 = this.getById(id1);
EmOreanizationEntity org2 = this.getById(id2);
boolean flag = false;
if(Func.isNotEmpty(org1) && Func.isNotEmpty(org2)){
Integer sort = org1.getSort();
org1.setSort(org2.getSort());
org2.setSort(sort);
List<EmOreanizationEntity> rows = new ArrayList<EmOreanizationEntity>();
rows.add(org1);
rows.add(org2);
flag = this.updateBatchById(rows);
}else {
flag = false;
}
return flag;
}
@Override
public boolean updateOrg(@Valid EmOreanizationEntity em_oreanization) {
EmOreanizationEntity temp = this.getById(em_oreanization.getId());
// 处理序号问题
if(Func.isNotEmpty(temp)
&& temp.getPid() != null
&& em_oreanization.getPid() != null
&& temp.getPid().longValue() != em_oreanization.getPid().longValue()){
int maxSort = oreanizationMapper.selectMaxSort(em_oreanization.getPid()) + 1;
em_oreanization.setSort(maxSort);
return this.updateById(em_oreanization);
}else {
return this.updateById(em_oreanization);
}
}
@Override
public boolean saveOrg(EmOreanizationEntity em_oreanization) {
int maxSort = oreanizationMapper.selectMaxSort(em_oreanization.getPid()) + 1;
em_oreanization.setSort(maxSort);
int cnt = oreanizationMapper.insert(em_oreanization);
return cnt > 0;
}
@Override
public R<List<EmTreeNode>> groupTree() {
QueryWrapper<EmOreanizationEntity> queryWrapper = new QueryWrapper<EmOreanizationEntity>() {{
eq("PID",0);
}};
queryWrapper.orderByAsc("PID","SORT");
//数据库里所有pid为空的为根节点组织
List<EmOreanizationEntity> structs = oreanizationMapper.selectList(queryWrapper);
//查询所有数据 ListAll
QueryWrapper<EmOreanizationEntity> queryWrapper2 = new QueryWrapper<EmOreanizationEntity>() {{
}};
queryWrapper2.orderByAsc("PID","SORT");
List<EmOreanizationEntity> resultList = oreanizationMapper.selectList(queryWrapper2);
//把组织信息换成节点
List<EmTreeNode> rootNodes = new ArrayList<>();
for (EmOreanizationEntity struct : structs) {
EmTreeNode treeNode = new EmTreeNode();
treeNode.setId(struct.getId());
treeNode.setParentId(struct.getPid());
treeNode.setTitle(struct.getName());
treeNode.setLevel(1);
rootNodes.add(groupToNode(treeNode));
}
//生成树
List<EmTreeNode> nodeList = createGroupAndStationTree(resultList, rootNodes);
return R.data(nodeList);
}
@Override
public Integer sort(Long id) {
return oreanizationMapper.selectMaxSort(id) + 1;
}
private EmTreeNode groupToNode(EmTreeNode treeNode) {
if (Objects.isNull(treeNode)) {
return null;
}
return treeNode;
}
public List<EmTreeNode> createGroupAndStationTree(List<EmOreanizationEntity> resultList, List<EmTreeNode> rootNodes) {
if (rootNodes == null || rootNodes.size() < 1) {
return null;
}
//遍历根节点
for (EmTreeNode rootNode : rootNodes) {
//找到子节点
List<EmTreeNode> childNodes = listGroupNodeByPid(resultList,rootNode.getId()+"",rootNode.getLevel());
//如果没有数据了,就跳出循环
if (childNodes == null || childNodes.size() == 0) {
continue;
}
//遍历子节点
rootNode.setChildren(createGroupAndStationTree(resultList, childNodes));
}
return rootNodes;
}
public List<EmTreeNode> listGroupNodeByPid(List<EmOreanizationEntity> resultList, String id,Integer level){
List<EmTreeNode> childNodes = new ArrayList<>();
level = level+1;
for (EmOreanizationEntity struct : resultList) {
EmTreeNode treeNode = new EmTreeNode();
if(id.equals(struct.getPid()+"")){
treeNode.setId(struct.getId());
treeNode.setParentId(struct.getPid());
treeNode.setTitle(struct.getName());
treeNode.setLevel(level);
childNodes.add(treeNode);
}
}
return childNodes;
}
}

6
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/MessageAlarmCenterApplication.java

@ -16,6 +16,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@ComponentScan(basePackages = {"com.hnac.hzims.*"})
public class MessageAlarmCenterApplication extends SpringBootServletInitializer {
static String APP_NAME="message-alarm-center";
// static {
// System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.config.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.username", "nacos");
// System.setProperty("spring.cloud.nacos.password", "nacos");
// }
public static void main(String[] args) {
// System.setProperty("nacos.standalone", "true");
BladeApplication.run(APP_NAME, MessageAlarmCenterApplication.class, args);

5
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/MessageReceiveInfoController.java

@ -21,6 +21,7 @@ import com.hnac.hzims.message_alarm.util.ParamUtil;
import com.hnac.hzims.message_alarm.vo.MessageReceiveAlarmInfoVo;
import com.hnac.hzims.message_alarm.vo.MessageReceiveNotifyInfoVo;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -78,7 +79,9 @@ public class MessageReceiveInfoController extends BladeController implements Cac
param = new HashMap<>();
}
param.put("userId",AuthUtil.getUserId());
param.put("messageType", MessageTypeEnum.ALARM.getCode());
if (param.get("messageType") == null || "".equals(param.get("messageType"))) {
param.put("messageType", MessageTypeEnum.ALARM.getCode() + "," + MessageTypeEnum.FLOW_WARN.getCode());
}
if(param.get("title")!=null && !"".equals(param.get("title"))){
param.put("title","%"+param.get("title")+"%");
}

14
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/PlanParamInfoController.java

@ -1,8 +1,13 @@
package com.hnac.hzims.message_alarm.controller;
import com.hnac.hzims.message_alarm.xxljob.MessageMonitorObjJob;
import com.xxl.job.core.biz.model.ReturnT;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
@ -17,5 +22,14 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/planparaminfo")
public class PlanParamInfoController {
@Autowired
MessageMonitorObjJob messageMonitorObjJob;
@RequestMapping(value = "/test", method = {RequestMethod.GET})
public R test() {
ReturnT<String> stringReturnT = messageMonitorObjJob.flowWarnJob(null);
return R.data(stringReturnT);
}
}

3
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzims.message_alarm.mapper;
import com.hnac.hzims.operational.station.entity.StationEntity;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
@ -8,4 +9,6 @@ import java.util.Map;
public interface DataDeviceMapper {
List<String> getCodeByModelId(@Param("modelId") Long modelId);
StationEntity getStationFlowValueByCode(String code);
}

12
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml

@ -8,4 +8,16 @@
and status = 1
and model_id = #{modelId}
</select>
<select id="getStationFlowValueByCode" resultType="com.hnac.hzims.operational.station.entity.StationEntity">
SELECT
IFNULL(discharge, '0' ) as discharge,
name
FROM
hzims_operation.`hzims_station`
WHERE
CODE = #{code}
AND IS_DELETED = '0'
</select>
</mapper>

8
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml

@ -24,7 +24,13 @@
receive.*
from message_receive_info receive
left join message_alarm_info alarm on receive.message_id = alarm.id
where receive.message_type=#{param.messageType} and receive.receive_user_id=#{param.userId}
where receive.receive_user_id=#{param.userId}
<if test=" param.messageType!=null and param.messageType!='' ">
and receive.message_type in
<foreach item="item" index="index" collection="param.messageType.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test=" param.title!=null and param.title!='' ">
and alarm.title like #{param.title}
</if>

33
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mqtt/MessageFlowWranConsumer.java

@ -0,0 +1,33 @@
package com.hnac.hzims.message_alarm.mqtt;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.message_alarm.entity.MessageResponseData;
import com.hnac.hzims.message_alarm.strategy.FactoryStrategy;
import com.hnac.hzims.message_alarm.strategy.Strategy;
import lombok.extern.slf4j.Slf4j;
import org.springblade.mqtt.customer.IMqttReceive;
import org.springblade.mqtt.customer.annotation.MqttReceive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
//告警消费主题
@Service
@MqttReceive(topicName = "message_alarm_center/handleFlowWarn")
@Slf4j
public class MessageFlowWranConsumer implements IMqttReceive {//消费(flowAlarm)json数据
@Autowired
FactoryStrategy factoryForStrategy;
@Override
public void handlerMessage(String message) {
log.info("收到告警消息: "+message);
//解析消息 发送消息
MessageResponseData responseData= JSONObject.parseObject(message,MessageResponseData.class);
//获取对应策略
Strategy strategy=factoryForStrategy.getStrategy(responseData.getBodyType());
if(strategy!=null) {//执行
strategy.handleJson(responseData);
}
}
}

9
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java

@ -14,10 +14,17 @@ public interface IMessageStrategyService {
Map<Long, User> getPersons(int personSource, String personSourceIds);
List<MessageObjTemplateVo> queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType);
void saveAlarmMessage(MessageSendInfo info,String processInstanceId,String processKey,int alarmLevel,String jsonData);
void saveNotifyMessage(MessageSendInfo info,String jsonData);
void saveFlowWarnMessage(MessageSendInfo info,String processInstanceId,String processKey,int alarmLevel,String jsonData);
MessageSendInfo getSendMessageInfo(MessageObjTemplateVo vo,String message);
boolean sendSmsInfo(MessageSendInfo info, MessageResponseData responseData);
boolean sendMessage(MessageDTO messageDTO);
}
int sendFlowWarnMessage(String message, String phone);
}

52
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/impl/MessageStrategyServiceImpl.java

@ -12,6 +12,7 @@ import org.springblade.core.sms.model.SmsResponse;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import com.hnac.hzims.message_alarm.enums.*;
import com.hnac.hzims.message_alarm.service.*;
@ -156,6 +157,25 @@ public class MessageStrategyServiceImpl implements IMessageStrategyService {
}
return smsResponseR.isSuccess();
}
@Value("${ecological.SMSTemplate:avg_flow_warning}")
private String flowWarningTemplateCode; // 日均流量告警模板编码
/**
* 发送短信
* @param message 短信内容
* @param phone 负责人电话
*/
@Override
public int sendFlowWarnMessage(String message, String phone) {
// 高板岩一站 电站生态流量预警:核定流量0.02(m³/s),当前日均流量0.017(m³/s),建议生态流量后续9小时的实时流量值不低于0.054(m³/s)
Map<String, Object> params = new HashMap<>();
params.put("message", message);
R<SmsResponse> smsResponseR = smsClient.sendMessage("200000", flowWarningTemplateCode, JSONObject.toJSONString(params), phone);
if (Func.isNotEmpty(smsResponseR) && smsResponseR.isSuccess()) {
return 1;
} else {
return 2;
}
}
@Override
public List<MessageObjTemplateVo> queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType) {
@ -237,6 +257,38 @@ public class MessageStrategyServiceImpl implements IMessageStrategyService {
}
@Override
public void saveFlowWarnMessage(MessageSendInfo info,String processInstanceId,String processKey,
int alarmLevel,String jsonData) {
//存储告警消息
MessageAlarmInfo alarmInfo=new MessageAlarmInfo();
alarmInfo.setTitle(info.getTitle());//消息标题
alarmInfo.setContent(info.getMessage());//消息内容
alarmInfo.setSchemeId(info.getSchemeId());//消息方案id
alarmInfo.setSendUserName("系统管理员");//发送人姓名
alarmInfo.setSendTime(new Date());
alarmInfo.setDataJson(jsonData);//数据json(mq中的原始数据)
alarmInfo.setProcessInstanceId(processInstanceId);//流程实例id
alarmInfo.setAlarmLevel(alarmLevel);//告警等级(1-5)
alarmInfo.setObjectSource(info.getObjectSource());
alarmInfo.setProcessKey(processKey);
alarmInfo.setObjectCode(info.getObjectCode());
Long messageId=messageAlarmInfoService.insert(alarmInfo);
//存储接收者记录
List<MessageReceiveInfo> receiveInfos=new ArrayList<>();
for (Map.Entry<Long,String> map: info.getPerson().entrySet()){
MessageReceiveInfo receiveInfo=new MessageReceiveInfo();
receiveInfo.setMessageId(messageId);
receiveInfo.setMessageType(MessageTypeEnum.FLOW_WARN.getCode());
receiveInfo.setReceiveUserId(map.getKey());
receiveInfo.setReceiveUserName(map.getValue());
receiveInfo.setStatus(MessageStatusEnum.ZERO.getCode());
receiveInfos.add(receiveInfo);
}
messageReceiveInfoService.batchSave(receiveInfos);
}
@Override
public MessageSendInfo getSendMessageInfo(MessageObjTemplateVo vo,String message) {
Map<Long, User> userMap=getPersons(vo.getPersonSource(),vo.getPersonSourceIds());
if(userMap==null){

191
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/strategy/FlowWarnStrategy.java

@ -0,0 +1,191 @@
package com.hnac.hzims.message_alarm.strategy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message_alarm.dto.MessageDTO;
import com.hnac.hzims.message_alarm.entity.MessageMonitorObjAttr;
import com.hnac.hzims.message_alarm.entity.MessageResponseData;
import com.hnac.hzims.message_alarm.entity.MessageSendInfo;
import com.hnac.hzims.message_alarm.enums.PushTypeEnum;
import com.hnac.hzims.message_alarm.enums.TemplateTypeEnum;
import com.hnac.hzims.message_alarm.mapper.MessageMonitorObjAttrMapper;
import com.hnac.hzims.message_alarm.service.IMessageStrategyService;
import com.hnac.hzims.message_alarm.util.CheckDataRationalUtil;
import com.hnac.hzims.message_alarm.vo.MessageObjTemplateVo;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
//告警解析策略
@Component("flowWarn")
@Slf4j
public class FlowWarnStrategy implements Strategy {
@Autowired
IMessageStrategyService messageStrategyService;
@Autowired
IFlowClient flowClient;
@Resource
private MessageMonitorObjAttrMapper messageMonitorObjAttrMapper;
@Override
public void handleJson(MessageResponseData responseData) {
log.info("入参responseData:{}", responseData);
//可执行模板
List<MessageObjTemplateVo> executableTemplate = null;
//解析属性列表数据
List<Map<String, Object>> attrListByObject = CheckDataRationalUtil.parseAttrListByObject(responseData.getData());
if (attrListByObject == null || attrListByObject.isEmpty()) {
return;
}
//查找符合条件的模板
List<MessageObjTemplateVo> list = messageStrategyService.queryMessageObjTemplateVo(responseData.getSchemeId(),
responseData.getDeviceCode(), TemplateTypeEnum.FLOW_WARN.getCode());
log.info("告警模板总个数:" + list.size());
//筛选出可执行的模板
if (list != null && !list.isEmpty()) {
executableTemplate = new ArrayList<>();
//获取数据中的最高级
int highLevel = CheckDataRationalUtil.getHighLevel(attrListByObject);
for (MessageObjTemplateVo vo : list) {
//校验模板与数据属性吻合度
boolean checkAttr = CheckDataRationalUtil.checkAttr(vo, responseData);
if (!checkAttr) {
continue;
}
//对象有属性的 针对自己的等级评价
// 对象不包含属性的 已字段中的最高等级评价
boolean checkObj = CheckDataRationalUtil.checkAlarmObj(vo, attrListByObject, highLevel);
if (!checkObj) {//筛选出可执行的模板
continue;
}
// 替换模板content
String templateContent = buildContent(responseData.getData(), vo.getTemplateContent());
vo.setTemplateContent(templateContent);
executableTemplate.add(vo);
}
log.info("告警模板符合个数:" + executableTemplate.size());
//发送消息+存储消息
for (MessageObjTemplateVo vo : executableTemplate) {
//解析模板内容
String message = CheckDataRationalUtil.parseContent(vo.getTemplateContent(), responseData);
log.info("模板:" + vo.getTemplateTitle() + ",发送告警消息:" + message);
//组装消息
// // 造假数据
// MessageSendInfo info = new MessageSendInfo();
// HashMap<Long, String> map = new HashMap<>();
// map.put(1710229795322830849L, "绿色小水电");
// info.setPerson(map);
// info.setTenantId("20000");
// info.setObjectSource("111");
// info.setPhones("13107280912");
// info.setMessage(message);
// info.setTitle("title");
// info.setObjectCode("JSCZ001");
// info.setSchemeId(1769602788549591042L);
MessageSendInfo info = messageStrategyService.getSendMessageInfo(vo, message);
if (info == null) {
continue;
}
//发送消息
if (PushTypeEnum.SMS.getCode().equals(info.getPushType())) {
// todo 短信配置
// 高板岩一站 电站生态流量预警:核定流量0.02(m³/s),当前日均流量0.017(m³/s),建议生态流量后续9小时的实时流量值不低于0.054(m³/s)
messageStrategyService.sendFlowWarnMessage(message, info.getPhones());
} else {
// messageStrategyService.sendInfo(info);
}
//启动流程实例
if (vo.getProcessKey() != null && !"".equals(vo.getProcessKey().trim())) {//I II III IV 启动流程
Map<String, Object> variables = new HashMap<>();
variables.put("alarm_msg", message);
String processInstanceId = null;
if (vo.getAutoStartProcess() != null && vo.getAutoStartProcess().intValue() == 1) {//自动触发
R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceByKey(vo.getProcessKey(), "message_alarm_center", variables);
processInstanceId = bladeFlowR.getData().getProcessInstanceId();
}
//保存信息
messageStrategyService.saveFlowWarnMessage(info, processInstanceId, vo.getProcessKey(), vo.getAlarmLevel(), JSON.toJSONString(responseData));
} else {//V无需启动流程 需要相关人员确认一下
messageStrategyService.saveFlowWarnMessage(info, null, null, vo.getAlarmLevel(), JSON.toJSONString(responseData));
}
}
}
}
private final static String JOIN_CODE = "、";
/**
* 组装消息模板
*
* @param templateContent 模板
* @param responseData 数据
* @return
*/
private MessageDTO messageMake(String phones, String templateContent, MessageResponseData responseData, List<Map<String, Object>> list) {
MessageDTO messageDto = new MessageDTO();
messageDto.setStation(responseData.getObjectName());
messageDto.setTime(responseData.getCreateDate());
messageDto.setPhone(phones);
Map<String, String> keyToAttr = messageMonitorObjAttrMapper.selectList(new LambdaQueryWrapper<MessageMonitorObjAttr>() {{
eq(MessageMonitorObjAttr::getInstanceCode, responseData.getDeviceCode());
}}).stream().collect(Collectors.toMap(MessageMonitorObjAttr::getAttrCode, MessageMonitorObjAttr::getAttrName));
//拼接所有属性key值
List<String> keyList = CheckDataRationalUtil.getAttrList(templateContent);
//获取对应value值
StringBuilder valueStr = new StringBuilder();
StringBuilder keyStr = new StringBuilder();
for (String key : keyList) {
String tmpKey = key.replaceAll("\\{", "").replaceAll("}", "");
Object value = CheckDataRationalUtil.getDataByKey(tmpKey, list);
if (value != null) {
keyStr.append(getKeyName(keyToAttr, tmpKey));
valueStr.append(value.toString());
valueStr.append(JOIN_CODE);
keyStr.append(JOIN_CODE);
}
}
valueStr.deleteCharAt(valueStr.length() - 1);
keyStr.deleteCharAt(keyStr.length() - 1);
messageDto.setNum(valueStr.toString());
messageDto.setType(keyStr.toString());
log.info("messageMake {}", messageDto);
return messageDto;
}
//获取当前key对应名称
private String getKeyName(Map<String, String> objAttr, String key) {
return StringUtils.isEmpty(objAttr.get(key)) ? "-" : objAttr.get(key);
}
private String buildContent(String data, String templateContent) {
JSONArray array = JSON.parseArray(data);
Map map = JSON.parseObject(array.get(0).toString(), Map.class);
return map.get("suggest").toString();
}
}

227
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/xxljob/MessageMonitorObjJob.java

@ -6,6 +6,7 @@ import com.hnac.hzims.baseinfo.entity.ThreeDuty;
import com.hnac.hzims.baseinfo.feign.IBaseInfoClient;
import com.hnac.hzims.damsafety.entity.TBuilding;
import com.hnac.hzims.damsafety.feign.IWrpSectionBClient;
import com.hnac.hzims.entity.ReportData;
import com.hnac.hzims.message_alarm.dto.MessageDTO;
import com.hnac.hzims.message_alarm.entity.*;
import com.hnac.hzims.message_alarm.enums.AlarmLevelEnum;
@ -19,8 +20,14 @@ import com.hnac.hzims.message_alarm.service.IMessageStrategyService;
import com.hnac.hzims.message_alarm.strategy.FactoryRuleStrategy;
import com.hnac.hzims.message_alarm.util.DateUtil;
import com.hnac.hzims.message_alarm.vo.MessageObjAttrRuleVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.util.CommonUtil;
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.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient;
import com.hnac.hzinfo.sdk.analyse.po.ComputeBaseStrategyPO;
@ -43,11 +50,13 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
@ -102,6 +111,7 @@ public class MessageMonitorObjJob {
private final static String NOTIFY_TOPIC = "message_alarm_center/handleNotify"; //通知消息主题
private final static String ALARM_TOPIC = "message_alarm_center/handleAlarm";//告警消息主题
private final static String FLOW_ALARM_TOPIC = "message_alarm_center/handleFlowWarn";//流量告警消息主题
@Value("${hzims.alarm.rzalarm.level3}")
private String level3;
@ -442,6 +452,70 @@ public class MessageMonitorObjJob {
return ReturnT.SUCCESS;
}
//流量告警消息
@XxlJob("flowWarnJob")
public ReturnT<String> flowWarnJob(String param) {
XxlJobParam xxlJobParam = JsonUtil.parse(param, XxlJobParam.class);
if (null == xxlJobParam) {
xxlJobParam = new XxlJobParam();
xxlJobParam.setCreateSdf("yyyy-MM-dd HH:mm:ss");
}
logger.info("告警消息执行定时任务开始:" + new Date());
// 获取当前时间 8点 15点 根据现在的生态流量建议接下来的时间的流量
LocalDateTime now = LocalDateTime.now();
LocalDateTime startTime = now.withHour(0).withMinute(0).withSecond(0).withNano(0);
// 判断是否是8点还是15点
int hours = (int) ChronoUnit.HOURS.between(startTime, now);
if (hours != 8 && hours != 15) {
return null;
}
//查询 已启动方案监控的对象 且关联了FLOWALARM模板
List<MessageSchemeObj> schemeObjList = getObjCodes(xxlJobParam.getSchemeId(), TemplateTypeEnum.FLOW_WARN.getCode());
logger.info("schemeObjList:" + schemeObjList);
if (schemeObjList != null && !schemeObjList.isEmpty()) {
//获取对象+属性+规则数据
LambdaQueryWrapper<MessageMonitorObjAttr> wrapper = new LambdaQueryWrapper<>();
List<String> codes = schemeObjList.stream().map(MessageSchemeObj::getObjectCode).distinct().collect(Collectors.toList());
wrapper.in(MessageMonitorObjAttr::getInstanceCode, codes);
List<MessageObjAttrRuleVo> attrRuleVos = messageMonitorObjAttrService.queryMessageObjAttrRuleVo(wrapper);
if (attrRuleVos == null || attrRuleVos.isEmpty()) {
return ReturnT.FAIL;
}
//获取对象属性
List<MessageMonitorObjAttr> attrs = attrRuleVos.stream().map(MessageObjAttrRuleVo::getAttr).distinct().collect(Collectors.toList());
logger.info("attrs:" + attrs);
for (MessageSchemeObj obj : schemeObjList) {
//获取对象对应的属性的实时数据
List<Map<String, Object>> fieldsHistoryDate = getFieldsHistoryDate(attrs, obj, hours, startTime, now);
logger.info("================平均数据res: ===========" + fieldsHistoryDate);
//获取对象属性对应的规则
List<MessageObjAttrRuleVo> rules = getMessageMonitorObjAttrRule(attrRuleVos, obj);
List<Map<String, Object>> jsonList = getFlowAlarmList(obj.getObjectCode(), fieldsHistoryDate, rules, startTime, now);
logger.info("================流量告警数据jsonList: ===========" + jsonList);
//发送mqtt
if (jsonList != null && !jsonList.isEmpty()) {//如果属性中有告警 就发送
Map<String, String> dataMap = new HashMap<>();
dataMap.put("templateType", TemplateTypeEnum.FLOW_WARN.getCode());
dataMap.put("jsonData", JsonUtil.toJson(jsonList));
SimpleDateFormat createSdf = new SimpleDateFormat(xxlJobParam.getCreateSdf());
dataMap.put("createDate", createSdf.format(new Date()));//时间格式
logger.info("================dataMap: ===========" + dataMap);
//发送mqtt
sendMqttMessage(FLOW_ALARM_TOPIC, dataMap, obj);
}
}
}
logger.info("告警消息执行定时任务结束:" + new Date());
return ReturnT.SUCCESS;
}
/**
* 查询出该流域下的所有水库通知到所有水库的对应责任人号码
* @param reservoirInfo
@ -857,5 +931,158 @@ public class MessageMonitorObjJob {
}
private List<Map<String, Object>> getFieldsHistoryDate(List<MessageMonitorObjAttr> attrs, MessageSchemeObj obj,
Integer timeInterval, LocalDateTime startTime,
LocalDateTime endTime) {
//查询对象已配置的属性值
List<String> signages = attrs.stream().filter(e->e.getInstanceCode().equals(obj.getObjectCode()))
.map(MessageMonitorObjAttr::getAttrCode)
.collect(Collectors.toList());
List<Map<String, Object>> resultList = new ArrayList<>();
for (String signage : signages) {
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
String stcd = obj.getObjectCode();
List<Map<String, Object>> dataList =
getData(stcd, 3, 2, timeInterval, startTime, endTime, signage);
if (!CollectionUtils.isEmpty(dataList)) {
// 为了处理特殊返回情况 多查出一条数据的问题
if (dataList.size() > 1) {
dataList.remove(0);
}
}
resultList.add(dataList.get(0));
}
return resultList;
}
public List<Map<String, Object>> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime startTime, LocalDateTime endTime, String signage) {
List<Map<String, Object>> list = new ArrayList<>();
if (signage == null) {
return null;
}
int count = 0;
List<ReportData> reportDataList =
getDataByDeviceCode(stcd, accessRules, saveTimeType, timeInterval, startTime, endTime, signage);
count = reportDataList.size();
for (int i = 0; i < count; i++) {
Map<String, Object> res = new HashMap<>();
ReportData reportData = reportDataList.get(i);
res.put("tm", reportData.getKeyStr());
res.put(signage, reportData.getVal());
res.put("signage", signage);
list.add(res);
}
return list;
}
List<ReportData> getDataByDeviceCode(String deviceCode, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime start, LocalDateTime end, String col) {
List<ReportData> reportData = new ArrayList<>();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
po.setDeviceCode(deviceCode);
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO conditionPO = new AnalyzeDataConditionPO();
conditionPO.setBeginTime(start);
conditionPO.setEndTime(end);
conditionPO.setSignages(col);
// conditionPO.setKeepFigures(3);
conditionPO.setAccessRules(accessRules);
conditionPO.setSaveTimeType(saveTimeType);
conditionPO.setTimeInterval(timeInterval);
conditionPO.setFull(1);
signboardConditions.add(conditionPO);
po.setSignboardConditions(signboardConditions);
Result<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (result == null || !result.isSuccess()) {
return reportData;
}
List<AnalyzeDataConditionVO> datas = result.getData();
if (datas == null || datas.isEmpty()) {
return reportData;
}
for (AnalyzeDataConditionVO vo : datas) {
List<AnalyseDataTaosVO> dataTaosVOs = vo.getList();
for (AnalyseDataTaosVO vv : dataTaosVOs) {
if (vo.getSignage().equals(col)) {
ReportData data = new ReportData();
data.setKeyStr(CommonUtil.getKeyBySaveTimeType(vv.getTs(), saveTimeType));
String val = vv.getVal();
data.setStcd(deviceCode);
data.setVal(val);
if (val != null && !"".equals(val)) {
data.setValue(Double.valueOf(vv.getVal()));
} else {
data.setValue(0.0);
}
data.setName(vo.getName());
reportData.add(data);
}
}
}
return reportData;
}
private List<Map<String,Object>> getFlowAlarmList(String objCode,
List<Map<String, Object>> dataList,
List<MessageObjAttrRuleVo> ruleVos,
LocalDateTime startTime,
LocalDateTime now){
List<Map<String,Object>> res=new ArrayList<>();
int level=0;
if(ruleVos == null || ruleVos.isEmpty()){
return null;
}
if(dataList == null || dataList.isEmpty()){
return null;
}
//判断整个对象中是否有属性告警
for (Map<String, Object> fieldsData : dataList) {
String attr = fieldsData.get("signage").toString();
String val = fieldsData.get(attr).toString();
String ts = fieldsData.get("tm").toString();
List<MessageObjAttrRuleVo> filterList = ruleVos.stream().filter(e -> e.getAttr().getAttrCode().equals(attr)).collect(Collectors.toList());
if (filterList != null && !filterList.isEmpty()) {
List<MessageMonitorObjAttrRule> rules = filterList.get(0).getAttrRuleList();
if (CollectionUtils.isEmpty(rules)) {
continue;
}
Map<String, String> param = new HashMap<>();
param.put("objCode", objCode);
param.put("attr", attr);
param.put("val", val);
param.put("ts", ts);
Map<String, Object> messageMap = parseAlarmRule(param, rules);
level = level + Integer.parseInt(messageMap.get("alarmLevel").toString());
// 查询电站核定流量 并计算剩下的时间需要达到多少平均流量
if (Integer.parseInt(messageMap.get("alarmLevel").toString()) > 0) {
StationEntity station = dataDeviceMapper.getStationFlowValueByCode(objCode);
messageMap.put("suggest", "0");
try {
// 高板岩一站 电站生态流量预警:核定流量0.02(m³/s),当前日均流量0.017(m³/s),建议生态流量后续9小时的实时流量值不低于0.054(m³/s)
long seconds = ChronoUnit.SECONDS.between(startTime, now);
long hours = 24 - ChronoUnit.HOURS.between(startTime, now);
BigDecimal sumFlow = station.getDischarge().multiply(new BigDecimal(24 * 60 * 60));
BigDecimal nowFlow = new BigDecimal(val).multiply(new BigDecimal(seconds));
BigDecimal divide = sumFlow.subtract(nowFlow).divide(new BigDecimal(24 * 60 * 60 - seconds), 2, RoundingMode.HALF_UP);
messageMap.put("suggest", station.getName() + "电站生态流量预警:核定流量" + station.getDischarge() +
"(m³/s),当前日均流量" + val + "(m³/s),建议生态流量后续" + hours + "小时的实时流量值不低于" + divide + "(m³/s)");
} catch (Exception e) {
messageMap.put("suggest", "0");
}
}
res.add(messageMap);
}
}
if(level == 0){//告警等级相加大于0就是有告警
return null;
}
return res;
}
}

2
hzims-service/message-alarm-service/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口
server:
port: 8201
port: 8200
#数据源配置
#spring:

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/huosan/service/impl/HuoSanTargetServiceImpl.java

@ -57,7 +57,7 @@ public class HuoSanTargetServiceImpl implements HuoSanTargetService {
@Override
public KpisVO KPIs(String riverCode) {
LambdaQueryWrapper<StationEntity> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(StationEntity::getType, HomePageConstant.HYDROPOWER);
// lambdaQueryWrapper.eq(StationEntity::getType, HomePageConstant.HYDROPOWER);
if(!StringUtil.isEmpty(riverCode)){
lambdaQueryWrapper.eq(StationEntity::getBscd,riverCode);
}
@ -132,7 +132,7 @@ public class HuoSanTargetServiceImpl implements HuoSanTargetService {
public StationTargetVO target(String code) {
// 站点查询
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
// .eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
.eq(StationEntity::getCode,code));
if(ObjectUtil.isEmpty(station)){
return new StationTargetVO();

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

@ -196,7 +196,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 水电站站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
//.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
// .eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;

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

Loading…
Cancel
Save