Browse Source

Merge branch 'sxgk-liangzidianguangpu' of https://gitee.com/pang-rongan/tofly-sxgk into branch-business-1102

wangzhun 3 years ago
parent
commit
1911095ec7
70 changed files with 704 additions and 172 deletions
  1. 30 0
      sxgk-projet/sxgk-data/data-api/pom.xml
  2. 42 0
      sxgk-projet/sxgk-data/data-api/src/main/java/com/tofly/api/DeviceCheckDataClient.java
  3. 104 0
      sxgk-projet/sxgk-data/data-api/src/main/java/com/tofly/pojo/CheckDataDto.java
  4. 74 0
      sxgk-projet/sxgk-data/data-boot/pom.xml
  5. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/DataApplication.java
  6. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/commons/CommonConstants.java
  7. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/commons/TipsConstants.java
  8. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/config/FeignConfig.java
  9. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/config/ParameterConfig.java
  10. 27 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/controller/CheckDataDayController.java
  11. 3 2
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/controller/CheckDataHourController.java
  12. 6 13
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/controller/DeviceCheckDataController.java
  13. 0 2
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/dto/CheckDataDto.java
  14. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/dto/WarningDataVo.java
  15. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/dto/WarningVo.java
  16. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/entity/CheckDataDay.java
  17. 4 1
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/entity/CheckDataHour.java
  18. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/entity/DeviceCheckData.java
  19. 2 2
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/entity/WarningInfo.java
  20. 1 1
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/mapper/CheckDataDayMapper.java
  21. 1 1
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/mapper/CheckDataHourMapper.java
  22. 1 1
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/mapper/DeviceCheckDataMapper.java
  23. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/service/CheckDataDayService.java
  24. 3 1
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/CheckDataHourService.java
  25. 2 0
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/DeviceCheckDataService.java
  26. 1 1
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/service/impl/CheckDataDayServiceImpl.java
  27. 9 2
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/impl/CheckDataHourServiceImpl.java
  28. 12 5
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/impl/DeviceCheckDataServiceImpl.java
  29. 18 9
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/task/sendDataTask.java
  30. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/utils/SnowflakeUtils.java
  31. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/CheckDataDayVo.java
  32. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/CheckDataHourVo.java
  33. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/CheckDataVo.java
  34. 6 1
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/vo/DeviceCheckDataNewVo.java
  35. 24 0
      sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/TargetShowVo.java
  36. 0 9
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/vo/WarningInfoVo.java
  37. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/resources/bootstrap-test.yml
  38. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/resources/bootstrap.yml
  39. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/resources/logback-spring.xml
  40. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/resources/mapper/CheckDataDayMapper.xml
  41. 0 0
      sxgk-projet/sxgk-data/data-boot/src/main/resources/mapper/CheckDataHourMapper.xml
  42. 1 1
      sxgk-projet/sxgk-data/src/main/resources/mapper/DeviceCheckDataMapper.xml
  43. 5 49
      sxgk-projet/sxgk-data/pom.xml
  44. 0 36
      sxgk-projet/sxgk-data/src/main/java/com/tofly/data/controller/CheckDataDayController.java
  45. 9 0
      sxgk-projet/sxgk-notice/notice-boot/pom.xml
  46. 4 0
      sxgk-projet/sxgk-notice/notice-boot/src/main/java/com/tofly/notice/NoticeApplication.java
  47. 56 0
      sxgk-projet/sxgk-notice/notice-boot/src/main/java/com/tofly/notice/config/FeignConfig.java
  48. 69 5
      sxgk-projet/sxgk-notice/notice-boot/src/main/java/com/tofly/notice/service/impl/TidingsServiceImpl.java
  49. 10 0
      sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/api/SurveySiteClient.java
  50. 10 0
      sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/api/WarningInfoClient.java
  51. 0 6
      sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/pojo/CheckTargetDataVo.java
  52. 5 1
      sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/pojo/SiteCheckTargetVo.java
  53. 24 0
      sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/pojo/TargetShowVo.java
  54. 7 3
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/construct/InitializeDataConstruct.java
  55. 21 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/controller/WarningInfoController.java
  56. 3 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/mapper/DeviceTargetPMapper.java
  57. 5 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/DeviceTargetPService.java
  58. 2 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/WarningInfoService.java
  59. 24 4
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/impl/DeviceCheckDataServiceImpl.java
  60. 6 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/impl/DeviceTargetPServiceImpl.java
  61. 29 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/impl/WarningInfoServiceImpl.java
  62. 0 5
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/CheckTargetDataVo.java
  63. 6 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/DeviceCheckDataNewVo.java
  64. 5 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/SiteCheckTargetVo.java
  65. 23 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/TargetShowVo.java
  66. 0 7
      sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/WarningInfoVo.java
  67. 1 1
      sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/CheckTargetMapper.xml
  68. 4 0
      sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/DeviceTargetPMapper.xml
  69. 3 1
      sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/SurveySiteMapper.xml
  70. 2 2
      sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/WarningInfoMapper.xml

+ 30 - 0
sxgk-projet/sxgk-data/data-api/pom.xml

@@ -0,0 +1,30 @@
+<?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">
+    <parent>
+        <artifactId>sxgk-data</artifactId>
+        <groupId>com.tofly</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>data-api</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 42 - 0
sxgk-projet/sxgk-data/data-api/src/main/java/com/tofly/api/DeviceCheckDataClient.java

@@ -0,0 +1,42 @@
+package com.tofly.api;
+
+import com.tofly.common.core.entity.ResultRespone;
+import com.tofly.pojo.CheckDataDto;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.validation.Valid;
+
+/**
+ * 消息服务
+ */
+@FeignClient(name = "tofly-sxgk-data",contextId="DeviceCheckDataClient")
+public interface DeviceCheckDataClient {
+
+
+    /**
+     * 水质量数据推送接口
+     * @param dto 数据
+     * @return
+     */
+    @PostMapping("/devicecheckdata/drainageMonitor/push" )
+    ResultRespone drainageMonitoring(@Valid @RequestBody CheckDataDto dto);
+
+    /**
+     * 地表水监测终端数据
+     * @param dto 数据
+     * @return
+     */
+    @PostMapping("/devicecheckdata/floorWater/push" )
+    ResultRespone floorWaterMonitoring(@Valid @RequestBody CheckDataDto dto);
+
+    /**
+     * 水环境光谱智能遥感终端数据
+     * @param dto 数据
+     * @return
+     */
+    @PostMapping("/devicecheckdata/waterEnvior/push" )
+    ResultRespone waterEnvior(@Valid @RequestBody CheckDataDto dto);
+}

+ 104 - 0
sxgk-projet/sxgk-data/data-api/src/main/java/com/tofly/pojo/CheckDataDto.java

@@ -0,0 +1,104 @@
+package com.tofly.pojo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@EqualsAndHashCode
+public class CheckDataDto implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 设备SN码
+     */
+    @ApiModelProperty(value = "设备SN码")
+    private String deviceSn;
+
+    /**
+     * 断面ID
+     */
+    @ApiModelProperty(value = "断面ID",required = true)
+    private String sectionId;
+
+    /**
+     * 断面名称
+     */
+    @ApiModelProperty(value = "断面名称")
+    private String sectionName;
+    /**
+     * 浊度
+     */
+    @ApiModelProperty(value = "浊度")
+    private Double turb;
+    /**
+     * 叶绿素光谱指数 -11
+     */
+    @ApiModelProperty(value = "叶绿素光谱指数 -1 到 1")
+    private Double chl;
+    /**
+     * 水温
+     */
+    @ApiModelProperty(value = "水温")
+    private Double temperature;
+    /**
+     * 溶解氧
+     */
+    @ApiModelProperty(value = "溶解氧")
+    private Double doxygen;
+    /**
+     * 污染状态 0 正常 1 预警 2 轻度 3 中度 4 重度
+     */
+    @ApiModelProperty(value = "污染状态 0 正常 1 预警 2 轻度 3 中度 4 重度 ")
+    private Short pollute;
+    /**
+     * 电导率
+     */
+    @ApiModelProperty(value = "电导率")
+    private Double ec;
+    /**
+     * 化学需氧量
+     */
+    @ApiModelProperty(value = "化学需氧量")
+    private Double cod;
+    /**
+     * TOC
+     */
+    @ApiModelProperty(value = "TOC")
+    private Double toc;
+    /**
+     * 高锰酸盐指数
+     */
+    @ApiModelProperty(value = "高锰酸盐指数")
+    private Double codmn;
+    /**
+     * 悬浮物
+     */
+    @ApiModelProperty(value = "悬浮物")
+    private Double tss;
+    /**
+     * 采集时间
+     */
+    @ApiModelProperty(value = "采集时间",required = true)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date collectionDate;
+    /**
+     * 设备状态 0 正常 1 维护中
+     */
+    @ApiModelProperty(value = "设备状态 0 正常 1 维护中")
+    private Short status;
+
+    /**
+     * 备注
+     */
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+
+}

+ 74 - 0
sxgk-projet/sxgk-data/data-boot/pom.xml

@@ -0,0 +1,74 @@
+<?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">
+    <parent>
+        <artifactId>sxgk-data</artifactId>
+        <groupId>com.tofly</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>data-boot</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+
+        <!-- xxl-job -->
+        <dependency>
+            <groupId>com.xuxueli</groupId>
+            <artifactId>xxl-job-core</artifactId>
+            <version>2.2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.tofly</groupId>
+            <artifactId>notice-api</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.tofly</groupId>
+            <artifactId>survey-api</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.tofly</groupId>
+            <artifactId>common-redis</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-core</artifactId>
+            <version>5.7.10</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.3.2</version>
+        </dependency>
+
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

sxgk-projet/sxgk-data/src/main/java/com/tofly/data/DataApplication.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/DataApplication.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/commons/CommonConstants.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/commons/CommonConstants.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/commons/TipsConstants.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/commons/TipsConstants.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/config/FeignConfig.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/config/FeignConfig.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/config/ParameterConfig.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/config/ParameterConfig.java


+ 27 - 0
sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/controller/CheckDataDayController.java

@@ -0,0 +1,27 @@
+/*
+ * Author: wangjian
+ * 生成controller
+ */
+package com.tofly.data.controller;
+
+import com.tofly.data.service.CheckDataDayService;
+import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 设备检测数据表_天统计
+ *
+ * @author admin
+ * @date Fri Oct 15 00:00:00 CST 2021
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/checkdataday")
+@Api(tags="设备检测数据表_天统计接口")
+public class CheckDataDayController {
+
+    private final  CheckDataDayService checkDataDayService;
+
+}

+ 3 - 2
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/controller/CheckDataHourController.java

@@ -5,9 +5,10 @@
 package com.tofly.data.controller;
 
 import com.tofly.data.service.CheckDataHourService;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
 import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 设备检测数据表_15分钟(按照日期分区)

+ 6 - 13
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/controller/DeviceCheckDataController.java

@@ -5,28 +5,21 @@
 package com.tofly.data.controller;
 
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.tofly.common.core.entity.ResultRespone;
-import com.tofly.common.log.annotation.ToFlyAppLog;
 import com.tofly.data.commons.CommonConstants;
 import com.tofly.data.dto.CheckDataDto;
-import com.tofly.data.entity.DeviceCheckData;
 import com.tofly.data.service.DeviceCheckDataService;
-import com.tofly.pojo.SiteCheckTargetVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
-import java.util.Arrays;
-import java.util.List;
 
 /**
  * 设备检测数据表(按照日期分区)多数据库将根据设备类型、编号分表并按日期分区

+ 0 - 2
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/dto/CheckDataDto.java

@@ -1,13 +1,11 @@
 package com.tofly.data.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.tofly.data.commons.TipsConstants;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springframework.format.annotation.DateTimeFormat;
 
-import javax.validation.constraints.NotEmpty;
 import java.io.Serializable;
 import java.util.Date;
 

sxgk-projet/sxgk-data/src/main/java/com/tofly/data/dto/WarningDataVo.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/dto/WarningDataVo.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/dto/WarningVo.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/dto/WarningVo.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/entity/CheckDataDay.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/entity/CheckDataDay.java


+ 4 - 1
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/entity/CheckDataHour.java

@@ -4,7 +4,10 @@
  */
 package com.tofly.data.entity;
 
-import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;

sxgk-projet/sxgk-data/src/main/java/com/tofly/data/entity/DeviceCheckData.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/entity/DeviceCheckData.java


+ 2 - 2
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/entity/WarningInfo.java

@@ -4,8 +4,8 @@
  */
 package com.tofly.data.entity;
 
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;

sxgk-projet/sxgk-data/src/main/java/com/tofly/data/mapper/CheckDataDayMapper.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/mapper/CheckDataDayMapper.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/mapper/CheckDataHourMapper.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/mapper/CheckDataHourMapper.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/mapper/DeviceCheckDataMapper.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/mapper/DeviceCheckDataMapper.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/CheckDataDayService.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/service/CheckDataDayService.java


+ 3 - 1
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/CheckDataHourService.java

@@ -6,8 +6,8 @@ package com.tofly.data.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.tofly.data.entity.CheckDataHour;
-import com.tofly.data.vo.CheckDataHourVo;
 import com.tofly.data.vo.CheckDataDayVo;
+import com.tofly.data.vo.CheckDataHourVo;
 
 import java.util.Date;
 import java.util.List;
@@ -25,4 +25,6 @@ public interface CheckDataHourService extends IService<CheckDataHour> {
     boolean saveCheckDataHour(List<CheckDataHourVo> checkData);
 
     List<CheckDataDayVo> summaryCheckDataDay(Date maxdate, Date endDate);
+
+    Date minDate();
 }

+ 2 - 0
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/DeviceCheckDataService.java

@@ -28,4 +28,6 @@ public interface DeviceCheckDataService extends IService<DeviceCheckData> {
     List<SiteCheckTargetVo> getSiteCheckTargets();
 
     List<CheckDataHourVo> summaryCheckDataHour(Date date, Date endDate);
+
+    Date minDate();
 }

sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/impl/CheckDataDayServiceImpl.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/service/impl/CheckDataDayServiceImpl.java


+ 9 - 2
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/impl/CheckDataHourServiceImpl.java

@@ -10,14 +10,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.tofly.data.commons.CommonConstants;
 import com.tofly.data.config.ParameterConfig;
 import com.tofly.data.entity.CheckDataHour;
+import com.tofly.data.mapper.CheckDataHourMapper;
 import com.tofly.data.service.CheckDataHourService;
 import com.tofly.data.utils.SnowflakeUtils;
-import com.tofly.data.vo.CheckDataHourVo;
 import com.tofly.data.vo.CheckDataDayVo;
+import com.tofly.data.vo.CheckDataHourVo;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.tofly.data.mapper.CheckDataHourMapper;
 
 import java.util.Date;
 import java.util.List;
@@ -89,4 +89,11 @@ public class CheckDataHourServiceImpl extends ServiceImpl<CheckDataHourMapper, C
         return list;
     }
 
+    @Override
+    public Date minDate() {
+        Date date = this.getObj(new QueryWrapper<CheckDataHour>().select("MIN(COLLECTION_TIME_QUANTUM) as COLLECTION_TIME_QUANTUM")
+                ,(o)->{return (Date)o;} );
+        return date;
+    }
+
 }

+ 12 - 5
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/service/impl/DeviceCheckDataServiceImpl.java

@@ -6,6 +6,8 @@ package com.tofly.data.service.impl;
 
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.tofly.api.SurveySiteClient;
 import com.tofly.api.TidingsClient;
@@ -18,6 +20,7 @@ import com.tofly.data.dto.WarningDataVo;
 import com.tofly.data.dto.WarningVo;
 import com.tofly.data.entity.DeviceCheckData;
 import com.tofly.data.entity.WarningInfo;
+import com.tofly.data.mapper.DeviceCheckDataMapper;
 import com.tofly.data.service.DeviceCheckDataService;
 import com.tofly.data.utils.SnowflakeUtils;
 import com.tofly.data.vo.CheckDataHourVo;
@@ -33,7 +36,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
-import com.tofly.data.mapper.DeviceCheckDataMapper;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalTime;
@@ -287,6 +289,7 @@ public class DeviceCheckDataServiceImpl extends ServiceImpl<DeviceCheckDataMappe
             //缓存最新数据
             DeviceCheckDataNewVo dataNewVo = new DeviceCheckDataNewVo();
             BeanUtils.copyProperties(data,dataNewVo);
+            dataNewVo.setShowVos(vo.getShowVos());
             dataNewVo.setWarningInfos(new ArrayList<>());
             if(warningVo.getWarings()!=null){
                 for (WarningDataVo dataVo:warningVo.getWarings()) {
@@ -305,9 +308,7 @@ public class DeviceCheckDataServiceImpl extends ServiceImpl<DeviceCheckDataMappe
             successnew = template.opsForValue().setIfAbsent(CommonConstants.SITE_NEW_CHEC_DATA_LOCK+vo.getSiteId(), "lock",
                     2000, TimeUnit.MILLISECONDS);
             if(successnew){
-                if(!template.opsForHash().hasKey(CommonConstants.SITE_NEW_CHEC_DATA,String.valueOf(vo.getSiteId()))){
-                    template.opsForHash().put(CommonConstants.SITE_NEW_CHEC_DATA,String.valueOf(vo.getSiteId()),vo);
-                }
+               template.opsForHash().put(CommonConstants.SITE_NEW_CHEC_DATA,String.valueOf(vo.getSiteId()), JSONObject.toJSONString(vo));
             }
         }catch (Exception e){
             log.error("redis error",e);
@@ -361,7 +362,6 @@ public class DeviceCheckDataServiceImpl extends ServiceImpl<DeviceCheckDataMappe
                 warningDataVo.setTargetUnit(r.getTargetUnit());
                 warningDataVo.setLowerLimit(r.getLowerLimit());
                 warningDataVo.setUpperLimit(r.getUpperLimit());
-                warningDataVo.setIsshow(r.getIsshow());
                 warningDataVo.setIshighest(CommonConstants.ZERO_SHORT);
                 warningVo.getWarings().add(warningDataVo);
             }else {
@@ -539,5 +539,12 @@ public class DeviceCheckDataServiceImpl extends ServiceImpl<DeviceCheckDataMappe
         return list;
     }
 
+    @Override
+    public Date minDate() {
+        Date date = this.getObj(new QueryWrapper<DeviceCheckData>().select("MIN(COLLECTION_DATE) as COLLECTION_DATE")
+                ,(o)->{return (Date)o;} );
+        return date;
+    }
+
 
 }

+ 18 - 9
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/task/sendDataTask.java

@@ -2,11 +2,11 @@ package com.tofly.data.task;
 
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
-import com.tofly.data.service.CheckDataHourService;
 import com.tofly.data.service.CheckDataDayService;
+import com.tofly.data.service.CheckDataHourService;
 import com.tofly.data.service.DeviceCheckDataService;
-import com.tofly.data.vo.CheckDataHourVo;
 import com.tofly.data.vo.CheckDataDayVo;
+import com.tofly.data.vo.CheckDataHourVo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -31,17 +31,21 @@ public class sendDataTask {
      * 1小时一次汇总数据
      */
     //@XxlJob("checkDataHourtask")
-    //@Scheduled(cron = "0 5 * * * ?")
+    //@Scheduled(cron = "0 0/5 * * * ?")
+    @Scheduled(cron = "0 5 * * * ?")
     public void checkDataHourtask(){
         //获取1小时钟最大采集时间
         boolean isrun = true;
+        Date datetime = new Date();
+        Date maxdate = checkDataHourService.maxDate();
+        if (maxdate != null) {
+            maxdate = DateUtil.offsetHour(maxdate, 1);
+        }else {
+            maxdate = deviceCheckDataService.minDate();
+        }
         while (isrun) {
-            Date maxdate = checkDataHourService.maxDate();
-            Date datetime = new Date();
             Date endDate = DateUtil.beginOfHour(datetime);
-            if (maxdate != null) {
-                maxdate = DateUtil.offsetHour(maxdate, 1);
-            }
+
             long betweenDay = DateUtil.between(maxdate, endDate, DateUnit.DAY);
             if (betweenDay > 2) {
                 endDate = DateUtil.offsetDay(maxdate, 2);
@@ -56,6 +60,8 @@ public class sendDataTask {
                     return;
                 }
             }
+            maxdate = endDate;
+
         }
         log.info("checkDataHourtask执行完成");
     }
@@ -64,7 +70,8 @@ public class sendDataTask {
      * 每天一次汇总数据
      */
     //@XxlJob("dataDayTask")
-    //@Scheduled(cron = "0 0 1 * * ?")
+    //@Scheduled(cron = "0 0/10 * * * ?")
+    @Scheduled(cron = "0 0 1 * * ?")
     public void dataDayTask(){
         Date maxdate = checkDataDayService.maxDate();
         Date datetime = new Date();
@@ -74,6 +81,8 @@ public class sendDataTask {
         //开始时间
         if(maxdate!=null){
             maxdate = DateUtil.offsetDay(maxdate,1);
+        }else {
+            maxdate = checkDataHourService.minDate();
         }
         List<CheckDataDayVo> checkData = checkDataHourService.summaryCheckDataDay(maxdate,endDate);
 

sxgk-projet/sxgk-data/src/main/java/com/tofly/data/utils/SnowflakeUtils.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/utils/SnowflakeUtils.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/vo/CheckDataDayVo.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/CheckDataDayVo.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/vo/CheckDataHourVo.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/CheckDataHourVo.java


sxgk-projet/sxgk-data/src/main/java/com/tofly/data/vo/CheckDataVo.java → sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/CheckDataVo.java


+ 6 - 1
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/vo/DeviceCheckDataNewVo.java

@@ -1,6 +1,7 @@
 package com.tofly.data.vo;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.tofly.pojo.TargetShowVo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -50,7 +51,11 @@ public class DeviceCheckDataNewVo extends CheckDataVo {
      */
     @ApiModelProperty(value = "设备状态 0 正常 1 维护中")
     private Short status;
-
+    /**
+     * 指标显示与否
+     */
+    @ApiModelProperty(value = "指标显示与否")
+    private List<TargetShowVo> showVos;
     /**
      * 告警信息
      */

+ 24 - 0
sxgk-projet/sxgk-data/data-boot/src/main/java/com/tofly/data/vo/TargetShowVo.java

@@ -0,0 +1,24 @@
+package com.tofly.data.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+@Data
+@EqualsAndHashCode
+public class TargetShowVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 指标字段名
+     */
+    @ApiModelProperty(value = "指标字段名")
+    private String targetCode;
+
+    /**
+     * 是否显示0否,1
+     */
+    @ApiModelProperty(value = "是否显示0否,1是")
+    private Short isshow;
+}

+ 0 - 9
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/vo/WarningInfoVo.java

@@ -1,7 +1,5 @@
 package com.tofly.data.vo;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -98,11 +96,4 @@ public class WarningInfoVo implements Serializable {
     private String warningValue;
 
 
-    /**
-     * 是否显示
-     */
-    @ApiModelProperty(value = "是否显示")
-    private Short isshow;
-
-
 }

sxgk-projet/sxgk-data/src/main/resources/bootstrap-test.yml → sxgk-projet/sxgk-data/data-boot/src/main/resources/bootstrap-test.yml


sxgk-projet/sxgk-data/src/main/resources/bootstrap.yml → sxgk-projet/sxgk-data/data-boot/src/main/resources/bootstrap.yml


sxgk-projet/sxgk-data/src/main/resources/logback-spring.xml → sxgk-projet/sxgk-data/data-boot/src/main/resources/logback-spring.xml


sxgk-projet/sxgk-data/src/main/resources/mapper/CheckDataDayMapper.xml → sxgk-projet/sxgk-data/data-boot/src/main/resources/mapper/CheckDataDayMapper.xml


sxgk-projet/sxgk-data/src/main/resources/mapper/CheckDataHourMapper.xml → sxgk-projet/sxgk-data/data-boot/src/main/resources/mapper/CheckDataHourMapper.xml


+ 1 - 1
sxgk-projet/sxgk-data/src/main/resources/mapper/DeviceCheckDataMapper.xml

@@ -53,7 +53,7 @@
         </if>
               GROUP BY SITE_ID,DEVICE_ID,DATE_HOUR )t
               LEFT JOIN (
-            SELECT AVG(TURB) AS TURB,AVG(CHL) CHL,AVG(TEMPERATURE) TEMPERATURE,AVG(DOXYGEN) DOXYGEN,MAX(POLLUTE) POLLUTE,AVG(EC) EC,AVG(COD) COD,AVG(TOC) TOC,AVG(CODMN) CODMN,AVG(TSS) TSS,COUNT(ID) DATA_NUMBER ,SITE_ID,DEVICE_ID,DATE_HOUR
+            SELECT round(AVG(TURB),3) AS TURB,round(AVG(CHL),3) CHL,round(AVG(TEMPERATURE),3) TEMPERATURE,round(AVG(DOXYGEN),3) DOXYGEN,MAX(POLLUTE) POLLUTE,round(AVG(EC),3) EC,round(AVG(COD),3) COD,round(AVG(TOC),3) TOC,round(AVG(CODMN),3) CODMN,round(AVG(TSS),3) TSS,COUNT(ID) DATA_NUMBER ,SITE_ID,DEVICE_ID,DATE_HOUR
             FROM TF_YWPN_DEVICE_CHECK_DATA_W  WHERE ISVALID = 0 AND SITE_ID > 0
             AND <![CDATA[ COLLECTION_DATE < #{endDate}   ]]>
            <if test="date != null ">

+ 5 - 49
sxgk-projet/sxgk-data/pom.xml

@@ -11,6 +11,11 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>sxgk-data</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>data-api</module>
+        <module>data-boot</module>
+    </modules>
 
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
@@ -19,40 +24,6 @@
 
     <dependencies>
 
-        <!-- xxl-job -->
-        <dependency>
-            <groupId>com.xuxueli</groupId>
-            <artifactId>xxl-job-core</artifactId>
-            <version>2.2.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.tofly</groupId>
-            <artifactId>notice-api</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.tofly</groupId>
-            <artifactId>survey-api</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.tofly</groupId>
-            <artifactId>common-redis</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>cn.hutool</groupId>
-            <artifactId>hutool-core</artifactId>
-            <version>5.7.10</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.3.2</version>
-        </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
@@ -60,20 +31,5 @@
     </dependencies>
 
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
 
 </project>

+ 0 - 36
sxgk-projet/sxgk-data/src/main/java/com/tofly/data/controller/CheckDataDayController.java

@@ -1,36 +0,0 @@
-/*
- * Author: wangjian
- * 生成controller
- */
-package com.tofly.data.controller;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.tofly.common.core.entity.ResultRespone;
-import com.tofly.common.log.annotation.ToFlyAppLog;
-import com.tofly.data.entity.CheckDataDay;
-import com.tofly.data.service.CheckDataDayService;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import org.springframework.web.bind.annotation.ModelAttribute;
-
-import java.util.Arrays;
-/**
- * 设备检测数据表_天统计
- *
- * @author admin
- * @date Fri Oct 15 00:00:00 CST 2021
- */
-@RestController
-@AllArgsConstructor
-@RequestMapping("/checkdataday")
-@Api(tags="设备检测数据表_天统计接口")
-public class CheckDataDayController {
-
-    private final  CheckDataDayService checkDataDayService;
-
-}

+ 9 - 0
sxgk-projet/sxgk-notice/notice-boot/pom.xml

@@ -27,6 +27,15 @@
             <artifactId>common-redis</artifactId>
             <version>1.0.0</version>
         </dependency>
+        <dependency>
+            <groupId>com.tofly</groupId>
+            <artifactId>survey-api</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 4 - 0
sxgk-projet/sxgk-notice/notice-boot/src/main/java/com/tofly/notice/NoticeApplication.java

@@ -1,9 +1,13 @@
 package com.tofly.notice;
 
 import com.tofly.baseapi.config.ToflyWebColudApplication;
+import com.tofly.notice.config.FeignConfig;
 import org.springframework.boot.SpringApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
 
 @ToflyWebColudApplication
+@EnableFeignClients(basePackages ={"com.tofly.api"},defaultConfiguration = {FeignConfig.class})
 public class NoticeApplication {
     public static void main(String[] args) {
         SpringApplication.run(NoticeApplication.class, args);

+ 56 - 0
sxgk-projet/sxgk-notice/notice-boot/src/main/java/com/tofly/notice/config/FeignConfig.java

@@ -0,0 +1,56 @@
+package com.tofly.notice.config;
+
+import com.alibaba.fastjson.JSON;
+import feign.Request;
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Field;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+public class FeignConfig implements RequestInterceptor {
+    @Override
+    public void apply(RequestTemplate requestTemplate) {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+        //添加token
+        requestTemplate.header("Authorization", request.getHeader("Authorization"));
+        //将body的数据写入参数
+        if("GET".equals(requestTemplate.method())){
+            try{
+                //获取body内容
+                String json = requestTemplate.requestBody().asString();
+                if (StringUtils.isEmpty(json)) {
+                    return ;
+                }
+                Map<String, Object> map= JSON.parseObject(json);
+                Set<String> set = map.keySet();
+                Iterator<String> it = set.iterator();
+                while (it.hasNext()) {
+                    String key = (String) it.next();
+                    Object values = map.get(key);
+                    if (values!=null && !"".equals(values) && !"null".equals(values)) {
+                        //将body的参数写入queries
+                        requestTemplate.query(key,values.toString());
+                    }
+                }
+                Class requestClass=requestTemplate.getClass();
+                Field field = requestClass.getDeclaredField("body");
+                field.setAccessible(true);
+                //修改body为空。
+                field.set(requestTemplate, Request.Body.empty());
+            }catch (Exception e){
+
+            }
+
+
+        }
+
+    }
+}

+ 69 - 5
sxgk-projet/sxgk-notice/notice-boot/src/main/java/com/tofly/notice/service/impl/TidingsServiceImpl.java

@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.tofly.api.WarningInfoClient;
+import com.tofly.common.core.entity.ResultRespone;
 import com.tofly.common.oauth.util.SecurityUtils;
 import com.tofly.notice.commons.CommonConstants;
 import com.tofly.notice.config.ParameterConfig;
@@ -17,6 +19,7 @@ import com.tofly.notice.dto.TidingsSavtDto;
 import com.tofly.notice.entity.Tidings;
 import com.tofly.notice.service.TidingsService;
 import com.tofly.notice.utils.SnowflakeUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,6 +37,7 @@ import java.util.stream.Collectors;
  * @author xqf
  * @date Fri Oct 08 00:00:00 CST 2021
  */
+@Slf4j
 @Service("tidingsService")
 public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> implements TidingsService {
 
@@ -42,6 +46,8 @@ public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> impl
      */
     @Autowired
     private ParameterConfig parameterConfig;
+    @Autowired
+    private WarningInfoClient warningInfoClient;
     /**
      * 查询消息列表
      * @param page 分页
@@ -78,6 +84,19 @@ public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> impl
 
     @Override
     public boolean signRead(Long projectId) {
+
+        List<Long> list = this.listObjs(new QueryWrapper<Tidings>().select("distinct DATA_ID ").lambda().eq(Tidings::getProjectId,projectId)
+                .eq(Tidings::getIsreceive,CommonConstants.ZERO_SHORT).and(r->r.eq(Tidings::getReceiveUser, SecurityUtils.getUserId())
+                        .or(j->j.isNull(Tidings::getReceiveUser).in(Tidings::getReceiveRole,SecurityUtils.getRoles()))
+                        //3、未指定接收人及角色
+                        .or(j->j.isNull(Tidings::getReceiveUser).isNull(Tidings::getReceiveRole)))
+                ,o -> {
+                    return Long.parseLong(String.valueOf(o));
+                });
+        if(!signReadWarning(list)){
+            return false;
+        }
+
         return this.update(new UpdateWrapper<Tidings>().lambda().set(Tidings::getIsreceive,CommonConstants.ONE_SHORT)
                 .set(Tidings::getHandleUser,SecurityUtils.getUserId()).set(Tidings::getHandleTime,new Date())
                 .eq(Tidings::getProjectId,projectId)
@@ -87,6 +106,21 @@ public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> impl
                         .or(j->j.isNull(Tidings::getReceiveUser).isNull(Tidings::getReceiveRole))));
     }
 
+    /**
+     * 调用接口修改告警状态
+     * @param list
+     * @return
+     */
+    private boolean signReadWarning(List<Long> list){
+        if(list!=null&&!list.isEmpty()) {
+            String ids = StringUtils.join(list,",");
+            ResultRespone respone = warningInfoClient.warningSignRead(ids);
+            if(respone!=null){
+               return (boolean) respone.getResult();
+            }
+        }
+        return false;
+    }
 
     /**
      * 保存消息
@@ -112,6 +146,14 @@ public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> impl
      */
     @Override
     public boolean readTidings(Long id) {
+        Long dataid = this.getObj(new QueryWrapper<Tidings>().select("distinct DATA_ID ").lambda().eq(Tidings::getId,id)
+                        .eq(Tidings::getIsreceive,CommonConstants.ZERO_SHORT)
+                ,o -> {
+                    return Long.parseLong(String.valueOf(o));
+                });
+        if(!signReadWarning(Arrays.asList(dataid))){
+            return false;
+        }
         return this.update(new UpdateWrapper<Tidings>().lambda().set(Tidings::getIsreceive,CommonConstants.ONE_SHORT)
                 .set(Tidings::getHandleUser,SecurityUtils.getUserId()).set(Tidings::getHandleTime,new Date())
                 .eq(Tidings::getId,id).eq(Tidings::getIsreceive,CommonConstants.ZERO_SHORT));
@@ -125,9 +167,25 @@ public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> impl
     @Override
     public Object batchReadTidings(String ids) {
         try {
-            List<Integer> list_id = strToListInt(ids);
+            List<Long> list_id = strToListInt(ids);
+            if(list_id==null||list_id.isEmpty()){
+                return false;
+            }
+            List<Long> list = this.listObjs(new QueryWrapper<Tidings>().select("distinct DATA_ID ").lambda()
+                    .eq(list_id.size()==1,Tidings::getId,list_id.get(0))
+                    .in(list_id.size()>1,Tidings::getId,list_id)
+                    .eq(Tidings::getIsreceive,CommonConstants.ZERO_SHORT)
+                    ,o -> {
+                        return Long.parseLong(String.valueOf(o));
+                    });
+            if(!signReadWarning(list)){
+                return false;
+            }
+
             return this.baseMapper.update(new Tidings(),new UpdateWrapper<Tidings>().lambda().set(Tidings::getIsreceive,CommonConstants.ONE_SHORT)
-                    .set(Tidings::getHandleUser,SecurityUtils.getUserId()).set(Tidings::getHandleTime,new Date()).in(Tidings::getId,list_id)
+                    .set(Tidings::getHandleUser,SecurityUtils.getUserId()).set(Tidings::getHandleTime,new Date())
+                    .eq(list_id.size()==1,Tidings::getId,list_id.get(0))
+                    .in(list_id.size()>1,Tidings::getId,list_id)
                     .eq(Tidings::getIsreceive,CommonConstants.ZERO_SHORT));
         }catch (Exception e){
             log.error("异常:",e);
@@ -138,7 +196,13 @@ public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> impl
     @Override
     public Object batchDataReadTidings(String ids) {
         try {
-            List<Integer> list_id = strToListInt(ids);
+            List<Long> list_id = strToListInt(ids);
+            if(list_id==null||list_id.isEmpty()){
+                return false;
+            }
+            if(!signReadWarning(list_id)){
+                return false;
+            }
             return this.baseMapper.update(new Tidings(),new UpdateWrapper<Tidings>().lambda().set(Tidings::getIsreceive,CommonConstants.ONE_SHORT)
                     .set(Tidings::getHandleUser,SecurityUtils.getUserId()).set(Tidings::getHandleTime,new Date()).in(Tidings::getDataId,list_id)
                     .eq(Tidings::getIsreceive,CommonConstants.ZERO_SHORT));
@@ -154,9 +218,9 @@ public class TidingsServiceImpl extends ServiceImpl<TidingsMapper, Tidings> impl
      * @param str
      * @return
      */
-    public static List<Integer> strToListInt(String str){
+    public static List<Long> strToListInt(String str){
         List<String> strs = Arrays.asList(str.split(CommonConstants.CSV));
-        return strs.stream().map(st->Integer.parseInt(st)).collect(Collectors.toList());
+        return strs.stream().map(st->Long.parseLong(st)).collect(Collectors.toList());
     }
 
 

+ 10 - 0
sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/api/SurveySiteClient.java

@@ -15,9 +15,19 @@ import org.springframework.web.bind.annotation.RequestParam;
 @FeignClient(name = "tofly-sxgk-survey",contextId="SurveySiteClient")
 public interface SurveySiteClient {
 
+    /**
+     * 根据设备sn或站点切面id 查询站点详情
+     * @param deviceSn 设备sn
+     * @param sectionId 站点切面id
+     * @return
+     */
     @PostMapping("/surveysite/siteTarget" )
     ResultRespone getSiteCheckTarget(@RequestParam(value = "deviceSn",required = false)String deviceSn,@RequestParam(value = "sectionId",required = false) String sectionId);
 
+    /**
+     * 获取所有站点详情
+     * @return
+     */
     @GetMapping("/surveysite/targets")
     ResultRespone getSiteCheckTargets();
 }

+ 10 - 0
sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/api/WarningInfoClient.java

@@ -1,6 +1,9 @@
 package com.tofly.api;
 
+import com.tofly.common.core.entity.ResultRespone;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * 修改告警状态
@@ -8,4 +11,11 @@ import org.springframework.cloud.openfeign.FeignClient;
 @FeignClient(name = "tofly-sxgk-survey",contextId="WarningInfoClient")
 public interface WarningInfoClient {
 
+    /**
+     * 根据监测数据id标记告警信息全部已读
+     * @param ids 监测数据id集合字符串,用逗号分隔
+     * @return
+     */
+    @PostMapping("/warninginfo/warningSignRead")
+    ResultRespone warningSignRead(@RequestParam(value = "ids",required = true)String ids);
 }

+ 0 - 6
sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/pojo/CheckTargetDataVo.java

@@ -32,10 +32,4 @@ public class CheckTargetDataVo extends CheckTargetVo{
     @ApiModelProperty(value = "告警value")
     private String warningValue;
 
-    /**
-     * 是否显示
-     */
-    @ApiModelProperty(value = "是否显示")
-    private Short isshow;
-
 }

+ 5 - 1
sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/pojo/SiteCheckTargetVo.java

@@ -84,7 +84,11 @@ public class SiteCheckTargetVo implements Serializable {
      */
     @ApiModelProperty(value = "设备名称")
     private String deviceName;
-
+    /**
+     * 指标显示与否
+     */
+    @ApiModelProperty(value = "指标显示与否")
+    private List<TargetShowVo> showVos;
 
     /**
      * 指标集合

+ 24 - 0
sxgk-projet/sxgk-survey/survey-api/src/main/java/com/tofly/pojo/TargetShowVo.java

@@ -0,0 +1,24 @@
+package com.tofly.pojo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+@Data
+@EqualsAndHashCode
+public class TargetShowVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 指标字段名
+     */
+    @ApiModelProperty(value = "指标字段名")
+    private String targetCode;
+
+    /**
+     * 是否显示0否,1
+     */
+    @ApiModelProperty(value = "是否显示0否,1是")
+    private Short isshow;
+}

+ 7 - 3
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/construct/InitializeDataConstruct.java

@@ -2,6 +2,7 @@ package com.tofly.survey.construct;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.tofly.survey.commons.CommonConstants;
 import com.tofly.survey.service.CheckDataDayService;
 import com.tofly.survey.service.DeviceCheckDataService;
@@ -31,9 +32,8 @@ public class InitializeDataConstruct {
 
     @Autowired
     private SurveySiteService siteService;
-    @Qualifier("redisTemplate")
     @Autowired
-    private RedisTemplate template;
+    private StringRedisTemplate template;
     @Autowired
     private DeviceCheckDataService deviceCheckDataService;
 
@@ -45,6 +45,8 @@ public class InitializeDataConstruct {
     public void init(){
         log.info("===================================================================================");
 
+        //TODO 以后需要注调清理
+        //template.delete(CommonConstants.SITE_DATA_SUMMARY);
         if(!template.hasKey(CommonConstants.SITE_DATA_SUMMARY)){
             Boolean success = template.opsForValue().setIfAbsent(CommonConstants.SITE_DATA_SUMMARY_LOCK, "lock",
                     2000, TimeUnit.MILLISECONDS);
@@ -61,6 +63,8 @@ public class InitializeDataConstruct {
             }
             template.delete(CommonConstants.SITE_DATA_SUMMARY_LOCK);
         }
+        //TODO 以后需要注调清理
+        //template.delete(CommonConstants.SITE_NEW_CHEC_DATA);
         List<DeviceCheckDataNewVo> vos = deviceCheckDataService.getAllSiteNewData(null);
         for (DeviceCheckDataNewVo vo:vos) {
             if(!template.opsForHash().hasKey(CommonConstants.SITE_NEW_CHEC_DATA,String.valueOf(vo.getSiteId()))){
@@ -76,7 +80,7 @@ public class InitializeDataConstruct {
                     2000, TimeUnit.MILLISECONDS);
             if(successnew){
                 if(!template.opsForHash().hasKey(CommonConstants.SITE_NEW_CHEC_DATA,String.valueOf(vo.getSiteId()))){
-                    template.opsForHash().put(CommonConstants.SITE_NEW_CHEC_DATA,String.valueOf(vo.getSiteId()),vo);
+                    template.opsForHash().put(CommonConstants.SITE_NEW_CHEC_DATA,String.valueOf(vo.getSiteId()), JSONObject.toJSONString(vo));
                 }
             }
         }catch (Exception e){

+ 21 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/controller/WarningInfoController.java

@@ -11,6 +11,7 @@ import com.tofly.common.core.entity.ResultRespone;
 import com.tofly.common.log.annotation.ToFlyAppLog;
 import com.tofly.survey.commons.CommonConstants;
 import com.tofly.survey.commons.Constant;
+import com.tofly.survey.commons.TipsConstants;
 import com.tofly.survey.context.ExcelStrategyContext;
 import com.tofly.survey.dto.WarningInfoListDto;
 import com.tofly.survey.em.ExcelExportFileTypeEnum;
@@ -19,6 +20,7 @@ import com.tofly.survey.service.WarningInfoService;
 import com.tofly.survey.utils.ExcelUtil;
 import com.tofly.survey.vo.WarningInfoListVo;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -129,6 +131,25 @@ public class WarningInfoController {
       return ResultRespone.success(warningInfoService.removeById(id));
     }
 
+    /**
+     * 告警已读,根据检验数据ID标记关联所有消息已读
+     * @param ids id
+     * @return ResultRespone
+     */
+    @ToFlyAppLog(title="告警已读,根据检验数据ID标记关联所有消息已读" )
+    @ApiOperation(value = "告警已读,根据检验数据ID标记关联所有消息已读")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "ids", value = "批量标记,多个id以逗号隔开", required = true, dataType = "String")
+    })
+    @PostMapping("/warningSignRead")
+    public ResultRespone warningSignRead(@RequestParam(value = "ids",required = false)String ids){
+        if(StringUtils.isEmpty(ids)){
+            return ResultRespone.failed(TipsConstants.ID_ISNULL);
+        }
+        return ResultRespone.success(warningInfoService.warningSignRead(ids));
+    }
+
+
     /**
      * 通过id批量删除设备告警信息表
      * @param ids id

+ 3 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/mapper/DeviceTargetPMapper.java

@@ -6,6 +6,7 @@ package com.tofly.survey.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.tofly.survey.entity.DeviceTargetP;
+import com.tofly.survey.vo.TargetShowVo;
 import org.apache.ibatis.annotations.Param;
 
 
@@ -18,4 +19,6 @@ import java.util.List;
  */
 public interface DeviceTargetPMapper extends BaseMapper<DeviceTargetP> {
     String getTargetStr(@Param("deviceID") Long deviceID);
+
+    List<TargetShowVo> getDeviceTarget(@Param("deviceType") Long deviceType);
 }

+ 5 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/DeviceTargetPService.java

@@ -8,6 +8,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.tofly.survey.dto.DeviceTargetPPutDto;
 import com.tofly.survey.dto.DeviceTargetPSaveDto;
 import com.tofly.survey.entity.DeviceTargetP;
+import com.tofly.survey.vo.TargetShowVo;
+
+import java.util.List;
 
 /**
  * 设备指标
@@ -28,4 +31,6 @@ public interface DeviceTargetPService extends IService<DeviceTargetP> {
     Object updateRemoveByIds(String ids);
 
     String getTargetStr(Long deviceType);
+
+    List<TargetShowVo> getDeviceTarget(Long deviceType);
 }

+ 2 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/WarningInfoService.java

@@ -29,4 +29,6 @@ public interface WarningInfoService extends IService<WarningInfo> {
     List<DeviceCheckData> selectWaterfllor(Long i, Long i1);
 
     Object data();
+
+    boolean warningSignRead(String ids);
 }

+ 24 - 4
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/impl/DeviceCheckDataServiceImpl.java

@@ -7,6 +7,7 @@ package com.tofly.survey.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -60,13 +61,17 @@ public class DeviceCheckDataServiceImpl extends ServiceImpl<DeviceCheckDataMappe
      */
     @Autowired
     private WarningInfoService warningInfoService;
+    /**
+     * 设备指标
+     */
+    @Autowired
+    private DeviceTargetPService deviceTargetPService;
 
     /**
      * redis
      */
-    @Qualifier("redisTemplate")
     @Autowired
-    private RedisTemplate template;
+    private StringRedisTemplate template;
 
     /**
      * 批量设置数据无效
@@ -208,12 +213,15 @@ public class DeviceCheckDataServiceImpl extends ServiceImpl<DeviceCheckDataMappe
             list_id = StrToArrayUtil.strToListLong(sites);
         }
         List<DeviceCheckDataNewVo> dataNewVos = new ArrayList<>();
-        Map<String,DeviceCheckDataNewVo> map = template.opsForHash().entries(CommonConstants.SITE_NEW_CHEC_DATA);
+        Map<Object, Object> map = template.opsForHash().entries(CommonConstants.SITE_NEW_CHEC_DATA);
         if(list_id!=null&&!list_id.isEmpty()) {
             for (Long id:list_id  ){
                 String key = String.valueOf(id);
                 if(map.containsKey(key)){
-                    dataNewVos.add(map.get(key));
+                    String value = (String) map.get(key);
+                    if(StringUtils.isNotEmpty(value)){
+                        dataNewVos.add(JSONObject.parseObject(value,DeviceCheckDataNewVo.class));
+                    }
                 }
             }
         }
@@ -230,6 +238,18 @@ public class DeviceCheckDataServiceImpl extends ServiceImpl<DeviceCheckDataMappe
             list_id = StrToArrayUtil.strToListLong(sites);
         }
         List<DeviceCheckDataNewVo> vos = this.baseMapper.getAllSiteNewData(null,list_id);
+        Map<Long,List<TargetShowVo>> map = new HashMap<>();
+        for (DeviceCheckDataNewVo vo: vos ) {
+            Long device_type_id = vo.getDeviceType();
+            if(map.containsKey(device_type_id)){
+                vo.setShowVos(map.get(device_type_id));
+            }else {
+                List<TargetShowVo> showVos = deviceTargetPService.getDeviceTarget(vo.getDeviceType());
+                map.put(device_type_id,showVos);
+                vo.setShowVos(showVos);
+            }
+
+        }
         return vos;
     }
 

+ 6 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/impl/DeviceTargetPServiceImpl.java

@@ -19,6 +19,7 @@ import com.tofly.survey.service.DeviceTargetPService;
 import com.tofly.survey.service.DeviceTypePService;
 import com.tofly.survey.service.TargetDictionaryPService;
 import com.tofly.survey.utils.StrToArrayUtil;
+import com.tofly.survey.vo.TargetShowVo;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -148,4 +149,9 @@ public class DeviceTargetPServiceImpl extends ServiceImpl<DeviceTargetPMapper, D
     public String getTargetStr(Long deviceID) {
         return this.baseMapper.getTargetStr(deviceID);
     }
+
+    @Override
+    public List<TargetShowVo> getDeviceTarget(Long deviceType) {
+        return this.baseMapper.getDeviceTarget(deviceType);
+    }
 }

+ 29 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/service/impl/WarningInfoServiceImpl.java

@@ -5,14 +5,19 @@
 package com.tofly.survey.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.tofly.common.oauth.util.SecurityUtils;
+import com.tofly.survey.commons.CommonConstants;
 import com.tofly.survey.dto.WarningInfoListDto;
 import com.tofly.survey.entity.DeviceCheckData;
 import com.tofly.survey.entity.WarningInfo;
 import com.tofly.survey.service.WarningInfoService;
+import com.tofly.survey.utils.StrToArrayUtil;
 import com.tofly.survey.vo.WarningInfoListVo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.ParseException;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -27,6 +32,7 @@ import org.springframework.stereotype.Service;
 import com.tofly.survey.mapper.WarningInfoMapper;
 
 import java.io.IOException;
+import java.util.Date;
 import java.util.List;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -75,6 +81,29 @@ public class WarningInfoServiceImpl extends ServiceImpl<WarningInfoMapper, Warni
         return null;
     }
 
+    /**
+     * 根据数据id标记告警已读
+     * @param ids
+     * @return
+     */
+    @Override
+    public boolean warningSignRead(String ids) {
+        List<Long> list_id = null;
+        if(StringUtils.isNotEmpty(ids)) {
+            list_id = StrToArrayUtil.strToListLong(ids);
+        }
+        if(list_id==null||list_id.isEmpty()){
+            return false;
+        }
+        return this.update(new UpdateWrapper<WarningInfo>().lambda()
+                .set(WarningInfo::getHandleState, CommonConstants.ONE_SHORT)
+                .set(WarningInfo::getHandleUser, SecurityUtils.getUserId())
+                .set(WarningInfo::getHandleTime,new Date())
+                .eq(WarningInfo::getHandleState, CommonConstants.ZERO_SHORT)
+                .eq(list_id.size() == 1,WarningInfo::getCheckDataId,list_id.get(0))
+                .in(list_id.size()>1,WarningInfo::getCheckDataId,list_id));
+    }
+
     class DataRun implements Runnable{
         int beg ;
         int end;

+ 0 - 5
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/CheckTargetDataVo.java

@@ -29,11 +29,6 @@ public class CheckTargetDataVo extends CheckTargetVo{
      */
     @ApiModelProperty(value = "告警value")
     private String warningValue;
-    /**
-     * 是否显示
-     */
-    @ApiModelProperty(value = "是否显示")
-    private Short isshow;
 
 
 }

+ 6 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/DeviceCheckDataNewVo.java

@@ -55,6 +55,12 @@ public class DeviceCheckDataNewVo extends CheckDataVo {
     @ApiModelProperty(value = "设备状态 0 正常 1 维护中")
     private Short status;
 
+    /**
+     * 指标显示与否
+     */
+    @ApiModelProperty(value = "指标显示与否")
+    private List<TargetShowVo> showVos;
+
     /**
      * 告警信息
      */

+ 5 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/SiteCheckTargetVo.java

@@ -85,6 +85,11 @@ public class SiteCheckTargetVo implements Serializable {
     @ApiModelProperty(value = "设备名称")
     private String deviceName;
 
+    /**
+     * 指标显示与否
+     */
+    @ApiModelProperty(value = "指标显示与否")
+    private List<TargetShowVo> showVos;
 
     /**
      * 指标集合

+ 23 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/TargetShowVo.java

@@ -0,0 +1,23 @@
+package com.tofly.survey.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+@Data
+@EqualsAndHashCode
+public class TargetShowVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 指标字段名
+     */
+    @ApiModelProperty(value = "指标字段名")
+    private String targetCode;
+
+    /**
+     * 是否显示0否,1
+     */
+    @ApiModelProperty(value = "是否显示0否,1是")
+    private Short isshow;
+}

+ 0 - 7
sxgk-projet/sxgk-survey/survey-boot/src/main/java/com/tofly/survey/vo/WarningInfoVo.java

@@ -99,11 +99,4 @@ public class WarningInfoVo  implements Serializable {
     @ApiModelProperty(value = "预警value")
     private String warningValue;
 
-    /**
-     * 是否显示
-     */
-    @ApiModelProperty(value = "是否显示")
-    private Short isshow;
-
-
 }

+ 1 - 1
sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/CheckTargetMapper.xml

@@ -63,7 +63,7 @@
     </select>
 
     <select id="getSiteCheckDataTarget" resultType="com.tofly.survey.vo.CheckTargetDataVo">
-        SELECT t.ID,t.TARGET_UNIT,t.TARGET_ID,t.UPPER_LIMIT,t.LOWER_LIMIT,t.BIGIN_TIME,t.END_TIME,t.WARNING_LEVEL,t.WARNING_NAME,t.ISTIDINGS,t.ISSTART,d.TARGET_NAME,d.TARGET_MIN,d.TARGET_MAX,d.TARGET_CODE,c.VALUE as WARNING_VALUE,,d.ISSHOW
+        SELECT t.ID,t.TARGET_UNIT,t.TARGET_ID,t.UPPER_LIMIT,t.LOWER_LIMIT,t.BIGIN_TIME,t.END_TIME,t.WARNING_LEVEL,t.WARNING_NAME,t.ISTIDINGS,t.ISSTART,d.TARGET_NAME,d.TARGET_MIN,d.TARGET_MAX,d.TARGET_CODE,c.VALUE as WARNING_VALUE
         FROM TF_YWPN_CHECK_TARGET_W t
         LEFT JOIN TF_YWPN_DEVICE_TARGET_P d ON(t.TARGET_ID = d.ID)
         LEFT JOIN TF_SXGK_SMS.TF_SMPN_CODE_X c ON (t.WARNING_LEVEL = c.ID)

+ 4 - 0
sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/DeviceTargetPMapper.xml

@@ -30,5 +30,9 @@
         SELECT wm_concat(TARGET_NAME)  from TF_YWPN_DEVICE_TARGET_P WHERE TYPE_ID = #{deviceID}
     </select>
 
+    <select id="getDeviceTarget" resultType="com.tofly.survey.vo.TargetShowVo">
+        SELECT TARGET_CODE,ISSHOW FROM TF_YWPN_DEVICE_TARGET_P WHERE TYPE_ID = #{deviceType}
+    </select>
+
 
 </mapper>

+ 3 - 1
sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/SurveySiteMapper.xml

@@ -184,6 +184,8 @@
         <result property="deviceCode" column="DEVICE_CODE"/>
         <result property="deviceSn" column="DEVICE_SN"/>
         <result property="deviceName" column="DEVICE_NAME"/>
+        <association property="showVos" column="DEVICE_TYPE"
+                     select="com.tofly.survey.mapper.DeviceTargetPMapper.getDeviceTarget"></association>
         <association property="targets" column="ID"
                      select="com.tofly.survey.mapper.CheckTargetMapper.getSiteCheckDataTarget"></association>
     </resultMap>
@@ -203,7 +205,7 @@
     </select>
 
 
-    <select id="getSiteCheck" resultType="com.tofly.survey.vo.SiteCheckVo">
+    <select id="getSiteCheck" resultType="com.tofly.survey.vo.SiteCheckVo" >
         SELECT s.ID,s.SITE_NAME,s.SECTION_ID,s.SITE_ADDRESS,s.LONGITUDE,s.LATITUDE,s.SITE_STATE,d.DEVICE_TYPE,d.DEVICE_TYPE_NAME,d.ID as DEVICE_ID,d.DEVICE_CODE,d.DEVICE_NAME,d.DEVICE_SN,t.ICON
              ,(SELECT count(id) FROM TF_YWPN_TIDINGS_W WHERE SITE_ID = s.ID and ISRECEIVE = 0) WARNING_NUMBER
              ,(SELECT COUNT(ID) ct FROM TF_YWPN_WARNING_INFO_W WHERE SITE_ID = s.ID and CREATE_TIME > #{date}) as IS_WARNING

+ 2 - 2
sxgk-projet/sxgk-survey/survey-boot/src/main/resources/mapper/WarningInfoMapper.xml

@@ -23,7 +23,7 @@
 
 
     <select id="getSiteCheckWarning" resultType="com.tofly.survey.vo.WarningInfoVo">
-        SELECT w.ID,w.CHECK_VALUE,w.CHECK_TARGET_ID,w.ISHIGHEST,d.TARGET_NAME,d.TARGET_CODE ,t.TARGET_UNIT,t.WARNING_NAME,t.WARNING_LEVEL, t.UPPER_LIMIT,t.LOWER_LIMIT,t.BIGIN_TIME,t.END_TIME,c.VALUE as WARNING_VALUE,d.ISSHOW
+        SELECT w.ID,w.CHECK_VALUE,w.CHECK_TARGET_ID,w.ISHIGHEST,d.TARGET_NAME,d.TARGET_CODE ,t.TARGET_UNIT,t.WARNING_NAME,t.WARNING_LEVEL, t.UPPER_LIMIT,t.LOWER_LIMIT,t.BIGIN_TIME,t.END_TIME,c.VALUE as WARNING_VALUE
         FROM TF_YWPN_WARNING_INFO_W w
                  LEFT JOIN TF_YWPN_CHECK_TARGET_W t ON (w.CHECK_TARGET_ID=t.ID)
                  LEFT JOIN TF_YWPN_DEVICE_TARGET_P d ON(t.TARGET_ID = d.ID)
@@ -80,7 +80,7 @@
                  and d.DEVICE_NAME like CONCAT(CONCAT('%',#{dto.deviceName}),'%')
            </if>
            <if test="dto.handleState != null">
-               w.HANDLE_STATE = #{dto.handleState}
+               and w.HANDLE_STATE = #{dto.handleState}
            </if>
              <if test="dto.beginTime != null ">
                  and c.COLLECTION_DATE >= #{dto.beginTime}