Browse Source

Merge remote-tracking branch 'origin/huoshan' into huoshan

zhongwei
yang_shj 1 year ago
parent
commit
333347464a
  1. 2
      hzims-service-api/pom.xml
  2. 20
      hzims-service-api/water-quality-api/pom.xml
  3. 24
      hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqConfigD.java
  4. 54
      hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqWfrinfB.java
  5. 59
      hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqWqsinfB.java
  6. 22
      hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqWrrinfB.java
  7. 50
      hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/feign/IWqWqsinfBClient.java
  8. 7
      hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/vo/WqWqsinfBVo.java
  9. 20
      hzims-service-api/water-rain-api/pom.xml
  10. 26
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/bo/StationResp.java
  11. 13
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/HzStPptnR.java
  12. 14
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/HzStRiverR.java
  13. 15
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/HzStRsvrR.java
  14. 14
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/ReorganizeData.java
  15. 13
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/ReorganizeLog.java
  16. 74
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/StStbprpB.java
  17. 35
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/enums/HistoryDataCalcTypeEnum.java
  18. 35
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/enums/WaterFlowRainEnum.java
  19. 28
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/feign/IStStbprpBClient.java
  20. 19
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/feign/IStStbprpBDataClient.java
  21. 9
      hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/vo/StStbprpBVo.java
  22. 2
      hzims-service/pom.xml
  23. 68
      hzims-service/water-quality/pom.xml
  24. 51
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/WaterQualityApplication.java
  25. 125
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqConfigDController.java
  26. 179
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqDealDataController.java
  27. 128
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqWfrinfBController.java
  28. 151
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqWqsinfBController.java
  29. 128
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqWrrinfBController.java
  30. 12
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqConfigDMapper.java
  31. 10
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqConfigDMapper.xml
  32. 8
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWfrinfBMapper.java
  33. 5
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWfrinfBMapper.xml
  34. 30
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWqsinfBMapper.java
  35. 5
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWqsinfBMapper.xml
  36. 8
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWrrinfBMapper.java
  37. 5
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWrrinfBMapper.xml
  38. 21
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqConfigDService.java
  39. 20
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqDealDataService.java
  40. 9
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqWfrinfBService.java
  41. 30
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqWqsinfBService.java
  42. 8
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqWrrinfBService.java
  43. 48
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqConfigDServiceImpl.java
  44. 397
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqDealDataServiceImpl.java
  45. 13
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqWfrinfBServiceImpl.java
  46. 34
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqWqsinfBServiceServiceImpl.java
  47. 13
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqWrrinfBServiceImpl.java
  48. 54
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/util/ParamUtil.java
  49. 26
      hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/wrapper/WqWqsinfBWrapper.java
  50. 30
      hzims-service/water-quality/src/main/resources/application-dev.yml
  51. 28
      hzims-service/water-quality/src/main/resources/application-prod.yml
  52. 28
      hzims-service/water-quality/src/main/resources/application-test.yml
  53. 13
      hzims-service/water-quality/src/main/resources/application.yml
  54. 77
      hzims-service/water-rain/pom.xml
  55. 29
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/WaterRainApplication.java
  56. 51
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/ReorganizeLogController.java
  57. 151
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/StStbprpBController.java
  58. 163
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/StStbprpBDataController.java
  59. 145
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/WaterRainReorganizeController.java
  60. 26
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/feign/StStbprpBClient.java
  61. 20
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/feign/StStbprpBDataClient.java
  62. 336
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/listener/UploadWaterFlowRainDataListener.java
  63. 11
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/ReorganizeLogMapper.java
  64. 33
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/ReorganizeLogMapper.xml
  65. 8
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/StStbprpBMapper.java
  66. 5
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/StStbprpBMapper.xml
  67. 28
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/WaterRainReorganizeMapper.java
  68. 150
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/WaterRainReorganizeMapper.xml
  69. 12
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IReorganizeLogService.java
  70. 47
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IStStbprpBDataService.java
  71. 8
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IStStbprpBService.java
  72. 34
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IWaterRainReorganizeService.java
  73. 4
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IWaterRainService.java
  74. 45
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/ReorganizeLogServiceImpl.java
  75. 896
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/StStbprpBDataServiceImpl.java
  76. 11
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/StStbprpBServiceImpl.java
  77. 235
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/WaterRainReorganizeServiceImpl.java
  78. 8
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/WaterRainServiceImpl.java
  79. 31
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/util/DateUtil.java
  80. 64
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/util/GisUtil.java
  81. 26
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/util/ParamUtil.java
  82. 27
      hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/wrapper/StStbprpBWrapper.java
  83. 30
      hzims-service/water-rain/src/main/resources/application-dev.yml
  84. 28
      hzims-service/water-rain/src/main/resources/application-prod.yml
  85. 28
      hzims-service/water-rain/src/main/resources/application-test.yml
  86. 13
      hzims-service/water-rain/src/main/resources/application.yml
  87. 7
      hzims-service/water-rain/src/main/resources/banner.txt

2
hzims-service-api/pom.xml

@ -31,6 +31,8 @@
<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>
</modules>
<dependencies>

20
hzims-service-api/water-quality-api/pom.xml

@ -0,0 +1,20 @@
<?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>water-quality-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>
</project>

24
hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqConfigD.java

@ -0,0 +1,24 @@
package com.hnac.hzims.waterquality.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;
/**
*水质监测指标配置
*/
@Data
@TableName("wq_config_d")
public class WqConfigD implements Serializable {
@ApiModelProperty("测站编码")
@TableId(type=IdType.INPUT)
private String stcd;
@ApiModelProperty("指标类型")
private String type;
@ApiModelProperty("指标值")
private String value;
}

54
hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqWfrinfB.java

@ -0,0 +1,54 @@
package com.hnac.hzims.waterquality.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
*水功能区基本信息
*/
@Data
@TableName("wq_wfrinf_b")
@EqualsAndHashCode(callSuper = true)
public class WqWfrinfB extends BaseEntity {
@ApiModelProperty("水功能区代码")
private String wfrcd;
@ApiModelProperty("水功能区名称")
private String wfrnm;
@ApiModelProperty("流域名称")
private String bsnm;
@ApiModelProperty("水系名称")
private String hnnm;
@ApiModelProperty("河流名称")
private String rvnm;
@ApiModelProperty("水功能区起始断面名称")
private String wfrscsnm;
@ApiModelProperty("水功能区起始断面经度")
private Double wfrscslgtd;
@ApiModelProperty("水功能区起始断面纬度")
private Double wfrscslttd;
@ApiModelProperty("水功能区终止断面名称")
private String wfrecsnm;
@ApiModelProperty("水功能区终止断面经度")
private Double wfrecslgtd;
@ApiModelProperty("水功能区终止断面纬度")
private Double wfrecslttd;
@ApiModelProperty("行政区划码")
private String addvcd;
@ApiModelProperty("水功能区长度")
private Double wfrln;
@ApiModelProperty("水功能区库容")
private Double wfrrc;
@ApiModelProperty("水功能区面积")
private Double wfrar;
@ApiModelProperty("水功能区水质目标")
private String wfrwqt;
@ApiModelProperty("水功能区功能排序")
private String wfrwfo;
@ApiModelProperty("备注")
private String nt;
}

59
hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqWqsinfB.java

@ -0,0 +1,59 @@
package com.hnac.hzims.waterquality.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
/**
*水质监测站
*/
@Data
@TableName("wq_wqsinf_b")
@EqualsAndHashCode(callSuper = true)
public class WqWqsinfB extends BaseEntity {
@ApiModelProperty("测站编码")
private String stcd;
@ApiModelProperty("测站名称")
private String stnm;
@ApiModelProperty("测站等级")
private String stgrd;
@ApiModelProperty("流域名称")
private String bsnm;
@ApiModelProperty("水系名称")
private String hnnm;
@ApiModelProperty("河流名称")
private String rvnm;
@ApiModelProperty("经度")
private Double lgtd;
@ApiModelProperty("纬度")
private Double lttd;
@ApiModelProperty("站址")
private String stlc;
@ApiModelProperty("行政区划码")
private String addvcd;
@ApiModelProperty("水资源分区码")
private String wrrcd;
@ApiModelProperty("水功能区划码")
private String wfrcd;
@ApiModelProperty("管理单位")
private String adag;
@ApiModelProperty("监测单位")
private String mnag;
@ApiModelProperty("监测频次")
private Integer mnfrq;
@ApiModelProperty("自动监测")
private Integer atmn;
@ApiModelProperty("建站年月")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date esstym;
@ApiModelProperty("撤站年月")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date wdstym;
@ApiModelProperty("备注")
private String nt;
}

22
hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/entity/WqWrrinfB.java

@ -0,0 +1,22 @@
package com.hnac.hzims.waterquality.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.base.BaseEntity;
/**
* 水资源分区基本信息
*/
@Data
@TableName("wq_wrrinf_b")
public class WqWrrinfB extends BaseEntity {
@ApiModelProperty("水资源分区码")
private String wrrcd;
@ApiModelProperty("水资源分区名称")
private String wrrnm;
@ApiModelProperty("水资源分区面积")
private Double wrr5r;
}

50
hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/feign/IWqWqsinfBClient.java

@ -0,0 +1,50 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright Example,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Example, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.waterquality.feign;
import com.hnac.hzims.waterquality.vo.WqWqsinfBVo;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* Example Feign接口类
*
* @author Chill
*/
@FeignClient(
value = AppConstant.APPLICATION_DESK_NAME
)
public interface IWqWqsinfBClient {
String API_PREFIX = "/wqWqsinfBClient";
String LIST = API_PREFIX + "/list";
/**
* 获取Example列表
*
* @param number
* @return
*/
@GetMapping(LIST)
R<List<WqWqsinfBVo>> list(@RequestParam("number") Integer number);
}

7
hzims-service-api/water-quality-api/src/main/java/com/hnac/hzims/waterquality/vo/WqWqsinfBVo.java

@ -0,0 +1,7 @@
package com.hnac.hzims.waterquality.vo;
import com.hnac.hzims.waterquality.entity.WqWqsinfB;
public class WqWqsinfBVo extends WqWqsinfB {
}

20
hzims-service-api/water-rain-api/pom.xml

@ -0,0 +1,20 @@
<?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>water-rain-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>
</project>

26
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/bo/StationResp.java

@ -0,0 +1,26 @@
package com.hnac.hzims.waterrain.bo;
import com.hnac.hzims.waterrain.entity.StStbprpB;
public class StationResp {
private StStbprpB stStbprpB;
private Object obj;
public StStbprpB getStStbprpB() {
return stStbprpB;
}
public void setStStbprpB(StStbprpB stStbprpB) {
this.stStbprpB = stStbprpB;
}
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
}

13
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/HzStPptnR.java

@ -0,0 +1,13 @@
package com.hnac.hzims.waterrain.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class HzStPptnR implements Serializable {
private String stcd;
private Date tm;
private Double drp;
}

14
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/HzStRiverR.java

@ -0,0 +1,14 @@
package com.hnac.hzims.waterrain.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class HzStRiverR implements Serializable {
private String stcd;
private Date tm;
private Double z;
private Double q;
}

15
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/HzStRsvrR.java

@ -0,0 +1,15 @@
package com.hnac.hzims.waterrain.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class HzStRsvrR implements Serializable {
private String stcd;//测站编码
private Date tm;//时间
private Double rz; //水位
private Double inq;//流量
}

14
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/ReorganizeData.java

@ -0,0 +1,14 @@
package com.hnac.hzims.waterrain.entity;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class ReorganizeData {
private String yearMonth;
private String stcd;
private String sttp;
private List<Map<String,Object>> data;
}

13
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/ReorganizeLog.java

@ -0,0 +1,13 @@
package com.hnac.hzims.waterrain.entity;
import lombok.Data;
import java.io.Serializable;
@Data
public class ReorganizeLog implements Serializable {
private String stcd;
private String yearMonth;
private String operateUser;
private String checkUser;
}

74
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/entity/StStbprpB.java

@ -0,0 +1,74 @@
package com.hnac.hzims.waterrain.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.base.BaseEntity;
/**
* 水雨情测站信息表
*/
@Data
@TableName("st_stbprp_b")
public class StStbprpB extends BaseEntity {
@ApiModelProperty("机构id")
private String orgId;
@ApiModelProperty("河流id")
private String rvid;
@ApiModelProperty("水系id")
private String hnid;
@ApiModelProperty("流域id")
private String bsid;
@ApiModelProperty("测站编码")
private String stcd;
@ApiModelProperty("测站名称")
private String stnm;
@ApiModelProperty("河流名称")
private String rvnm;
@ApiModelProperty("水系名称")
private String hnnm;
@ApiModelProperty("流域名称")
private String bsnm;
@ApiModelProperty("经度(度分秒)")
private String lgtd;
@ApiModelProperty("纬度(度分秒)")
private String lttd;
@ApiModelProperty("站址")
private String stlc;
@ApiModelProperty("行政区划码")
private String addvcd;
@ApiModelProperty("基面修正基值")
private Double mdbz;
@ApiModelProperty("基面修正参数")
private Double mdpr;
@ApiModelProperty("基面名称")
private String dtmnm;
@ApiModelProperty("基面高程")
private Double dtmel;
@ApiModelProperty("站类")
private String sttp;
@ApiModelProperty("拍报段次")
private Double dfrtms;
@ApiModelProperty("拍报项目")
private String fritm;
@ApiModelProperty("报讯等级")
private String frgrd;
@ApiModelProperty("始报年月")
private String bgfrym;
@ApiModelProperty("截报年月")
private String edfrym;
@ApiModelProperty("管理机构")
private String admauth;
@ApiModelProperty("测站岸别")
private String stbk;
@ApiModelProperty("集水面积")
private Double drna;
@ApiModelProperty("拼音码")
private String phcd;
@ApiModelProperty("数值经度")
private Double nlgtd;
@ApiModelProperty("数值纬度")
private Double nlttd;
@ApiModelProperty("水库编码")
private String rscd;
}

35
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/enums/HistoryDataCalcTypeEnum.java

@ -0,0 +1,35 @@
package com.hnac.hzims.waterrain.enums;
public enum HistoryDataCalcTypeEnum {
ZERO(0,"整点值/最早值"),
ONE(1,"最大值"),
TWO(2,"最小值"),
THREE(3,"平均值"),
FOUR(4,"累计值/和值"),
FIVE(5,"变化值/差值"),
SIX(6,"最新值");
Integer strategy;
String desc;
HistoryDataCalcTypeEnum(Integer strategy, String desc){
this.strategy = strategy;
this.desc = desc;
}
public Integer getStrategy() {
return strategy;
}
public void setStrategy(Integer strategy) {
this.strategy = strategy;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

35
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/enums/WaterFlowRainEnum.java

@ -0,0 +1,35 @@
package com.hnac.hzims.waterrain.enums;
public enum WaterFlowRainEnum {
RR("RR","水库水文站"),
ZZ("ZZ","河道水位站"),
ZQ("ZQ","河道水文站"),
PP("PP","雨量站"),
LEVEL("level","水位"),
FLOW("flow","流量"),
RAIN("rain","降水");
private String code;
private String name;
WaterFlowRainEnum(String code,String name){
this.code=code;
this.name=name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

28
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/feign/IStStbprpBClient.java

@ -0,0 +1,28 @@
package com.hnac.hzims.waterrain.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
@FeignClient(
value = "water-rain-monitor",
url = "${feign.water-rain-monitor:}"
)
public interface IStStbprpBClient {
String API_PREFIX = "/stStbprpBClient";
String DETAIL = API_PREFIX + "/detail";
String LIST = API_PREFIX + "/list";
/**
* 获取测站详情
* @return
*/
@GetMapping(DETAIL)
StStbprpB detail(LambdaQueryWrapper wrapper);
@GetMapping(LIST)
List<StStbprpB> list(LambdaQueryWrapper wrapper);
}

19
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/feign/IStStbprpBDataClient.java

@ -0,0 +1,19 @@
package com.hnac.hzims.waterrain.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.Date;
import java.util.Map;
@FeignClient(
value = "water-rain-monitor",
url = "${feign.water-rain-monitor:}"
)
public interface IStStbprpBDataClient {
String API_PREFIX = "/stStbprpBDataClient";
String QUERYMAXORMIN = API_PREFIX + "/queryMaxOrMin";
@GetMapping(QUERYMAXORMIN)
Map<String, String> queryMaxOrMin(String deviceCode, Date startTime, Date endTime, Integer calcType,Integer saveTimeType,Integer timeInterval, String col);
}

9
hzims-service-api/water-rain-api/src/main/java/com/hnac/hzims/waterrain/vo/StStbprpBVo.java

@ -0,0 +1,9 @@
package com.hnac.hzims.waterrain.vo;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import lombok.Data;
@Data
public class StStbprpBVo extends StStbprpB {
private String sttpName;
}

2
hzims-service/pom.xml

@ -31,6 +31,8 @@
<module>digital-twin-display</module>
<module>dam-safety</module>
<module>video-image</module>
<module>water-quality</module>
<module>water-rain</module>
</modules>
<dependencies>

68
hzims-service/water-quality/pom.xml

@ -0,0 +1,68 @@
<?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</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>water-quality</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>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-oss-all</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-auto</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>water-quality-api</artifactId>
<version>${hzims.project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>common-api</artifactId>
</dependency>
</dependencies>
</project>

51
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/WaterQualityApplication.java

@ -0,0 +1,51 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright Example,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Example, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.waterquality;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* Demo启动器
*
* @author Chill
*/
@EnableBladeFeign(basePackages = {"org.springblade","com.hnac"})
@SpringCloudApplication
@MapperScan("com.hnac.hzims.**.mapper.**")
@EnableScheduling
@ComponentScan(basePackages = {"com.hnac.hzims.*"})
public class WaterQualityApplication extends SpringBootServletInitializer {
static String APPLICATION_NAME="water-quality";
public static void main(String[] args) {
BladeApplication.run(APPLICATION_NAME, WaterQualityApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return BladeApplication.createSpringApplicationBuilder(builder, APPLICATION_NAME, WaterQualityApplication.class);
}
}

125
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqConfigDController.java

@ -0,0 +1,125 @@
package com.hnac.hzims.waterquality.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.waterquality.entity.WqConfigD;
import com.hnac.hzims.waterquality.service.IWqConfigDService;
import com.hnac.hzims.waterquality.util.ParamUtil;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
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.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/waterQuality/wqConfigD")
@AllArgsConstructor
@Api(value = "水质监测指标配置", tags = "水质监测指标配置接口")
public class WqConfigDController extends BladeController implements CacheNames {
private final IWqConfigDService wqConfigDService;
/**
* 分页
*/
@GetMapping("/pageList")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入wqConfigD")
public R<IPage<WqConfigD>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
LambdaQueryWrapper<WqConfigD> wrapper= ParamUtil.conditionWqConfigD(param);
IPage<WqConfigD> pages = wqConfigDService.page(Condition.getPage(query), wrapper);
return R.data(pages);
}
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入wqConfigD")
public R<List<WqConfigD>> list(@ApiIgnore @RequestParam Map<String, Object> param) {
LambdaQueryWrapper<WqConfigD> wrapper=ParamUtil.conditionWqConfigD(param);
List<WqConfigD> list = wqConfigDService.list(wrapper);
return R.data(list);
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入wqConfigD")
public R<WqConfigD> detail(WqConfigD wqConfigD) {
WqConfigD detail = wqConfigDService.getOne(Condition.getQueryWrapper(wqConfigD));
return R.data(detail);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入wqConfigD")
public R save(@RequestBody Map<String,Object> param) {
String stcd=String.valueOf(param.get("stcd"));
if(StringUtils.isBlank(stcd)){
return R.fail("未传递测站编码");
}
List<Map<String,Object>> list=(List<Map<String,Object>>)param.get("list");
List<WqConfigD> wqConfigDs=new ArrayList<>();
for(Map<String,Object> data:list){
WqConfigD wqConfigD=new WqConfigD();
wqConfigD.setStcd(stcd);
wqConfigD.setType(String.valueOf(data.get("type")));
wqConfigD.setValue(String.valueOf(data.get("value")));
wqConfigDs.add(wqConfigD);
}
if(wqConfigDs==null || wqConfigDs.isEmpty()){
return R.fail("未传递配置参数");
}
LambdaQueryWrapper<WqConfigD> wrapper=new LambdaQueryWrapper();
wrapper.eq(WqConfigD::getStcd,stcd);
return R.status(wqConfigDService.batchSave(wqConfigDs,wrapper));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "stcd")
public R remove(@ApiParam(value = "测站编码集合") @RequestParam String stcd) {
List<String> list=Func.toStrList(stcd);
LambdaQueryWrapper<WqConfigD> wrapper=new LambdaQueryWrapper();
wrapper.in(WqConfigD::getStcd,list);
boolean temp = wqConfigDService.delete(wrapper);
return R.status(temp);
}
}

179
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqDealDataController.java

@ -0,0 +1,179 @@
package com.hnac.hzims.waterquality.controller;
import com.hnac.hzims.entity.Report;
import com.hnac.hzims.entity.ReportData;
import com.hnac.hzims.enums.QueryDateTypeEnum;
import com.hnac.hzims.util.CommonUtil;
import com.hnac.hzims.waterquality.service.IWqDealDataService;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/waterQuality/wqData")
@AllArgsConstructor
@Api(value = "水质数据查询接口", tags = "水质数据查询接口")
public class WqDealDataController extends BladeController implements CacheNames {
private final IWqDealDataService wqDealDataService;
// DeviceClient deviceClient;
/**
*
* @param stcd
* @param beginSpt
* @param endSpt
* @param type hour month year
* @param accessRules 取数规则0=整点值1=最大值2=最小值3=平均值4=累计值/和值)5=变化值/差值 6=最新值
* @return
*/
@ApiOperation("基础数据报表,数据查询和统计分析使用接口")
@RequestMapping(value = "/getReportData", method = RequestMethod.GET)
public R getReportData(String stcd, String beginSpt, String endSpt,String type,Integer accessRules) {
Map<String,Date> res= CommonUtil.getStartEnd(beginSpt,endSpt);
if(res == null){
return R.data(500,false, "日期格式错误");
}
// R<Boolean> flag=deviceClient.isDeviceCodeExist(stcd);
// if(flag!=null && (!flag.isSuccess() || !flag.getData())){
// return R.data(500,false, "设备实例不存在,请联系管理员");
// }
//查询基础数据
Report report = wqDealDataService.getReportData(stcd,type,accessRules, res.get("begin"), res.get("end"));
return R.data(report,"查询成功");
}
//同期比较
@ApiOperation("同期比较")
@RequestMapping(value = "/getCompare", method = RequestMethod.GET)
public R getCompare(String stcd, String beginSpt, String endSpt,Integer accessRules,String col) {
Map<String,Date> res=CommonUtil.getStartEnd(beginSpt,endSpt);
if(res == null){
return R.data(500,false, "日期格式错误");
}
// R<Boolean> flag=deviceClient.isDeviceCodeExist(stcd);
// if(flag!=null && (!flag.isSuccess() || !flag.getData())){
// return R.data(500,false, "设备实例不存在,请联系管理员");
// }
//查询基础数据
Report report = wqDealDataService.getCompare(stcd, QueryDateTypeEnum.DAY.getQueryDateType(),accessRules, res.get("begin"), res.get("end"), col);
return R.data(report,"查询成功");
}
//环比
@ApiOperation("同一时刻的环比")
@RequestMapping(value = "/getRingCompare", method = RequestMethod.GET)
public R getRingCompare(String stcd, String beginSpt, String endSpt, Integer hour) {
Map<String,Date> res=CommonUtil.getStartEnd(beginSpt,endSpt);
if(res == null){
return R.data(500,false, "日期格式错误");
}
// R<Boolean> flag=deviceClient.isDeviceCodeExist(stcd);
// if(flag!=null && (!flag.isSuccess() || !flag.getData())){
// return R.data(500,false, "设备实例不存在,请联系管理员");
// }
//查询基础数据
Report report = wqDealDataService.getRingCompare(stcd, res.get("begin"), res.get("end"),hour);
return R.data(report,"查询成功");
}
@ApiOperation("水质评价数据")
@RequestMapping(value = "/getEvaluate", method = RequestMethod.GET)
public R getEvaluate(String stcd, String type,String date) {//type 0实时 1历史
// R<Boolean> flag=deviceClient.isDeviceCodeExist(stcd);
// if(flag!=null && (!flag.isSuccess() || !flag.getData())){
// return R.data(500,false, "设备实例不存在,请联系管理员");
// }
List<FieldsData> report = null;
if("1".equals(type)) {
Map<String,Date> res=CommonUtil.getStartEnd(date + " 00:00:00",date + " 23:59:59");
if(res == null){
return R.data(500,false, "日期格式错误");
}
//查询基础数据
report = wqDealDataService.getHistoryData(stcd,res.get("begin"), res.get("end"));
}else{
report = wqDealDataService.getRealData(stcd);
}
return R.data(report,"查询成功");
}
//同期比较
@ApiOperation("获取某一项的历史数据")
@RequestMapping(value = "/getHistoryDataByCol", method = RequestMethod.GET)
public R getHistoryDataByCol(String stcd, String beginSpt, String endSpt,Integer accessRules,String col) {
Map<String,Date> res=CommonUtil.getStartEnd(beginSpt,endSpt);
if(res == null){
return R.data(500,false, "日期格式错误");
}
// R<Boolean> flag=deviceClient.isDeviceCodeExist(stcd);
// if(flag!=null && (!flag.isSuccess() || !flag.getData())){
// return R.data(500,false, "设备实例不存在,请联系管理员");
// }
//查询基础数据
List<ReportData> report = wqDealDataService.getDataByCol(stcd,QueryDateTypeEnum.DAY.getQueryDateType(),accessRules, res.get("begin"), res.get("end"), col);
return R.data(report,"查询成功");
}
@ApiOperation("表头列")
@RequestMapping(value = "/getTableHead", method = RequestMethod.GET)
public R getTableHead(String stcd) {
// R<Boolean> flag=deviceClient.isDeviceCodeExist(stcd);
// if(flag!=null && (!flag.isSuccess() || !flag.getData())){
// return R.data(500,false, "设备实例不存在,请联系管理员");
// }
//查询基础数据
List<AnalyzeInstanceFieldVO> report = wqDealDataService.getSignages(stcd);
return R.data(report,"查询成功");
}
//实时数据
@ApiOperation("实时数据接口")
@RequestMapping(value = "/getRealData", method = RequestMethod.GET)
public R getRealData(String stcd) {
// R<Boolean> flag=deviceClient.isDeviceCodeExist(stcd);
// if(flag!=null && (!flag.isSuccess() || !flag.getData())){
// return R.data(500,false, "设备实例不存在,请联系管理员");
// }
List<FieldsData> report = wqDealDataService.getRealData(stcd);
return R.data(report,"查询成功");
}
}

128
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqWfrinfBController.java

@ -0,0 +1,128 @@
package com.hnac.hzims.waterquality.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.waterquality.entity.WqWfrinfB;
import com.hnac.hzims.waterquality.service.IWqWfrinfBService;
import com.hnac.hzims.waterquality.util.ParamUtil;
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.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/waterQuality/WqWfrinfB")
@AllArgsConstructor
@Api(value = "水功能区基本信息", tags = "水功能区基本信息接口")
public class WqWfrinfBController extends BladeController implements CacheNames {
private final IWqWfrinfBService wqWfrinfBService;
/**
* 分页
*/
@GetMapping("/pageList")
@ApiImplicitParams({
@ApiImplicitParam(name = "wfrcd", value = "水功能区划码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "wfrnm", value = "水功能区名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入wqWfrinfB")
public R<IPage<WqWfrinfB>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
LambdaQueryWrapper<WqWfrinfB> wrapper= ParamUtil.conditionWqWfrinfB(param);
IPage<WqWfrinfB> pages = wqWfrinfBService.page(Condition.getPage(query), wrapper);
return R.data(pages);
}
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "wfrcd", value = "水功能区划码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "wfrnm", value = "水功能区名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入wqWfrinfB")
public R<List<WqWfrinfB>> list(@ApiIgnore @RequestParam Map<String, Object> param) {
LambdaQueryWrapper<WqWfrinfB> wrapper=ParamUtil.conditionWqWfrinfB(param);
List<WqWfrinfB> list = wqWfrinfBService.list(wrapper);
return R.data(list);
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入wqWfrinfB")
public R<WqWfrinfB> detail(WqWfrinfB wqWfrinfB) {
WqWfrinfB detail = wqWfrinfBService.getOne(Condition.getQueryWrapper(wqWfrinfB));
return R.data(detail);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入wqWfrinfB")
public R save(@RequestBody WqWfrinfB wqWfrinfB) {
LambdaQueryWrapper<WqWfrinfB> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(WqWfrinfB::getWfrcd,wqWfrinfB.getWfrcd());
List<WqWfrinfB> list = wqWfrinfBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("水功能区代码已存在");
}
wrapper=new LambdaQueryWrapper<>();
wrapper.eq(WqWfrinfB::getWfrnm,wqWfrinfB.getWfrnm());
list = wqWfrinfBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("水功能区名称已存在");
}
return R.status(wqWfrinfBService.save(wqWfrinfB));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入wqWfrinfB")
public R update(@RequestBody WqWfrinfB wqWfrinfB) {
return R.status(wqWfrinfBService.updateById(wqWfrinfB));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = wqWfrinfBService.deleteLogic(Func.toLongList(ids));
return R.status(temp);
}
}

151
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqWqsinfBController.java

@ -0,0 +1,151 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright wqWqsinfB,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* wqWqsinfB, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.waterquality.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.waterquality.entity.WqWqsinfB;
import com.hnac.hzims.waterquality.service.IWqWqsinfBService;
import com.hnac.hzims.waterquality.util.ParamUtil;
import com.hnac.hzims.waterquality.vo.WqWqsinfBVo;
import com.hnac.hzims.waterquality.wrapper.WqWqsinfBWrapper;
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.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
/**
* 水质监测站控制器
*
* @author Chill
*/
@RestController
@RequestMapping("/waterQuality/wqWqsinfB")
@AllArgsConstructor
@Api(value = "水质监测站", tags = "水质监测站接口")
public class WqWqsinfBController extends BladeController implements CacheNames {
private final IWqWqsinfBService wqWqsinfBService;
/**
* 分页
*/
@GetMapping("/pageList")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "stnm", value = "测站名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入wqWqsinfB")
public R<IPage<WqWqsinfBVo>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
LambdaQueryWrapper<WqWqsinfB> wrapper= ParamUtil.conditionWqWqsinfB(param);
IPage<WqWqsinfB> pages = wqWqsinfBService.page(Condition.getPage(query), wrapper);
return R.data(WqWqsinfBWrapper.build().pageVO(pages));
}
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "stnm", value = "测站名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入wqWqsinfB")
public R<List<WqWqsinfBVo>> list(@ApiIgnore @RequestParam Map<String, Object> param) {
LambdaQueryWrapper<WqWqsinfB> wrapper=ParamUtil.conditionWqWqsinfB(param);
List<WqWqsinfB> list = wqWqsinfBService.list(wrapper);
return R.data(WqWqsinfBWrapper.build().listVO(list));
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入wqWqsinfB")
public R<WqWqsinfBVo> detail(WqWqsinfB wqWqsinfB) {
WqWqsinfB detail = wqWqsinfBService.getOne(Condition.getQueryWrapper(wqWqsinfB));
return R.data(WqWqsinfBWrapper.build().entityVO(detail));
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入wqWqsinfB")
public R save(@RequestBody WqWqsinfB wqWqsinfB) {
LambdaQueryWrapper<WqWqsinfB> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(WqWqsinfB::getStcd,wqWqsinfB.getStcd());
List<WqWqsinfB> list = wqWqsinfBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("测站编码已存在");
}
wrapper=new LambdaQueryWrapper<>();
wrapper.eq(WqWqsinfB::getStnm,wqWqsinfB.getStnm());
list = wqWqsinfBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("测站名称已存在");
}
return R.status(wqWqsinfBService.save(wqWqsinfB));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入wqWqsinfB")
public R update(@RequestBody WqWqsinfB wqWqsinfB) {
return R.status(wqWqsinfBService.updateById(wqWqsinfB));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = wqWqsinfBService.deleteLogic(Func.toLongList(ids));
return R.status(temp);
}
}

128
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/controller/WqWrrinfBController.java

@ -0,0 +1,128 @@
package com.hnac.hzims.waterquality.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.waterquality.entity.WqWrrinfB;
import com.hnac.hzims.waterquality.service.IWqWrrinfBService;
import com.hnac.hzims.waterquality.util.ParamUtil;
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.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/waterQuality/wqWrrinfB")
@AllArgsConstructor
@Api(value = "水资源分区基本信息", tags = "水资源分区基本信息接口")
public class WqWrrinfBController extends BladeController implements CacheNames {
private final IWqWrrinfBService wqWrrinfBService;
/**
* 分页
*/
@GetMapping("/pageList")
@ApiImplicitParams({
@ApiImplicitParam(name = "wrrcd", value = "水资源分区码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "wrrnm", value = "水资源分区名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入wqWrrinfB")
public R<IPage<WqWrrinfB>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
LambdaQueryWrapper<WqWrrinfB> wrapper= ParamUtil.conditionWqWrrinfB(param);
IPage<WqWrrinfB> pages = wqWrrinfBService.page(Condition.getPage(query), wrapper);
return R.data(pages);
}
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "wrrcd", value = "水资源分区码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "wrrnm", value = "水资源分区名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入wqWrrinfB")
public R<List<WqWrrinfB>> list(@ApiIgnore @RequestParam Map<String, Object> param) {
LambdaQueryWrapper<WqWrrinfB> wrapper=ParamUtil.conditionWqWrrinfB(param);
List<WqWrrinfB> list = wqWrrinfBService.list(wrapper);
return R.data(list);
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入wqWrrinfB")
public R<WqWrrinfB> detail(WqWrrinfB wqWrrinfB) {
WqWrrinfB detail = wqWrrinfBService.getOne(Condition.getQueryWrapper(wqWrrinfB));
return R.data(detail);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入wqWrrinfB")
public R save(@RequestBody WqWrrinfB wqWrrinfB) {
LambdaQueryWrapper<WqWrrinfB> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(WqWrrinfB::getWrrcd,wqWrrinfB.getWrrcd());
List<WqWrrinfB> list = wqWrrinfBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("水资源分区码已存在");
}
wrapper=new LambdaQueryWrapper<>();
wrapper.eq(WqWrrinfB::getWrrnm,wqWrrinfB.getWrrnm());
list = wqWrrinfBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("水资源分区名称已存在");
}
return R.status(wqWrrinfBService.save(wqWrrinfB));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入wqWrrinfB")
public R update(@RequestBody WqWrrinfB wqWrrinfB) {
return R.status(wqWrrinfBService.updateById(wqWrrinfB));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = wqWrrinfBService.deleteLogic(Func.toLongList(ids));
return R.status(temp);
}
}

12
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqConfigDMapper.java

@ -0,0 +1,12 @@
package com.hnac.hzims.waterquality.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.waterquality.entity.WqConfigD;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface WqConfigDMapper extends BaseMapper<WqConfigD> {
int batchSave(@Param("list") List<WqConfigD> list);
}

10
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqConfigDMapper.xml

@ -0,0 +1,10 @@
<?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.waterquality.mapper.WqConfigDMapper">
<insert id="batchSave">
insert into wq_config_d(STCD,TYPE,VALUE) values
<foreach collection="list" separator="," item="item">
(#{item.stcd},#{item.type},#{item.value})
</foreach>
</insert>
</mapper>

8
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWfrinfBMapper.java

@ -0,0 +1,8 @@
package com.hnac.hzims.waterquality.mapper;
import com.hnac.hzims.waterquality.entity.WqWfrinfB;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
public interface WqWfrinfBMapper extends UserDataScopeBaseMapper<WqWfrinfB> {
}

5
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWfrinfBMapper.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.waterquality.mapper.WqWfrinfBMapper">
</mapper>

30
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWqsinfBMapper.java

@ -0,0 +1,30 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright Example,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Example, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.waterquality.mapper;
import com.hnac.hzims.waterquality.entity.WqWqsinfB;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* Mapper 接口
*
* @author Chill
*/
public interface WqWqsinfBMapper extends UserDataScopeBaseMapper<WqWqsinfB> {
}

5
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWqsinfBMapper.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.waterquality.mapper.WqWqsinfBMapper">
</mapper>

8
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWrrinfBMapper.java

@ -0,0 +1,8 @@
package com.hnac.hzims.waterquality.mapper;
import com.hnac.hzims.waterquality.entity.WqWrrinfB;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
public interface WqWrrinfBMapper extends UserDataScopeBaseMapper<WqWrrinfB> {
}

5
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/mapper/WqWrrinfBMapper.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.waterquality.mapper.WqWrrinfBMapper">
</mapper>

21
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqConfigDService.java

@ -0,0 +1,21 @@
package com.hnac.hzims.waterquality.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.waterquality.entity.WqConfigD;
import java.util.List;
public interface IWqConfigDService {
IPage<WqConfigD> page(IPage<WqConfigD> page, LambdaQueryWrapper<WqConfigD> wrapper);
List<WqConfigD> list(LambdaQueryWrapper<WqConfigD> wrapper);
WqConfigD getOne(QueryWrapper<WqConfigD> wrapper);
boolean batchSave(List<WqConfigD> list,LambdaQueryWrapper<WqConfigD> wrapper);
boolean delete(LambdaQueryWrapper<WqConfigD> wrapper);
}

20
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqDealDataService.java

@ -0,0 +1,20 @@
package com.hnac.hzims.waterquality.service;
import com.hnac.hzims.entity.Report;
import com.hnac.hzims.entity.ReportData;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO;
import java.util.Date;
import java.util.List;
public interface IWqDealDataService {
Report getReportData(String stcd, String type, Integer accessRules, Date start, Date end);
Report getCompare(String stcd,String type,Integer accessRules,Date start,Date end,String col);
Report getRingCompare(String stcd,Date start,Date end,int hour);
List<ReportData> getDataByCol(String stcd, String type, Integer accessRules, Date start, Date end, String col);
List<FieldsData> getRealData(String stcd);
List<AnalyzeInstanceFieldVO> getSignages(String stcd);
List<FieldsData> getHistoryData(String stcd, Date start, Date end);
}

9
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqWfrinfBService.java

@ -0,0 +1,9 @@
package com.hnac.hzims.waterquality.service;
import com.hnac.hzims.waterquality.entity.WqWfrinfB;
import org.springblade.core.mp.base.BaseService;
public interface IWqWfrinfBService extends BaseService<WqWfrinfB> {
}

30
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqWqsinfBService.java

@ -0,0 +1,30 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright Example,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Example, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.waterquality.service;
import com.hnac.hzims.waterquality.entity.WqWqsinfB;
import org.springblade.core.mp.base.BaseService;
/**
* 服务类
*
* @author Chill
*/
public interface IWqWqsinfBService extends BaseService<WqWqsinfB> {
}

8
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/IWqWrrinfBService.java

@ -0,0 +1,8 @@
package com.hnac.hzims.waterquality.service;
import com.hnac.hzims.waterquality.entity.WqWrrinfB;
import org.springblade.core.mp.base.BaseService;
public interface IWqWrrinfBService extends BaseService<WqWrrinfB> {
}

48
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqConfigDServiceImpl.java

@ -0,0 +1,48 @@
package com.hnac.hzims.waterquality.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.waterquality.entity.WqConfigD;
import com.hnac.hzims.waterquality.mapper.WqConfigDMapper;
import com.hnac.hzims.waterquality.service.IWqConfigDService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class WqConfigDServiceImpl implements IWqConfigDService {
@Resource
WqConfigDMapper wqConfigDMapper;
@Override
public IPage<WqConfigD> page(IPage<WqConfigD> page, LambdaQueryWrapper<WqConfigD> wrapper) {
return wqConfigDMapper.selectPage(page,wrapper);
}
@Override
public List<WqConfigD> list(LambdaQueryWrapper<WqConfigD> wrapper) {
return wqConfigDMapper.selectList(wrapper);
}
@Override
public WqConfigD getOne(QueryWrapper<WqConfigD> wrapper) {
return wqConfigDMapper.selectOne(wrapper);
}
@Override
public boolean batchSave(List<WqConfigD> list,LambdaQueryWrapper<WqConfigD> wrapper) {
delete(wrapper);
wqConfigDMapper.batchSave(list);
return true;
}
@Override
public boolean delete(LambdaQueryWrapper<WqConfigD> wrapper) {
int count=wqConfigDMapper.delete(wrapper);
return count>0;
}
}

397
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqDealDataServiceImpl.java

@ -0,0 +1,397 @@
package com.hnac.hzims.waterquality.service.impl;
import com.hnac.hzims.entity.Report;
import com.hnac.hzims.entity.ReportData;
import com.hnac.hzims.enums.QueryDateTypeEnum;
import com.hnac.hzims.util.CommonUtil;
import com.hnac.hzims.waterquality.service.IWqDealDataService;
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.core.response.Result;
import com.hnac.hzinfo.sdk.real.RealDataSearchClient;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Service
public class WqDealDataServiceImpl implements IWqDealDataService {
@Autowired
AnalyseDataSearchClient analyseDataSearchClient;
@Autowired
RealDataSearchClient realDataSearchClient;
@Override
public List<FieldsData> getRealData(String stcd){
RealDataSearchPO po=new RealDataSearchPO();
po.setAnalyzeCode(stcd);
List<AnalyzeInstanceFieldVO> list=getSignages(stcd);
if(list==null || list.isEmpty()){
return null;
}
List<String> signages=new ArrayList<>();
for(AnalyzeInstanceFieldVO vo:list){
signages.add(vo.getSignage());
}
po.setSignages(signages);
Result<List<FieldsData>> result=realDataSearchClient.getRealDataByDeviceCode(po);
if(result==null || !result.isSuccess()){
return null;
}
return result.getData();
}
@Override
public List<AnalyzeInstanceFieldVO> getSignages(String stcd){
//查询列
Result<List<AnalyzeInstanceFieldVO>> result=analyseDataSearchClient.getInstanceFieldByAnalyseCode(stcd,1,"");
if(result==null || !result.isSuccess()){
return null;
}
List<AnalyzeInstanceFieldVO> analyzeInstanceFieldVOS=result.getData();
return analyzeInstanceFieldVOS;
}
@Override
public List<FieldsData> getHistoryData(String stcd, Date start, Date end) {
List<FieldsData> result=new ArrayList<>();
List<AnalyzeInstanceFieldVO> signages=getSignages(stcd);
if(signages==null || signages.isEmpty()){
return null;
}
List<ReportData> list=listDataReport(start, end, QueryDateTypeEnum.DAY,stcd,6,signages);
if(list==null || list.isEmpty()){
return null;
}
for(ReportData data:list){
FieldsData dd=new FieldsData();
if(StringUtil.isNotBlank(data.getName())) {
dd.setFieldName(data.getName());
}else{
dd.setFieldName(getNameBySignage(data.getStcd(),signages));
}
dd.setSignage(data.getStcd());//测站 换成 属性
dd.setValue(data.getVal());
dd.setTime(data.getKeyStr());
dd.setQ(0);
result.add(dd);
}
return result;
}
String getNameBySignage(String signage,List<AnalyzeInstanceFieldVO> signages){
for(AnalyzeInstanceFieldVO vo:signages){
if(vo.getSignage().equals(signage)){
return vo.getFieldName();
}
}
return "";
}
@Override
public Report getReportData(String stcd, String type, Integer accessRules, Date start, Date end){
//检查数据是否正常并转化
final QueryDateTypeEnum dtEnum = CommonUtil.checkType(type);
if(stcd==null || "".equals(stcd)){
return null;
}
if(dtEnum ==null){
return null;
}
//设置基础数据
List<AnalyzeInstanceFieldVO> signages=getSignages(stcd);
if(signages==null || signages.isEmpty()){
return null;
}
//初始化报表
Report report = new Report();
report.initBaseReport(signages.size(), start, end, dtEnum);
//获取数据库某个站点不同时间要求的数据
List<ReportData> timeDataList = listDataReport(start, end,dtEnum,stcd,accessRules,signages);
if(timeDataList==null || timeDataList.isEmpty()){
return null;
}
for(int i=0;i<signages.size();i++) {
String signage=signages.get(i).getSignage();
List<ReportData> tmpList=CommonUtil.getReportDataBySignage(timeDataList,signage);
for (ReportData reportData : tmpList) {
String value = reportData.getVal();
// if (value != null && !"-".equals(value) && !"".equals(value.trim())) {
// value = new BigDecimal(value).setScale(3, BigDecimal.ROUND_DOWN).toString();
// }
if(value == null){
value = "-";
}
report.setBaseCell(reportData.getKeyStr(), i, value);
}
}
return report;
}
@Override
public Report getCompare(String stcd, String type, Integer accessRules, Date start, Date end, String col) {
//检查数据是否正常并转化
final QueryDateTypeEnum dtEnum = CommonUtil.checkType(type);
if(stcd==null || "".equals(stcd)){
return null;
}
if(dtEnum ==null){
return null;
}
//初始化报表
Report report = new Report();
report.initCompareBaseReport(2, start, end, dtEnum);
for(int i=0;i<2;i++){
//当前日期范围
List<ReportData> list=listDataReportByCol(subYear(start,i),subYear(end,i),dtEnum,stcd,accessRules,col,true);
if(list==null || list.isEmpty()){
continue;
}
for (ReportData reportData : list) {
String value = reportData.getVal();
// if (value != null && !"-".equals(value) && !"".equals(value.trim())) {
// value = new BigDecimal(value).setScale(3, BigDecimal.ROUND_DOWN).toString();
// }
if(value == null){
value = "-";
}
report.setBaseCell(reportData.getKeyStr(), i, value);
}
}
return report;
}
private Date subYear(Date date,int year){
Calendar calendar= Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.YEAR,-year);
return calendar.getTime();
}
@Override
public Report getRingCompare(String stcd, Date start, Date end,int hour) {
//检查数据是否正常并转化
final QueryDateTypeEnum dtEnum = QueryDateTypeEnum.DAY;
//设置基础数据
List<AnalyzeInstanceFieldVO> signages=getSignages(stcd);
if(signages==null || signages.isEmpty()){
return null;
}
//初始化报表
Report report = new Report();
report.initBaseRingReport(signages.size(), start, end, dtEnum);
List<ReportData> reportDataList=listDataReport(start,end,QueryDateTypeEnum.HOUR,stcd,0,signages);
if(reportDataList==null || reportDataList.isEmpty()){
return null;
}
String hourStr=hour>9? ""+hour : "0"+hour;
String keyStr=" "+hourStr;
for(int i=0;i<signages.size();i++) {
String signage=signages.get(i).getSignage();
List<ReportData> tmpList=CommonUtil.getReportDataBySignage(reportDataList,signage);
for (int j=0;j<tmpList.size();j++) {
ReportData reportData=tmpList.get(j);
if(reportData.getKeyStr().indexOf(keyStr)>-1) {
String value = reportData.getVal();
// if (value != null && !"-".equals(value) && !"".equals(value.trim())) {
// value = new BigDecimal(value).setScale(3, BigDecimal.ROUND_DOWN).toString();
// }
if (value == null) {
value = "-";
}
report.setBaseCell(reportData.getKeyStr(), i, value);
}
}
}
return report;
}
@Override
public List<ReportData> getDataByCol(String stcd, String type, Integer accessRules, Date start, Date end, String col) {
//检查数据是否正常并转化
final QueryDateTypeEnum dtEnum = CommonUtil.checkType(type);
if(stcd==null || "".equals(stcd)){
return null;
}
if(dtEnum ==null){
return null;
}
//获取数据库某个站点不同时间要求的数据
List<ReportData> timeDataList =listDataReportByCol(start, end,dtEnum,stcd,accessRules,col,false);
if(timeDataList==null || timeDataList.isEmpty()){
return null;
}
return timeDataList;
}
private List<ReportData> listDataReport(Date begin,Date endSt, QueryDateTypeEnum dtEnum, String deviceCode, Integer accessRules, List<AnalyzeInstanceFieldVO> signages) {
//周期类型: 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年)
Integer saveTimeType=2;
if(QueryDateTypeEnum.DAY.equals(dtEnum)){
saveTimeType = 3;
}
if(QueryDateTypeEnum.MONTH.equals(dtEnum)){
saveTimeType = 5;
}
if(QueryDateTypeEnum.YEAR.equals(dtEnum)){
saveTimeType = 6;
}
LocalDateTime start = LocalDateTime.ofInstant(begin.toInstant(), ZoneId.systemDefault());
LocalDateTime end = LocalDateTime.ofInstant(endSt.toInstant(), ZoneId.systemDefault());
return getDataByDeviceCode(deviceCode,accessRules,saveTimeType,start,end,signages);
}
private List<ReportData> listDataReportByCol(Date begin,Date endSt, QueryDateTypeEnum dtEnum, String deviceCode,
Integer accessRules, String col,boolean isCompare) {
//周期类型: 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年)
Integer saveTimeType=2;
if(QueryDateTypeEnum.DAY.equals(dtEnum)){
saveTimeType = 3;
}
if(QueryDateTypeEnum.MONTH.equals(dtEnum)){
saveTimeType = 5;
}
if(QueryDateTypeEnum.YEAR.equals(dtEnum)){
saveTimeType = 6;
}
LocalDateTime start = LocalDateTime.ofInstant(begin.toInstant(), ZoneId.systemDefault());
LocalDateTime end = LocalDateTime.ofInstant(endSt.toInstant(), ZoneId.systemDefault());
return getDataByDeviceCodeByCol(deviceCode,accessRules,saveTimeType,start,end,col,isCompare);
}
List<ReportData> getDataByDeviceCodeByCol(String deviceCode,Integer accessRules,Integer saveTimeType,
LocalDateTime start,LocalDateTime end,String col,boolean isCompare){
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(1);
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) {
ReportData data=new ReportData();
if(isCompare) {
data.setKeyStr(CommonUtil.getKey(vv.getTs()));
}else{
data.setKeyStr(CommonUtil.getKeyBySaveTimeType(vv.getTs(),saveTimeType));
}
data.setStcd(deviceCode);//测站
data.setVal(vv.getVal());
data.setName(vo.getName());
reportData.add(data);
}
}
return reportData;
}
List<ReportData> getDataByDeviceCode(String deviceCode,Integer accessRules,Integer saveTimeType,
LocalDateTime start,LocalDateTime end,List<AnalyzeInstanceFieldVO> signages){
List<ReportData> reportData=new ArrayList<>();
AnalyseCodeByAnalyseDataPO po=new AnalyseCodeByAnalyseDataPO();
po.setDeviceCode(deviceCode);
List<AnalyzeDataConditionPO> signboardConditions=new ArrayList<>();
for(AnalyzeInstanceFieldVO vo:signages) {
AnalyzeDataConditionPO conditionPO = new AnalyzeDataConditionPO();
conditionPO.setBeginTime(start);
conditionPO.setEndTime(end);
conditionPO.setSignages(vo.getSignage());
// conditionPO.setKeepFigures(3);
conditionPO.setAccessRules(accessRules);
conditionPO.setSaveTimeType(saveTimeType);
conditionPO.setTimeInterval(1);
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) {
ReportData data=new ReportData();
data.setKeyStr(CommonUtil.getKeyBySaveTimeType(vv.getTs(),saveTimeType));
data.setStcd(vo.getSignage());//测站变成属性值
data.setVal(vv.getVal());
data.setName(vo.getName());
reportData.add(data);
}
}
return reportData;
}
}

13
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqWfrinfBServiceImpl.java

@ -0,0 +1,13 @@
package com.hnac.hzims.waterquality.service.impl;
import com.hnac.hzims.waterquality.entity.WqWfrinfB;
import com.hnac.hzims.waterquality.mapper.WqWfrinfBMapper;
import com.hnac.hzims.waterquality.service.IWqWfrinfBService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class WqWfrinfBServiceImpl extends BaseServiceImpl<WqWfrinfBMapper, WqWfrinfB> implements IWqWfrinfBService {
}

34
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqWqsinfBServiceServiceImpl.java

@ -0,0 +1,34 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright Example,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Example, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.waterquality.service.impl;
import com.hnac.hzims.waterquality.entity.WqWqsinfB;
import com.hnac.hzims.waterquality.mapper.WqWqsinfBMapper;
import com.hnac.hzims.waterquality.service.IWqWqsinfBService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* 服务实现类
*
* @author Chill
*/
@Service
public class WqWqsinfBServiceServiceImpl extends BaseServiceImpl<WqWqsinfBMapper, WqWqsinfB> implements IWqWqsinfBService {
}

13
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/service/impl/WqWrrinfBServiceImpl.java

@ -0,0 +1,13 @@
package com.hnac.hzims.waterquality.service.impl;
import com.hnac.hzims.waterquality.entity.WqWrrinfB;
import com.hnac.hzims.waterquality.mapper.WqWrrinfBMapper;
import com.hnac.hzims.waterquality.service.IWqWrrinfBService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class WqWrrinfBServiceImpl extends BaseServiceImpl<WqWrrinfBMapper, WqWrrinfB> implements IWqWrrinfBService {
}

54
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/util/ParamUtil.java

@ -0,0 +1,54 @@
package com.hnac.hzims.waterquality.util;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.waterquality.entity.WqConfigD;
import com.hnac.hzims.waterquality.entity.WqWfrinfB;
import com.hnac.hzims.waterquality.entity.WqWqsinfB;
import com.hnac.hzims.waterquality.entity.WqWrrinfB;
import java.util.Map;
public class ParamUtil {
public static LambdaQueryWrapper<WqWqsinfB> conditionWqWqsinfB(Map<String, Object> param){
LambdaQueryWrapper<WqWqsinfB> wrapper=new LambdaQueryWrapper();
if(param.get("stcd")!=null) {
wrapper.like(WqWqsinfB::getStcd,param.get("stcd"));
}
if(param.get("stnm")!=null) {
wrapper.like(WqWqsinfB::getStnm,param.get("stnm"));
}
return wrapper;
}
public static LambdaQueryWrapper<WqConfigD> conditionWqConfigD(Map<String, Object> param){
LambdaQueryWrapper<WqConfigD> wrapper=new LambdaQueryWrapper();
if(param.get("stcd")!=null) {
wrapper.like(WqConfigD::getStcd,param.get("stcd"));
}
return wrapper;
}
public static LambdaQueryWrapper<WqWfrinfB> conditionWqWfrinfB(Map<String, Object> param){
LambdaQueryWrapper<WqWfrinfB> wrapper=new LambdaQueryWrapper();
if(param.get("wfrcd")!=null) {
wrapper.like(WqWfrinfB::getWfrcd,param.get("wfrcd"));
}
if(param.get("wfrnm")!=null) {
wrapper.like(WqWfrinfB::getWfrnm,param.get("wfrnm"));
}
return wrapper;
}
public static LambdaQueryWrapper<WqWrrinfB> conditionWqWrrinfB(Map<String, Object> param){
LambdaQueryWrapper<WqWrrinfB> wrapper=new LambdaQueryWrapper();
if(param.get("wrrcd")!=null) {
wrapper.like(WqWrrinfB::getWrrcd,param.get("wrrcd"));
}
if(param.get("wrrnm")!=null) {
wrapper.like(WqWrrinfB::getWrrnm,param.get("wrrnm"));
}
return wrapper;
}
}

26
hzims-service/water-quality/src/main/java/com/hnac/hzims/waterquality/wrapper/WqWqsinfBWrapper.java

@ -0,0 +1,26 @@
package com.hnac.hzims.waterquality.wrapper;
import com.hnac.hzims.waterquality.entity.WqWqsinfB;
import com.hnac.hzims.waterquality.vo.WqWqsinfBVo;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import java.util.Objects;
public class WqWqsinfBWrapper extends BaseEntityWrapper<WqWqsinfB, WqWqsinfBVo> {
public WqWqsinfBWrapper() {
}
public static WqWqsinfBWrapper build() {
return new WqWqsinfBWrapper();
}
@Override
public WqWqsinfBVo entityVO(WqWqsinfB entity) {
WqWqsinfBVo wqWqsinfBVo = Objects.requireNonNull(BeanUtil.copy(entity, WqWqsinfBVo.class));
return wqWqsinfBVo;
}
}

30
hzims-service/water-quality/src/main/resources/application-dev.yml

@ -0,0 +1,30 @@
#服务器端口
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

28
hzims-service/water-quality/src/main/resources/application-prod.yml

@ -0,0 +1,28 @@
#服务器端口
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:
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}

28
hzims-service/water-quality/src/main/resources/application-test.yml

@ -0,0 +1,28 @@
#服务器端口
server:
port: 8200
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.test.url}
# username: ${blade.datasource.test.username}
# password: ${blade.datasource.test.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}

13
hzims-service/water-quality/src/main/resources/application.yml

@ -0,0 +1,13 @@
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.hnac.hzims.**.entity
#swagger扫描路径配置
swagger:
base-packages:
- org.springbalde
- com.hnac

77
hzims-service/water-rain/pom.xml

@ -0,0 +1,77 @@
<?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</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>water-rain</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>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-oss-all</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-auto</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>water-rain-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>common-api</artifactId>
</dependency>
</dependencies>
</project>

29
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/WaterRainApplication.java

@ -0,0 +1,29 @@
package com.hnac.hzims.waterrain;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
//水雨情模块
@EnableBladeFeign(basePackages = {"org.springblade","com.hnac"})
@SpringCloudApplication
@MapperScan("com.hnac.hzims.**.mapper.**")
@EnableScheduling
@ComponentScan(basePackages = {"com.hnac.hzims.*"})
public class WaterRainApplication extends SpringBootServletInitializer {
public final static String APP_NAME = "water-rain";
public static void main(String[] args) {
BladeApplication.run(APP_NAME, WaterRainApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return BladeApplication.createSpringApplicationBuilder(builder, APP_NAME, WaterRainApplication.class);
}
}

51
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/ReorganizeLogController.java

@ -0,0 +1,51 @@
package com.hnac.hzims.waterrain.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import com.hnac.hzims.waterrain.entity.ReorganizeLog;
import com.hnac.hzims.waterrain.service.IReorganizeLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/waterRain/reorganizeLog")
@AllArgsConstructor
@Api(value = "整编日志", tags = "整编日志接口")
public class ReorganizeLogController {
@Autowired
IReorganizeLogService reorganizeLogService;
@GetMapping("/detail")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "yearMonth", value = "年月", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入stcd+yearMonth")
public R<ReorganizeLog> detail(String stcd,String yearMonth) {
ReorganizeLog reorganizeLog = reorganizeLogService.queryReorganizeLog(stcd, yearMonth);
return R.data(reorganizeLog);
}
@GetMapping("/check")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "yearMonth", value = "年月", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "校核", notes = "传入stcd+yearMonth")
public R<Boolean> check(String stcd,String yearMonth) {
boolean flag = reorganizeLogService.check(stcd, yearMonth, AuthUtil.getUserName());
return R.data(flag,"校核成功");
}
}

151
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/StStbprpBController.java

@ -0,0 +1,151 @@
package com.hnac.hzims.waterrain.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
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.tool.api.R;
import org.springblade.core.tool.utils.Func;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import com.hnac.hzims.waterrain.service.IStStbprpBService;
import com.hnac.hzims.waterrain.util.GisUtil;
import com.hnac.hzims.waterrain.util.ParamUtil;
import com.hnac.hzims.waterrain.vo.StStbprpBVo;
import com.hnac.hzims.waterrain.wrapper.StStbprpBWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/waterRain/stStbprpB")
@AllArgsConstructor
@Api(value = "水雨情测站信息表", tags = "水雨情测站信息表接口")
public class StStbprpBController extends BladeController implements CacheNames {
private final IStStbprpBService stStbprpBService;
/**
* 分页
*/
@GetMapping("/pageList")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "stnm", value = "测站名称", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "rscd", value = "水库编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "sttp", value = "站类", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入StStbprpB")
public R<IPage<StStbprpBVo>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
LambdaQueryWrapper<StStbprpB> wrapper= ParamUtil.conditionStStbprpB(param);
IPage<StStbprpB> pages = stStbprpBService.page(Condition.getPage(query), wrapper);
return R.data(StStbprpBWrapper.build().pageVO(pages));
}
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "stcd", value = "测站编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "stnm", value = "测站名称", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "rscd", value = "水库编码", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "sttp", value = "站类", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入StStbprpB")
public R<List<StStbprpBVo>> list(@ApiIgnore @RequestParam Map<String, Object> param) {
LambdaQueryWrapper<StStbprpB> wrapper=ParamUtil.conditionStStbprpB(param);
List<StStbprpB> list = stStbprpBService.list(wrapper);
return R.data(StStbprpBWrapper.build().listVO(list));
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入StStbprpB")
public R<StStbprpBVo> detail(StStbprpB stStbprpB) {
StStbprpB detail = stStbprpBService.getOne(Condition.getQueryWrapper(stStbprpB));
return R.data(StStbprpBWrapper.build().entityVO(detail));
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入stStbprpB")
public R save(@RequestBody StStbprpB stStbprpB) {
LambdaQueryWrapper<StStbprpB> wrapper=new LambdaQueryWrapper();
wrapper.eq(StStbprpB::getIsDeleted,stStbprpB.getIsDeleted());
wrapper.eq(StStbprpB::getStcd,stStbprpB.getStcd());
List<StStbprpB> list = stStbprpBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("测站编码已存在");
}
wrapper=new LambdaQueryWrapper();
wrapper.eq(StStbprpB::getIsDeleted,stStbprpB.getIsDeleted());
wrapper.eq(StStbprpB::getStnm,stStbprpB.getStnm());
list = stStbprpBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("测站名称已存在");
}
//将经纬度转为度分秒
GisUtil.dealGisData(stStbprpB);
return R.status(stStbprpBService.save(stStbprpB));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入StStbprpB")
public R update(@RequestBody StStbprpB stStbprpB) {
LambdaQueryWrapper<StStbprpB> wrapper=new LambdaQueryWrapper();
wrapper.eq(StStbprpB::getStcd,stStbprpB.getStcd());
wrapper.eq(StStbprpB::getIsDeleted,stStbprpB.getIsDeleted());
wrapper.ne(StStbprpB::getId,stStbprpB.getId());
List<StStbprpB> list = stStbprpBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("测站编码已存在");
}
wrapper=new LambdaQueryWrapper();
wrapper.eq(StStbprpB::getIsDeleted,stStbprpB.getIsDeleted());
wrapper.eq(StStbprpB::getStnm,stStbprpB.getStnm());
wrapper.ne(StStbprpB::getId,stStbprpB.getId());
list = stStbprpBService.list(wrapper);
if(list!=null && !list.isEmpty()){
return R.fail("测站名称已存在");
}
//将经纬度转为度分秒
GisUtil.dealGisData(stStbprpB);
return R.status(stStbprpBService.updateById(stStbprpB));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = stStbprpBService.deleteLogic(Func.toLongList(ids));
return R.status(temp);
}
}

163
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/StStbprpBDataController.java

@ -0,0 +1,163 @@
package com.hnac.hzims.waterrain.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.cache.CaffeineCacheUtil;
import com.hnac.hzims.entity.Report;
import com.hnac.hzims.entity.YearReport;
import com.hnac.hzims.util.CommonUtil;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
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 com.hnac.hzims.waterrain.bo.StationResp;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import com.hnac.hzims.waterrain.service.IStStbprpBDataService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/waterRain/stStbprpBData")
@AllArgsConstructor
@Api(value = "水雨情测站数据", tags = "水雨情测站数据接口")
public class StStbprpBDataController extends BladeController implements CacheNames {
private final IStStbprpBDataService stStbprpBDataService;
//获取实时数据
@ApiOperation("实时数据")
@RequestMapping(value = "getRealData", method = RequestMethod.GET)
public R getRealData(String stcd) {
List<FieldsData> realData = stStbprpBDataService.getRealData(stcd);
return R.data(realData,"查询成功");
}
@ApiOperation("根据测站查询历史数据")
@RequestMapping(value = "getDataByHour", method = RequestMethod.GET)
public R getDataByHour(String stcd,String yearMonth) {
List<Map<String,Object>> yearReport = stStbprpBDataService.getDataByHour(stcd,yearMonth);
return R.data(yearReport,"查询成功");
}
@ApiOperation("表头列")
@RequestMapping(value = "/getTableHead", method = RequestMethod.GET)
public R getTableHead(String stcd) {
//查询基础数据
List<AnalyzeInstanceFieldVO> report = stStbprpBDataService.getSignages(stcd);
return R.data(report,"查询成功");
}
/**
* 获取某站点年度统计报表
*
* @param stcd 测站点
* @param year 统计年份 yyyy
* @return
*/
@ApiOperation("年度统计报表")
@RequestMapping(value = "getYearReport", method = RequestMethod.GET)
public R getYearReport(String stcd, Integer year,String sttp,String col) {
String key=stcd+"_"+year+"_"+col;
YearReport report =CaffeineCacheUtil.getYear(key);
if(report!=null){
return R.data(report,"查询缓存成功");
}
YearReport yearReport = stStbprpBDataService.getYearReport(stcd, year,sttp, col);
CaffeineCacheUtil.addYear(key,yearReport);
return R.data(yearReport,"查询成功");
}
@ApiOperation("水量年度统计报表")
@RequestMapping(value = "getWaterYearReport", method = RequestMethod.GET)
public R getWaterYearReport(String stcd, Integer year,String sttp) {
YearReport yearReport = stStbprpBDataService.getWaterYearReport(stcd, year,sttp);
return R.data(yearReport,"查询成功");
}
@ApiOperation("水量年度统计报表")
@RequestMapping(value = "getRainYearReport", method = RequestMethod.GET)
public R getRainYearReport(String stcd, Integer year,String sttp,String col) {
YearReport yearReport = stStbprpBDataService.getRainYearReport(stcd, year,sttp,col);
return R.data(yearReport,"查询成功");
}
@ApiOperation("基础数据报表,数据查询和统计分析使用接口")
@RequestMapping(value = "/getReportData", method = RequestMethod.GET)
public R getReportData(
String[] stcds, String beginSpt, String endSpt, String type,String sttp,String col) {
Map<String,Date> res=CommonUtil.getStartEnd(beginSpt,endSpt);
if(res == null){
return R.data(500,false, "日期格式错误");
}
String key=stcds.toString()+"_"+beginSpt+"_"+endSpt+"_"+type+"_"+col;
Report report = CaffeineCacheUtil.get(key);
if(report!=null){
return R.data(report,"查询成功");
}
//查询基础数据
report = stStbprpBDataService
.getReportData(Arrays.asList(stcds), res.get("begin"), res.get("end"), type, sttp,col);
CaffeineCacheUtil.add(key,report);
return R.data(report,"查询成功");
}
@ApiOperation("水量基础数据报表,数据查询和统计分析使用接口")
@RequestMapping(value = "/getWaterReportData", method = RequestMethod.GET)
public R getWaterReportData(
String[] stcds, String beginSpt, String endSpt, String type,String sttp) {
Map<String,Date> res= CommonUtil.getStartEnd(beginSpt,endSpt);
if(res == null){
return R.data(500,false, "日期格式错误");
}
//查询基础数据
Report report = stStbprpBDataService
.getWaterReportData(Arrays.asList(stcds), res.get("begin"), res.get("end"), type, sttp);
return R.data(report,"查询成功");
}
@ApiOperation("app 水雨情接口")
@RequestMapping(value = "page", method = RequestMethod.GET)
public R page(String sttp,String name, Query page) {
LambdaQueryWrapper<StStbprpB> wrapper=new LambdaQueryWrapper();
if(StringUtils.isNotBlank(sttp)) {
wrapper.in(StStbprpB::getSttp,sttp.split(","));
}
if(StringUtils.isNotBlank(name)) {
wrapper.like(StStbprpB::getStnm, name);
}
wrapper.like(StStbprpB::getCreateDept, AuthUtil.getDeptId());
IPage<StationResp> pageList = stStbprpBDataService.pageData(wrapper, Condition.getPage(page));
return R.data(pageList,"查询成功");
}
@ApiOperation("app 获取实时数据")
@RequestMapping(value = "getLastValue", method = RequestMethod.GET)
public R getLastValue(@RequestParam String stcd) {
Object obj = stStbprpBDataService.getLastValue(stcd);
return R.data(obj,"查询成功");
}
}

145
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/controller/WaterRainReorganizeController.java

@ -0,0 +1,145 @@
package com.hnac.hzims.waterrain.controller;
import com.alibaba.excel.EasyExcel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import com.hnac.hzims.waterrain.entity.ReorganizeData;
import com.hnac.hzims.waterrain.entity.ReorganizeLog;
import com.hnac.hzims.waterrain.listener.UploadWaterFlowRainDataListener;
import com.hnac.hzims.waterrain.service.IReorganizeLogService;
import com.hnac.hzims.waterrain.service.IWaterRainReorganizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/waterRain/reorganize")
@Api(tags = "水雨情数据整编接口")
public class WaterRainReorganizeController {
@Autowired
IWaterRainReorganizeService reorganizeDataService;
@Autowired
IReorganizeLogService reorganizeLogService;
//批量新增
@ApiOperation(value = "水雨情数据保存",notes = "水雨情数据保存")
@RequestMapping(value = "/batchInsert", method = RequestMethod.POST)
public R batchInsert(@RequestBody ReorganizeData data) {
//判定是否已整编
String stcd=data.getStcd();
String yearMonth=data.getYearMonth();
String sttp=data.getSttp();
boolean flag=reorganizeLogService.getReorganizeLog(stcd,yearMonth);
if(flag){
return R.fail(data.getYearMonth()+"数据已整编");
}
//删除数据,防止插入主键冲突
reorganizeDataService.delData(stcd,sttp,yearMonth);
flag=reorganizeDataService.batchInsert(data);
if(flag){
ReorganizeLog reorganizeLog=new ReorganizeLog();
reorganizeLog.setStcd(stcd);
reorganizeLog.setYearMonth(yearMonth);
reorganizeLog.setOperateUser(AuthUtil.getUserName());
reorganizeLogService.insertReorganizeLog(reorganizeLog);
return R.data("数据整编成功");
}else{
return R.fail(500,"数据整编失败");
}
}
//批量导入
/**
* @param file excel文件
* @param sttp
* @param stcd
* @return
*/
@ApiOperation(value = "水雨情数据导入",notes = "水雨情数据导入")
@RequestMapping(value = "/uploadWaterFlowRain", method = RequestMethod.POST)
public R uploadReservoir(MultipartFile file, String sttp,String stcd,String yearMonth) {
//判定是否已整编
boolean flag=reorganizeLogService.getReorganizeLog(stcd,yearMonth);
if(flag){
return R.data(yearMonth+"数据已整编");
}
if(file == null){
return R.fail(500,"未上传文件");
}
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
if("xls".equals(suffix) || "xlsx".equals(suffix)){
try {
//删除数据,防止插入主键冲突
reorganizeDataService.delData(stcd, sttp, yearMonth);
List<String> errMessage=getMessage(file,sttp,stcd);
if (errMessage.isEmpty()) {
ReorganizeLog reorganizeLog=new ReorganizeLog();
reorganizeLog.setStcd(stcd);
reorganizeLog.setYearMonth(yearMonth);
reorganizeLog.setOperateUser(AuthUtil.getUserName());
reorganizeLogService.insertReorganizeLog(reorganizeLog);
return R.data(true,"导入成功");
} else {
return R.data(500,errMessage,"导入失败,请查看具体详情");
}
}catch (IOException e){
return R.fail(500,"导入失败,文件流获取出错");
}
}else{
return R.fail(500,"导入文件格式不对,请按模板文件格式来");
}
}
private List<String> getMessage(MultipartFile file, String sttp,String stcd) throws IOException {
List<String> errMessage=new ArrayList<>();
UploadWaterFlowRainDataListener uploadDataListener = new UploadWaterFlowRainDataListener(reorganizeDataService,sttp,stcd,0);
EasyExcel.read(file.getInputStream(), uploadDataListener).sheet().doReadSync();
errMessage.addAll(uploadDataListener.getErrMessage());
return errMessage;
}
@ApiOperation(value = "整编后数据查询",notes = "整编后数据查询")
@RequestMapping(value = "/queryData", method = RequestMethod.GET)
public R queryData(String stcd,String sttp,String yearMonth) {
//判定是否已整编
boolean flag=reorganizeLogService.getReorganizeLog(stcd,yearMonth);
if(!flag){
return R.data(200,null,"数据未整编,无法查询到数据");
}
List<Map<String,Object>> list=reorganizeDataService.queryData(stcd,sttp,yearMonth);
return R.data(list,"数据查询成功");
}
//重新整编
@ApiOperation(value = "重新整编",notes = "重新整编")
@RequestMapping(value = "/afresh", method = RequestMethod.GET)
public R afresh(String stcd,String yearMonth) {
//删除整编日志
reorganizeLogService.delReorganizeLog(stcd, yearMonth);
return R.data(true,"可以重新整编了");
}
}

26
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/feign/StStbprpBClient.java

@ -0,0 +1,26 @@
package com.hnac.hzims.waterrain.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import com.hnac.hzims.waterrain.service.IStStbprpBService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class StStbprpBClient implements IStStbprpBClient{
@Autowired
private IStStbprpBService stStbprpBService;
@Override
public StStbprpB detail(LambdaQueryWrapper wrapper) {
return stStbprpBService.getOne(wrapper);
}
@Override
public List<StStbprpB> list(LambdaQueryWrapper wrapper) {
return stStbprpBService.list(wrapper);
}
}

20
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/feign/StStbprpBDataClient.java

@ -0,0 +1,20 @@
package com.hnac.hzims.waterrain.feign;
import com.hnac.hzims.waterrain.service.IStStbprpBDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.Map;
@RestController
public class StStbprpBDataClient implements IStStbprpBDataClient{
@Autowired
IStStbprpBDataService stStbprpBDataService;
@Override
public Map<String, String> queryMaxOrMin(String deviceCode, Date startTime, Date endTime, Integer calcType, Integer saveTimeType, Integer timeInterval, String col) {
return stStbprpBDataService.queryMaxOrMin(deviceCode,startTime,endTime,calcType,col);
}
}

336
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/listener/UploadWaterFlowRainDataListener.java

@ -0,0 +1,336 @@
package com.hnac.hzims.waterrain.listener;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.hnac.hzims.waterrain.entity.HzStPptnR;
import com.hnac.hzims.waterrain.entity.HzStRiverR;
import com.hnac.hzims.waterrain.entity.HzStRsvrR;
import com.hnac.hzims.waterrain.enums.WaterFlowRainEnum;
import com.hnac.hzims.waterrain.service.IWaterRainReorganizeService;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class UploadWaterFlowRainDataListener extends AnalysisEventListener<Map<Integer,String>> {
//每00条在invoke中执行一次,剩余的会在doAfterAllAnalysed中执行
private static final int BATCH_COUNT = 200;
private List<String> errMessage;
//对应的测站类型
private String sttp;
//对应的测站编码
private String stcd;
//头部信息
private List<String> head;
//数据的起始列数(从0开始算)
private int firstColumn;
List<Map<Integer,String>> list = new ArrayList<>();
private IWaterRainReorganizeService waterRainReorganizeService;;
public UploadWaterFlowRainDataListener(IWaterRainReorganizeService waterRainReorganizeService, String sttp,
String stcd, int firstColumn) {
this.waterRainReorganizeService = waterRainReorganizeService;
this.sttp = sttp;
this.stcd = stcd;
this.firstColumn = firstColumn;
errMessage = new ArrayList<>();
head = new ArrayList<>();
}
public String getSttp() {
return sttp;
}
public void setSttp(String sttp) {
this.sttp = sttp;
}
public List<String> getErrMessage() {
return errMessage;
}
public void setErrMessage(List<String> errMessage) {
this.errMessage = errMessage;
}
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
for(int i=0;i<headMap.size();i++) {
head.add(headMap.get(i));
}
}
@Override
public void invoke(Map<Integer,String> map, AnalysisContext analysisContext) {
list.add(map);
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
if (list.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
list.clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
if(!list.isEmpty()) {
saveData();
}
list.clear();
head.clear();
}
private void saveData() {
//逐条执行
try {
// dealData();
//批量执行
batchDealDataList();
} catch (ParseException e) {
e.printStackTrace();
}
}
private void dealData() throws ParseException {
Map<String,String> data=checkData(sttp);
if ("true".equals(data.get("flag"))) {
for (Map<Integer, String> map : list) {
//组装批量数据
saveEntity(map, sttp, stcd);
}
} else {
errMessage.add(data.get("msg"));
}
}
//批量执行
private void batchDealDataList() throws ParseException {
List<HzStPptnR> stPptnRList=new ArrayList<>();
List<HzStRiverR> stRiverRList=new ArrayList<>();
List<HzStRsvrR> stRsvrRList=new ArrayList<>();
Map<String,String> data=checkData(sttp);
if ("true".equals(data.get("flag"))) {
for (Map<Integer,String> map : list) {
//组装批量数据
Map<String,Object> res=getOneObj(map,sttp,stcd);
if(res!=null) {
if(WaterFlowRainEnum.PP.getCode().equals(sttp)) {
Object stPptnR = res.get(WaterFlowRainEnum.PP.getCode());
stPptnRList.addAll((List<HzStPptnR>) stPptnR);
}
if(WaterFlowRainEnum.ZZ.getCode().equals(sttp)) {
Object stRiverR = res.get(WaterFlowRainEnum.ZZ.getCode());
stRiverRList.addAll((List<HzStRiverR>) stRiverR);
stRiverR = res.get(WaterFlowRainEnum.ZQ.getCode());
stRiverRList.addAll((List<HzStRiverR>) stRiverR);
}
if(WaterFlowRainEnum.ZQ.getCode().equals(sttp)) {
Object stRiverR = res.get(WaterFlowRainEnum.ZQ.getCode());
stRiverRList.addAll((List<HzStRiverR>) stRiverR);
}
if(WaterFlowRainEnum.RR.getCode().equals(sttp)) {
Object stRsvrR = res.get(WaterFlowRainEnum.RR.getCode());
stRsvrRList.addAll((List<HzStRsvrR>) stRsvrR);
}
}
}
} else {
errMessage.add(data.get("msg"));
}
//批量插入
if(stPptnRList!=null && !stPptnRList.isEmpty() ) {//雨量站
waterRainReorganizeService.batchStPptnR(stPptnRList);
}
if(stRiverRList!=null && !stRiverRList.isEmpty()) {//河道水文、水位站
waterRainReorganizeService.batchStRiverR(stRiverRList);
}
if(stRsvrRList!=null && !stRsvrRList.isEmpty()) {//水库水文站
waterRainReorganizeService.batchStRsvrR(stRsvrRList);
}
}
private Map<String,Object> getOneObj(Map<Integer,String> map,String sttp,String stcd) throws ParseException {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH");
Map<String,Object> res=new HashMap<>();
Date dd=sdf.parse(map.get(0));
if(WaterFlowRainEnum.RR.getCode().equals(sttp)){
HzStRsvrR stRsvrR=new HzStRsvrR();
stRsvrR.setStcd(stcd);
stRsvrR.setTm(dd);
String data=map.get(1);
stRsvrR.setRz(Double.valueOf(data));
data=map.get(2);
stRsvrR.setInq(Double.valueOf(data));
List<HzStRsvrR> dataRes=(List<HzStRsvrR>)res.get(sttp);;
if(dataRes==null || dataRes.isEmpty()) {
dataRes=new ArrayList<>();
}
dataRes.add(stRsvrR);
res.put(sttp,dataRes);
}
if(WaterFlowRainEnum.ZZ.getCode().equals(sttp) || WaterFlowRainEnum.ZQ.getCode().equals(sttp)){
HzStRiverR stRiverR=new HzStRiverR();
stRiverR.setStcd(stcd);
stRiverR.setTm(dd);
String z=map.get(1);
stRiverR.setZ(Double.valueOf(z));
String q=map.get(2);
stRiverR.setQ(Double.valueOf(q));
List<HzStRiverR> dataRes=(List<HzStRiverR>)res.get(sttp);
if(dataRes==null || dataRes.isEmpty()) {
dataRes=new ArrayList<>();
}
dataRes.add(stRiverR);
res.put(sttp,dataRes);
}
if(WaterFlowRainEnum.PP.getCode().equals(sttp)){
HzStPptnR stPptnR=new HzStPptnR();
String drp=map.get(1);
stPptnR.setStcd(stcd);
stPptnR.setTm(dd);
stPptnR.setDrp(Double.valueOf(drp));
List<HzStPptnR> dataRes=null;
if(res.get(sttp)!=null) {
dataRes=(List<HzStPptnR>)res.get(sttp);
dataRes.add(stPptnR);
}else{
dataRes=new ArrayList<>();
}
res.put(sttp,dataRes);
}
return res;
}
private void saveEntity(Map<Integer,String> map,String sttp,String stcd) throws ParseException {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH");
String dateStr=map.get(0);
Date dd=sdf.parse(dateStr);
if(WaterFlowRainEnum.RR.getCode().equals(sttp)){
HzStRsvrR stRsvrR=new HzStRsvrR();
stRsvrR.setStcd(stcd);
stRsvrR.setTm(dd);
String rz=map.get(1);
stRsvrR.setRz(Double.valueOf(rz));
String inq=map.get(2);
stRsvrR.setInq(Double.valueOf(inq));
waterRainReorganizeService.insertHzStRsvrR(stRsvrR);
}
if(WaterFlowRainEnum.ZZ.getCode().equals(sttp) || WaterFlowRainEnum.ZQ.getCode().equals(sttp)){
HzStRiverR stRiverR=new HzStRiverR();
stRiverR.setStcd(stcd);
stRiverR.setTm(dd);
String z=map.get(1);
stRiverR.setZ(Double.valueOf(z));
String q=map.get(2);
stRiverR.setQ(Double.valueOf(q));
waterRainReorganizeService.insertHzStRiverR(stRiverR);
}
if(WaterFlowRainEnum.PP.getCode().equals(sttp)){//降雨
HzStPptnR stPptnR=new HzStPptnR();
stPptnR.setStcd(stcd);
stPptnR.setTm(dd);
String drp=map.get(1);
stPptnR.setDrp(Double.valueOf(drp));
waterRainReorganizeService.insertHzStPptnR(stPptnR);
}
}
//校核某一行的数据
Map<String,String> checkData(String sttp) {
Map<String, String> data = new HashMap<>();
String msg="请检查导入数据中";
for (Map<Integer,String> map : list) {
String dateStr = map.get(0);
String columnStr = "";
if (WaterFlowRainEnum.RR.getCode().equals(sttp)) {
String rz = map.get(1);
String inq = map.get(2);
if (StringUtils.isBlank(rz)) {
columnStr += dateStr + "的水位数据为空";
if (StringUtils.isBlank(inq)) {
columnStr += ",流量数据为空";
data.put("msg", msg + "," + columnStr);
data.put("flag", "false");
return data;
}
data.put("msg", msg + "," + columnStr);
data.put("flag", "false");
return data;
} else {
if (StringUtils.isBlank(inq)) {
columnStr += dateStr + "的流量数据为空";
data.put("msg", msg + "," + columnStr);
data.put("flag", "false");
return data;
}
}
}
if (WaterFlowRainEnum.ZZ.getCode().equals(sttp) || WaterFlowRainEnum.ZQ.getCode().equals(sttp)) {
String z = map.get(1);
String q = map.get(2);
if (StringUtils.isBlank(z)) {
columnStr += dateStr + "的水位数据为空";
if (StringUtils.isBlank(q)) {
columnStr += ",流量数据为空";
data.put("msg", msg + "," + columnStr);
data.put("flag", "false");
return data;
}
data.put("msg", msg + "," + columnStr);
data.put("flag", "false");
return data;
} else {
if (StringUtils.isBlank(q)) {
columnStr += dateStr + "的流量数据为空;";
data.put("msg", msg + "," + columnStr);
data.put("flag", "false");
return data;
}
}
}
if (WaterFlowRainEnum.PP.getCode().equals(sttp)) {//降雨
String drp = map.get(1);
if (StringUtils.isBlank(drp)) {
columnStr += dateStr + "的降雨量数据为空";
data.put("msg", msg + "," + columnStr);
data.put("flag", "false");
return data;
}
}
if ("".equals(columnStr)) {
data.put("msg", "");
data.put("flag", "true");
}
}
return data;
}
}

11
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/ReorganizeLogMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.waterrain.mapper;
import org.apache.ibatis.annotations.Param;
import com.hnac.hzims.waterrain.entity.ReorganizeLog;
public interface ReorganizeLogMapper {
int insert(ReorganizeLog reorganizeLog);
ReorganizeLog queryReorganizeLog(@Param("stcd") String stcd, @Param("yearMonth") String yearMonth);
int checkOk(ReorganizeLog reorganizeLog);
int delReorganizeLog(@Param("stcd") String stcd, @Param("yearMonth") String yearMonth);
}

33
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/ReorganizeLogMapper.xml

@ -0,0 +1,33 @@
<?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.waterrain.mapper.ReorganizeLogMapper">
<resultMap id="BaseResult" type="com.hnac.hzims.waterrain.entity.ReorganizeLog">
<result jdbcType="VARCHAR" property="stcd" column="stcd"/>
<result jdbcType="VARCHAR" property="yearMonth" column="year_month"/>
<result jdbcType="VARCHAR" property="operateUser" column="operate_user"/>
<result jdbcType="VARCHAR" property="checkUser" column="check_user"/>
</resultMap>
<insert id="insert" parameterType="com.hnac.hzims.waterrain.entity.ReorganizeLog">
insert into reorganize_log(stcd,`year_month`,operate_user,check_user)
values (#{stcd,jdbcType=VARCHAR},#{yearMonth,jdbcType=VARCHAR},
#{operateUser,jdbcType=VARCHAR},#{checkUser,jdbcType=VARCHAR})
</insert>
<select id="queryReorganizeLog" resultMap="BaseResult">
select stcd,`year_month`,operate_user,check_user
from reorganize_log
where stcd=#{stcd} and `year_month`=#{yearMonth}
</select>
<update id="checkOk" parameterType="com.hnac.hzims.waterrain.entity.ReorganizeLog">
update reorganize_log
set check_user=#{checkUser}
where stcd=#{stcd} and `year_month`=#{yearMonth}
</update>
<delete id="delReorganizeLog">
delete
from reorganize_log
where stcd=#{stcd} and `year_month`=#{yearMonth}
</delete>
</mapper>

8
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/StStbprpBMapper.java

@ -0,0 +1,8 @@
package com.hnac.hzims.waterrain.mapper;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import com.hnac.hzims.waterrain.entity.StStbprpB;
public interface StStbprpBMapper extends UserDataScopeBaseMapper<StStbprpB> {
}

5
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/StStbprpBMapper.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.waterrain.mapper.StStbprpBMapper">
</mapper>

28
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/WaterRainReorganizeMapper.java

@ -0,0 +1,28 @@
package com.hnac.hzims.waterrain.mapper;
import org.apache.ibatis.annotations.Param;
import com.hnac.hzims.waterrain.entity.HzStPptnR;
import com.hnac.hzims.waterrain.entity.HzStRiverR;
import com.hnac.hzims.waterrain.entity.HzStRsvrR;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface WaterRainReorganizeMapper {
int batchStPptnR(@Param("list") List<HzStPptnR> list);
int batchStRiverR(@Param("list")List<HzStRiverR> list);
int batchStRsvrR(@Param("list")List<HzStRsvrR> list);
int insertHzStPptnR(HzStPptnR hzStPptnR);
int insertHzStRsvrR(HzStRsvrR hzStRsvrR);
int insertHzStRiverR(HzStRiverR hzStRiverR);
List<Map<String,Object>> queryStPptnR(@Param("stcd") String stcd, @Param("start") Date start, @Param("end") Date end);
List<Map<String,Object>> queryStRsvrR(@Param("stcd")String stcd,@Param("start") Date start, @Param("end") Date end);
List<Map<String,Object>> queryStRiverR(@Param("stcd")String stcd,@Param("start") Date start, @Param("end") Date end);
int delStPptnR(@Param("stcd") String stcd, @Param("start") Date start, @Param("end") Date end);
int delStRsvrR(@Param("stcd")String stcd,@Param("start") Date start, @Param("end") Date end);
int delStRiverR(@Param("stcd")String stcd,@Param("start") Date start, @Param("end") Date end);
}

150
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/mapper/WaterRainReorganizeMapper.xml

@ -0,0 +1,150 @@
<?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.waterrain.mapper.WaterRainReorganizeMapper">
<insert id="batchStPptnR" parameterType="com.hnac.hzims.waterrain.entity.HzStPptnR">
insert into st_pptn_r(STCD,TM,DRP) values
<foreach collection="list" separator="," item="cus">
(#{cus.stcd}, #{cus.tm},#{cus.drp})
</foreach>
</insert>
<insert id="batchStRiverR" parameterType="com.hnac.hzims.waterrain.entity.HzStRiverR">
insert into st_river_r(STCD,TM,Z,Q)
<foreach collection="list" separator="," item="cus">
(#{cus.stcd}, #{cus.tm},#{cus.z},#{cus.q})
</foreach>
</insert>
<insert id="batchStRsvrR" parameterType="com.hnac.hzims.waterrain.entity.HzStRsvrR">
insert into st_rsvr_r(STCD,TM,RZ,INQ)
<foreach collection="list" separator="," item="cus">
(#{cus.stcd}, #{cus.tm},#{cus.rz},#{cus.inq})
</foreach>
</insert>
<insert id="insertHzStPptnR" parameterType="com.hnac.hzims.waterrain.entity.HzStPptnR">
insert into st_pptn_r
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="stcd != null" >
STCD,
</if>
<if test="tm != null" >
TM,
</if>
<if test="drp != null" >
DRP,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="stcd != null" >
#{stcd,jdbcType=CHAR},
</if>
<if test="tm != null" >
#{tm,jdbcType=TIMESTAMP},
</if>
<if test="drp != null" >
#{drp,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<insert id="insertHzStRiverR" parameterType="com.hnac.hzims.waterrain.entity.HzStRiverR">
insert into st_river_r
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="stcd != null" >
STCD,
</if>
<if test="tm != null" >
TM,
</if>
<if test="z != null" >
Z,
</if>
<if test="q != null" >
Q,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="stcd != null" >
#{stcd,jdbcType=CHAR},
</if>
<if test="tm != null" >
#{tm,jdbcType=TIMESTAMP},
</if>
<if test="z != null" >
#{z,jdbcType=DECIMAL},
</if>
<if test="q != null" >
#{q,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<insert id="insertHzStRsvrR" parameterType="com.hnac.hzims.waterrain.entity.HzStRsvrR">
insert into st_rsvr_r
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="stcd != null" >
STCD,
</if>
<if test="tm != null" >
TM,
</if>
<if test="rz != null" >
RZ,
</if>
<if test="inq != null" >
INQ,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="stcd != null" >
#{stcd,jdbcType=CHAR},
</if>
<if test="tm != null" >
#{tm,jdbcType=TIMESTAMP},
</if>
<if test="rz != null" >
#{rz,jdbcType=DECIMAL},
</if>
<if test="inq != null" >
#{inq,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<select id="queryStPptnR" resultType="java.util.Map">
select DATE_FORMAT(tm,'%Y-%m-%d %H') as tm,drp as rain from st_pptn_r
where stcd=#{stcd} and tm between #{start} and #{end}
order by tm
</select>
<select id="queryStRsvrR" resultType="java.util.Map">
select DATE_FORMAT(tm,'%Y-%m-%d %H') as tm,rz as water_level,inq as flow from st_rsvr_r
where stcd=#{stcd} and tm between #{start} and #{end}
order by tm
</select>
<select id="queryStRiverR" resultType="java.util.Map">
select DATE_FORMAT(tm,'%Y-%m-%d %H') as tm,z as water_level,q as flow from st_river_r
where stcd=#{stcd} and tm between #{start} and #{end}
order by tm
</select>
<delete id="delStPptnR">
delete from st_pptn_r
where stcd=#{stcd} and tm between #{start} and #{end}
</delete>
<delete id="delStRsvrR">
delete from st_rsvr_r
where stcd=#{stcd} and tm between #{start} and #{end}
</delete>
<delete id="delStRiverR">
delete from st_river_r
where stcd=#{stcd} and tm between #{start} and #{end}
</delete>
</mapper>

12
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IReorganizeLogService.java

@ -0,0 +1,12 @@
package com.hnac.hzims.waterrain.service;
import com.hnac.hzims.waterrain.entity.ReorganizeLog;
public interface IReorganizeLogService {
boolean getReorganizeLog(String stcd,String yearMonth);
ReorganizeLog queryReorganizeLog(String stcd, String yearMonth);
boolean insertReorganizeLog(ReorganizeLog reorganizeLog);
boolean check(String stcd,String yearMonth,String checkUser);
boolean delReorganizeLog(String stcd,String yearMonth);
}

47
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IStStbprpBDataService.java

@ -0,0 +1,47 @@
package com.hnac.hzims.waterrain.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.entity.Report;
import com.hnac.hzims.entity.YearReport;
import com.hnac.hzims.waterrain.bo.StationResp;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface IStStbprpBDataService {
//获取计算值(最大 最小 平均等等)
Map<String, String> queryMaxOrMin(String deviceCode, Date startTime, Date endTime,
Integer calcType, String col);
//获取最新值以及差值
List<Map<String,Object>> getLastValues(List<String> stcds,String sttp);
//过程线
Report getReportData(List<String> deviceCode, Date begin, Date end, String type , String sttp, String col);
//水量过程线
Report getWaterReportData(List<String> deviceCodes, Date begin, Date end, String type, String sttp);
//年报表
YearReport getYearReport(String stcd, Integer year, String sttp, String col);
//水量年报表
YearReport getWaterYearReport(String deviceCode, Integer year,String sttp);
//将于年报
YearReport getRainYearReport(String deviceCode, Integer year,String sttp,String col);
Object getLastValue(String stcd);
IPage<StationResp> pageData(LambdaQueryWrapper wrapper, IPage page);
List<FieldsData> getRealData(String stcd);
List<AnalyzeInstanceFieldVO> getSignages(String stcd);
List<Map<String,Object>> getDataByHour(String stcd,String yearMonth);
}

8
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IStStbprpBService.java

@ -0,0 +1,8 @@
package com.hnac.hzims.waterrain.service;
import org.springblade.core.mp.base.BaseService;
import com.hnac.hzims.waterrain.entity.StStbprpB;
public interface IStStbprpBService extends BaseService<StStbprpB> {
}

34
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IWaterRainReorganizeService.java

@ -0,0 +1,34 @@
package com.hnac.hzims.waterrain.service;
import com.hnac.hzims.waterrain.entity.HzStPptnR;
import com.hnac.hzims.waterrain.entity.HzStRiverR;
import com.hnac.hzims.waterrain.entity.HzStRsvrR;
import com.hnac.hzims.waterrain.entity.ReorganizeData;
import java.util.List;
import java.util.Map;
public interface IWaterRainReorganizeService {
boolean batchInsert(ReorganizeData data);
void batchStPptnR(List<HzStPptnR> list);
void batchStRiverR(List<HzStRiverR> list);
void batchStRsvrR(List<HzStRsvrR> list);
int insertHzStPptnR(HzStPptnR hzStPptnR);
int insertHzStRsvrR(HzStRsvrR hzStRsvrR);
int insertHzStRiverR(HzStRiverR hzStRiverR);
List<Map<String,Object>> queryStPptnR(String stcd,String yearMonth);
List<Map<String,Object>> queryStRsvrR(String stcd,String yearMonth);
List<Map<String,Object>> queryStRiverR(String stcd,String yearMonth);
boolean delStPptnR(String stcd,String yearMonth);
boolean delStRsvrR(String stcd,String yearMonth);
boolean delStRiverR(String stcd,String yearMonth);
List<Map<String,Object>> queryData(String stcd,String sttp,String yearMonth);
boolean delData(String stcd,String sttp,String yearMonth);
}

4
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/IWaterRainService.java

@ -0,0 +1,4 @@
package com.hnac.hzims.waterrain.service;
public interface IWaterRainService {
}

45
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/ReorganizeLogServiceImpl.java

@ -0,0 +1,45 @@
package com.hnac.hzims.waterrain.service.impl;
import com.hnac.hzims.waterrain.entity.ReorganizeLog;
import com.hnac.hzims.waterrain.mapper.ReorganizeLogMapper;
import com.hnac.hzims.waterrain.service.IReorganizeLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class ReorganizeLogServiceImpl implements IReorganizeLogService {
@Resource
ReorganizeLogMapper reorganizeLogMapper;
@Override
public boolean getReorganizeLog(String stcd, String yearMonth) {
ReorganizeLog reorganizeLog=queryReorganizeLog(stcd,yearMonth);
return reorganizeLog!=null;
}
@Override
public ReorganizeLog queryReorganizeLog(String stcd, String yearMonth) {
return reorganizeLogMapper.queryReorganizeLog(stcd,yearMonth);
}
@Override
public boolean insertReorganizeLog(ReorganizeLog reorganizeLog) {
return reorganizeLogMapper.insert(reorganizeLog)>0;
}
@Override
public boolean check(String stcd, String yearMonth, String checkUser) {
ReorganizeLog reorganizeLog=new ReorganizeLog();
reorganizeLog.setStcd(stcd);
reorganizeLog.setYearMonth(yearMonth);
reorganizeLog.setCheckUser(checkUser);
return reorganizeLogMapper.checkOk(reorganizeLog)>0;
}
@Override
public boolean delReorganizeLog(String stcd, String yearMonth) {
return reorganizeLogMapper.delReorganizeLog(stcd,yearMonth)>0;
}
}

896
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/StStbprpBDataServiceImpl.java

@ -0,0 +1,896 @@
package com.hnac.hzims.waterrain.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.entity.*;
import com.hnac.hzims.enums.QueryDateTypeEnum;
import com.hnac.hzims.util.CommonUtil;
import com.hnac.hzims.util.ReportDateUtil;
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;
import com.hnac.hzinfo.sdk.analyse.vo.DeviceSinglePropsValueQuery;
import com.hnac.hzinfo.sdk.analyse.vo.DeviceSinglePropsValueVO;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.real.RealDataSearchClient;
import org.apache.commons.lang3.time.DateUtils;
import com.hnac.hzims.waterrain.bo.*;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import com.hnac.hzims.waterrain.service.IStStbprpBDataService;
import com.hnac.hzims.waterrain.service.IStStbprpBService;
import com.hnac.hzims.waterrain.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.*;
@Service
public class StStbprpBDataServiceImpl implements IStStbprpBDataService {
@Autowired
AnalyseDataSearchClient analyseDataSearchClient;
@Autowired
RealDataSearchClient realDataSearchClient;
@Autowired
IStStbprpBService stStbprpBService;
@Override
public Object getLastValue(String stcd) {
LambdaQueryWrapper<StStbprpB> wrapper=new LambdaQueryWrapper();
wrapper.eq(StStbprpB::getStcd,stcd);
wrapper.eq(StStbprpB::getIsDeleted,0);
StStbprpB resp = stStbprpBService.getOne(wrapper);
return getLastValue(resp);
}
private Object getLastValue(StStbprpB resp){
List<String> stcds=new ArrayList<>();
stcds.add(resp.getStcd());
List<Map<String,Object>> dataList = getLastValues(stcds, resp.getSttp());
if(dataList!=null && !dataList.isEmpty()) {
return dataList.get(0);
}else{
return null;
}
}
@Override
public IPage<StationResp> pageData(LambdaQueryWrapper wrapper, IPage page) {
IPage<StStbprpB> pageList = stStbprpBService.page(page, wrapper);
IPage<StationResp> list = new Page(pageList.getCurrent(),pageList.getSize());
int count=(int)pageList.getTotal();
List<String> stcds=new ArrayList<>();
for (StStbprpB resp : pageList.getRecords()) {
stcds.add(resp.getStcd());
}
List<StationResp> records=new ArrayList<>();
for (StStbprpB resp : pageList.getRecords()) {
StationResp temp = new StationResp();
temp.setStStbprpB(resp);
temp.setObj(getLastValue(resp));
records.add(temp);
}
list.setPages(pageList.getPages());
list.setRecords(records);
list.setTotal(count);
return list;
}
@Override
public List<FieldsData> getRealData(String stcd) {
RealDataSearchPO po=new RealDataSearchPO();
po.setAnalyzeCode(stcd);
List<AnalyzeInstanceFieldVO> list=getSignages(stcd);
if(list==null || list.isEmpty()){
return null;
}
List<String> signages=new ArrayList<>();
for(AnalyzeInstanceFieldVO vo:list){
signages.add(vo.getSignage());
}
po.setSignages(signages);
Result<List<FieldsData>> result=realDataSearchClient.getRealDataByDeviceCode(po);
if(result==null || !result.isSuccess()){
return null;
}
return result.getData();
}
@Override
public List<AnalyzeInstanceFieldVO> getSignages(String stcd){
//查询列
Result<List<AnalyzeInstanceFieldVO>> result=analyseDataSearchClient.getInstanceFieldByAnalyseCode(stcd,1,"");
if(result==null || !result.isSuccess()){
return null;
}
List<AnalyzeInstanceFieldVO> analyzeInstanceFieldVOS=result.getData();
return analyzeInstanceFieldVOS;
}
@Override
public List<Map<String, Object>> getDataByHour(String stcd,String yearMonth) {
List<Map<String, Object>> list=new ArrayList<>();
Map<String,Date> dateMap=DateUtil.getStartEnd(yearMonth);
Date begin= dateMap.get("start");
Date endSt= dateMap.get("end");
if(begin==null || endSt==null){
return null;
}
LocalDateTime start = LocalDateTime.ofInstant(begin.toInstant(), ZoneId.systemDefault());
LocalDateTime end = LocalDateTime.ofInstant(endSt.toInstant(), ZoneId.systemDefault());
List<AnalyzeInstanceFieldVO> vos=getSignages(stcd);
if(vos==null || vos.isEmpty()){
return null;
}
Map<String,List<ReportData>> map=new HashMap<>();
int count=0;
for(AnalyzeInstanceFieldVO vo:vos) {
List<ReportData> reportDataList = getDataByDeviceCode(stcd, 6,2,start,end, vo.getSignage());
map.put(vo.getSignage(),reportDataList);
count = reportDataList.size();
}
for (int i = 0; i < count; i++) {
Map<String,Object> res=new HashMap<>();
for(AnalyzeInstanceFieldVO vo:vos) {
List<ReportData> reportDataList=map.get(vo.getSignage());
ReportData reportData=reportDataList.get(i);
res.put("tm",reportData.getKeyStr());
res.put(vo.getSignage(),reportData.getVal());
}
list.add(res);
}
return list;
}
//获取测站 水量年报表
@Override
public YearReport getWaterYearReport(String deviceCode, Integer year, String sttp) {
YearReport yearReport=getYearReport(deviceCode, year, sttp,"flow");
dealYearReport(yearReport);
return yearReport;
}
void dealRainYearReport(YearReport yearReport){
if(yearReport!=null){
List<ReportUnit> monthList=yearReport.getMonthList();
dealMonthList(monthList,yearReport.getYear());
List<ReportData> yearList=yearReport.getYearList();
dealYearList(yearList,yearReport.getYear());
}
}
void dealYearReport(YearReport yearReport){
if(yearReport!=null){
List<List<String>> dayList=yearReport.getDayList();
dealDayList(dayList);
List<ReportUnit> monthList=yearReport.getMonthList();
dealMonthList(monthList,yearReport.getYear());
List<ReportData> yearList=yearReport.getYearList();
dealYearList(yearList,yearReport.getYear());
}
}
void dealDayList(List<List<String>> dayList){
for(List<String> list:dayList){
if(list!=null && !list.isEmpty()) {
for (int i=0,size=list.size(); i<size; i++) {
String str=list.get(i);
if (!"-".equals(str)) {
list.set(i,getNewVal(str,"day",""));
}
}
}
}
}
void dealMonthList(List<ReportUnit> monthList,int year){
if(monthList!=null && !monthList.isEmpty()) {
for (ReportUnit reportUnit:monthList) {
String key=reportUnit.getKey();
if(!key.contains("时间")){
List<String> list=reportUnit.getDataList();
dealMonthDataList(list,year);
}
}
}
}
void dealMonthDataList(List<String> list,int year){
if(list!=null && !list.isEmpty()){
for (int i=0,size=list.size(); i<size; i++) {
String str=list.get(i);
if (!"-".equals(str)) {
int month= i+1;
// String monthStr = month < 9 ? "0"+month:""+month;
list.set(i,getNewVal(str,"month",year+"-"+month));
}
}
}
}
void dealYearList(List<ReportData> yearList,int year){
for(ReportData reportData:yearList){
String keyStr=reportData.getKeyStr();
if(!keyStr.contains("时间")){
String str=reportData.getVal();
if (!"-".equals(str)) {
reportData.setVal(getNewVal(str, "year", year + ""));
}
}
}
}
//获取测站 水量过程线
@Override
public Report getWaterReportData(List<String> deviceCodes, Date begin, Date end, String type, String sttp) {
Report report=getReportData(deviceCodes, begin, end, type, sttp,"flow");
dealReportData(report,type);
return report;
}
void dealReportData(Report report, String dateType){
if(report!=null) {
List<ReportUnit> list = report.getData();
if(list!=null && !list.isEmpty()) {
for (ReportUnit reportUnit : list) {
String key = reportUnit.getKey();
List<String> dataList = reportUnit.getDataList();
dealDataList(dataList, dateType, key);
}
}
}
}
void dealDataList(List<String> dataList,String dateType,String key){
if(dataList!=null && !dataList.isEmpty()) {
for (int i = 0,size=dataList.size(); i<size;i++) {
String value=dataList.get(i);
if(!"-".equals(value)) {
dataList.set(i,getNewVal(value,dateType,key));
}
}
}
}
String getNewVal(String value,String dateType,String key){
long xishu=1;
if(QueryDateTypeEnum.YEAR.getQueryDateType().equals(dateType)){//年
int year = Integer.valueOf(key);
if((year%4==0 && year%100!=0) || (year%400==0)){
xishu = 31622400;//366天的秒数
}else{
xishu = 31536000;//365天的秒数
}
}
if(QueryDateTypeEnum.MONTH.getQueryDateType().equals(dateType)){//月
String[] keys=key.split("-");
int day=getDaysByYearMonth(Integer.valueOf(keys[0]),Integer.valueOf(keys[1]));
xishu = day*86400;//day天的秒数 0.004425
}
if(QueryDateTypeEnum.DAY.getQueryDateType().equals(dateType)){//日
xishu = 86400;//1天的秒数
}
if(QueryDateTypeEnum.HOUR.getQueryDateType().equals(dateType)){//时
xishu = 3600;//1小时的秒数
}
if(value!=null && !"-".equals(value) && !"".equals(value.trim())) {
BigDecimal result = new BigDecimal(value).multiply(new BigDecimal(xishu));
return String.format("%.3f", result);
}else{
return "-";
}
}
public static int getDaysByYearMonth(int year, int month) {
Calendar a = Calendar.getInstance();
a.set(Calendar.YEAR, year);
a.set(Calendar.MONTH, month - 1);
a.set(Calendar.DATE, 1);
a.roll(Calendar.DATE, -1);
int maxDate = a.get(Calendar.DATE);
return maxDate;
}
//获取测站年报表
@Override
public YearReport getRainYearReport(String deviceCode, Integer year, String sttp, String col) {
//初始化年份
YearReport yearReport = new YearReport();
yearReport.init(deviceCode, year);
//拿到一年数据
Date begin = ReportDateUtil.getDate(year, 0, 1, 8, 0, 0);
Date end = ReportDateUtil.getNextDate(begin, Calendar.YEAR);
List<ReportData> yearReportData = listDataReport(begin, end, QueryDateTypeEnum.DAY,deviceCode,sttp, col);
//年度数据转化到报表里,计算每月数据和年数据
try {
toYearRainReport(yearReport, yearReportData, col,sttp);
} catch (Exception e) {
return null;
}
//返回数据
return yearReport;
}
@Override
public YearReport getYearReport(String deviceCode, Integer year, String sttp, String col) {
//初始化年份
YearReport yearReport = new YearReport();
yearReport.init(deviceCode, year);
//拿到一年数据
Date begin = ReportDateUtil.getDate(year, 0, 1, 8, 0, 0);
Date end = ReportDateUtil.getNextDate(begin, Calendar.YEAR);
List<ReportData> yearReportData = listDataReport(begin, end, QueryDateTypeEnum.DAY,deviceCode,sttp, col);
//年度数据转化到报表里,计算每月数据和年数据
try {
toYearReport(yearReport, yearReportData, col,sttp);
} catch (Exception e) {
return null;
}
//返回数据
return yearReport;
}
/**
* 年度数据转化到报表里,然後计算每月统计数据和年统计数据
*
* @param yearReport
* @param yearReportData
* @param col
* @throws ParseException
*/
private void toYearReport(YearReport yearReport, List<ReportData> yearReportData, String col,String sttp)
throws ParseException {
//先把数据转化到设计的二维链表里
SimpleDateFormat sdf = ReportDateUtil.getSimpleDateFormatByType(QueryDateTypeEnum.DAY);
Calendar calendar = Calendar.getInstance();
for (ReportData reportData : yearReportData) {
Date tempDay = sdf.parse(reportData.getKeyStr());
calendar.setTime(tempDay);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
String value=reportData.getVal();
if(value!=null && !"-".equals(value) && !"".equals(value.trim())){
value = new BigDecimal(value).setScale(3,BigDecimal.ROUND_DOWN).toString();
}
yearReport.setDayValue(month, day,value);
}
//初始化每月列表
yearReport.initMonthList(new String[]{
StandardData.STANDARD_AVG,
StandardData.STANDARD_MAX,
StandardData.STANDARD_MAX_DATE,
StandardData.STANDARD_MIN,
StandardData.STANDARD_MIN_DATE
});
//计算每月统计数据
calcMonth(yearReport, col,sttp);
//计算年数据
calcYear(yearReport, col,sttp);
}
private void toYearRainReport(YearReport yearReport, List<ReportData> yearReportData, String col,String sttp)
throws ParseException {
//先把数据转化到设计的二维链表里
SimpleDateFormat sdf = ReportDateUtil.getSimpleDateFormatByType(QueryDateTypeEnum.DAY);
Calendar calendar = Calendar.getInstance();
for (ReportData reportData : yearReportData) {
Date tempDay = sdf.parse(reportData.getKeyStr());
calendar.setTime(tempDay);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
String value=reportData.getVal();
if(value!=null && !"-".equals(value) && !"".equals(value.trim())){
value = new BigDecimal(value).setScale(3,BigDecimal.ROUND_DOWN).toString();
}
yearReport.setDayValue(month, day,value);
}
//初始化每月列表
yearReport.initMonthList(new String[]{
StandardData.STANDARD_AVG,
StandardData.STANDARD_MAX,
StandardData.STANDARD_MAX_DATE,
StandardData.STANDARD_MIN,
StandardData.STANDARD_MIN_DATE
});
// //计算每月统计数据
// calcRainMonth(yearReport);
// //计算年数据
// calcRainYear(yearReport, col,sttp);
}
// private void calcRainMonth(YearReport yearReport) {
// StandardData standardData =null;
// String stcd = yearReport.getStcd();
// List<List<String>> dayList = yearReport.getDayList();
// for (int month = 0; month < dayList.size(); month++) {
// if (Objects.isNull(standardData)) {
// standardData = new StandardData();
// }
// standardData.dealNullData();
//
//
// if(avgValue!=null && !avgValue.isEmpty()) {
// yearReport.setMonthValue(StandardData.STANDARD_AVG, month, avgValue.get(0).getVal());
//// yearReport.setMonthValue(StandardData.STANDARD_AVG, month, avgValue.get(stcd));
// }else{
// yearReport.setMonthValue(StandardData.STANDARD_AVG, month, "-");
// }
//
// if(maxValue!=null) {
// yearReport.setMonthValue(StandardData.STANDARD_MAX, month, maxValue.get(stcd));
// yearReport.setMonthValue(StandardData.STANDARD_MAX_DATE, month, maxValue.get("tm"));
// }else{
// yearReport.setMonthValue(StandardData.STANDARD_MAX, month, "-");
// yearReport.setMonthValue(StandardData.STANDARD_MAX_DATE, month, "-");
// }
//
// if(minValue!=null) {
// yearReport.setMonthValue(StandardData.STANDARD_MIN, month, minValue.get(stcd));
// yearReport.setMonthValue(StandardData.STANDARD_MIN_DATE, month, minValue.get("tm"));
// }else{
// yearReport.setMonthValue(StandardData.STANDARD_MIN, month, "-");
// yearReport.setMonthValue(StandardData.STANDARD_MIN_DATE, month, "-");
// }
//
// }
// }
private void calcMonth(YearReport yearReport, String col,String sttp) {
//SimpleDateFormat sdf = ReportDateUtil.getSimpleDateFormatByType(QueryDateTypeEnum.DAY);
//获取日报表数据
StandardData standardData =null;
String stcd = yearReport.getStcd();
List<List<String>> dayList = yearReport.getDayList();
for (int month = 0; month < dayList.size(); month++) {
Date begin = ReportDateUtil.getDate(yearReport.getYear(), month, 1, 8, 0, 0);
Date end = ReportDateUtil.getNextDate(begin, Calendar.MONTH);
//拿到一个月的统计数据
Map<String,String> maxValue= queryMaxOrMin(stcd, begin, end,1,col);
Map<String,String> minValue= queryMaxOrMin(stcd, begin, end,2,col);
// Map<String,String> avgValue= queryMaxOrMin(stcd, begin, end,3,col);
List<ReportData> avgValue= listDataReport( begin, end,QueryDateTypeEnum.MONTH,stcd,sttp,col);
if (Objects.isNull(standardData)) {
standardData = new StandardData();
}
standardData.dealNullData();
if(avgValue!=null && !avgValue.isEmpty()) {
yearReport.setMonthValue(StandardData.STANDARD_AVG, month, avgValue.get(0).getVal());
// yearReport.setMonthValue(StandardData.STANDARD_AVG, month, avgValue.get(stcd));
}else{
yearReport.setMonthValue(StandardData.STANDARD_AVG, month, "-");
}
if(maxValue!=null && maxValue.get(stcd)!=null) {
yearReport.setMonthValue(StandardData.STANDARD_MAX, month, maxValue.get(stcd));
yearReport.setMonthValue(StandardData.STANDARD_MAX_DATE, month, maxValue.get("tm"));
}else{
yearReport.setMonthValue(StandardData.STANDARD_MAX, month, "-");
yearReport.setMonthValue(StandardData.STANDARD_MAX_DATE, month, "-");
}
if(minValue!=null && minValue.get(stcd)!=null) {
yearReport.setMonthValue(StandardData.STANDARD_MIN, month, minValue.get(stcd));
yearReport.setMonthValue(StandardData.STANDARD_MIN_DATE, month, minValue.get("tm"));
}else{
yearReport.setMonthValue(StandardData.STANDARD_MIN, month, "-");
yearReport.setMonthValue(StandardData.STANDARD_MIN_DATE, month, "-");
}
}
}
private void calcYear(YearReport yearReport, String col,String sttp) {
StandardData standardData =null;
String stcd = yearReport.getStcd();
Date begin = ReportDateUtil.getDate(yearReport.getYear(), 0, 1, 8, 0, 0);
Date end = ReportDateUtil.getNextDate(begin, Calendar.YEAR);
Map<String,String> maxValue= queryMaxOrMin(stcd, begin, end,1, col);
Map<String,String> minValue= queryMaxOrMin(stcd, begin, end,2, col);
// Map<String,String> avgValue= queryMaxOrMin(stcd, begin, end,3, col);
List<ReportData> avgValue= listDataReport( begin, end,QueryDateTypeEnum.YEAR,stcd,sttp,col);
if (Objects.isNull(standardData)) {
standardData = new StandardData();
}
standardData.dealNullData();
List<ReportData> yearList = new ArrayList<>();
if(avgValue!=null && !avgValue.isEmpty()){
yearList.add(new ReportData(StandardData.STANDARD_AVG, avgValue.get(0).getVal()));
// yearList.add(new ReportData(StandardData.STANDARD_AVG, avgValue.get(stcd)));
}else{
yearList.add(new ReportData(StandardData.STANDARD_AVG, "-"));
}
if(maxValue!=null && maxValue.get(stcd)!=null) {
yearList.add(new ReportData(StandardData.STANDARD_MAX, maxValue.get(stcd)));
yearList.add(new ReportData(StandardData.STANDARD_MAX_DATE, maxValue.get("tm")));
}else{
yearList.add(new ReportData(StandardData.STANDARD_MAX, "-"));
yearList.add(new ReportData(StandardData.STANDARD_MAX_DATE, "-"));
}
if(minValue!=null && minValue.get(stcd)!=null) {
yearList.add(new ReportData(StandardData.STANDARD_MIN, minValue.get(stcd)));
yearList.add(new ReportData(StandardData.STANDARD_MIN_DATE, minValue.get("tm")));
}else{
yearList.add(new ReportData(StandardData.STANDARD_MIN, "-"));
yearList.add(new ReportData(StandardData.STANDARD_MIN_DATE, "-"));
}
yearReport.setYearList(yearList);
}
//获取测站过程线
@Override
public Report getReportData(List<String> deviceCodes, Date begin, Date end, String type,String sttp,String col) {
//检查数据是否正常并转化
final QueryDateTypeEnum dtEnum = CommonUtil.checkType(type);
if(deviceCodes==null || deviceCodes.size()<=0){
return null;
}
if(dtEnum ==null){
return null;
}
//初始化报表
Report report = new Report();
report.initBaseReport(deviceCodes.size(), begin, end, dtEnum);
//设置基础数据
for (int i = 0; i < deviceCodes.size(); i++) {
String deviceCode = deviceCodes.get(i);
//获取数据库某个站点不同时间要求的数据
List<ReportData> timeDataList = listDataReport(begin, end,dtEnum,deviceCode,sttp,col);
for (ReportData reportData : timeDataList) {
String value=reportData.getVal();
// if(value!=null && !"-".equals(value) && !"".equals(value.trim())){
// value = new BigDecimal(value).setScale(3,BigDecimal.ROUND_DOWN).toString();
// }
report.setBaseCell(reportData.getKeyStr(), i, value);
}
}
return report;
}
private List<ReportData> listDataReport(Date begin,Date endSt,QueryDateTypeEnum dtEnum,String deviceCode,String sttp,String col) {
List<ReportData> list=new ArrayList<>();
//周期类型: 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年)
Integer saveTimeType=2;
if(QueryDateTypeEnum.DAY.equals(dtEnum)){
saveTimeType = 3;
}
if(QueryDateTypeEnum.MONTH.equals(dtEnum)){
saveTimeType = 5;
}
if(QueryDateTypeEnum.YEAR.equals(dtEnum)){
saveTimeType = 6;
}
LocalDateTime start = LocalDateTime.ofInstant(begin.toInstant(), ZoneId.systemDefault());
LocalDateTime end = LocalDateTime.ofInstant(endSt.toInstant(), ZoneId.systemDefault());
if(sttp.contains("RR") || sttp.contains("ZZ") || sttp.contains("ZQ")){
return getDataByDeviceCode(deviceCode, 3, saveTimeType, start, end, col);
}
if("PP".equals(sttp)){
return getDataByDeviceCode(deviceCode, 4, saveTimeType, start, end, col);
}
return list;
}
List<ReportData> getDataByDeviceCode(String deviceCode,Integer accessRules,Integer saveTimeType,
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(1);
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;
}
//获取测站最新值
@Override
public List<Map<String,Object>> getLastValues(List<String> stcds,String sttp) {
List<Map<String,Object>> result=new ArrayList<>();
List<DeviceSinglePropsValueVO> oldRzList=null;
List<DeviceSinglePropsValueVO> oldInqList=null;
List<DeviceSinglePropsValueVO> oldDrpList=null;
List<DeviceSinglePropsValueVO> rzList=null;
List<DeviceSinglePropsValueVO> inqList=null;
List<DeviceSinglePropsValueVO> drpList=null;
Date endTime =new Date();
Date beginTime= DateUtils.addMinutes(endTime,-60);
Date beginTime1= DateUtils.addMinutes(beginTime,-60);
//获取一个最新值
if("RR".equals(sttp) || "ZQ".equals(sttp)){
rzList = getNewValue(stcds, "water_level", beginTime, endTime);
inqList = getNewValue(stcds, "flow", beginTime, endTime);
oldRzList = getNewValue(stcds, "water_level", beginTime1, beginTime);
oldInqList = getNewValue(stcds, "flow", beginTime1, beginTime);
}
if("PP".equals(sttp)) {
drpList = getNewValue(stcds, "rain", beginTime, endTime);
oldDrpList = getNewValue(stcds, "rain", beginTime1, beginTime);
}
if("ZZ".equals(sttp)){
rzList = getNewValue(stcds, "water_level", beginTime, endTime);
// inqList = getNewValue(stcds, "inq", beginTime, endTime);
oldRzList = getNewValue(stcds, "water_level", beginTime1, beginTime);
// oldInqList = getNewValue(stcds, "inq", beginTime1, beginTime);
}
for(String stcd:stcds) {
Map<String,Object> map=new HashMap<>();
map.put("stcd",stcd);
if("RR".equals(sttp) || "ZQ".equals(sttp)){
boolean inqFlag = true;
boolean rzFlag = true;
BigDecimal rz=getDataByStcd(stcd,rzList);
map.put("rz",rz);
BigDecimal inq=getDataByStcd(stcd,inqList);
map.put("inq",inq);
BigDecimal oldRz=getDataByStcd(stcd,oldRzList);
if (oldRz.compareTo(rz) > 0) {
rzFlag = false;
}
map.put("isRiseRz",rzFlag);
BigDecimal oldInq=getDataByStcd(stcd,oldInqList);
if (oldInq.compareTo(inq) > 0) {
inqFlag = false;
}
map.put("isRiseInq",inqFlag);
}
if("PP".equals(sttp)){
boolean inqDrp = true;
BigDecimal drp=getDataByStcd(stcd,drpList);
map.put("drp",drp);
BigDecimal oldDrp=getDataByStcd(stcd,oldDrpList);
if (oldDrp.compareTo(drp) > 0) {
inqDrp = false;
}
map.put("isRiseDrp",inqDrp);
}
if("ZZ".equals(sttp)){
boolean rzFlag = true;
BigDecimal rz=getDataByStcd(stcd,rzList);
map.put("rz",rz);
BigDecimal oldRz=getDataByStcd(stcd,oldRzList);
if (oldRz.compareTo(rz) > 0) {
rzFlag = false;
}
map.put("isRiseRz",rzFlag);
}
result.add(map);
}
return result;
}
private BigDecimal getDataByStcd(String stcd,List<DeviceSinglePropsValueVO> data){
if(data==null || data.isEmpty()){
return BigDecimal.ZERO;
}
for(DeviceSinglePropsValueVO vo:data){
if(stcd.equals(vo.getDeviceCode())){
String value=String.valueOf(vo.getValue());
if(vo.getValue()!=null && !"".equals(value)) {
return new BigDecimal(value);
}else{
return BigDecimal.ZERO;
}
}
}
return BigDecimal.ZERO;
}
List<DeviceSinglePropsValueVO> getNewValue(List<String> stcds,String col,Date beginTime,Date endTime){
//获取一个最新值
DeviceSinglePropsValueQuery query = new DeviceSinglePropsValueQuery();
query.setAccessRule("6");
query.setDeviceCodes(stcds);
query.setSignage(col);
query.setBeginTime(beginTime);
query.setEndTime(endTime);
Result<List<DeviceSinglePropsValueVO>> res=analyseDataSearchClient.getValueOfBacthDeviceCode(query);
if(res==null || !res.isSuccess()){
return null;
}
List<DeviceSinglePropsValueVO> list=res.getData();
return list;
}
/**
* 获取 对应(计算)值的遥测值
* @param deviceCode 设备编码
* @param startTime 开始时间
* @param endTime 结束时间
* @param calcType 0=最早值1=最大值2=最小值3=平均值4=累计值/和值)5=变化值/差值 6=最新值
// * @param saveTimeType 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年)
* @param col 对应的物理值 英文
* @return
*/
@Override
public Map<String,String> queryMaxOrMin(String deviceCode, Date startTime, Date endTime,
Integer calcType, String col) {
Map<String,String> res=new HashMap<>();
List<String> signages=new ArrayList<>();
signages.add(col);
ComputeBaseStrategyPO po=new ComputeBaseStrategyPO();
LocalDateTime start = LocalDateTime.ofInstant(startTime.toInstant(), ZoneId.systemDefault());
po.setBeginTime(start);
LocalDateTime end = LocalDateTime.ofInstant(endTime.toInstant(), ZoneId.systemDefault());
po.setEndTime(end);
po.setAccessRules(calcType);
po.setDeviceCode(deviceCode);
po.setSignages(signages);
Result<List<AnalyseDataTaosVO>> result=analyseDataSearchClient.getComputeBaseStrategy(po);
if(result==null || !result.isSuccess()){
return res;
}
List<AnalyseDataTaosVO> datas=result.getData();
if(datas!=null && !datas.isEmpty()){
for(AnalyseDataTaosVO vo:datas) {
// if(col.equals(vo.getSignage())) {
String value=vo.getVal();
String tm=vo.getTs();
res.put(deviceCode, value);
res.put("tm", tm);
// }
}
}
return res;
}
private AnalyseCodeByAnalyseDataPO getAnalyseCodeByAnalyseDataPO(String deviceCode,Date startTime,Date endTime,Integer calcType,
Integer saveTimeType,Integer timeInterval,String col){
AnalyseCodeByAnalyseDataPO analyzeDataCondition=new AnalyseCodeByAnalyseDataPO();
analyzeDataCondition.setDeviceCode(deviceCode);
List<AnalyzeDataConditionPO> signboardConditions=new ArrayList<>();
AnalyzeDataConditionPO conditionPO=new AnalyzeDataConditionPO();
LocalDateTime start = LocalDateTime.ofInstant(startTime.toInstant(), ZoneId.systemDefault());
conditionPO.setBeginTime(start);
LocalDateTime end = LocalDateTime.ofInstant(endTime.toInstant(), ZoneId.systemDefault());
conditionPO.setEndTime(end);
conditionPO.setAccessRules(calcType);
if(timeInterval == null) {
timeInterval = calcTimeInterval(saveTimeType, start, end);
//加1的目的 就是对小数位进行统一处理
conditionPO.setTimeInterval(timeInterval + 1);
}else{
conditionPO.setTimeInterval(timeInterval);
}
conditionPO.setSaveTimeType(saveTimeType);
conditionPO.setFull(1);
conditionPO.setSignages(col);
// conditionPO.setKeepFigures(3);
signboardConditions.add(conditionPO);
analyzeDataCondition.setSignboardConditions(signboardConditions);
return analyzeDataCondition;
}
//计算时间间隔
private static Integer calcTimeInterval(Integer saveTimeType,LocalDateTime start,LocalDateTime end){
Duration duration = Duration.between(start,end);
switch (saveTimeType) {
case 1://分
return (int)duration.toMinutes();
case 2://时
return (int)duration.toHours();
case 3://天
return (int)duration.toDays();
case 4://周
return (int)duration.toDays()/7;
case 5://月
LocalDate startDate = start.toLocalDate();
LocalDate endDate = end.toLocalDate();
return Period.between(startDate, endDate).getMonths();
case 6://年
startDate = start.toLocalDate();
endDate = end.toLocalDate();
return Period.between(startDate, endDate).getYears();
default:
return (int)duration.getSeconds();
}
}
}

11
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/StStbprpBServiceImpl.java

@ -0,0 +1,11 @@
package com.hnac.hzims.waterrain.service.impl;
import org.springblade.core.mp.base.BaseServiceImpl;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import com.hnac.hzims.waterrain.mapper.StStbprpBMapper;
import com.hnac.hzims.waterrain.service.IStStbprpBService;
import org.springframework.stereotype.Service;
@Service
public class StStbprpBServiceImpl extends BaseServiceImpl<StStbprpBMapper, StStbprpB> implements IStStbprpBService {
}

235
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/WaterRainReorganizeServiceImpl.java

@ -0,0 +1,235 @@
package com.hnac.hzims.waterrain.service.impl;
import com.hnac.hzims.waterrain.entity.HzStPptnR;
import com.hnac.hzims.waterrain.entity.HzStRiverR;
import com.hnac.hzims.waterrain.entity.HzStRsvrR;
import com.hnac.hzims.waterrain.entity.ReorganizeData;
import com.hnac.hzims.waterrain.enums.WaterFlowRainEnum;
import com.hnac.hzims.waterrain.mapper.WaterRainReorganizeMapper;
import com.hnac.hzims.waterrain.service.IWaterRainReorganizeService;
import com.hnac.hzims.waterrain.util.DateUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class WaterRainReorganizeServiceImpl implements IWaterRainReorganizeService {
@Resource
WaterRainReorganizeMapper waterRainReorganizeMapper;
@Override
public boolean batchInsert(ReorganizeData data) {
String sttp=data.getSttp();
if(WaterFlowRainEnum.RR.getCode().equals(sttp)){
List<HzStRsvrR> list=dealHzStRsvrR(data);
if(list!=null && !list.isEmpty()) {
batchStRsvrR(list);
return true;
}
}
if(WaterFlowRainEnum.ZZ.getCode().equals(sttp) || WaterFlowRainEnum.ZQ.getCode().equals(sttp)){
List<HzStRiverR> list=dealHzStRiverR(data);
if(list!=null && !list.isEmpty()) {
batchStRiverR(list);
return true;
}
}
if(WaterFlowRainEnum.PP.getCode().equals(sttp)){
List<HzStPptnR> list=dealHzStPptnR(data);
if(list!=null && !list.isEmpty()) {
batchStPptnR(list);
return true;
}
}
return false;
}
private List<HzStRsvrR> dealHzStRsvrR(ReorganizeData data){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH");
List<HzStRsvrR> list=new ArrayList<>();
List<Map<String,Object>> mapList=data.getData();
if(mapList!=null && !mapList.isEmpty()){
for(Map<String,Object> param:mapList){
String tm=String.valueOf(param.get("tm"));
String rz=String.valueOf(param.get("water_level"));
String inq=String.valueOf(param.get("flow"));
HzStRsvrR stRsvrR=new HzStRsvrR();
stRsvrR.setStcd(data.getStcd());
stRsvrR.setInq(Double.valueOf(inq));
stRsvrR.setRz(Double.valueOf(rz));
try {
stRsvrR.setTm(sdf.parse(tm));
} catch (ParseException e) {
e.printStackTrace();
}
list.add(stRsvrR);
}
}
return list;
}
private List<HzStRiverR> dealHzStRiverR(ReorganizeData data){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH");
List<HzStRiverR> list=new ArrayList<>();
List<Map<String,Object>> mapList=data.getData();
if(mapList!=null && !mapList.isEmpty()){
for(Map<String,Object> param:mapList){
String tm=String.valueOf(param.get("tm"));
String z=String.valueOf(param.get("water_level"));
String q=String.valueOf(param.get("flow"));
HzStRiverR stRiverR=new HzStRiverR();
stRiverR.setStcd(data.getStcd());
stRiverR.setQ(Double.valueOf(q));
stRiverR.setZ(Double.valueOf(z));
try {
stRiverR.setTm(sdf.parse(tm));
} catch (ParseException e) {
e.printStackTrace();
}
list.add(stRiverR);
}
}
return list;
}
private List<HzStPptnR> dealHzStPptnR(ReorganizeData data){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH");
List<HzStPptnR> list=new ArrayList<>();
List<Map<String,Object>> mapList=data.getData();
if(mapList!=null && !mapList.isEmpty()){
for(Map<String,Object> param:mapList){
String tm=String.valueOf(param.get("tm"));
String drp=String.valueOf(param.get("rain"));
HzStPptnR stPptnR=new HzStPptnR();
stPptnR.setStcd(data.getStcd());
stPptnR.setDrp(Double.valueOf(drp));
try {
stPptnR.setTm(sdf.parse(tm));
} catch (ParseException e) {
e.printStackTrace();
}
list.add(stPptnR);
}
}
return list;
}
@Override
public void batchStPptnR(List<HzStPptnR> list) {
waterRainReorganizeMapper.batchStPptnR(list);
}
@Override
public void batchStRiverR(List<HzStRiverR> list) {
waterRainReorganizeMapper.batchStRiverR(list);
}
@Override
public void batchStRsvrR(List<HzStRsvrR> list) {
waterRainReorganizeMapper.batchStRsvrR(list);
}
@Override
public int insertHzStPptnR(HzStPptnR hzStPptnR) {
return waterRainReorganizeMapper.insertHzStPptnR(hzStPptnR);
}
@Override
public int insertHzStRsvrR(HzStRsvrR hzStRsvrR) {
return waterRainReorganizeMapper.insertHzStRsvrR(hzStRsvrR);
}
@Override
public int insertHzStRiverR(HzStRiverR hzStRiverR) {
return waterRainReorganizeMapper.insertHzStRiverR(hzStRiverR);
}
@Override
public List<Map<String, Object>> queryStPptnR(String stcd, String yearMonth) {
Map<String,Date> dateMap=DateUtil.getStartEnd(yearMonth);
Date begin= dateMap.get("start");
Date endSt= dateMap.get("end");
return waterRainReorganizeMapper.queryStPptnR(stcd,begin,endSt);
}
@Override
public List<Map<String, Object>> queryStRsvrR(String stcd, String yearMonth) {
Map<String,Date> dateMap=DateUtil.getStartEnd(yearMonth);
Date begin= dateMap.get("start");
Date endSt= dateMap.get("end");
return waterRainReorganizeMapper.queryStRsvrR(stcd,begin,endSt);
}
@Override
public List<Map<String, Object>> queryStRiverR(String stcd, String yearMonth) {
Map<String,Date> dateMap= DateUtil.getStartEnd(yearMonth);
Date begin= dateMap.get("start");
Date endSt= dateMap.get("end");
return waterRainReorganizeMapper.queryStRiverR(stcd,begin,endSt);
}
@Override
public boolean delStPptnR(String stcd, String yearMonth) {
Map<String,Date> dateMap= DateUtil.getStartEnd(yearMonth);
Date begin= dateMap.get("start");
Date endSt= dateMap.get("end");
return waterRainReorganizeMapper.delStPptnR(stcd,begin,endSt)>0;
}
@Override
public boolean delStRsvrR(String stcd, String yearMonth) {
Map<String,Date> dateMap= DateUtil.getStartEnd(yearMonth);
Date begin= dateMap.get("start");
Date endSt= dateMap.get("end");
return waterRainReorganizeMapper.delStRsvrR(stcd,begin,endSt)>0;
}
@Override
public boolean delStRiverR(String stcd, String yearMonth) {
Map<String,Date> dateMap= DateUtil.getStartEnd(yearMonth);
Date begin= dateMap.get("start");
Date endSt= dateMap.get("end");
return waterRainReorganizeMapper.delStRiverR(stcd,begin,endSt)>0;
}
@Override
public List<Map<String, Object>> queryData(String stcd, String sttp, String yearMonth) {
if(WaterFlowRainEnum.RR.getCode().equals(sttp)){
return queryStRsvrR(stcd,yearMonth);
}
if(WaterFlowRainEnum.ZZ.getCode().equals(sttp) || WaterFlowRainEnum.ZQ.getCode().equals(sttp)){
return queryStRiverR(stcd,yearMonth);
}
if(WaterFlowRainEnum.PP.getCode().equals(sttp)){
return queryStPptnR(stcd,yearMonth);
}
return null;
}
@Override
public boolean delData(String stcd, String sttp, String yearMonth) {
if(WaterFlowRainEnum.RR.getCode().equals(sttp)){
return delStRsvrR(stcd,yearMonth);
}
if(WaterFlowRainEnum.ZZ.getCode().equals(sttp) || WaterFlowRainEnum.ZQ.getCode().equals(sttp)){
return delStRiverR(stcd,yearMonth);
}
if(WaterFlowRainEnum.PP.getCode().equals(sttp)){
return delStPptnR(stcd,yearMonth);
}
return false;
}
}

8
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/service/impl/WaterRainServiceImpl.java

@ -0,0 +1,8 @@
package com.hnac.hzims.waterrain.service.impl;
import com.hnac.hzims.waterrain.service.IWaterRainService;
import org.springframework.stereotype.Service;
@Service
public class WaterRainServiceImpl implements IWaterRainService {
}

31
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/util/DateUtil.java

@ -0,0 +1,31 @@
package com.hnac.hzims.waterrain.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
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);
}
}

64
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/util/GisUtil.java

@ -0,0 +1,64 @@
package com.hnac.hzims.waterrain.util;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import java.math.BigDecimal;
public class GisUtil {
public static void dealGisData(StStbprpB stStbprpB){
if(stStbprpB!=null) {
stStbprpB.setLgtd(dealData(stStbprpB.getNlgtd()));
stStbprpB.setLttd(dealData(stStbprpB.getNlttd()));
}
}
// public static void main(String[] args) {
// System.out.println(dealData(new BigDecimal("10.121806")));
// }
private static String dealData(Double data0){
if(data0!=null && new BigDecimal(data0).compareTo(BigDecimal.ZERO)!=0) {
BigDecimal data=new BigDecimal(data0);
//度
String str=intVal(data)+"°";
//分
String dataStr = String.valueOf(data);
if(dataStr.indexOf(".")>-1) {
String[] dataArr = dataStr.split("\\.");
data = mul("0." + dataArr[1]);
str += intVal(data) + "'";
}else{
str += "0'";
}
//秒
dataStr=String.valueOf(data);
if(dataStr.indexOf(".")>-1) {
String[] dataArr = dataStr.split("\\.");
data = mul("0." + dataArr[1]);
str+=data.setScale(5, BigDecimal.ROUND_DOWN).stripTrailingZeros()+"\"";
}else{
str += "0\"";
}
return str;
}
return "0°";
}
private static int intVal(BigDecimal data){
return data.setScale( 0, BigDecimal.ROUND_DOWN).intValue();
}
private static BigDecimal mul(String data){
return new BigDecimal(data).multiply(new BigDecimal("60"));
}
// public static void main(String[] args) {
// String str=dealData(new BigDecimal("0.0"));
// System.out.println(str);
// }
}

26
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/util/ParamUtil.java

@ -0,0 +1,26 @@
package com.hnac.hzims.waterrain.util;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import java.util.Map;
public class ParamUtil {
public static LambdaQueryWrapper<StStbprpB> conditionStStbprpB(Map<String, Object> param){
LambdaQueryWrapper<StStbprpB> wrapper=new LambdaQueryWrapper();
if(param.get("stcd")!=null) {
wrapper.like(StStbprpB::getStcd,param.get("stcd"));
}
if(param.get("stnm")!=null && !"".equals(param.get("stnm").toString())) {
wrapper.like(StStbprpB::getStnm,param.get("stnm"));
}
if(param.get("sttp")!=null) {
String sttp=param.get("sttp").toString();
wrapper.in(StStbprpB::getSttp,sttp.split(","));
}
if(param.get("rscd")!=null) {
wrapper.like(StStbprpB::getRscd,param.get("rscd"));
}
return wrapper;
}
}

27
hzims-service/water-rain/src/main/java/com/hnac/hzims/waterrain/wrapper/StStbprpBWrapper.java

@ -0,0 +1,27 @@
package com.hnac.hzims.waterrain.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictCache;
import com.hnac.hzims.waterrain.entity.StStbprpB;
import com.hnac.hzims.waterrain.vo.StStbprpBVo;
import java.util.Objects;
public class StStbprpBWrapper extends BaseEntityWrapper<StStbprpB, StStbprpBVo> {
public StStbprpBWrapper() {
}
public static StStbprpBWrapper build() {
return new StStbprpBWrapper();
}
@Override
public StStbprpBVo entityVO(StStbprpB stStbprpB) {
StStbprpBVo stbprpBVo = (StStbprpBVo) Objects.requireNonNull(BeanUtil.copy(stStbprpB, StStbprpBVo.class));
String sttpName = DictCache.getValue("st_station_type", Func.toStr(stbprpBVo.getSttp()));
stbprpBVo.setSttpName(sttpName);
return stbprpBVo;
}
}

30
hzims-service/water-rain/src/main/resources/application-dev.yml

@ -0,0 +1,30 @@
#服务器端口
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

28
hzims-service/water-rain/src/main/resources/application-prod.yml

@ -0,0 +1,28 @@
#服务器端口
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:
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}

28
hzims-service/water-rain/src/main/resources/application-test.yml

@ -0,0 +1,28 @@
#服务器端口
server:
port: 8200
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.test.url}
# username: ${blade.datasource.test.username}
# password: ${blade.datasource.test.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}

13
hzims-service/water-rain/src/main/resources/application.yml

@ -0,0 +1,13 @@
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.hnac.hzims.**.entity
#swagger扫描路径配置
swagger:
base-packages:
- org.springbalde
- com.hnac

7
hzims-service/water-rain/src/main/resources/banner.txt

@ -0,0 +1,7 @@
_ _ ____ ___ __ __ ___ _ _ ___ _ _ ___
| || | |_ / |_ _| | \/ | / __| o O O | | | | | _ \ o O O | | | | | _ \
| __ | / / | | | |\/| | \__ \ o | |_| | | _/ o | |_| | | _/
|_||_| /___| |___| |_|__|_| |___/ TS__[O] \___/ _|_|_ TS__[O] \___/ _|_|_
_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_| """ | {======|_|"""""|_| """ |
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'
Loading…
Cancel
Save