Browse Source

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

zhongwei
haungxing 4 months ago
parent
commit
724e1de145
  1. 31
      hzims-service-api/hzims-ecological-api/pom.xml
  2. 10
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/entity/Demo.java
  3. 29
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/feign/ISuichangClient.java
  4. 138
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/util/DateUtil.java
  5. 39
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/util/MemoryPagination.java
  6. 43
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorCountVo.java
  7. 29
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorReq.java
  8. 54
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/AvgMonitorVo.java
  9. 80
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/EcologicalFlowVo.java
  10. 37
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowDataReq.java
  11. 60
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportDayVo.java
  12. 33
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportDetailVo.java
  13. 49
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/ExamStationFlowReportVo.java
  14. 26
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/FlowWarnQueryDTO.java
  15. 45
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/FlowWarnVo.java
  16. 33
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/ImageReq.java
  17. 28
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/ImageVo.java
  18. 22
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/MissingImagesRes.java
  19. 46
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorExportDTO.java
  20. 27
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorRes.java
  21. 27
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorSingleInfoReq.java
  22. 25
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorSingleInfoVo.java
  23. 47
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/RealMonitorVo.java
  24. 21
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/StationQueryReq.java
  25. 25
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/StationTreeRes.java
  26. 70
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/StationTypeVo.java
  27. 45
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/StationVo.java
  28. 40
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataDetailVo.java
  29. 29
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataReq.java
  30. 37
      hzims-service-api/hzims-ecological-api/src/main/java/com/hnac/hzims/suichang/vo/StatisticsFlowDataVo.java
  31. 1
      hzims-service-api/pom.xml
  32. 20
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/InstitutionalEntity.java
  33. 56
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/RectificationEntity.java
  34. 20
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/TrainEntity.java
  35. 62
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/ViolationEntity.java
  36. 27
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/RectificationParamVo.java
  37. 23
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/RectificationSummaryVo.java
  38. 29
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/ViolationParamVo.java
  39. 20
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/ViolationSummaryVo.java
  40. 75
      hzims-service/hzims-ecological/pom.xml
  41. 21
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/SuiChangApplication.java
  42. 111
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/EcologicalFlowController.java
  43. 72
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/ExamController.java
  44. 41
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/FlowWarnController.java
  45. 69
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/ImageAndVideoController.java
  46. 56
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/StatisticsFlowDataController.java
  47. 43
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/feign/SuichangClient.java
  48. 33
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/EcologicalFlowMapper.java
  49. 104
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/EcologicalFlowMapper.xml
  50. 39
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/ImageAndVideoMapper.java
  51. 61
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/ImageAndVideoMapper.xml
  52. 36
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/EcologicalFlowService.java
  53. 37
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/ExamStationDataService.java
  54. 26
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/FlowWarnService.java
  55. 53
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/ImageAndVideoService.java
  56. 56
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/RealMonitorService.java
  57. 20
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/StatisticsDataService.java
  58. 491
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/EcologicalFlowServiceImpl.java
  59. 274
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/ExamStationDataServiceImpl.java
  60. 75
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/FlowWarnServiceImpl.java
  61. 198
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/ImageAndVideoServiceImpl.java
  62. 419
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/RealMonitorServiceImpl.java
  63. 172
      hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/StatisticsDataServiceImpl.java
  64. 16
      hzims-service/hzims-ecological/src/main/resources/application.yml
  65. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java
  66. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/wrapper/OperAccessLibraryWrapper.java
  67. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java
  68. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  69. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java
  70. 1
      hzims-service/pom.xml
  71. 24
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/InstitutionalController.java
  72. 72
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/RectificationController.java
  73. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/TrainController.java
  74. 70
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/ViolationController.java
  75. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/InstitutionalMapper.java
  76. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/InstitutionalMapper.xml
  77. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/RectificationMapper.java
  78. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/RectificationMapper.xml
  79. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.java
  80. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.xml
  81. 17
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/ViolationMapper.java
  82. 21
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/ViolationMapper.xml
  83. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IInstitutionalService.java
  84. 20
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IRectificlationService.java
  85. 19
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IViolationService.java
  86. 19
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/InstitutionalServiceImpl.java
  87. 60
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/RectificlationServiceImpl.java
  88. 61
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/ViolationServiceImpl.java

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

@ -1,31 +0,0 @@
<?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>hzims-ecological-api</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.5</version>
</dependency>
</dependencies>
</project>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1
hzims-service-api/pom.xml

@ -25,7 +25,6 @@
<module>middle-api</module>
<module>alarm-api</module>
<module>big-model-api</module>
<module>hzims-ecological-api</module>
</modules>
<dependencies>

20
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/InstitutionalEntity.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.train.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* @author xiashandong
* @created 2020/9/8 15:09
**/
@Data
@TableName("hzims_institutional_information")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "制度资料实体类")
public class InstitutionalEntity extends TenantEntity {
}

56
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/RectificationEntity.java

@ -0,0 +1,56 @@
package com.hnac.hzims.safeproduct.train.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.util.Date;
/**
* @author ysj
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_rectification_supervision")
@ApiModel(value = "整改督办")
public class RectificationEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "责任人ID")
private Long personLiable;
@ApiModelProperty(value = "责任人名称")
private String personLiableName;
@ApiModelProperty(value = "整改类型: 0-整改闭环 1-会议督办")
private Integer rectificationType;
@ApiModelProperty(value = "限时日期")
private Date limitTime;
@ApiModelProperty(value = "提醒日期")
private Date remindTime;
@ApiModelProperty(value = "完成日期")
private Date completeTime;
@ApiModelProperty(value = "问题事项")
private String problemMatters;
@ApiModelProperty(value = "措施")
private String measures;
@ApiModelProperty(value = "问题附件路径")
private String problemAttachmentPath;
@ApiModelProperty(value = "问题附件名称")
private String problemAttachmentName;
}

20
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/TrainEntity.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.train.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* @author xiashandong
* @created 2020/9/8 15:09
**/
@Data
@TableName("hzims_safety_training")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "安全培训实体类")
public class TrainEntity extends TenantEntity {
}

62
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/ViolationEntity.java

@ -0,0 +1,62 @@
package com.hnac.hzims.safeproduct.train.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author ysj
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_violation_assessment")
@ApiModel(value = "违章考核实体类")
public class ViolationEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "发现人ID")
private Long discoverer;
@ApiModelProperty(value = "发现人名称")
private String discovererName;
@ApiModelProperty(value = "被考核人ID")
private Long assessorCover;
@ApiModelProperty(value = "被考核人名称")
private String assessorName;
@ApiModelProperty(value = "发现时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private Date discoverTime;
@ApiModelProperty(value = "问题事项")
private String problemMatters;
@ApiModelProperty(value = "违规级别 : 0-严重 1-一般")
private Integer violationLevel;
@ApiModelProperty(value = "处理结果")
private String processingResults;
@ApiModelProperty(value = "通知单附件地址")
private String noticeAttachmentPath;
@ApiModelProperty(value = "通知单附件名称")
private String noticeAttachmentName;
}

27
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/RectificationParamVo.java

@ -0,0 +1,27 @@
package com.hnac.hzims.safeproduct.train.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class RectificationParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "月份")
private String month;
@ApiModelProperty(value = "整改类型: 0-整改闭环 1-会议督办")
private Integer rectificationType;
@ApiModelProperty(value = "整改状态: 0-未整改 1-已整改")
private Integer status;
@ApiModelProperty(value = "责任人")
private String personLiableName;
}

23
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/RectificationSummaryVo.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.train.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class RectificationSummaryVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "整改类型")
private Integer rectificationType;
@ApiModelProperty(value = "应完成数量")
private Integer completeSum;
@ApiModelProperty(value = "完成数量")
private Integer completeCount;
}

29
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/ViolationParamVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.safeproduct.train.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class ViolationParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "月份")
private String month;
@ApiModelProperty(value = "发现开始时间")
private String startTime;
@ApiModelProperty(value = "发现结束时间")
private String endTime;
@ApiModelProperty(value = "违章等级")
private Integer violationLevel;
@ApiModelProperty(value = "发现人")
private String discovererName;
}

20
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/ViolationSummaryVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.train.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class ViolationSummaryVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "违规次数")
private Integer count;
}

75
hzims-service/hzims-ecological/pom.xml

@ -1,75 +0,0 @@
<?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>hzims-ecological</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-ecological-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-operational-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>message-alarm-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.name}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<username>${docker.username}</username>
<password>${docker.password}</password>
<repository>${docker.registry.url}/${docker.namespace}/${project.artifactId}</repository>
<tag>${project.version}</tag>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--设置为true,以便把本地的system的jar也包括进来-->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
</project>

21
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/SuiChangApplication.java

@ -1,21 +0,0 @@
package com.hnac.hzims.suichang;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.ComponentScan;
@EnableBladeFeign(basePackages = {"org.springblade", "com.hnac"})
@SpringCloudApplication
@MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.hzims.*"})
public class SuiChangApplication extends SpringBootServletInitializer {
public final static String APP_NAME = "hzims-ecological";
public static void main(String[] args) {
BladeApplication.run(APP_NAME, SuiChangApplication.class, args);
}
}

111
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/EcologicalFlowController.java

@ -1,111 +0,0 @@
package com.hnac.hzims.suichang.controller;
import com.hnac.hzims.suichang.service.EcologicalFlowService;
import com.hnac.hzims.suichang.service.RealMonitorService;
import com.hnac.hzims.suichang.util.MemoryPagination;
import com.hnac.hzims.suichang.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
/**
* 遂昌生态流量
*
* @author liangfan
*/
@RestController
@RequestMapping("/ecologicalFlow")
@Api(value = "遂昌生态流量", tags = "遂昌生态流量接口")
public class EcologicalFlowController {
@Autowired
private EcologicalFlowService ecologicalFlowService;
@Autowired
private RealMonitorService realMonitorService;
@RequestMapping(value = "/getEcologicalFlowIndexInfo", method = {RequestMethod.POST})
@ApiOperation(notes = "遂昌生态流量", value = "遂昌生态流量")
public R getEcologicalFlowIndexInfo() {
EcologicalFlowVo vo = ecologicalFlowService.getEcologicalFlowIndexInfo();
return R.data(vo);
}
@RequestMapping(value = "/getAvgMonitorInfo", method = {RequestMethod.POST})
@ApiOperation(notes = "实时监测日均流量", value = "实时监测日均流量")
public R getAvgMonitorInfo() {
return R.data(realMonitorService.getAvgMonitorInfo());
}
@RequestMapping(value = "/getAvgMonitorCountInfo", method = {RequestMethod.POST})
@ApiOperation(notes = "生态流量监管-日均流量", value = "生态流量监管-日均流量")
public R getAvgMonitorCountInfo(@RequestBody AvgMonitorReq req) {
List<AvgMonitorCountVo> resultList = realMonitorService.getAvgMonitorCountInfo(req);
// 内存分页
HashMap<String, Object> map = new HashMap<>();
resultList = MemoryPagination.pagination(resultList, req.getCurrent(), req.getSize());
map.put("records", resultList);
map.put("total", resultList.size());
return R.data(map);
}
@RequestMapping(value = "/getRealMonitorInfo", method = {RequestMethod.GET})
@ApiOperation(notes = "实时流量页面", value = "实时流量页面")
public R getRealMonitorInfo(String name, Query query) {
RealMonitorRes res = realMonitorService.getRealMonitorInfo(name);
List<RealMonitorVo> resultList = res.getRealMonitorVos();
HashMap<String, Object> map = new HashMap<>();
resultList = MemoryPagination.pagination(resultList, query.getCurrent(), query.getSize());
map.put("records", resultList);
map.put("total", resultList.size());
map.put("reportCount", res.getReportCount());
return R.data(map);
}
@RequestMapping(value = "/getRealMonitorSingleInfo", method = {RequestMethod.POST})
@ApiOperation(notes = "单个电站实时流量明细", value = "单个电站实时流量明细")
public R getRealMonitorSingleInfo(@RequestBody RealMonitorSingleInfoReq req) {
List<RealMonitorSingleInfoVo> resultList = realMonitorService.getRealMonitorSingleInfo(req);
HashMap<String, Object> map = new HashMap<>();
resultList = MemoryPagination.pagination(resultList, req.getCurrent(), req.getSize());
map.put("records", resultList);
map.put("total", resultList.size());
return R.data(map);
}
@RequestMapping(value = "/exportRealMonitorInfo", method = {RequestMethod.GET})
@ApiOperation(notes = "导出实时流量页面数据", value = "导出实时流量页面数据")
public void exportRealMonitorInfo(HttpServletResponse response, String name) {
realMonitorService.exportRealMonitorInfo(response, name);
}
@RequestMapping(value = "/exportRealMonitorSingleInfo", method = {RequestMethod.GET})
@ApiOperation(notes = "导出单个电站实时流量明细", value = "导出单个电站实时流量明细")
public void exportRealMonitorSingleInfo(HttpServletResponse response, RealMonitorSingleInfoReq req) {
realMonitorService.exportRealMonitorSingleInfo(response, req);
}
@RequestMapping(value = "/exportAvgMonitorCountInfo", method = {RequestMethod.GET})
@ApiOperation(notes = "导出生态流量监管-日均流量", value = "导出生态流量监管-日均流量")
public void exportAvgMonitorCountInfo(HttpServletResponse response, AvgMonitorReq req) {
realMonitorService.exportAvgMonitorCountInfo(response, req);
}
@RequestMapping(value = "/getRealData", method = {RequestMethod.GET})
public R test(String deviceCode) {
return R.data(realMonitorService.getRealData(deviceCode));
}
}

72
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/ExamController.java

@ -1,72 +0,0 @@
package com.hnac.hzims.suichang.controller;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.suichang.service.ExamStationDataService;
import com.hnac.hzims.suichang.util.MemoryPagination;
import com.hnac.hzims.suichang.vo.ExamStationFlowDataReq;
import com.hnac.hzims.suichang.vo.ExamStationFlowReportDayVo;
import com.hnac.hzims.suichang.vo.ExamStationFlowReportVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author: liangfan
* @Date: 2024-03-15 15:08
* @Description:
*/
@RestController
@RequestMapping("/exam")
@Api(value = "遂昌生态流量-考核管理", tags = "遂昌生态流量-考核管理")
public class ExamController {
@Autowired
private ExamStationDataService examStationDataService;
@RequestMapping(value = "/examStationFlowReportByTime", method = {RequestMethod.GET})
@ApiOperation(notes = "电站月考核", value = "电站月考核")
public R examStatisticsFlowReportByTime(ExamStationFlowDataReq req) {
List<ExamStationFlowReportVo> resultList =
examStationDataService.examStationFlowReportByTime(req);
HashMap<String, Object> map = new HashMap<>();
resultList = MemoryPagination.pagination(resultList, req.getCurrent(), req.getSize());
map.put("records", resultList);
map.put("total", resultList.size());
return R.data(map);
}
@RequestMapping(value = "/exportExamStationFlowReportByTime", method = {RequestMethod.GET})
@ApiOperation(notes = "电站月考核", value = "电站月考核")
public void exportExamStationFlowReportByTime(HttpServletResponse response, ExamStationFlowDataReq req) {
examStationDataService.exportExamStationFlowReportByTime(response, req);
}
@RequestMapping(value = "/examStationFlowReportOfDay", method = {RequestMethod.GET})
@ApiOperation(notes = "电站日考核", value = "电站日考核")
public R examStationFlowReportOfDay(ExamStationFlowDataReq req) {
List<ExamStationFlowReportDayVo> resultList = examStationDataService.examStationFlowReportOfDay(req);
String isPass = req.getIsPass();
// 条件过滤
if (StringUtils.isNotBlank(req.getIsPass())) {
resultList =
resultList.stream().filter(o -> o.getStatus().equals(isPass)).collect(Collectors.toList());
}
HashMap<String, Object> map = new HashMap<>();
resultList = MemoryPagination.pagination(resultList, req.getCurrent(), req.getSize());
map.put("records", resultList);
map.put("total", resultList.size());
return R.data(map);
}
}

41
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/FlowWarnController.java

@ -1,41 +0,0 @@
package com.hnac.hzims.suichang.controller;
import com.hnac.hzims.suichang.service.FlowWarnService;
import com.hnac.hzims.suichang.vo.FlowWarnQueryDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 遂昌生态流量
*
* @author liangfan
*/
@RestController
@RequestMapping("/flowWarn")
@Api(value = "遂昌生态流量预警信息", tags = "遂昌生态流量预警信息")
public class FlowWarnController {
@Autowired
private FlowWarnService flowWarnService;
@RequestMapping(value = "/getFlowWarnList", method = {RequestMethod.GET})
@ApiOperation(notes = "大屏遂昌生态流量预警信息", value = "大屏遂昌生态流量预警信息")
public R getFlowWarnList(FlowWarnQueryDTO dto, Query query) {
return R.data(flowWarnService.getFlowWarnList(dto, query));
}
@RequestMapping(value = "/warningPush", method = {RequestMethod.GET})
@ApiOperation(notes = "大屏遂昌生态流量预警信息", value = "大屏遂昌生态流量预警信息")
public R warningPush(FlowWarnQueryDTO dto) {
return R.data(flowWarnService.warningPush(dto));
}
}

69
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/ImageAndVideoController.java

@ -1,69 +0,0 @@
package com.hnac.hzims.suichang.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.suichang.service.ImageAndVideoService;
import com.hnac.hzims.suichang.vo.ImageReq;
import com.hnac.hzims.suichang.vo.MissingImagesRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: liangfan
* @Date: 2024-03-15 15:08
* @Description:
*/
@RestController
@RequestMapping("/imageAndVideo")
@Api(value = "图片和视频", tags = "图片和视频")
public class ImageAndVideoController {
@Autowired
private ImageAndVideoService imageAndVideoService;
@RequestMapping(value = "/getMissingImagesInfo", method = {RequestMethod.GET})
@ApiOperation(notes = "照片缺失率", value = "照片缺失率")
public R<IPage<MissingImagesRes>> getMissingImagesInfo(ImageReq req, Query query) {
return R.data(imageAndVideoService.getMissingImagesInfo(req, query));
}
@RequestMapping(value = "/missingPush", method = {RequestMethod.GET})
@ApiOperation(notes = "照片缺失日期及数据", value = "照片缺失日期及数据")
public R missingPush(ImageReq req) {
return R.data(imageAndVideoService.missingPush(req));
}
@RequestMapping(value = "/getImageInfoStatus", method = {RequestMethod.POST})
@ApiOperation(notes = "照片缺失率详情", value = "照片缺失率详情")
public R getImageInfoStatus(@RequestBody ImageReq req) {
return R.data(imageAndVideoService.getImageInfoStatus(req));
}
@RequestMapping(value = "/getImageInfoByDeviceCode", method = {RequestMethod.GET})
@ApiOperation(notes = "根据DeviceCode及时间查询照片", value = "根据DeviceCode及时间查询照片")
public R getImageInfoByDeviceCode(ImageReq req, Query query) {
return R.data(imageAndVideoService.getImageInfoByDeviceCode(req, query));
}
@RequestMapping(value = "/selectNewestImage", method = {RequestMethod.GET})
@ApiOperation(notes = "泄放照片", value = "泄放照片")
public R selectNewestImage(ImageReq req, Query query) {
return R.data(imageAndVideoService.selectNewestImage(req, query));
}
@RequestMapping(value = "/getStationVideoType", method = {RequestMethod.GET, RequestMethod.POST})
@ApiOperation(value = "获取视频byType", notes = "获取视频byType")
public R getStationTree(String videoType) {
return R.data(imageAndVideoService.getStationVideoType(videoType));
}
}

56
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/controller/StatisticsFlowDataController.java

@ -1,56 +0,0 @@
package com.hnac.hzims.suichang.controller;
import com.hnac.hzims.suichang.service.StatisticsDataService;
import com.hnac.hzims.suichang.util.MemoryPagination;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataDetailVo;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataReq;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
/**
* @Author: liangfan
* @Date: 2024-03-14 16:18
* @Description:
*/
@RestController
@RequestMapping("/statisticsData")
@Api(value = "遂昌生态流量-统计报表", tags = "遂昌生态流量-统计报表")
public class StatisticsFlowDataController {
@Autowired
private StatisticsDataService statisticsDataService;
@RequestMapping(value = "/statisticsFlowReportByTime", method = {RequestMethod.GET})
@ApiOperation(notes = "", value = "")
public R statisticsFlowReportByTime(StatisticsFlowDataReq req) {
StatisticsFlowDataVo res = statisticsDataService.statisticsFlowReportByTime(req);
List<StatisticsFlowDataDetailVo> resultList = res.getDetail();
HashMap<String, Object> map = new HashMap<>();
// 内存分页
resultList = MemoryPagination.pagination(resultList, req.getCurrent(), req.getSize());
map.put("areaName", res.getAreaName());
map.put("examCount", res.getExamCount());
map.put("passCount", res.getPassCount());
map.put("passPre", res.getPassPre());
map.put("records", resultList);
map.put("total", resultList.size());
return R.data(map);
}
@RequestMapping(value = "/exportStatisticsFlowReportByTime", method = {RequestMethod.GET})
@ApiOperation(notes = "", value = "")
public void exportStatisticsFlowReportByTime(HttpServletResponse response, StatisticsFlowDataReq req) {
statisticsDataService.exportStatisticsFlowReportByTime(response, req);
}
}

43
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/feign/SuichangClient.java

@ -1,43 +0,0 @@
package com.hnac.hzims.suichang.feign;
import com.hnac.hzims.suichang.mapper.EcologicalFlowMapper;
import com.hnac.hzims.suichang.service.EcologicalFlowService;
import com.hnac.hzims.suichang.vo.StationQueryReq;
import com.hnac.hzims.suichang.vo.StationVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/suichangClient")
@Slf4j
@RequiredArgsConstructor
public class SuichangClient implements ISuichangClient {
@Autowired
private EcologicalFlowMapper ecologicalFlowMapper;
@Autowired
private EcologicalFlowService ecologicalFlowService;
@Override
@PostMapping(GET_STATION_BY_REQ)
public List<StationVo> getStationListByReq(StationQueryReq req) {
return ecologicalFlowMapper.getStationListByReq(req);
}
@Override
@PostMapping(GET_DATA)
public List<Map<String, Object>> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime startTime, LocalDateTime endTime) {
return ecologicalFlowService.getData(stcd, accessRules, saveTimeType, timeInterval,
startTime, endTime);
}
}

33
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/EcologicalFlowMapper.java

@ -1,33 +0,0 @@
package com.hnac.hzims.suichang.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.message_alarm.entity.MessageAlarmInfo;
import com.hnac.hzims.message_alarm.entity.MessageReceiveInfo;
import com.hnac.hzims.suichang.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springblade.system.user.entity.User;
import java.util.List;
/**
* 遂昌生态流量
*
* @author liangfan
*/
@Mapper
public interface EcologicalFlowMapper {
List<StationVo> getStationListByName(String name);
IPage<StationVo> getStationListByNamePage(StationQueryReq req, IPage page);
List<StationVo> getStationListByReq(@Param("req") StationQueryReq req);
IPage<FlowWarnVo> getFlowWarnList(FlowWarnQueryDTO dto, IPage page);
List<FlowWarnVo> getFlowWarnCount(FlowWarnQueryDTO dto);
}

104
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/EcologicalFlowMapper.xml

@ -1,104 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.suichang.mapper.EcologicalFlowMapper">
<sql id="Base_Station_Select" >
SELECT
a.name as name,
a.code as deviceCode,
a.discharge as flowValue,
a.type as stationType,
a.LGTD as lgtd,
a.LTTD as lttd
FROM
hzims_station a
WHERE
a.IS_DELETED = '0'
</sql>
<select id="getStationListByName" resultType="com.hnac.hzims.suichang.vo.StationVo">
<include refid="Base_Station_Select"/>
<if test="name != null and name != ''">
AND a.name like concat('%',#{name},'%')
</if>
</select>
<select id="getStationListByNamePage" resultType="com.hnac.hzims.suichang.vo.StationVo">
<include refid="Base_Station_Select"/>
<if test="req.name != null and req.name != ''">
AND a.name like concat('%',#{req.name},'%')
</if>
</select>
<select id="getStationListByReq" resultType="com.hnac.hzims.suichang.vo.StationVo">
<include refid="Base_Station_Select"/>
<if test="req.name != null and req.name != ''">
AND a.name like concat('%',#{req.name},'%')
</if>
<if test="req.stationType != null and req.stationType != ''">
AND a.type = #{req.stationType}
</if>
</select>
<select id="getFlowWarnList" resultType="com.hnac.hzims.suichang.vo.FlowWarnVo">
SELECT
c.`NAME`,
a.content,
a.send_time as sendTime,
b.receive_user_id as receiveUserId,
b.receive_user_name as receiveUserName,
a.object_source as objectSource,
a.object_code as objectCode,
a.alarm_level as alarmLevel
FROM
message_alarm.`message_alarm_info` a
JOIN message_alarm.`message_receive_info` b ON a.id = b.message_id
LEFT JOIN hzims_operation.hzims_station c ON c.`CODE` = a.object_code
WHERE
b.message_type = 'flowWarn'
<if test="dto.startTime != null and dto.startTime != ''">
AND a.send_time &gt;= #{dto.startTime}
</if>
<if test="dto.endTime != null and dto.endTime != ''">
AND a.send_time &lt;= #{dto.endTime}
</if>
<if test="dto.objectCode != null and dto.objectCode != ''">
AND a.object_code = #{dto.objectCode}
</if>
</select>
<select id="getFlowWarnCount" resultType="com.hnac.hzims.suichang.vo.FlowWarnVo">
SELECT
c.`NAME`,
a.content,
a.send_time as sendTime,
b.receive_user_id as receiveUserId,
b.receive_user_name as receiveUserName,
a.object_source as objectSource,
a.object_code as objectCode,
a.alarm_level as alarmLevel
FROM
message_alarm.`message_alarm_info` a
JOIN message_alarm.`message_receive_info` b ON a.id = b.message_id
LEFT JOIN hzims_operation.hzims_station c ON c.`CODE` = a.object_code
WHERE
b.message_type = 'flowWarn'
<if test="startTime != null and startTime != ''">
AND a.send_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND a.send_time &lt;= #{endTime}
</if>
<if test="objectCode != null and objectCode != ''">
AND a.object_code = #{objectCode}
</if>
GROUP BY
a.id
</select>
</mapper>

39
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/ImageAndVideoMapper.java

@ -1,39 +0,0 @@
package com.hnac.hzims.suichang.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.suichang.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 遂昌生态流量
*
* @author liangfan
*/
@Mapper
public interface ImageAndVideoMapper {
IPage<ImageVo> getImageInfo(ImageReq req, IPage page);
/**
* 根据设备stcds查询各个设备最新图片信息
* @param req
* @param page
* @return
*/
IPage<ImageVo> selectNewestImage(ImageReq req, IPage page);
/**
* 查询视频点位
* @param videoType
* @return
*/
List<StationTypeVo> selectStationTypeByOwerType(String videoType);
}

61
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/mapper/ImageAndVideoMapper.xml

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.suichang.mapper.ImageAndVideoMapper">
<select id="getImageInfo" resultType="com.hnac.hzims.suichang.vo.ImageVo">
SELECT
b.`name`,
a.*
FROM
base_info.`image_info` a
LEFT JOIN hzinfo_data.hzinfo_data_device b ON a.STCD = b.CODE
WHERE
1 = 1
AND b.is_deleted = '0'
AND a.`DATA` IS NOT NULL
<if test="req.startTime != null and req.startTime != ''">
AND a.time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null and req.endTime != ''">
AND a.time &lt;= #{req.endTime}
</if>
<if test="req.deviceCode != null and req.deviceCode != ''">
AND a.stcd = #{req.deviceCode}
</if>
ORDER BY a.time asc
</select>
<select id="selectNewestImage" resultType="com.hnac.hzims.suichang.vo.ImageVo">
SELECT
c.`name`,
a.*
FROM
base_info.image_info AS a
JOIN hzinfo_data.hzinfo_data_device c ON a.STCD = c.`CODE`
JOIN ( SELECT stcd, max( b.time ) AS time FROM base_info.image_info AS b WHERE DATA IS NOT NULL GROUP BY b.stcd ) AS b ON a.stcd = b.stcd
WHERE
1 = 1
AND a.time = b.time
AND c.is_deleted = '0'
<if test="req.deviceCode != null and req.deviceCode != ''">
AND a.stcd = #{req.deviceCode}
</if>
</select>
<select id="selectStationTypeByOwerType" resultType="com.hnac.hzims.suichang.vo.StationTypeVo">
SELECT
*
FROM
hzims_operation.hzims_station_video_type
WHERE
is_deleted = 0
<if test="type != null and type != ''">
AND video_type = #{videoType}
</if>
ORDER BY
sort
</select>
</mapper>

36
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/EcologicalFlowService.java

@ -1,36 +0,0 @@
package com.hnac.hzims.suichang.service;
import com.hnac.hzims.suichang.vo.EcologicalFlowVo;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* @Author: liangfan
* @Date: 2024-03-08 15:06
* @Description:
*/
public interface EcologicalFlowService {
/**
* 首页生态流量
*
* @return
*/
EcologicalFlowVo getEcologicalFlowIndexInfo();
/**
* 查询历史数据
* @param stcd
* @param accessRules 取数规则0=最早值1=最大值2=最小值3=平均值4=(累计值/和值)5=(变化值/差值)6=最新值")
* @param saveTimeType 周期类型: 0-> s() 1->m()2->h(小时) 3->d() 4->w() 5->n(自然月)6->y(自然年)
* @param timeInterval
* @param startTime
* @param endTime
* @return
*/
List<Map<String, Object>> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime startTime, LocalDateTime endTime);
}

37
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/ExamStationDataService.java

@ -1,37 +0,0 @@
package com.hnac.hzims.suichang.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.suichang.vo.*;
import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @Author: liangfan
* @Date: 2024-03-08 15:06
* @Description:
*/
public interface ExamStationDataService {
/**
* 电站月考核
* @param req
* @return
*/
List<ExamStationFlowReportVo> examStationFlowReportByTime(ExamStationFlowDataReq req);
/**
* 电站月考核 导出
* @param req
* @return
*/
void exportExamStationFlowReportByTime(HttpServletResponse response, ExamStationFlowDataReq req);
/**
* 流量计电站日考核
* @param req
* @return
*/
List<ExamStationFlowReportDayVo> examStationFlowReportOfDay(ExamStationFlowDataReq req);
}

26
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/FlowWarnService.java

@ -1,26 +0,0 @@
package com.hnac.hzims.suichang.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.suichang.vo.FlowWarnQueryDTO;
import com.hnac.hzims.suichang.vo.FlowWarnVo;
import org.springblade.core.mp.support.Query;
import java.util.List;
import java.util.Map;
/**
* @author liangfan
*/
public interface FlowWarnService {
IPage<FlowWarnVo> getFlowWarnList(FlowWarnQueryDTO dto, Query query);
/**
* 分页查询预警信息及告警信息
* @param dto
* @return
*/
Map<String, Map<String, Integer>> warningPush(FlowWarnQueryDTO dto);
}

53
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/ImageAndVideoService.java

@ -1,53 +0,0 @@
package com.hnac.hzims.suichang.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.suichang.vo.*;
import org.springblade.core.mp.support.Query;
import java.util.List;
import java.util.Map;
/**
* @Author: liangfan
* @Date: 2024-03-08 15:06
* @Description:
*/
public interface ImageAndVideoService {
/**
* 照片缺失率信息
* @param req
* @param query
* @return
*/
IPage<MissingImagesRes> getMissingImagesInfo(ImageReq req, Query query);
/**
* 照片条数 日期
* @param req
* @return
*/
Map<String, Map<String, Integer>> missingPush(ImageReq req);
/**
* 泄放照片详情
* @param req
* @param query
* @return
*/
IPage<ImageVo> getImageInfoByDeviceCode(ImageReq req, Query query);
/**
* 照片缺失率详情
* @param req
* @return
*/
List<ImageVo> getImageInfoStatus(ImageReq req);
IPage<ImageVo> selectNewestImage(ImageReq req, Query query);
List<StationTreeRes> getStationVideoType(String videoType);
}

56
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/RealMonitorService.java

@ -1,56 +0,0 @@
package com.hnac.hzims.suichang.service;
import com.hnac.hzims.suichang.vo.*;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @Author: liangfan
* @Date: 2024-03-13 16:37
* @Description:
*/
public interface RealMonitorService {
/**
* 查询日均流量数据
*/
List<AvgMonitorVo> getAvgMonitorInfo();
/**
* 查询一段时间的日均流量数据
* @param req
* @return
*/
List<AvgMonitorCountVo> getAvgMonitorCountInfo(AvgMonitorReq req);
/**
* 实时流量列表页面
* @return
*/
RealMonitorRes getRealMonitorInfo(String name);
void exportRealMonitorInfo(HttpServletResponse response, String name);
void exportRealMonitorSingleInfo(HttpServletResponse response, RealMonitorSingleInfoReq req);
void exportAvgMonitorCountInfo(HttpServletResponse response, AvgMonitorReq req);
/**
* 实时流量列表页面单个电站
* @return
*/
List<RealMonitorSingleInfoVo> getRealMonitorSingleInfo(RealMonitorSingleInfoReq req);
/**
* 查询实时流量数据
* @param stcd
* @return
*/
String getRealData(String stcd, String signage);
String getRealData(String stcd);
}

20
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/StatisticsDataService.java

@ -1,20 +0,0 @@
package com.hnac.hzims.suichang.service;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataReq;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataVo;
import javax.servlet.http.HttpServletResponse;
/**
* @Author: liangfan
* @Date: 2024-03-08 15:06
* @Description:
*/
public interface StatisticsDataService {
StatisticsFlowDataVo statisticsFlowReportByTime(StatisticsFlowDataReq req);
void exportStatisticsFlowReportByTime(HttpServletResponse response, StatisticsFlowDataReq req);
}

491
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/EcologicalFlowServiceImpl.java

@ -1,491 +0,0 @@
package com.hnac.hzims.suichang.service.impl;
import com.hnac.hzims.entity.ReportData;
import com.hnac.hzims.suichang.mapper.EcologicalFlowMapper;
import com.hnac.hzims.suichang.service.EcologicalFlowService;
import com.hnac.hzims.suichang.util.DateUtil;
import com.hnac.hzims.suichang.vo.EcologicalFlowVo;
import com.hnac.hzims.suichang.vo.FlowWarnQueryDTO;
import com.hnac.hzims.suichang.vo.FlowWarnVo;
import com.hnac.hzims.suichang.vo.StationVo;
import com.hnac.hzims.util.CommonUtil;
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.sdk.analyse.AnalyseDataSearchClient;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
* @Author: liangfan
* @Date: 2024-03-08 15:06
* @Description:
*/
@Slf4j
@Service
public class EcologicalFlowServiceImpl implements EcologicalFlowService {
@Autowired
AnalyseDataSearchClient analyseDataSearchClient;
@Autowired
private EcologicalFlowMapper ecologicalFlowMapper;
@Value("${suichang.signage}")
String signage;
@Override
public EcologicalFlowVo getEcologicalFlowIndexInfo() {
LocalDateTime startTime = LocalDateTime.now();
EcologicalFlowVo ecologicalFlowVo = new EcologicalFlowVo();
// 监测电站数 无节制电站 流量计电站 1.无节制电站 2.流量计电站
List<StationVo> stationInfoList = ecologicalFlowMapper.getStationListByName(null);
List<StationVo> noLimitStationListSize = stationInfoList.stream().filter(o -> "1".equals(o.getStationType())).collect(Collectors.toList());
List<StationVo> flowStationListSize = stationInfoList.stream().filter(o -> "2".equals(o.getStationType())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(stationInfoList)) {
return ecologicalFlowVo;
}
ecologicalFlowVo.setAllStationListSize(stationInfoList.size());
ecologicalFlowVo.setNoLimitStationListSize(noLimitStationListSize.size());
ecologicalFlowVo.setFlowStationListSize(flowStationListSize.size());
int yesterdayFinishCount = 0, weekCount = 0, monthFinishCount = 0, quarterCount = 0, halfYearCount = 0, yearCount = 0,
reportTodayCount = 0, reportYesTerdayCount = 0, warnTodayCount = 0, warnYesTerdayCount = 0;
// 得到所有设备实例code及核定下限流量
log.info("站点信息list:{}", stationInfoList);
// 多线程优化
List<CompletableFuture<Integer>> yesterdayFinishCountList = new ArrayList<>();
List<CompletableFuture<Integer>> weekCountList = new ArrayList<>();
List<CompletableFuture<Integer>> monthFinishCountList = new ArrayList<>();
List<CompletableFuture<Integer>> quarterCountList = new ArrayList<>();
List<CompletableFuture<Integer>> halfYearCountList = new ArrayList<>();
List<CompletableFuture<Integer>> yearCountList = new ArrayList<>();
List<CompletableFuture<Map<String, Integer>>> reportAndWarnTodayMapList = new ArrayList<>();
List<CompletableFuture<Map<String, Integer>>> reportAndWarnYesTerdayMapList = new ArrayList<>();
// 多线程 调用平台方法
buildCompletableFutureList(stationInfoList, yesterdayFinishCountList, weekCountList, monthFinishCountList,
quarterCountList, halfYearCountList, yearCountList, reportAndWarnTodayMapList, reportAndWarnYesTerdayMapList);
try {
for (int i = 0; i < stationInfoList.size(); i++) {
// 1.昨日达标情况 达标率就是有没有达到核定下限流量
yesterdayFinishCount = yesterdayFinishCountList.get(i).get() + yesterdayFinishCount;
// 2.上月达标情况
weekCount = weekCountList.get(i).get() + weekCount;
// 3.上周达标情况
monthFinishCount = monthFinishCountList.get(i).get() + monthFinishCount;
// 4.季度达标情况
quarterCount = quarterCountList.get(i).get() + quarterCount;
// 5.半年达标情况
halfYearCount = halfYearCountList.get(i).get() + halfYearCount;
// 6.年达标情况
yearCount = yearCountList.get(i).get() + yearCount;
// 7.今日 预警数 上报率
Map<String, Integer> reportAndWarnTodayMap = reportAndWarnTodayMapList.get(i).get();
reportTodayCount = reportTodayCount + reportAndWarnTodayMap.get("count");
warnTodayCount = warnTodayCount + reportAndWarnTodayMap.get("warnCount");
// 8.昨日 预警数 上报率
Map<String, Integer> reportAndWarnYesTerdayMap = reportAndWarnYesTerdayMapList.get(i).get();
reportYesTerdayCount = reportYesTerdayCount + reportAndWarnYesTerdayMap.get("count");
warnYesTerdayCount = warnYesTerdayCount + reportAndWarnYesTerdayMap.get("warnCount");
}
} catch (Exception e) {
e.printStackTrace();
}
log.info("yesterdayFinishCount = {}, weekCount = {}, monthFinishCount = {}, quarterCount = {}, halfYearCount = {}, yearCount = {}",
yesterdayFinishCount, weekCount, monthFinishCount, quarterCount, halfYearCount, yearCount);
// build返回信息
buildRestultInfo(ecologicalFlowVo, stationInfoList.size(),
yesterdayFinishCount, monthFinishCount, weekCount, quarterCount, halfYearCount,
yearCount, reportTodayCount, warnTodayCount, reportYesTerdayCount, warnYesTerdayCount);
LocalDateTime endTime = LocalDateTime.now();
log.info("耗时:{}", ChronoUnit.SECONDS.between(startTime, endTime));
return ecologicalFlowVo;
}
@Override
public List<Map<String, Object>> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime startTime, LocalDateTime endTime) {
List<Map<String, Object>> list = new ArrayList<>();
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) {
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<ReportData> reportDataList =
getDataByDeviceCode(stcd, accessRules, saveTimeType, timeInterval, startTime, endTime, 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;
}
List<ReportData> getDataByDeviceCode(String deviceCode, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime start, LocalDateTime end, String col) {
List<ReportData> reportData = new ArrayList<>();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
po.setDeviceCode(deviceCode);
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO conditionPO = new AnalyzeDataConditionPO();
conditionPO.setBeginTime(start);
conditionPO.setEndTime(end);
conditionPO.setSignages(col);
// conditionPO.setKeepFigures(3);
conditionPO.setAccessRules(accessRules);
conditionPO.setSaveTimeType(saveTimeType);
conditionPO.setTimeInterval(timeInterval);
conditionPO.setFull(1);
signboardConditions.add(conditionPO);
po.setSignboardConditions(signboardConditions);
Result<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (result == null || !result.isSuccess()) {
return reportData;
}
List<AnalyzeDataConditionVO> datas = result.getData();
if (datas == null || datas.isEmpty()) {
return reportData;
}
for (AnalyzeDataConditionVO vo : datas) {
List<AnalyseDataTaosVO> dataTaosVOs = vo.getList();
for (AnalyseDataTaosVO vv : dataTaosVOs) {
if (vo.getSignage().equals(col)) {
ReportData data = new ReportData();
data.setKeyStr(CommonUtil.getKeyBySaveTimeType(vv.getTs(), saveTimeType));
String val = vv.getVal();
data.setStcd(deviceCode);
data.setVal(val);
if (val != null && !"".equals(val)) {
data.setValue(Double.valueOf(vv.getVal()));
} else {
data.setValue(0.0);
}
data.setName(vo.getName());
reportData.add(data);
}
}
}
return reportData;
}
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;
}
int getDayInfo(String stcd, BigDecimal discharge) {
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 获取昨天的日期
LocalDateTime last = now.minusDays(1);
// 昨天的开始时间(00:00) 昨天的结束时间(00:00)yesterday: 2024-03-10 00:00:00 yesterday: 2024-03-11 00:00:00
LocalDateTime startTime = last.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime = last.plusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
// 昨日达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 3, 1, startTime, endTime);
log.info("昨日达标情况data: {}, 设备编码为:{}", dataList, stcd);
return getCount(dataList, discharge);
}
int getWeekInfo(String stcd, BigDecimal discharge) {
LocalDate today = LocalDate.now();
// 获取上周的星期一(假设周一是周的开始)
LocalDate lastWeekMonday = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).minusWeeks(1);
// 上周的开始时间:上周星期一的00:00
LocalDateTime startTime = LocalDateTime.of(lastWeekMonday, LocalTime.MIN);
LocalDateTime endTime = startTime.plusDays(7).withHour(0).withMinute(0).withSecond(0).withNano(0);
// 周达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 4, 1, startTime, endTime);
log.info("周达标情况data: {}, 设备编码为:{}", dataList, stcd);
return getCount(dataList, discharge);
}
int getMouthInfo(String stcd, BigDecimal discharge) {
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 获取上个月的开始日期
LocalDateTime last = now.minusMonths(1);
// 上个月的开始时间(00:00) 上个月的结束时间(00:00)
LocalDateTime startTime = last.withHour(0).withDayOfMonth(1).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime = last.plusMonths(1).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
// 上月达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 5, 1, startTime, endTime);
log.info("月达标情况data: {}, 设备编码为:{}", dataList, stcd);
return getCount(dataList, discharge);
}
int getQuarterInfo(String stcd, BigDecimal discharge) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime startTime = DateUtil.getStartOfLastQuarter(now);
LocalDateTime endTime = DateUtil.getEndOfLastQuarter(now);
// 周达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 5, 3, startTime, endTime);
log.info("季度达标情况data: {}, 设备编码为:{}", dataList, stcd);
return getCount(dataList, discharge);
}
int getHaltYearInfo(String stcd, BigDecimal discharge) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime startTime = DateUtil.getStartOfHalfYear(now);
LocalDateTime endTime = DateUtil.getEndOfHalfYear(now);
// 上月达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 5, 6, startTime, endTime);
log.info("半年达标情况data: {}, 设备编码为:{}", dataList, stcd);
return getCount(dataList, discharge);
}
int getYearInfo(String stcd, BigDecimal discharge) {
LocalDateTime startTime = LocalDateTime.of(Year.now().getValue() - 1, Month.JANUARY, 1, 0, 0);
LocalDateTime endTime = LocalDateTime.of(Year.now().getValue(), Month.JANUARY, 1, 0, 0, 0);
// 上月达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 6, 1, startTime, endTime);
log.info("去年达标情况data: {}, 设备编码为:{}", dataList, stcd);
return getCount(dataList, discharge);
}
Map<String, Integer> reportAndWarnToday(String stcd) {
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
LocalDateTime startTime = now.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime = now;
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 2, 1, startTime, endTime);
log.info("今天上报data: {}, 设备编码为:{}", dataList, stcd);
int count = 0;
if (!CollectionUtils.isEmpty(dataList)) {
for (Map<String, Object> info : dataList) {
String ecologicalFlowValue = null == info.get(signage) ? null :
info.get(signage).toString();
log.info("ecologicalFlowValue的值: {}", ecologicalFlowValue);
if (StringUtils.isNotBlank(ecologicalFlowValue)) {
count++;
}
}
}
HashMap<String, Integer> map = new HashMap<>();
map.put("count", count);
FlowWarnQueryDTO dto = new FlowWarnQueryDTO();
dto.setStartTime(DateUtil.getStringTime(startTime));
dto.setEndTime(DateUtil.getStringTime(endTime));
dto.setObjectCode(stcd);
List<FlowWarnVo> flowWarnList = ecologicalFlowMapper.getFlowWarnCount(dto);
if (CollectionUtils.isEmpty(flowWarnList)) {
map.put("warnCount", 0);
} else {
map.put("warnCount", flowWarnList.size());
}
return map;
}
Map<String, Integer> reportAndWarnYesTerday(String stcd) {
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 获取昨天的日期
LocalDateTime last = now.minusDays(1);
// 昨天的开始时间(00:00) 昨天的结束时间(00:00)yesterday: 2024-03-10 00:00:00 yesterday: 2024-03-11 00:00:00
LocalDateTime startTime = last.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime = last.plusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = getData(stcd, 3, 2, 1, startTime, endTime);
log.info("昨天上报data: {}, 设备编码为:{}", dataList, stcd);
int count = 0;
if (!CollectionUtils.isEmpty(dataList)) {
for (Map<String, Object> info : dataList) {
String ecologicalFlowValue = null == info.get(signage) ? null :
info.get(signage).toString();
log.info("ecologicalFlowValue的值: {}", ecologicalFlowValue);
if (StringUtils.isNotBlank(ecologicalFlowValue)) {
count++;
}
}
}
HashMap<String, Integer> map = new HashMap<>();
map.put("count", count);
FlowWarnQueryDTO dto = new FlowWarnQueryDTO();
dto.setStartTime(DateUtil.getStringTime(startTime));
dto.setEndTime(DateUtil.getStringTime(endTime));
dto.setObjectCode(stcd);
Query query = new Query();
query.setCurrent(1);
query.setSize(10000);
List<FlowWarnVo> flowWarnList = ecologicalFlowMapper.getFlowWarnList(dto, Condition.getPage(query)).getRecords();
if (CollectionUtils.isEmpty(flowWarnList)) {
map.put("warnCount", 0);
} else {
map.put("warnCount", flowWarnList.size());
}
return map;
}
int getCount(List<Map<String, Object>> dataList, BigDecimal discharge) {
int count = 0;
if (!CollectionUtils.isEmpty(dataList)) {
Map<String, Object> info = dataList.get(dataList.size() - 1);
String ecologicalFlowValue = null == info.get(signage) ? "0" :
info.get(signage).toString();
log.info("ecologicalFlowValue的值: {}", ecologicalFlowValue);
if (new BigDecimal(ecologicalFlowValue).compareTo(discharge) >= 0) {
count++;
}
}
return count;
}
/**
* bulid info
* @param stationInfoList
* @param yesterdayFinishCountList
* @param weekCountList
* @param monthFinishCountList
* @param quarterCountList
* @param halfYearCountList
* @param yearCountList
* @param reportAndWarnTodayMapList
* @param reportAndWarnYesTerdayMapList
*/
void buildCompletableFutureList(List<StationVo> stationInfoList,
List<CompletableFuture<Integer>> yesterdayFinishCountList ,
List<CompletableFuture<Integer>> weekCountList ,
List<CompletableFuture<Integer>> monthFinishCountList ,
List<CompletableFuture<Integer>> quarterCountList ,
List<CompletableFuture<Integer>> halfYearCountList ,
List<CompletableFuture<Integer>> yearCountList ,
List<CompletableFuture<Map<String, Integer>>> reportAndWarnTodayMapList ,
List<CompletableFuture<Map<String, Integer>>> reportAndWarnYesTerdayMapList ){
for (int i = 0; i < stationInfoList.size(); i++) {
StationVo vo = stationInfoList.get(i);
// String stcd = "JSCZ001";
// 设备编号 核定流量
String stcd = vo.getDeviceCode();
BigDecimal discharge = vo.getFlowValue();
// 1.昨日达标情况 达标率就是有没有达到核定下限流量
yesterdayFinishCountList.add(CompletableFuture.supplyAsync(() -> getDayInfo(stcd, discharge)));
// 2.上周达标情况
weekCountList.add(CompletableFuture.supplyAsync(() -> getMouthInfo(stcd, discharge)));
// 3.上月达标情况
monthFinishCountList.add(CompletableFuture.supplyAsync(() -> getWeekInfo(stcd, discharge)));
// 4.季度达标情况
quarterCountList.add(CompletableFuture.supplyAsync(() -> getQuarterInfo(stcd, discharge)));
// 5.半年达标情况
halfYearCountList.add(CompletableFuture.supplyAsync(() -> getHaltYearInfo(stcd, discharge)));
// 6.年达标情况
yearCountList.add(CompletableFuture.supplyAsync(() -> getYearInfo(stcd, discharge)));
// 7.今日 预警数 上报率
reportAndWarnTodayMapList.add(CompletableFuture.supplyAsync(() -> reportAndWarnToday(stcd)));
// 8.昨日 预警数 上报率
reportAndWarnYesTerdayMapList.add(CompletableFuture.supplyAsync(() -> reportAndWarnYesTerday(stcd)));
}
}
void buildRestultInfo(EcologicalFlowVo ecologicalFlowVo, Integer size, Integer yesterdayFinishCount,
Integer monthFinishCount, Integer weekCount, Integer quarterCount, Integer halfYearCount,
Integer yearCount, Integer reportTodayCount, Integer warnTodayCount,
Integer reportYesTerdayCount, Integer warnYesTerdayCount) {
// 昨日
BigDecimal yesterdayFinishPer = BigDecimal.valueOf(yesterdayFinishCount).divide(BigDecimal.valueOf(size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setYesterdayFinishPer(yesterdayFinishPer.multiply(BigDecimal.valueOf(100)) + "%");
ecologicalFlowVo.setYesterdayFinishCount(yesterdayFinishCount);
// 上月
BigDecimal monthFinishPer = BigDecimal.valueOf(monthFinishCount).divide(BigDecimal.valueOf(size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setMonthFinishPer(monthFinishPer.multiply(BigDecimal.valueOf(100)) + "%");
ecologicalFlowVo.setMonthFinishCount(monthFinishCount);
// 上周
BigDecimal weekFinishPer = BigDecimal.valueOf(weekCount).divide(BigDecimal.valueOf(size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setWeekFinishPer(weekFinishPer.multiply(BigDecimal.valueOf(100)) + "%");
// 季度
BigDecimal quarterFinishPer = BigDecimal.valueOf(quarterCount).divide(BigDecimal.valueOf(size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setQuarterFinishPer(quarterFinishPer.multiply(BigDecimal.valueOf(100)) + "%");
// 半年
BigDecimal halfYearFinishPer = BigDecimal.valueOf(halfYearCount).divide(BigDecimal.valueOf(size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setHalfYearFinishPer(halfYearFinishPer.multiply(BigDecimal.valueOf(100)) + "%");
// 一年
BigDecimal yearFinishPer = BigDecimal.valueOf(yearCount).divide(BigDecimal.valueOf(size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setYearFinishPer(yearFinishPer.multiply(BigDecimal.valueOf(100)) + "%");
// 今天预警数 上报率
// 计算几天过了几个小时
long hoursPassedToday = DateUtil.getHoursPassedToday() + 1;
BigDecimal reportTodayPre;
reportTodayPre = BigDecimal.valueOf(reportTodayCount).divide(BigDecimal.valueOf(hoursPassedToday * size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setReportTodayPre(reportTodayPre.multiply(BigDecimal.valueOf(100)) + "%");
ecologicalFlowVo.setWarnTodayCount(warnTodayCount);
// 昨天预警数 上报率
BigDecimal reportYesTerdayPre = BigDecimal.valueOf(reportYesTerdayCount).divide(BigDecimal.valueOf(24L * size), 2, RoundingMode.HALF_UP);
ecologicalFlowVo.setReportYesTerdayPre(reportYesTerdayPre.multiply(BigDecimal.valueOf(100)) + "%");
ecologicalFlowVo.setWarnYesTerdayCount(warnYesTerdayCount);
}
}

274
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/ExamStationDataServiceImpl.java

@ -1,274 +0,0 @@
package com.hnac.hzims.suichang.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.hnac.hzims.suichang.mapper.EcologicalFlowMapper;
import com.hnac.hzims.suichang.service.EcologicalFlowService;
import com.hnac.hzims.suichang.service.ExamStationDataService;
import com.hnac.hzims.suichang.service.RealMonitorService;
import com.hnac.hzims.suichang.util.DateUtil;
import com.hnac.hzims.suichang.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
* @Author: liangfan
* @Date: 2024-03-14 16:19
* @Description:
*/
@Slf4j
@Service
public class ExamStationDataServiceImpl implements ExamStationDataService {
@Autowired
private EcologicalFlowMapper ecologicalFlowMapper;
@Autowired
private EcologicalFlowService ecologicalFlowService;
@Autowired
private RealMonitorService realMonitorService;
@Value("${suichang.signage}")
String signage;
@Value("${suichang.passPreValue}")
String passPreValue;
@Value("${suichang.timeSignage}")
String timeSignage;
@Override
public List<ExamStationFlowReportVo> examStationFlowReportByTime(ExamStationFlowDataReq req) {
StationQueryReq queryReq = new StationQueryReq();
queryReq.setStationType(req.getStationType());
queryReq.setName(req.getName());
// 查询电站
List<StationVo> list = ecologicalFlowMapper.getStationListByReq(queryReq);
List<ExamStationFlowReportVo> result = new ArrayList<>();
// 根据电站查询日均流量
for (StationVo stationRelationVo : list) {
// String stcd = "JSCZ001";
String stcd = stationRelationVo.getDeviceCode();
LocalDateTime startTime = DateUtil.getStartTime(req.getStartTime());
LocalDateTime endTime = DateUtil.getEndTimeByDay(req.getEndTime());
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = ecologicalFlowService.getData(stcd, 3, 3, 1, startTime, endTime);
long days = ChronoUnit.DAYS.between(startTime, endTime);
log.info("dataList: {}, 设备编码为:{}, 天数:{}", dataList, stcd, days);
// 合格情况
BigDecimal flowValue = stationRelationVo.getFlowValue();
List<ExamStationFlowReportDetailVo> infos = new ArrayList<>();
int passCount = 0;
if (!CollectionUtils.isEmpty(dataList)) {
// 为了处理特殊返回情况 多查出一条数据的问题
if (dataList.size() > days) {
dataList.remove(0);
}
for (Map<String, Object> info : dataList) {
ExamStationFlowReportDetailVo detailVo = new ExamStationFlowReportDetailVo();
detailVo.setIsPass("不合格");
String ecologicalFlowValue = null == info.get(signage) ? "0" :
info.get(signage).toString();
log.info("ecologicalFlowValue的值: {}", ecologicalFlowValue);
if (new BigDecimal(ecologicalFlowValue).compareTo(flowValue) >= 0) {
passCount++;
detailVo.setIsPass("合格");
}
detailVo.setFlowValue(flowValue);
detailVo.setEcologicalFlowValue(new BigDecimal(ecologicalFlowValue));
detailVo.setTm(info.get(timeSignage).toString());
infos.add(detailVo);
}
}
ExamStationFlowReportVo examStationFlowReportVo = new ExamStationFlowReportVo();
examStationFlowReportVo.setName(stationRelationVo.getName());
examStationFlowReportVo.setAreaName("遂昌县");
examStationFlowReportVo.setFlowValue(flowValue);
examStationFlowReportVo.setInfos(infos);
examStationFlowReportVo.setPassCount(passCount);
examStationFlowReportVo.setCount(days);
BigDecimal pre = BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(days), 2, RoundingMode.HALF_UP);
examStationFlowReportVo.setPassPre(pre.multiply(BigDecimal.valueOf(100)) + "%");
String isPass = pre.compareTo(new BigDecimal(passPreValue)) >= 0 ? "合格" : "不合格";
examStationFlowReportVo.setIsPass(isPass);
result.add(examStationFlowReportVo);
}
return result;
}
@Override
public void exportExamStationFlowReportByTime(HttpServletResponse response, ExamStationFlowDataReq req) {
List<ExamStationFlowReportVo> examStationFlowReportVos = this.examStationFlowReportByTime(req);
// 动态生成的表头
List<String> firstHead = new ArrayList<>(Arrays.asList("电站名称", "所属区域", "核定流量"));
List<String> endHead = new ArrayList<>(Arrays.asList("合格天数(天)", "考核天数(天)", "合格率", "是否合格"));
List<String> allList = new ArrayList<>();
allList.addAll(firstHead);
if (!CollectionUtils.isEmpty(examStationFlowReportVos)) {
ExamStationFlowReportVo examStationFlowReportVo = examStationFlowReportVos.get(0);
List<ExamStationFlowReportDetailVo> infos = examStationFlowReportVo.getInfos();
List<String> mindHead = infos.stream().map(ExamStationFlowReportDetailVo::getTm).collect(Collectors.toList());
allList.addAll(mindHead);
}
allList.addAll(endHead);
List<List<String>> head = allList.stream().map(v -> {
List<String> list = new ArrayList<>();
list.add(v);
return list;
}).collect(Collectors.toList());
// 组合数据
List<List<String>> contentLists = new ArrayList<>();
examStationFlowReportVos.forEach(o -> {
List<String> list = new ArrayList<>();
list.add(o.getName());
list.add(o.getAreaName());
list.add(o.getFlowValue().toString());
List<ExamStationFlowReportDetailVo> exVo = o.getInfos();
exVo.forEach(k -> {
list.add(k.getIsPass());
});
list.add(o.getPassCount().toString());
list.add(o.getCount().toString());
list.add(o.getPassPre());
list.add(o.getIsPass());
contentLists.add(list);
});
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("电站月考核" + ".xlsx", "UTF-8"));
EasyExcel.write(response.getOutputStream()).autoCloseStream(Boolean.TRUE).head(head).autoTrim(true)
.sheet(1, "电站月考核").registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.doWrite(contentLists);
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public List<ExamStationFlowReportDayVo> examStationFlowReportOfDay(ExamStationFlowDataReq req) {
LocalDateTime startYesTodayTime = DateUtil.getStartTime(req.getStartTime()).minusDays(1);
LocalDateTime endYesTodayTime = DateUtil.getEndTimeByDay(req.getStartTime()).minusDays(1);
LocalDateTime startTime = DateUtil.getStartTime(req.getStartTime());
LocalDateTime endTime = DateUtil.getEndTimeByDay(req.getStartTime());
StationQueryReq queryReq = new StationQueryReq();
queryReq.setStationType(req.getStationType());
queryReq.setName(req.getName());
// 查询电站
List<StationVo> list = ecologicalFlowMapper.getStationListByReq(queryReq);
List<ExamStationFlowReportDayVo> result = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
// 多线程优化
List<CompletableFuture<BigDecimal>> yesTerDayAvgFlowValueList = new ArrayList<>();
List<CompletableFuture<BigDecimal>> todayAvgFlowValueList = new ArrayList<>();
List<CompletableFuture<String>> realFlowValueList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
String stcd = list.get(i).getDeviceCode();
yesTerDayAvgFlowValueList.add(CompletableFuture.supplyAsync(() -> getAvgOneDayData(stcd, startYesTodayTime, endYesTodayTime)));
todayAvgFlowValueList.add(CompletableFuture.supplyAsync(() -> getAvgOneDayData(stcd, startTime, endTime)));
realFlowValueList.add(CompletableFuture.supplyAsync(() -> realMonitorService.getRealData(stcd, signage)));
}
for (int i = 0; i < list.size(); i++) {
BigDecimal yesTerDayAvgFlowValue = null;
BigDecimal todayAvgFlowValue = null;
String realFlowValue = null;
try {
// 前日日均流量
yesTerDayAvgFlowValue = yesTerDayAvgFlowValueList.get(i).get();
// 当日日均流量
todayAvgFlowValue = todayAvgFlowValueList.get(i).get();
// 实时流量
realFlowValue = realFlowValueList.get(i).get();
} catch (Exception e) {
e.printStackTrace();
}
result.add(buildVo(list.get(i), yesTerDayAvgFlowValue, realFlowValue, todayAvgFlowValue));
}
}
return result;
}
/**
* 计算单日日均流量
*
* @param stcd
* @return
*/
BigDecimal getAvgOneDayData(String stcd, LocalDateTime startTime, LocalDateTime endTime) {
long days = ChronoUnit.DAYS.between(startTime, endTime);
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList =
ecologicalFlowService.getData(stcd, 3, 3, 1, startTime, endTime);
log.info("dataList: {}, 设备编码为:{}, 开始:{}, 结束 {}, 天数:{}", dataList, stcd, startTime, endTime, days);
if (!CollectionUtils.isEmpty(dataList)) {
// 为了处理特殊返回情况 多查出一条数据的问题
if (dataList.size() > days) {
dataList.remove(0);
}
Map<String, Object> info = dataList.get(0);
String ecologicalFlowValue = null == info.get(signage) ? "0" :
info.get(signage).toString();
log.info("ecologicalFlowValue的值: {}", ecologicalFlowValue);
return new BigDecimal(ecologicalFlowValue);
}
return BigDecimal.ZERO;
}
/**
* build vo
* @param stationRelationVo
* @param yesTerDayAvgFlowValue
* @param realFlowValue
* @param todayAvgFlowValue
* @return
*/
ExamStationFlowReportDayVo buildVo(StationVo stationRelationVo, BigDecimal yesTerDayAvgFlowValue, String realFlowValue, BigDecimal todayAvgFlowValue) {
ExamStationFlowReportDayVo vo = new ExamStationFlowReportDayVo();
vo.setName(stationRelationVo.getName());
vo.setAreaName("遂昌县");
vo.setFlowValue(stationRelationVo.getFlowValue());
vo.setYesTerDayAvgFlowValue(yesTerDayAvgFlowValue);
vo.setRealFlowValue(new BigDecimal(realFlowValue));
vo.setToDayAvgFlowValue(todayAvgFlowValue);
BigDecimal realOutFlow = todayAvgFlowValue.multiply(new BigDecimal(86400));
BigDecimal outFlow = stationRelationVo.getFlowValue().multiply(new BigDecimal(86400));
vo.setRealOutFlow(realOutFlow);
vo.setOutFlow(outFlow);
BigDecimal dayOutFlowPre = realOutFlow.divide(outFlow, 2, RoundingMode.HALF_UP);
String status = "未达标";
if (dayOutFlowPre.compareTo(new BigDecimal(passPreValue)) >= 0) {
status = "达标";
}
vo.setStatus(status);
vo.setDayOutFlowPre(dayOutFlowPre.multiply(new BigDecimal(100)) + "%");
return vo;
}
}

75
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/FlowWarnServiceImpl.java

@ -1,75 +0,0 @@
package com.hnac.hzims.suichang.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.suichang.mapper.EcologicalFlowMapper;
import com.hnac.hzims.suichang.service.FlowWarnService;
import com.hnac.hzims.suichang.vo.FlowWarnQueryDTO;
import com.hnac.hzims.suichang.vo.FlowWarnVo;
import com.hnac.hzims.suichang.vo.StationQueryReq;
import com.hnac.hzims.suichang.vo.StationVo;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
public class FlowWarnServiceImpl implements FlowWarnService {
@Autowired
private EcologicalFlowMapper ecologicalFlowMapper;
@Override
public IPage<FlowWarnVo> getFlowWarnList(FlowWarnQueryDTO dto, Query query) {
return ecologicalFlowMapper.getFlowWarnList(dto, Condition.getPage(query));
}
@Override
public Map<String, Map<String, Integer>> warningPush(FlowWarnQueryDTO dto) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<StationVo> stationList = ecologicalFlowMapper.getStationListByReq(new StationQueryReq());
LocalDateTime startTime = LocalDateTime.parse(dto.getStartTime(), formatter);
LocalDateTime endTime = LocalDateTime.parse(dto.getEndTime(), formatter);
List<LocalDateTime> dayList = new ArrayList<>();
while (!startTime.isAfter(endTime)) {
dayList.add(startTime);
startTime = startTime.plusDays(1);
}
Query query = new Query();
query.setCurrent(1);
query.setSize(10000);
List<FlowWarnVo> list = ecologicalFlowMapper.getFlowWarnList(dto, Condition.getPage(query)).getRecords();
Map<String, Map<String, Integer>> stationMap = new HashMap<>();
for (StationVo station : stationList) {
Map<String, Integer> dayMap = new LinkedHashMap<>();
List<FlowWarnVo> flowWarnVos =
list.stream().filter(var -> var.getObjectCode().equals(station.getDeviceCode())).collect(Collectors.toList());
for (int i = 0; i < dayList.size() - 1; i++) {
int degree = 0;
for (FlowWarnVo flowWarnVo : flowWarnVos) {
LocalDateTime warningTime =
LocalDateTime.parse(flowWarnVo.getSendTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if (Func.isEmpty(warningTime)) {
continue;
}
if (warningTime.isAfter(dayList.get(i)) && warningTime.isBefore(dayList.get(i + 1))) {
degree = degree + 1;
}
}
dayMap.put(dayList.get(i).format(formatter), degree);
}
stationMap.put(station.getDeviceCode(), dayMap);
}
return stationMap;
}
}

198
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/ImageAndVideoServiceImpl.java

@ -1,198 +0,0 @@
package com.hnac.hzims.suichang.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.suichang.mapper.EcologicalFlowMapper;
import com.hnac.hzims.suichang.mapper.ImageAndVideoMapper;
import com.hnac.hzims.suichang.service.ImageAndVideoService;
import com.hnac.hzims.suichang.util.DateUtil;
import com.hnac.hzims.suichang.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: liangfan
* @Date: 2024-03-14 16:19
* @Description:
*/
@Slf4j
@Service
public class ImageAndVideoServiceImpl implements ImageAndVideoService {
@Autowired
private EcologicalFlowMapper ecologicalFlowMapper;
@Autowired
private ImageAndVideoMapper imageAndVideoMapper;
@Override
public Page<MissingImagesRes> getMissingImagesInfo(ImageReq req, Query query) {
StationQueryReq stationQueryReq = new StationQueryReq();
stationQueryReq.setName(req.getName());
// 拿到电站列表
IPage<StationVo> stationListByNamePage =
ecologicalFlowMapper.getStationListByNamePage(stationQueryReq, Condition.getPage(query));
Page<MissingImagesRes> page = new Page<>();
BeanUtils.copyProperties(stationListByNamePage, page);
List<MissingImagesRes> resultList = new ArrayList<>();
DateTimeFormatter customFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime dateTime = LocalDateTime.parse(req.getStartTime(), customFormatter);
// 结合 LocalDate 和 LocalTime 创建 LocalDateTime 对象
stationListByNamePage.getRecords().forEach(o -> {
MissingImagesRes res = new MissingImagesRes();
res.setDeviceCode(o.getDeviceCode());
res.setName(o.getName());
res.setArea("遂昌县");
res.setMonth(String.valueOf(dateTime.getMonthValue()));
resultList.add(res);
});
page.setRecords(resultList);
return page;
}
@Override
public Map<String, Map<String, Integer>> missingPush(ImageReq req) {
StationQueryReq stationQueryReq = new StationQueryReq();
stationQueryReq.setName(req.getName());
List<StationVo> stationList = ecologicalFlowMapper.getStationListByReq(stationQueryReq);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime startTime = LocalDateTime.parse(req.getStartTime(), formatter);
LocalDateTime endTime = LocalDateTime.parse(req.getEndTime(), formatter);
List<LocalDateTime> dayList = new ArrayList<>();
while (!startTime.isAfter(endTime)) {
dayList.add(startTime);
startTime = startTime.plusDays(1);
}
// 查询时间段内的所有照片数据
Query query = new Query();
query.setCurrent(1);
query.setSize(10000);
List<ImageVo> imageInfoList = imageAndVideoMapper.getImageInfo(req, Condition.getPage(query)).getRecords();
Map<String, Map<String, Integer>> stationMap = new HashMap<>();
for (StationVo station : stationList) {
Map<String, Integer> dayMap = new LinkedHashMap<>();
List<ImageVo> infos =
imageInfoList.stream().filter(o -> o.getStcd().equals(station.getDeviceCode())).collect(Collectors.toList());
for (int i = 0; i < dayList.size() - 1; i++) {
int degree = 0;
for (ImageVo info : infos) {
LocalDateTime warningTime =
LocalDateTime.parse(info.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if (Func.isEmpty(warningTime)) {
continue;
}
if (!warningTime.isBefore(dayList.get(i)) && !warningTime.isAfter(dayList.get(i + 1))) {
degree = degree + 1;
}
}
dayMap.put(dayList.get(i).format(formatter), degree);
}
stationMap.put(station.getDeviceCode(), dayMap);
}
return stationMap;
}
@Override
public IPage<ImageVo> getImageInfoByDeviceCode(ImageReq req, Query query) {
// 根据deviceCode和时间段查询照片列表
return imageAndVideoMapper.getImageInfo(req, Condition.getPage(query));
}
@Override
public List<ImageVo> getImageInfoStatus(ImageReq req) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime startTime = LocalDateTime.parse(req.getStartTime(), formatter);
LocalDateTime endTime = LocalDateTime.parse(req.getEndTime(), formatter);
Query query = new Query();
query.setCurrent(1);
query.setSize(10000);
List<ImageVo> records = imageAndVideoMapper.getImageInfo(req, Condition.getPage(query)).getRecords();
List<LocalDateTime> hourList = new ArrayList<>();
while (!startTime.isAfter(endTime)) {
hourList.add(startTime);
startTime = startTime.plusHours(1);
}
List<ImageVo> resultList = new ArrayList<>();
for (int i = 0; i < hourList.size() - 1; i++) {
String stringTime = DateUtil.getStringTime(hourList.get(i));
boolean notHasInfo = true;
for (ImageVo vo : records) {
LocalDateTime warningTime =
LocalDateTime.parse(vo.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if (Func.isEmpty(warningTime)) {
continue;
}
if (warningTime.isAfter(hourList.get(i)) && warningTime.isBefore(hourList.get(i + 1))) {
vo.setTime(stringTime);
vo.setStatus("正常");
resultList.add(vo);
notHasInfo = false;
}
}
if (notHasInfo) {
ImageVo imageVo = new ImageVo();
imageVo.setTime(stringTime);
imageVo.setName("暂无图片详情");
imageVo.setStatus("异常");
resultList.add(imageVo);
}
}
// 筛选
if (StringUtil.isNotBlank(req.getStatus())) {
resultList = resultList.stream().filter(o -> o.getStatus().equals(req.getStatus())).collect(Collectors.toList());
}
return resultList;
}
@Override
public IPage<ImageVo> selectNewestImage(ImageReq req, Query query) {
return imageAndVideoMapper.selectNewestImage(req, Condition.getPage(query));
}
@Override
public List<StationTreeRes> getStationVideoType(String videoType) {
// 查询所有站点
List<StationVo> stationList = ecologicalFlowMapper.getStationListByReq(new StationQueryReq());
// 根据类型查询所有视频点位
List<StationTypeVo> videoList = imageAndVideoMapper.selectStationTypeByOwerType(videoType);
// 组装数据
List<StationTreeRes> resultList = new ArrayList<>();
for (StationVo stationVo : stationList) {
StationTreeRes stationTreeRes = new StationTreeRes();
List<StationTypeVo> child = videoList.stream().filter(o ->
o.getStationId().equals(stationVo.getDeviceCode())
).collect(Collectors.toList());
if (CollectionUtils.isEmpty(child)) {
continue;
}
stationTreeRes.setChild(child);
stationTreeRes.setCount(child.size());
stationTreeRes.setStationVo(stationVo);
resultList.add(stationTreeRes);
}
return resultList;
}
}

419
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/RealMonitorServiceImpl.java

@ -1,419 +0,0 @@
package com.hnac.hzims.suichang.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.hnac.hzims.suichang.mapper.EcologicalFlowMapper;
import com.hnac.hzims.suichang.service.EcologicalFlowService;
import com.hnac.hzims.suichang.service.RealMonitorService;
import com.hnac.hzims.suichang.util.DateUtil;
import com.hnac.hzims.suichang.vo.*;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.real.RealDataSearchClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: liangfan
* @Date: 2024-03-08 15:06
* @Description:
*/
@Slf4j
@Service
public class RealMonitorServiceImpl implements RealMonitorService {
@Autowired
private EcologicalFlowService ecologicalFlowService;
@Autowired
private EcologicalFlowMapper ecologicalFlowMapper;
@Autowired
RealDataSearchClient realDataSearchClient;
@Value("${suichang.signage}")
String signage;
@Value("${suichang.timeSignage}")
String timeSignage;
@Override
public List<AvgMonitorVo> getAvgMonitorInfo() {
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 昨天的开始时间(00:00) 昨天的结束时间(00:00)yesterday: 2024-03-12 00:00:00 yesterday: 2024-03-13 00:00:00
LocalDateTime startTime = now.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime = now.withMinute(0).withSecond(0).withNano(0);
int hours = (int)ChronoUnit.HOURS.between(startTime, endTime);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String dateNow = now.format(formatter);
List<StationVo> stationRelationList = ecologicalFlowMapper.getStationListByName(null);
List<AvgMonitorVo> resultList = new ArrayList<>();
for (StationVo vo : stationRelationList) {
String stcd = vo.getDeviceCode();
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = ecologicalFlowService.getData(
stcd, 3, 2, hours, startTime, endTime);
String realFlowValue = getRealData(stcd, signage);
log.info("dataList: {}, 实时流量为:{},设备编码为:{}", dataList, realFlowValue, stcd);
Map<String, Object> info = new HashMap<>();
if (!CollectionUtils.isEmpty(dataList)) {
// 为了处理特殊返回情况 多查出一条数据的问题
if (dataList.size() > 1) {
dataList.remove(0);
}
info = dataList.get(0);
}
AvgMonitorVo realMonitorVo = new AvgMonitorVo();
BeanUtils.copyProperties(vo, realMonitorVo);
realMonitorVo.setRealFlow(realFlowValue);
String ecologicalFlowValue = null == info.get(signage) ? "0" :
info.get(signage).toString();
log.info("info: {}, key:{}, 值:{}", info, signage, ecologicalFlowValue);
realMonitorVo.setAvgFlow(ecologicalFlowValue);
realMonitorVo.setDateNow(dateNow);
// 上报率
List<Map<String, Object>> reportList = ecologicalFlowService.getData(
stcd, 3, 2, 1, startTime, endTime);
int reportCount = 0;
if (!CollectionUtils.isEmpty(reportList)) {
// 为了处理特殊返回情况 多查出一条数据的问题
if (reportList.size() > hours) {
reportList.remove(0);
}
for (Map<String, Object> map : reportList) {
if (null != map.get(signage)) {
reportCount++;
}
}
}
BigDecimal pre = BigDecimal.valueOf(reportCount).divide(BigDecimal.valueOf(hours), 2, RoundingMode.HALF_UP);
pre = pre.compareTo(BigDecimal.ONE) >= 1 ? BigDecimal.ONE : pre;
realMonitorVo.setPassPre(pre.multiply(new BigDecimal(100))+ "%");
resultList.add(realMonitorVo);
}
return resultList;
}
@Override
public List<AvgMonitorCountVo> getAvgMonitorCountInfo(AvgMonitorReq req) {
// 昨日传2024-03-13 2024-03-13 时间段 2024-03-10 2024-03-13
String dateString = req.getStartTime() + " 00:00:00";
String endString = req.getEndTime() + " 00:00:00";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime startTime = LocalDateTime.parse(dateString, formatter);
LocalDateTime endTime = LocalDateTime.parse(endString, formatter).plusDays(1);
long days = ChronoUnit.DAYS.between(startTime, endTime);
log.info("开始结束时间: {}, {},相差天数:{}", startTime, endTime, days);
List<StationVo> stationRelationList = ecologicalFlowMapper.getStationListByName(req.getName());
List<AvgMonitorCountVo> resultList = new ArrayList<>();
for (StationVo vo : stationRelationList) {
// String stcd = "JSCZ001";
String stcd = vo.getDeviceCode();
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = ecologicalFlowService.getData(
stcd, 3, 3, 1, startTime, endTime);
log.info("dataList: {}, 设备编码为:{}", dataList, stcd);
if (!CollectionUtils.isEmpty(dataList)) {
int passCount = 0;
// 为了处理特殊返回情况 多查出一条数据的问题
if (dataList.size() > days) {
dataList.remove(0);
}
List<RealMonitorSingleInfoVo> infos = new ArrayList<>();
AvgMonitorCountVo realMonitorVo = new AvgMonitorCountVo();
for (int j = 0 ; j < dataList.size(); j++) {
Map<String, Object> info = dataList.get(j);
log.info("info: {}, key:{}, 值:{}", info, signage, info.get(signage));
String ecologicalFlowValue = null == info.get(signage) ? "0" :
info.get(signage).toString();
if (vo.getFlowValue().compareTo(new BigDecimal(ecologicalFlowValue)) <= 0) {
passCount++;
}
RealMonitorSingleInfoVo realInfo = new RealMonitorSingleInfoVo();
realInfo.setTm(info.get(timeSignage).toString());
realInfo.setValue(ecologicalFlowValue);
infos.add(realInfo);
}
realMonitorVo.setName(vo.getName());
realMonitorVo.setFlowValue(vo.getFlowValue());
realMonitorVo.setCount(days);
realMonitorVo.setPassCount(passCount);
BigDecimal pre = BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(days), 2, RoundingMode.HALF_UP);
realMonitorVo.setPassPre(pre.multiply(BigDecimal.valueOf(100)) + "%");
realMonitorVo.setInfos(infos);
resultList.add(realMonitorVo);
}
}
return resultList;
}
@Override
public RealMonitorRes getRealMonitorInfo(String name) {
// 创建一个 DateTimeFormatter 对象来指定输出格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String dateNow = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0).format(formatter);
// 查询所有站点
List<StationVo> infos = ecologicalFlowMapper.getStationListByName(name);
// 查询每个站点的名称,核定流量,实时流量,上报个数 时间
List<RealMonitorVo> resultList = new ArrayList<>();
for (StationVo info : infos) {
// String stcd = "JSCZ001";
String stcd = info.getDeviceCode();
String stationName = info.getName();
BigDecimal flowValue = info.getFlowValue();
// 查询实时数据
String realFlowValue = getRealData(stcd, signage);
// 查询历史条数(上报条数)
int historyDataCount = getHistoryDataCount(stcd);
RealMonitorVo realMonitorVo = new RealMonitorVo();
realMonitorVo.setName(stationName);
realMonitorVo.setDeviceCode(stcd);
realMonitorVo.setFlowValue(flowValue);
realMonitorVo.setRealFlow(realFlowValue);
realMonitorVo.setReportCount(historyDataCount);
realMonitorVo.setDateNow(dateNow);
realMonitorVo.setAreaName("遂昌县");
resultList.add(realMonitorVo);
}
// 应上报个数
long hoursPassedToday = DateUtil.getHoursPassedToday() + 1;
RealMonitorRes realMonitorRes = new RealMonitorRes();
realMonitorRes.setRealMonitorVos(resultList);
realMonitorRes.setReportCount(hoursPassedToday);
return realMonitorRes;
}
@Override
public void exportRealMonitorInfo(HttpServletResponse response, String name) {
RealMonitorRes realMonitorInfo = this.getRealMonitorInfo(name);
List<RealMonitorVo> list = realMonitorInfo.getRealMonitorVos();
List<RealMonitorExportDTO> result = list.stream().map(o -> {
RealMonitorExportDTO dto = new RealMonitorExportDTO();
BeanUtils.copyProperties(o, dto);
return dto;
}).collect(Collectors.toList());
// 下载导出
String filename = "实时流量";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8"));
//创建一个输出流
EasyExcel.write(response.getOutputStream(), RealMonitorExportDTO.class)
.autoCloseStream(Boolean.TRUE).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.sheet(1,"实时流量")
.doWrite(result);
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void exportRealMonitorSingleInfo(HttpServletResponse response, RealMonitorSingleInfoReq req) {
List<RealMonitorSingleInfoVo> realMonitorSingleInfos = getRealMonitorSingleInfo(req);
for (RealMonitorSingleInfoVo realMonitorSingleInfo : realMonitorSingleInfos) {
realMonitorSingleInfo.setTm(realMonitorSingleInfo.getTm() + ":00:00");
}
// 下载导出
String filename = "站点流量详情";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8"));
//创建一个输出流
EasyExcel.write(response.getOutputStream(), RealMonitorSingleInfoVo.class)
.autoCloseStream(Boolean.TRUE)
.sheet(1,"站点流量详情").registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.doWrite(realMonitorSingleInfos);
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public List<RealMonitorSingleInfoVo> getRealMonitorSingleInfo(RealMonitorSingleInfoReq req) {
String stcd = req.getDeviceCode();
LocalDateTime startTime = DateUtil.getStartTime(req.getStartTime());
LocalDateTime endTime = DateUtil.getEndTime(req.getEndTime());
log.info("开始时间结束时间: {}, {}", startTime, endTime);
// 昨日达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = ecologicalFlowService.getData(
stcd, 3, 2, 1, startTime, endTime);
log.info("拿到getHistoryDataCount dataList: {}, 设备编码为:{}", dataList, stcd);
List<RealMonitorSingleInfoVo> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(dataList)) {
resultList = dataList.stream().map(info -> {
String value = null == info.get(signage) ? "0" :
info.get(signage).toString();
String time = null == info.get(timeSignage) ? "" :
info.get(timeSignage).toString() + ":00:00";
RealMonitorSingleInfoVo vo = new RealMonitorSingleInfoVo();
vo.setValue(value);
vo.setTm(time);
return vo;
}).collect(Collectors.toList());
}
return resultList;
}
@Override
public String getRealData(String stcd, String signage) {
RealDataSearchPO po = new RealDataSearchPO();
po.setAnalyzeCode(stcd);
List<String> signages = new ArrayList<>();
signages.add(signage);
po.setSignages(signages);
Result<List<FieldsData>> result = realDataSearchClient.getRealDataByDeviceCode(po);
log.info("result: {}, 设备编码为:{}", result, stcd);
if (result == null || !result.isSuccess()) {
return null;
}
String value = "0";
List<FieldsData> data = result.getData();
if (!CollectionUtils.isEmpty(data)) {
value = data.get(0).getValue();
}
return value;
}
@Override
public void exportAvgMonitorCountInfo(HttpServletResponse response, AvgMonitorReq req) {
List<AvgMonitorCountVo> avgMonitorCountInfo = getAvgMonitorCountInfo(req);
// 动态生成的表头
List<String> firstHead = new ArrayList<>(Arrays.asList("电站名称", "核定流量"));
List<String> endHead = new ArrayList<>(Arrays.asList("考核天数", "合格天数", "合格率"));
List<String> allList = new ArrayList<>();
allList.addAll(firstHead);
if (avgMonitorCountInfo.size() > 0) {
AvgMonitorCountVo avgMonitorCountVo = avgMonitorCountInfo.get(0);
List<RealMonitorSingleInfoVo> infos = avgMonitorCountVo.getInfos();
List<String> mindHead = infos.stream().map(RealMonitorSingleInfoVo::getTm).collect(Collectors.toList());
allList.addAll(mindHead);
}
allList.addAll(endHead);
List<List<String>> head = allList.stream().map(v -> {
List<String> list = new ArrayList<>();
list.add(v);
return list;
}).collect(Collectors.toList());
// 组合数据
List<List<String>> contentLists = new ArrayList<>();
avgMonitorCountInfo.forEach(o -> {
List<String> list = new ArrayList<>();
list.add(o.getName());
list.add(o.getFlowValue().toString());
List<RealMonitorSingleInfoVo> rsVo = o.getInfos();
rsVo.forEach(k -> {
list.add(k.getValue());
});
list.add(o.getCount().toString());
list.add(o.getPassCount().toString());
list.add(o.getPassPre());
contentLists.add(list);
});
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("日均流量" + ".xlsx", "UTF-8"));
EasyExcel.write(response.getOutputStream()).autoCloseStream(Boolean.TRUE).head(head)
.sheet(1,"日均流量").registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.doWrite(contentLists);
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
int getHistoryDataCount(String stcd) {
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
LocalDateTime startTime = now.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime = now;
// 昨日达标情况 达标率就是有没有达到核定下限流量
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = ecologicalFlowService.getData(
stcd, 3, 2, 1, startTime, endTime);
log.info("拿到getHistoryDataCount dataList: {}, 设备编码为:{}", dataList, stcd);
int count = 0;
if (!CollectionUtils.isEmpty(dataList)) {
for (Map<String, Object> info : dataList) {
String ecologicalFlowValue = null == info.get(signage) ? null :
info.get(signage).toString();
log.info("ecologicalFlowValue的值: {}", ecologicalFlowValue);
if (StringUtils.isNotBlank(ecologicalFlowValue)) {
count++;
}
}
}
return count;
}
@Override
public String getRealData(String stcd) {
RealDataSearchPO po = new RealDataSearchPO();
po.setAnalyzeCode(stcd);
List<String> signages = new ArrayList<>();
signages.add(signage);
po.setSignages(signages);
Result<List<FieldsData>> result = realDataSearchClient.getRealDataByDeviceCode(po);
log.info("result: {}, 设备编码为:{}", result, stcd);
if (result == null || !result.isSuccess()) {
return null;
}
String value = "0";
List<FieldsData> data = result.getData();
if (!CollectionUtils.isEmpty(data)) {
value = data.get(0).getValue();
}
return value;
}
}

172
hzims-service/hzims-ecological/src/main/java/com/hnac/hzims/suichang/service/impl/StatisticsDataServiceImpl.java

@ -1,172 +0,0 @@
package com.hnac.hzims.suichang.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.hnac.hzims.suichang.mapper.EcologicalFlowMapper;
import com.hnac.hzims.suichang.service.EcologicalFlowService;
import com.hnac.hzims.suichang.service.StatisticsDataService;
import com.hnac.hzims.suichang.util.DateUtil;
import com.hnac.hzims.suichang.vo.StationVo;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataDetailVo;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataReq;
import com.hnac.hzims.suichang.vo.StatisticsFlowDataVo;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @Author: liangfan
* @Date: 2024-03-14 16:19
* @Description:
*/
@Slf4j
@Service
public class StatisticsDataServiceImpl implements StatisticsDataService {
@Autowired
private EcologicalFlowMapper ecologicalFlowMapper;
@Autowired
private EcologicalFlowService ecologicalFlowService;
@Value("${suichang.signage}")
String signage;
@Value("${suichang.passPreValue}")
String passPreValueInfo;
@Override
public StatisticsFlowDataVo statisticsFlowReportByTime(StatisticsFlowDataReq req) {
// 查询所有站点
List<StationVo> infos = ecologicalFlowMapper.getStationListByName(req.getName());
// 电站信息
List<StatisticsFlowDataDetailVo> dataDetailVos = new ArrayList<>();
// 构建detail 并返回达标数
int stationPassCount = buildInfos(req, infos, dataDetailVos, passPreValueInfo);
// 总览信息
StatisticsFlowDataVo result = new StatisticsFlowDataVo();
result.setAreaName("遂昌县");
result.setExamCount(infos.size());
result.setPassCount(stationPassCount);
BigDecimal pre = BigDecimal.valueOf(stationPassCount).divide(BigDecimal.valueOf(infos.size()), 2, RoundingMode.HALF_UP);
result.setPassPre(pre.multiply(BigDecimal.valueOf(100)) + "%");
result.setDetail(dataDetailVos);
return result;
}
@Override
public void exportStatisticsFlowReportByTime(HttpServletResponse response, StatisticsFlowDataReq req) {
StatisticsFlowDataVo statisticsFlowDataVo = statisticsFlowReportByTime(req);
// 动态生成的表头
String areaName = statisticsFlowDataVo.getAreaName();
Integer examCount = statisticsFlowDataVo.getExamCount();
Integer passCount = statisticsFlowDataVo.getPassCount();
String passPre = statisticsFlowDataVo.getPassPre();
List<String> firstHead = new ArrayList<>(Arrays.asList("区域名称:" + areaName, "考核电站数:" + examCount,
"达标电站数:" + passCount, "达标率(%):" + passPre, "安装流量计的电站数:" + examCount));
List<String> endHead = new ArrayList<>(Arrays.asList("电站名称", "核定生态流量", "考核天数", "合格天数", "合格率"));
// 构建表头
List<List<String>> head = new ArrayList<>();
for (int i = 0; i < endHead.size(); i++) {
List<String> list = new ArrayList<>();
list.add(firstHead.get(i));
list.add(endHead.get(i));
head.add(list);
}
// 组合数据
List<List<String>> contentLists = new ArrayList<>();
List<StatisticsFlowDataDetailVo> detail = statisticsFlowDataVo.getDetail();
detail.forEach(o -> {
List<String> list = new ArrayList<>();
list.add(o.getName());
list.add(o.getFlowValue());
list.add(o.getExamDays().toString());
list.add(o.getExamPassDays().toString());
list.add(o.getExamPassDayPre());
contentLists.add(list);
});
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报表" + ".xlsx", "UTF-8"));
EasyExcel.write(response.getOutputStream()).autoCloseStream(Boolean.TRUE).head(head).autoTrim(true)
.sheet(1, "报表").registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.doWrite(contentLists);
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
int buildInfos(StatisticsFlowDataReq req, List<StationVo> infos,
List<StatisticsFlowDataDetailVo> dataDetailVos, String passPreValue) {
int stationPassCount = 0;
for (StationVo stationRelationVo : infos) {
// String stcd = "JSCZ001";
String stcd = stationRelationVo.getDeviceCode();
BigDecimal flowValue = stationRelationVo.getFlowValue();
LocalDateTime startTime = DateUtil.getStartTime(req.getStartTime());
LocalDateTime endTime = DateUtil.getEndTimeByDay(req.getEndTime());
int days = (int) ChronoUnit.DAYS.between(startTime, endTime);
log.info("开始时间结束时间: {}, {},相差天数:{}", startTime, endTime, days);
// 查询单个站点一个时间段的日均数据
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
List<Map<String, Object>> dataList = ecologicalFlowService.getData(
stcd, 3, 3, 1, startTime, endTime);
log.info("dataList: {}, 设备编码为:{}", dataList, stcd);
StatisticsFlowDataDetailVo detailVo = new StatisticsFlowDataDetailVo();
if (!CollectionUtils.isEmpty(dataList)) {
int passCount = 0;
// 为了处理特殊返回情况 多查出一条数据的问题 跳过第一条
if (dataList.size() > days) {
dataList.remove(0);
}
for (int j = 0; j < dataList.size(); j++) {
Map<String, Object> info = dataList.get(j);
log.info("info: {}, key:{}, 值:{}", info, signage, info.get(signage));
String ecologicalFlowValue = null == info.get(signage) ? "0" :
info.get(signage).toString();
if (flowValue.compareTo(new BigDecimal(ecologicalFlowValue)) <= 0) {
passCount++;
}
}
// 计算合格率
BigDecimal singlePassPre = BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(days), 2, RoundingMode.HALF_UP);
if (new BigDecimal(passPreValue).compareTo(singlePassPre) <= 0) {
stationPassCount++;
}
detailVo.setExamPassDays(passCount);
detailVo.setExamPassDayPre(singlePassPre.multiply(BigDecimal.valueOf(100)) + "%");
}
// 组装数据
detailVo.setName(stationRelationVo.getName());
if(ObjectUtil.isNotEmpty(stationRelationVo.getFlowValue())){
detailVo.setFlowValue(stationRelationVo.getFlowValue().toString());
}
detailVo.setExamDays(days);
dataDetailVos.add(detailVo);
}
return stationPassCount;
}
}

16
hzims-service/hzims-ecological/src/main/resources/application.yml

@ -1,16 +0,0 @@
#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
#服务器端口
server:
port: 18999

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

@ -92,7 +92,9 @@ public class OperAccessLibraryServiceImpl extends ServiceImpl<OperAccessLibraryM
if(StringUtils.isEmpty(detail.getSafeInfos())){
R.data(detail);
}
if(StringUtils.isNotEmpty(detail.getSafeInfos())){
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(",")));
}
return R.data(detail);
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/wrapper/OperAccessLibraryWrapper.java

@ -36,7 +36,7 @@ public class OperAccessLibraryWrapper extends BaseEntityWrapper<OperAccessLibrar
vo.setCreateUserName(Optional.ofNullable(createUser).map(User::getName).orElse(null));
vo.setUpdateUserName(Optional.ofNullable(updateUser).map(User::getName).orElse(null));
if(StringUtil.isNotBlank(entity.getEmCode())){
vo.setEmName(Optional.ofNullable(emInfoClient.getByCode(entity.getEmCode())).map(EmInfoEntity::getName).orElse(null));
vo.setEmName(Optional.ofNullable(emInfoClient.getByCode(entity.getEmCode())).map(EmInfoEntity::getName).orElse(entity.getEmName()));
}
return vo;
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java

@ -42,6 +42,7 @@ import java.util.List;
@RestController
@RequestMapping("/areaMonthReport")
@Api(value = "区域月报", tags = "区域月报")
@AllArgsConstructor
@Slf4j
public class AreaMonthReportController extends BladeController {

38
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -979,50 +979,50 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
HSSFRow row_2 = sheet.createRow(2);
this.setTitileStyle(hssWB, row_2, 19, true);
HSSFCell header_row_2_cell_1 = row_2.getCell(1);
header_row_2_cell_1.setCellValue("计划发电量");
header_row_2_cell_1.setCellValue("计划发电量(kWh)");
HSSFCell header_row_2_cell_2 = row_2.getCell(2);
header_row_2_cell_2.setCellValue("实际发电量");
header_row_2_cell_2.setCellValue("实际发电量(kWh)");
HSSFCell header_row_2_cell_3 = row_2.getCell(3);
header_row_2_cell_3.setCellValue("发电完成率");
header_row_2_cell_3.setCellValue("发电完成率(%)");
HSSFCell header_row_2_cell_4 = row_2.getCell(4);
header_row_2_cell_4.setCellValue("同比");
header_row_2_cell_4.setCellValue("同比(%)");
HSSFCell header_row_2_cell_5 = row_2.getCell(5);
header_row_2_cell_5.setCellValue("发电计划预测");
header_row_2_cell_5.setCellValue("发电计划预测(kWh)");
HSSFCell header_row_2_cell_6 = row_2.getCell(6);
header_row_2_cell_6.setCellValue("操作票");
header_row_2_cell_6.setCellValue("操作票(张)");
HSSFCell header_row_2_cell_7 = row_2.getCell(7);
header_row_2_cell_7.setCellValue("操作票合格率");
header_row_2_cell_7.setCellValue("操作票合格率(%)");
HSSFCell header_row_2_cell_8 = row_2.getCell(8);
header_row_2_cell_8.setCellValue("工作票");
header_row_2_cell_8.setCellValue("工作票(张)");
HSSFCell header_row_2_cell_9 = row_2.getCell(9);
header_row_2_cell_9.setCellValue("工作票合格率");
header_row_2_cell_9.setCellValue("工作票合格率(%)");
HSSFCell header_row_2_cell_10 = row_2.getCell(10);
header_row_2_cell_10.setCellValue("日常维护");
header_row_2_cell_10.setCellValue("日常维护(个)");
HSSFCell header_row_2_cell_11 = row_2.getCell(11);
header_row_2_cell_11.setCellValue("巡检任务");
header_row_2_cell_11.setCellValue("巡检任务(个)");
HSSFCell header_row_2_cell_12 = row_2.getCell(12);
header_row_2_cell_12.setCellValue("缺陷数");
header_row_2_cell_12.setCellValue("缺陷数(个)");
HSSFCell header_row_2_cell_13 = row_2.getCell(13);
header_row_2_cell_13.setCellValue("消缺率");
header_row_2_cell_13.setCellValue("消缺率(%)");
HSSFCell header_row_2_cell_14 = row_2.getCell(14);
header_row_2_cell_14.setCellValue("检修任务");
header_row_2_cell_14.setCellValue("检修任务(个)");
HSSFCell header_row_2_cell_15 = row_2.getCell(15);
header_row_2_cell_15.setCellValue("安全生产会议次数");
header_row_2_cell_15.setCellValue("安全生产会议次数(次)");
HSSFCell header_row_2_cell_16 = row_2.getCell(16);
header_row_2_cell_16.setCellValue("月度自查报告");
header_row_2_cell_16.setCellValue("月度自查报告(次)");
HSSFCell header_row_2_cell_17 = row_2.getCell(17);
header_row_2_cell_17.setCellValue("设备试验");
header_row_2_cell_17.setCellValue("设备试验(条)");
HSSFCell header_row_2_cell_18 = row_2.getCell(18);
header_row_2_cell_18.setCellValue("技能培训");
header_row_2_cell_18.setCellValue("技能培训(次)");
HSSFCell header_row_2_cell_19 = row_2.getCell(19);
header_row_2_cell_19.setCellValue("安全大检查");
header_row_2_cell_19.setCellValue("安全大检查(次)");
// 表头一:合并情况
CellRangeAddress header_region_1 = new CellRangeAddress((short) 1, (short) 2, (short) 0, (short) 0);

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.report.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant;
@ -46,7 +47,6 @@ import org.apache.poi.ss.usermodel.charts.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springblade.core.log.exception.ServiceException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.*;
@ -62,7 +62,10 @@ import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -1032,6 +1035,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
}
}
// 行合并情况
if(runData.size() > 1){
CellRangeAddress region3 = new CellRangeAddress(rowNumber, endRow - 1, (short) 3, (short) 3);
CellRangeAddress region4 = new CellRangeAddress(rowNumber, endRow - 1, (short) 4, (short) 4);
CellRangeAddress region5 = new CellRangeAddress(rowNumber, endRow - 1, (short) 5, (short) 5);
@ -1042,6 +1046,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
sheet.addMergedRegion(region5);
sheet.addMergedRegion(region6);
sheet.addMergedRegion(region7);
}
return endRow;
}

1
hzims-service/pom.xml

@ -25,7 +25,6 @@
<module>hzims-alarm</module>
<module>hzims-basic</module>
<module>hzims-big-model</module>
<module>hzims-ecological</module>
</modules>
<dependencies>

24
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/InstitutionalController.java

@ -0,0 +1,24 @@
package com.hnac.hzims.safeproduct.train.controller;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.train.service.IInstitutionalService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/institutional")
@Business(module = Constants.APP_NAME, value = "制度资料")
@Api(tags = "制度资料")
public class InstitutionalController extends BladeController {
private final IInstitutionalService institutionalService;
}

72
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/RectificationController.java

@ -0,0 +1,72 @@
package com.hnac.hzims.safeproduct.train.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.train.entity.RectificationEntity;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.service.IRectificlationService;
import com.hnac.hzims.safeproduct.train.vo.RectificationParamVo;
import com.hnac.hzims.safeproduct.train.vo.RectificationSummaryVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationParamVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.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.*;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/rectification")
@Business(module = Constants.APP_NAME, value = "整改督办")
@Api(value = "整改督办", tags = "整改督办接口")
public class RectificationController extends BladeController {
private final IRectificlationService service;
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增违章考核", notes = "传入RectificationEntity")
public R save(@RequestBody RectificationEntity entity) {
return R.status(service.save(entity));
}
@PostMapping("/update")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "修改违章考核", notes = "传入RectificationEntity")
public R update(@RequestBody RectificationEntity entity) {
return R.status(service.updateById(entity));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "删除违章考核", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
return R.status(service.removeByIds(Func.toLongList(ids)));
}
@GetMapping("/pages")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "分页查询", notes = "查询条件:entity")
public R<IPage<RectificationEntity>> pageCondition(RectificationParamVo params, Query query) {
return R.data(service.pageCondition(params, Condition.getPage(query)));
}
@GetMapping("/summary")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "汇总", notes = "查询条件:站点ID、月份")
public R<IPage<RectificationSummaryVo>> summary(RectificationParamVo params, Query query) {
return R.data(service.summary(params,Condition.getPage(query)));
}
}

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/TrainController.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.train.controller;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.train.service.ITrainService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/train")
@Business(module = Constants.APP_NAME, value = "培训管理")
@Api(value = "培训管理", tags = "培训管理接口")
public class TrainController extends BladeController {
private final ITrainService trainService;
}

70
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/ViolationController.java

@ -0,0 +1,70 @@
package com.hnac.hzims.safeproduct.train.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.service.IViolationService;
import com.hnac.hzims.safeproduct.train.vo.ViolationParamVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.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.*;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/violation")
@Business(module = Constants.APP_NAME, value = "违章考核")
@Api(value = "违章考核", tags = "违章考核接口")
public class ViolationController extends BladeController {
private final IViolationService service;
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增违章考核", notes = "传入ViolationEntity")
public R save(@RequestBody ViolationEntity entity) {
return R.status(service.save(entity));
}
@PostMapping("/update")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "修改违章考核", notes = "传入HazardDetailsVo")
public R update(@RequestBody ViolationEntity entity) {
return R.status(service.updateById(entity));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "删除违章考核", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
return R.status(service.removeByIds(Func.toLongList(ids)));
}
@GetMapping("/pages")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "分页查询", notes = "查询条件:entity")
public R<IPage<ViolationEntity>> pageCondition(ViolationParamVo params, Query query) {
return R.data(service.pageCondition(params,Condition.getPage(query)));
}
@GetMapping("/summary")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "汇总", notes = "查询条件:站点ID、月份")
public R<IPage<ViolationSummaryVo>> summary(ViolationParamVo params, Query query) {
return R.data(service.summary(params,Condition.getPage(query)));
}
}

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/InstitutionalMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.safeproduct.train.mapper;
import com.hnac.hzims.safeproduct.train.entity.InstitutionalEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface InstitutionalMapper extends UserDataScopeBaseMapper<InstitutionalEntity> {
}

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/InstitutionalMapper.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.safeproduct.train.mapper.InstitutionalMapper">
</mapper>

18
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/RectificationMapper.java

@ -0,0 +1,18 @@
package com.hnac.hzims.safeproduct.train.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.train.entity.RectificationEntity;
import com.hnac.hzims.safeproduct.train.vo.RectificationParamVo;
import com.hnac.hzims.safeproduct.train.vo.RectificationSummaryVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface RectificationMapper extends UserDataScopeBaseMapper<RectificationEntity> {
IPage<RectificationSummaryVo> summary(@Param("params") RectificationParamVo params, IPage<ViolationSummaryVo> page);
}

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/RectificationMapper.xml

@ -0,0 +1,23 @@
<?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.safeproduct.train.mapper.RectificationMapper">
<select id="summary" resultType="com.hnac.hzims.safeproduct.train.vo.RectificationSummaryVo">
select * from
(select station_id,rectification_type,count(1) as completeSum,count(case when `status` = 1 then 1 end) as completeCount
from hzims_rectification_supervision
<where>
is_deleted = 0
<if test="params.stationId != null and params.stationId != ''">
and station_id = #{params.stationId}
</if>
<if test="params.month != null and params.month != ''">
and create_time like concat('%', #{params.month}, '%')
</if>
</where>
group by station_id,rectification_type
) a
order by (IFNULL(a.completeSum,0) / IFNULL(a.completeCount,0)) desc
</select>
</mapper>

13
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.java

@ -0,0 +1,13 @@
package com.hnac.hzims.safeproduct.train.mapper;
import com.hnac.hzims.safeproduct.train.entity.TrainEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface TrainMapper extends UserDataScopeBaseMapper<TrainEntity> {
}

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.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.safeproduct.train.mapper.TrainMapper">
</mapper>

17
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/ViolationMapper.java

@ -0,0 +1,17 @@
package com.hnac.hzims.safeproduct.train.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.vo.ViolationParamVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface ViolationMapper extends UserDataScopeBaseMapper<ViolationEntity> {
IPage<ViolationSummaryVo> summary(@Param("params") ViolationParamVo params, IPage<ViolationSummaryVo> page);
}

21
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/ViolationMapper.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.train.mapper.ViolationMapper">
<select id="summary" resultType="com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo">
select * from (select station_id,station_name,count(1) as count
from hzims_violation_assessment
<where>
is_deleted = 0
<if test="params.stationId != null and params.stationId != ''">
and station_id = #{params.stationId}
</if>
<if test="params.month != null and params.month != ''">
and discover_time like concat('%', #{params.month}, '%')
</if>
</where>
group by station_id,station_name) a
order by a.count desc
</select>
</mapper>

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IInstitutionalService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.safeproduct.train.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.train.entity.InstitutionalEntity;
/**
* @author ysj
*/
public interface IInstitutionalService extends IService<InstitutionalEntity> {
}

20
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IRectificlationService.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.train.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.train.entity.RectificationEntity;
import com.hnac.hzims.safeproduct.train.vo.RectificationParamVo;
import com.hnac.hzims.safeproduct.train.vo.RectificationSummaryVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
/**
* @author ysj
*/
public interface IRectificlationService extends IService<RectificationEntity> {
IPage<RectificationEntity> pageCondition(RectificationParamVo params, IPage<RectificationEntity> page);
IPage<RectificationSummaryVo> summary(RectificationParamVo params, IPage<ViolationSummaryVo> page);
}

19
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IViolationService.java

@ -0,0 +1,19 @@
package com.hnac.hzims.safeproduct.train.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.vo.ViolationParamVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
/**
* @author ysj
*/
public interface IViolationService extends IService<ViolationEntity> {
IPage<ViolationEntity> pageCondition(ViolationParamVo params, IPage<ViolationEntity> page);
IPage<ViolationSummaryVo> summary(ViolationParamVo stationId, IPage<ViolationSummaryVo> page);
}

19
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/InstitutionalServiceImpl.java

@ -0,0 +1,19 @@
package com.hnac.hzims.safeproduct.train.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.train.entity.InstitutionalEntity;
import com.hnac.hzims.safeproduct.train.mapper.InstitutionalMapper;
import com.hnac.hzims.safeproduct.train.service.IInstitutionalService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
* 制度资料
* @author ysj
*/
@Service
@RequiredArgsConstructor
public class InstitutionalServiceImpl extends ServiceImpl<InstitutionalMapper, InstitutionalEntity> implements IInstitutionalService {
}

60
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/RectificlationServiceImpl.java

@ -0,0 +1,60 @@
package com.hnac.hzims.safeproduct.train.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.train.entity.RectificationEntity;
import com.hnac.hzims.safeproduct.train.mapper.RectificationMapper;
import com.hnac.hzims.safeproduct.train.service.IRectificlationService;
import com.hnac.hzims.safeproduct.train.vo.RectificationParamVo;
import com.hnac.hzims.safeproduct.train.vo.RectificationSummaryVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
/**
* 整改督办
* @author ysj
*/
@Service
public class RectificlationServiceImpl extends ServiceImpl<RectificationMapper, RectificationEntity> implements IRectificlationService {
/**
* 分页列表查询整改督办
* @param params
* @param page
* @return
*/
@Override
public IPage<RectificationEntity> pageCondition(RectificationParamVo params, IPage<RectificationEntity> page) {
LambdaQueryWrapper<RectificationEntity> wrapper = new LambdaQueryWrapper();
wrapper.orderByDesc(RectificationEntity::getCreateTime);
if(StringUtil.isNotBlank(params.getStationId())){
wrapper.eq(RectificationEntity::getStationId,params.getStationId());
}
if(ObjectUtil.isNotEmpty(params.getRectificationType())){
wrapper.eq(RectificationEntity::getRectificationType,params.getRectificationType());
}
if(ObjectUtil.isNotEmpty(params.getStatus())){
wrapper.eq(RectificationEntity::getStatus,params.getStatus());
}
if(ObjectUtil.isNotEmpty(params.getPersonLiableName())){
wrapper.like(RectificationEntity::getPersonLiableName,params.getPersonLiableName());
}
return super.page(page,wrapper);
}
/**
* 分页列表查询整改督办汇总
* @param params
* @param page
* @return
*/
@Override
public IPage<RectificationSummaryVo> summary(RectificationParamVo params, IPage<ViolationSummaryVo> page) {
return this.baseMapper.summary(params,page);
}
}

61
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/ViolationServiceImpl.java

@ -0,0 +1,61 @@
package com.hnac.hzims.safeproduct.train.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.mapper.ViolationMapper;
import com.hnac.hzims.safeproduct.train.service.IViolationService;
import com.hnac.hzims.safeproduct.train.vo.ViolationParamVo;
import com.hnac.hzims.safeproduct.train.vo.ViolationSummaryVo;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
/**
* 违章考核
* @author ysj
*/
@Service
public class ViolationServiceImpl extends ServiceImpl<ViolationMapper, ViolationEntity> implements IViolationService {
/**
* 分页列表查询违章考核记录
* @param params
* @param page
* @return
*/
@Override
public IPage<ViolationEntity> pageCondition(ViolationParamVo params, IPage<ViolationEntity> page) {
LambdaQueryWrapper<ViolationEntity> wrapper = new LambdaQueryWrapper();
wrapper.orderByDesc(ViolationEntity::getCreateTime);
if(StringUtil.isNotBlank(params.getStationId())){
wrapper.eq(ViolationEntity::getStationId,params.getStartTime());
}
if(StringUtil.isNotBlank(params.getStartTime())){
wrapper.ge(ViolationEntity::getDiscoverTime,params.getStartTime());
}
if(StringUtil.isNotBlank(params.getEndTime())){
wrapper.eq(ViolationEntity::getDiscoverTime,params.getEndTime());
}
if(ObjectUtil.isNotEmpty(params.getViolationLevel())){
wrapper.eq(ViolationEntity::getViolationLevel,params.getViolationLevel());
}
if(ObjectUtil.isNotEmpty(params.getDiscovererName())){
wrapper.like(ViolationEntity::getDiscovererName,params.getDiscovererName());
}
return super.page(page,wrapper);
}
/**
* 分页列表查询违章考核汇总
* @param params
* @param page
* @return
*/
@Override
public IPage<ViolationSummaryVo> summary(ViolationParamVo params, IPage<ViolationSummaryVo> page) {
return this.baseMapper.summary(params,page);
}
}
Loading…
Cancel
Save