Przeglądaj źródła

智能门锁列表、液位传感器设备列表以及日志统计数据信息

zhj 2 lat temu
rodzic
commit
591ab72a83
21 zmienionych plików z 1076 dodań i 2 usunięć
  1. 1 2
      src/main/java/com/welampiot/controller/NoiseDevInfoController.java
  2. 60 0
      src/main/java/com/welampiot/controller/SmartLockController.java
  3. 174 0
      src/main/java/com/welampiot/controller/WaterLevelController.java
  4. 20 0
      src/main/java/com/welampiot/dao/SmartLockDevInfoDao.java
  5. 20 0
      src/main/java/com/welampiot/dao/WaterLevelDevInfoDao.java
  6. 21 0
      src/main/java/com/welampiot/dao/WaterLevelDevInfoLogDao.java
  7. 96 0
      src/main/java/com/welampiot/dto/SmartLockDevInfoDTO.java
  8. 109 0
      src/main/java/com/welampiot/dto/WaterLevelDevInfoDTO.java
  9. 38 0
      src/main/java/com/welampiot/dto/WaterLevelDevInfoLogDTO.java
  10. 17 0
      src/main/java/com/welampiot/service/SmartLockDevInfoService.java
  11. 20 0
      src/main/java/com/welampiot/service/WaterLevelDevInfoLogService.java
  12. 17 0
      src/main/java/com/welampiot/service/WaterLevelDevInfoService.java
  13. 120 0
      src/main/java/com/welampiot/service/impl/SmartLockDevInfoServiceImpl.java
  14. 34 0
      src/main/java/com/welampiot/service/impl/WaterLevelDevInfoLogServiceImpl.java
  15. 109 0
      src/main/java/com/welampiot/service/impl/WaterLevelDevInfoServiceImpl.java
  16. 25 0
      src/main/java/com/welampiot/vo/SmartLockDevInfoVO.java
  17. 26 0
      src/main/java/com/welampiot/vo/WaterLevelDevInfoLogVO.java
  18. 25 0
      src/main/java/com/welampiot/vo/WaterLevelDevInfoVO.java
  19. 60 0
      src/main/resources/mapper/SmartLockDevInfoMapper.xml
  20. 25 0
      src/main/resources/mapper/WaterLevelDevInfoLogMapper.xml
  21. 59 0
      src/main/resources/mapper/WaterLevelDevInfoMapper.xml

+ 1 - 2
src/main/java/com/welampiot/controller/NoiseDevInfoController.java

@@ -105,7 +105,6 @@ public class NoiseDevInfoController {
         long l = System.currentTimeMillis() - timezone * 3600 * 1000;
         long startTime = 0L;
         long endTime = 0L;
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         if (dateType == 0) { // 1 天
             startTime = l - 24 * 3600 * 1000;
             endTime = l;
@@ -127,7 +126,7 @@ public class NoiseDevInfoController {
         List<Object> dateList = new ArrayList<>();
         List<Object> dataList = new ArrayList<>();
         ArrayList<NoiseDevInfoLogDTO> list = new ArrayList<>();
-        simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         while (timeT < endTime) {
             objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)), i);
             dateList.add(simpleDateFormat.format(new Date(timeT + timezone * 3600 * 1000)));

+ 60 - 0
src/main/java/com/welampiot/controller/SmartLockController.java

@@ -0,0 +1,60 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.SmartLockDevInfoDTO;
+import com.welampiot.service.SmartLockDevInfoService;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.SmartLockDevInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+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.HttpServletRequest;
+
+/**
+ * ClassName: SmartLockController
+ * Package: com.welampiot.controller
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 15:49
+ * @Version: v1.0
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/smartLock")
+public class SmartLockController {
+    @Autowired
+    private SmartLockDevInfoService smartLockDevInfoService;
+
+    @Autowired
+    private ToolUtils toolUtils;
+
+    /**
+     * 获取智能门锁列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/getList", method = RequestMethod.POST)
+    public BaseResult getList(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer online = (Integer) toolUtils.getRequestContent(request,"online",1);
+        String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 1 : Integer.parseInt(request.getParameter("count"));
+
+        SmartLockDevInfoDTO dto = new SmartLockDevInfoDTO();
+        dto.setOnlineState(online);
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+        dto.setVersion(version);
+        dto.setKeyword(keyword);
+        dto.setSectionList(toolUtils.getSectionList(request));
+
+        SmartLockDevInfoVO vo = smartLockDevInfoService.getListBySmartLockDevInfoDTO(dto);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
+    }
+}

+ 174 - 0
src/main/java/com/welampiot/controller/WaterLevelController.java

@@ -0,0 +1,174 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.WaterLevelDevInfoDTO;
+import com.welampiot.dto.WaterLevelDevInfoLogDTO;
+import com.welampiot.service.WaterLevelDevInfoLogService;
+import com.welampiot.service.WaterLevelDevInfoService;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.WaterLevelDevInfoLogVO;
+import com.welampiot.vo.WaterLevelDevInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+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.HttpServletRequest;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * ClassName: WaterLevelController
+ * Package: com.welampiot.controller
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 17:03
+ * @Version: v1.0
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/waterLevel")
+public class WaterLevelController {
+    @Autowired
+    private WaterLevelDevInfoService waterLevelDevInfoService;
+
+    @Autowired
+    private WaterLevelDevInfoLogService waterLevelDevInfoLogService;
+
+    @Autowired
+    private ToolUtils toolUtils;
+
+    /**
+     * 获取液位传感器设备列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/getList", method = RequestMethod.POST)
+    public BaseResult getList(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer online = (Integer) toolUtils.getRequestContent(request,"online",1);
+        String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 1 : Integer.parseInt(request.getParameter("count"));
+
+        WaterLevelDevInfoDTO dto = new WaterLevelDevInfoDTO();
+        dto.setOnline(online);
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+        dto.setVersion(version);
+        dto.setKeyword(keyword);
+        dto.setSectionList(toolUtils.getSectionList(request));
+
+        WaterLevelDevInfoVO vo = waterLevelDevInfoService.getWaterLevelListByDTO(dto);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
+    }
+
+    /**
+     * 获取液位传感器设备统计数据信息
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/envStatisticsInfo", method = RequestMethod.POST)
+    public BaseResult envStatisticsInfo(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer id = (Integer) toolUtils.getRequestContent(request, "id", 1);
+        if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR, version);
+        Integer dateType = (Integer) toolUtils.getRequestContent(request, "dateType", 1);
+        Integer timezone = waterLevelDevInfoLogService.getTimezoneByWaterLevelId(id);
+        if (timezone == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL, version);
+        long l = System.currentTimeMillis() - timezone * 3600 * 1000;
+        long startTime = 0L;
+        long endTime = 0L;
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if (dateType == 0) { // 1 天
+            startTime = l - 24 * 3600 * 1000;
+            endTime = l;
+        } else if (dateType == 1) { // 3 天
+            startTime = l - 24 * 3600 * 1000 * 3;
+            endTime = l;
+        } else if (dateType == 2) { // 7 天
+            startTime = l - 24 * 3600 * 1000 * 7;
+            endTime = l;
+        } else if (dateType == 3) { // 14 天
+            startTime = l - 24 * 3600 * 1000 * 14;
+            endTime = l;
+        }else if (dateType == 4){ // 日期选择 最多30天
+            String date = (String) toolUtils.getRequestContent(request,"date",2);
+            if (date.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_DATE_ERROR,version);
+            List<String> split = Arrays.asList(date.split("/"));
+            System.out.println(split);
+            System.out.println(split.get(0));
+            System.out.println(split.get(1));
+            startTime = simpleDateFormat.parse(split.get(0) + " 00:00:00").getTime();
+            endTime = simpleDateFormat.parse(split.get(1) + " 23:59:59").getTime();
+            if (endTime < startTime) toolUtils.response(InterfaceResultEnum.LACK_DATE_FORMAT_ERROR,version);
+            if (endTime - startTime > 29L *24 * 3600 * 1000) toolUtils.response(InterfaceResultEnum.LACK_DATE_RANGE_ERROR,version);
+            startTime -= timezone * 3600 * 1000;
+            endTime -= timezone * 3600 * 1000;
+        }
+
+        HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
+        long timeT = startTime;
+        int i = 0;
+
+        List<Object> dateList = new ArrayList<>();
+        List<Object> dataSafeList = new ArrayList<>();
+        List<Object> depthList = new ArrayList<>();
+        ArrayList<WaterLevelDevInfoLogDTO> list = new ArrayList<>();
+        simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+        while (timeT < endTime) {
+            objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)), i);
+            dateList.add(simpleDateFormat.format(new Date(timeT + timezone * 3600 * 1000)));
+            dataSafeList.add(0);
+            depthList.add(0);
+            list.add(null);
+            timeT += 3600 * 1000;
+            i++;
+        }
+        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String startDate = simpleDateFormat.format(new Date(startTime));
+        String endDate = simpleDateFormat.format(new Date(endTime));
+        WaterLevelDevInfoLogDTO dto = new WaterLevelDevInfoLogDTO();
+        dto.setWaterLevelId(id);
+        dto.setStartDate(startDate);
+        dto.setEndDate(endDate);
+        List<WaterLevelDevInfoLogDTO> envStatisticsInfoByLogDTO = waterLevelDevInfoLogService.getEnvStatisticsInfoByLogDTO(dto);
+        for (WaterLevelDevInfoLogDTO waterLevelDevInfoLogDTO : envStatisticsInfoByLogDTO) {
+            Date date = new Date(simpleDateFormat2.parse(waterLevelDevInfoLogDTO.getUpdateTime()).getTime());
+            String s = simpleDateFormat.format(date);
+            if (objectObjectHashMap.containsKey(s)) {
+                Integer integer = objectObjectHashMap.get(s);
+                list.set(integer, waterLevelDevInfoLogDTO);
+            }
+        }
+        for (WaterLevelDevInfoLogDTO waterLevelDevInfoLogDTO : list) {
+            if (waterLevelDevInfoLogDTO != null) {
+                Date date = new Date(simpleDateFormat2.parse(waterLevelDevInfoLogDTO.getUpdateTime()).getTime());
+                String s = simpleDateFormat.format(date);
+                Integer integer = null;
+                if (objectObjectHashMap.containsKey(s)) {
+                    integer = objectObjectHashMap.get(s);
+                    list.set(integer, waterLevelDevInfoLogDTO);
+                }
+
+                if (waterLevelDevInfoLogDTO.getSafeDepth() != null && !waterLevelDevInfoLogDTO.getSafeDepth().equals("0") && integer != null){
+                    dataSafeList.set(integer,Float.valueOf(waterLevelDevInfoLogDTO.getSafeDepth()));
+                }
+                if (waterLevelDevInfoLogDTO.getDepth() != null && !waterLevelDevInfoLogDTO.getDepth().equals("0") && integer != null){
+                    depthList.set(integer,Float.valueOf(waterLevelDevInfoLogDTO.getDepth()));
+                }
+                date = new Date(simpleDateFormat2.parse(waterLevelDevInfoLogDTO.getUpdateTime()).getTime() + timezone * 3600 * 1000);
+                waterLevelDevInfoLogDTO.setUpdateTime(simpleDateFormat.format(date));
+            }
+        }
+        WaterLevelDevInfoLogVO waterLevelDevInfoLogVO = new WaterLevelDevInfoLogVO();
+        waterLevelDevInfoLogVO.setDateList(dateList);
+        waterLevelDevInfoLogVO.setDataSafeList(dataSafeList);
+        waterLevelDevInfoLogVO.setDepthList(depthList);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, waterLevelDevInfoLogVO);
+    }
+}

+ 20 - 0
src/main/java/com/welampiot/dao/SmartLockDevInfoDao.java

@@ -0,0 +1,20 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.SmartLockDevInfoDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: SmartLockDevInfoDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 11:30
+ * @Version: v1.0
+ */
+public interface SmartLockDevInfoDao {
+    List<SmartLockDevInfoDTO> getListBySmartLockDevInfoDTO(SmartLockDevInfoDTO dto);
+
+    Integer getSmartLockTotalByDTO(SmartLockDevInfoDTO dto);
+}

+ 20 - 0
src/main/java/com/welampiot/dao/WaterLevelDevInfoDao.java

@@ -0,0 +1,20 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.WaterLevelDevInfoDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: WaterLevelDevInfoDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 16:47
+ * @Version: v1.0
+ */
+public interface WaterLevelDevInfoDao {
+    List<WaterLevelDevInfoDTO> getWaterLevelListByDTO(WaterLevelDevInfoDTO dto);
+
+    Integer getWaterLevelTotalByDTO(WaterLevelDevInfoDTO dto);
+}

+ 21 - 0
src/main/java/com/welampiot/dao/WaterLevelDevInfoLogDao.java

@@ -0,0 +1,21 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.WaterLevelDevInfoLogDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: WaterLevelDevInfoLogDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 17:45
+ * @Version: v1.0
+ */
+public interface WaterLevelDevInfoLogDao {
+    List<WaterLevelDevInfoLogDTO> getEnvStatisticsInfoByLogDTO(WaterLevelDevInfoLogDTO dto);
+
+    Integer getTimezoneByWaterLevelId(@Param("id") Integer id);
+}

+ 96 - 0
src/main/java/com/welampiot/dto/SmartLockDevInfoDTO.java

@@ -0,0 +1,96 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: SmartLockDevInfoDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 9:28
+ * @Version: v1.0
+ */
+@Data
+public class SmartLockDevInfoDTO implements Serializable {
+    /** 主键 **/
+    private Integer id;
+
+    /** 灯杆id **/
+    private Integer lampPoleId;
+
+    /** 门锁的地址 **/
+    private String address;
+
+    /** 编号 **/
+    private String number;
+
+    /** 名称 **/
+    private String name;
+
+    /** 型号(0:DS899,1:R-JGS869,2:GSNi-3)**/
+    private Integer model;
+
+    /** 厂家(0:生久集团 1:云之声 2 :江苏未来城市公共空间)**/
+    private String factory;
+
+    /** 在线状态(0:离线,1:在线)**/
+    private Integer online;
+
+    /** 串口(0 3号串口,1 2号串口,2 1号串口)**/
+    private Integer serialPork;
+
+    /** 开关(0:闭锁,1:开关)**/
+    private Integer status;
+
+    /** 故障状态(0:正常,1:故障)**/
+    private Integer alarmStatus;
+
+    /** 令牌(1个小时过期)**/
+    private String accessToken;
+
+    /** 刷新令牌(1个小时过期)**/
+    private String refreshToken;
+
+    /** 电池电量(2000~3600对应0~100%)**/
+    private String batteryStatus;
+
+    /** 创建时间 **/
+    private String createTime;
+
+    /** 更新时间 **/
+    private String updateTime;
+
+    /** 安装时间 **/
+    private String installDate;
+
+    /** 过期时间 **/
+    private String expirationDate;
+
+    private Integer page;
+
+    private Integer count;
+
+    private String keyword;
+
+    private Integer onlineState;
+
+    private List<Integer> sectionList;
+
+    private String section;
+
+    private String area;
+
+    private String lampPoleName;
+
+    private Integer timezone;
+
+    private Integer cloudBoxModel;
+
+    private Integer version;
+
+    private static final long serialVersionUID = 1L;
+}

+ 109 - 0
src/main/java/com/welampiot/dto/WaterLevelDevInfoDTO.java

@@ -0,0 +1,109 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: SmartLockDevInfoDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 9:28
+ * @Version: v1.0
+ */
+@Data
+public class WaterLevelDevInfoDTO implements Serializable {
+    /** 主键 **/
+    private Integer id;
+
+    /** 灯杆id **/
+    private Integer lampPoleId;
+
+    /** 设备地址 **/
+    private String address;
+
+    /** 编号 **/
+    private String number;
+
+    /** 名称 **/
+    private String name;
+
+    /** 型号(0:WE-JXTX-YW01)**/
+    private Integer model;
+
+    /** 在线状态 **/
+    private Integer status;
+
+    /** 水深 **/
+    private String depth;
+
+    /** 屏幕的序列号 **/
+    private String screenNumber;
+
+    /** 安全深度 **/
+    private String safeDepth;
+
+    /** 网页背景颜色 **/
+    private String backgroundColor;
+
+    /** 正常情况下普通字体大小 **/
+    private Integer normalSize;
+
+    /** 正常情况下突出的字体 **/
+    private Integer normalBigSize;
+
+    /** 正常情况下字体颜色 **/
+    private String normalColor;
+
+    /** 告警时普通字体的大小 **/
+    private Integer alarmNormalSize;
+
+    /** 告警时突出字体的大小 **/
+    private Integer alarmBigSize;
+
+    /** 告警时字体的颜色 **/
+    private String alarmSizeColor;
+
+    /** 音柱地址 **/
+    private String broadcastAddress;
+
+    /** 音柱播放(0:停止 1:播放)**/
+    private Integer audioStatus;
+
+    /** 创建时间 **/
+    private String createTime;
+
+    /** 更新时间 **/
+    private String updateTime;
+
+    /** 安装时间 **/
+    private String installDate;
+
+    /** 过期时间 **/
+    private String expirationDate;
+
+    private Integer page;
+
+    private Integer count;
+
+    private String keyword;
+
+    private Integer online;
+
+    private List<Integer> sectionList;
+
+    private String section;
+
+    private String area;
+
+    private String lampPoleName;
+
+    private Integer timezone;
+
+    private Integer version;
+
+    private static final long serialVersionUID = 1L;
+}

+ 38 - 0
src/main/java/com/welampiot/dto/WaterLevelDevInfoLogDTO.java

@@ -0,0 +1,38 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: WaterLevelDevInfoLogDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 17:29
+ * @Version: v1.0
+ */
+@Data
+public class WaterLevelDevInfoLogDTO implements Serializable {
+    /** 主键 **/
+    private Integer id;
+
+    /** 液位设备id **/
+    private Integer waterLevelId;
+
+    /** 告警线(单位:m)**/
+    private String safeDepth;
+
+    /** 当前深度(单位:m)**/
+    private String depth;
+
+    /** 更新时间 **/
+    private String updateTime;
+
+    private String startDate;
+
+    private String endDate;
+
+    private static final long serialVersionUID = 1L;
+}

+ 17 - 0
src/main/java/com/welampiot/service/SmartLockDevInfoService.java

@@ -0,0 +1,17 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.SmartLockDevInfoDTO;
+import com.welampiot.vo.SmartLockDevInfoVO;
+
+/**
+ * ClassName: SmartLockDevInfoService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 12:41
+ * @Version: v1.0
+ */
+public interface SmartLockDevInfoService {
+    SmartLockDevInfoVO getListBySmartLockDevInfoDTO(SmartLockDevInfoDTO dto);
+}

+ 20 - 0
src/main/java/com/welampiot/service/WaterLevelDevInfoLogService.java

@@ -0,0 +1,20 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.WaterLevelDevInfoLogDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: WaterLevelDevInfoLogDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 17:45
+ * @Version: v1.0
+ */
+public interface WaterLevelDevInfoLogService {
+    List<WaterLevelDevInfoLogDTO> getEnvStatisticsInfoByLogDTO(WaterLevelDevInfoLogDTO dto);
+
+    Integer getTimezoneByWaterLevelId(Integer id);
+}

+ 17 - 0
src/main/java/com/welampiot/service/WaterLevelDevInfoService.java

@@ -0,0 +1,17 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.WaterLevelDevInfoDTO;
+import com.welampiot.vo.WaterLevelDevInfoVO;
+
+/**
+ * ClassName: WaterLevelDevInfoService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 16:51
+ * @Version: v1.0
+ */
+public interface WaterLevelDevInfoService {
+    WaterLevelDevInfoVO getWaterLevelListByDTO(WaterLevelDevInfoDTO dto);
+}

+ 120 - 0
src/main/java/com/welampiot/service/impl/SmartLockDevInfoServiceImpl.java

@@ -0,0 +1,120 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.SmartLockDevInfoDao;
+import com.welampiot.dto.SmartLockDevInfoDTO;
+import com.welampiot.service.SmartLockDevInfoService;
+import com.welampiot.vo.SmartLockDevInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * ClassName: SmartLockDevInfoServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 12:42
+ * @Version: v1.0
+ */
+@Service
+public class SmartLockDevInfoServiceImpl implements SmartLockDevInfoService {
+    @Autowired
+    private SmartLockDevInfoDao smartLockDevInfoDao;
+
+    @Override
+    public SmartLockDevInfoVO getListBySmartLockDevInfoDTO(SmartLockDevInfoDTO dto) {
+        SmartLockDevInfoVO vo = new SmartLockDevInfoVO();
+        vo.setTotal(smartLockDevInfoDao.getSmartLockTotalByDTO(dto));
+        List<SmartLockDevInfoDTO> listDTO = smartLockDevInfoDao.getListBySmartLockDevInfoDTO(dto);
+        List<SmartLockDevInfoDTO> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        listDTO.forEach(devInfoDTO ->{
+            if (devInfoDTO.getLampPoleName() == null){
+                devInfoDTO.setLampPoleName("");
+            }
+            if (devInfoDTO.getArea() == null){
+                devInfoDTO.setArea("");
+            }
+            if (devInfoDTO.getSection() == null){
+                devInfoDTO.setSection("");
+            }
+            if (devInfoDTO.getModel() != null && devInfoDTO.getModel() == 2){
+                devInfoDTO.setModel(2);
+            }else if (devInfoDTO.getModel() != null && devInfoDTO.getModel() == 1){
+                devInfoDTO.setModel(1);
+            }else {
+                devInfoDTO.setModel(0);
+            }
+            if (devInfoDTO.getOnline() != null && devInfoDTO.getOnline() == 1){
+                devInfoDTO.setOnline(1);
+            }else {
+                devInfoDTO.setOnline(0);
+            }
+            if (devInfoDTO.getStatus() != null && devInfoDTO.getStatus() == 1){
+                devInfoDTO.setStatus(1);
+            }else {
+                devInfoDTO.setStatus(0);
+            }
+            if (devInfoDTO.getCloudBoxModel() != null && devInfoDTO.getCloudBoxModel() == 3){
+                devInfoDTO.setCloudBoxModel(3);
+            }else if (devInfoDTO.getCloudBoxModel() != null && devInfoDTO.getCloudBoxModel() == 2){
+                devInfoDTO.setCloudBoxModel(2);
+            }else if (devInfoDTO.getCloudBoxModel() != null && devInfoDTO.getCloudBoxModel() == 1){
+                devInfoDTO.setCloudBoxModel(1);
+            }else {
+                devInfoDTO.setCloudBoxModel(0);
+            }
+            if (devInfoDTO.getCreateTime() != null && !devInfoDTO.getCreateTime().equals("")){
+                try {
+                    devInfoDTO.setCreateTime(simpleDateFormat.format(simpleDateFormat.parse(devInfoDTO.getCreateTime())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                devInfoDTO.setCreateTime("");
+            }
+            if (devInfoDTO.getInstallDate() != null && !devInfoDTO.getInstallDate().equals("")){
+                try {
+                    devInfoDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(devInfoDTO.getInstallDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                devInfoDTO.setInstallDate("");
+            }
+            if (devInfoDTO.getExpirationDate() != null && !devInfoDTO.getExpirationDate().equals("")){
+                try {
+                    devInfoDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(devInfoDTO.getExpirationDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                devInfoDTO.setExpirationDate("");
+            }
+            if (devInfoDTO.getUpdateTime() != null && !devInfoDTO.getUpdateTime().equals("")){
+                Date cmdTime;
+                try {
+                    cmdTime = simpleDateFormat.parse(devInfoDTO.getUpdateTime());
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+                //判断时区,为null默认东八区
+                long timezone = devInfoDTO.getTimezone() == null ? 8 : devInfoDTO.getTimezone();
+                long l = cmdTime.getTime() + timezone * 3600 * 1000;
+                cmdTime = new Date(l);
+                devInfoDTO.setUpdateTime(simpleDateFormat.format(cmdTime));
+            }else {
+                devInfoDTO.setUpdateTime("");
+            }
+            list.add(devInfoDTO);
+        });
+        vo.setList(list);
+        return vo;
+    }
+}

+ 34 - 0
src/main/java/com/welampiot/service/impl/WaterLevelDevInfoLogServiceImpl.java

@@ -0,0 +1,34 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.WaterLevelDevInfoLogDao;
+import com.welampiot.dto.WaterLevelDevInfoLogDTO;
+import com.welampiot.service.WaterLevelDevInfoLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: WaterLevelDevInfoLogServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 17:48
+ * @Version: v1.0
+ */
+@Service
+public class WaterLevelDevInfoLogServiceImpl implements WaterLevelDevInfoLogService {
+    @Autowired
+    private WaterLevelDevInfoLogDao waterLevelDevInfoLogDao;
+
+    @Override
+    public List<WaterLevelDevInfoLogDTO> getEnvStatisticsInfoByLogDTO(WaterLevelDevInfoLogDTO dto) {
+        return waterLevelDevInfoLogDao.getEnvStatisticsInfoByLogDTO(dto);
+    }
+
+    @Override
+    public Integer getTimezoneByWaterLevelId(Integer id) {
+        return waterLevelDevInfoLogDao.getTimezoneByWaterLevelId(id);
+    }
+}

+ 109 - 0
src/main/java/com/welampiot/service/impl/WaterLevelDevInfoServiceImpl.java

@@ -0,0 +1,109 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.WaterLevelDevInfoDao;
+import com.welampiot.dto.WaterLevelDevInfoDTO;
+import com.welampiot.service.WaterLevelDevInfoService;
+import com.welampiot.vo.WaterLevelDevInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * ClassName: WaterLevelDevInfoServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 16:52
+ * @Version: v1.0
+ */
+@Service
+public class WaterLevelDevInfoServiceImpl implements WaterLevelDevInfoService {
+    @Autowired
+    private WaterLevelDevInfoDao waterLevelDevInfoDao;
+
+    @Override
+    public WaterLevelDevInfoVO getWaterLevelListByDTO(WaterLevelDevInfoDTO dto) {
+        WaterLevelDevInfoVO vo = new WaterLevelDevInfoVO();
+        vo.setTotal(waterLevelDevInfoDao.getWaterLevelTotalByDTO(dto));
+        List<WaterLevelDevInfoDTO> waterLevelList = waterLevelDevInfoDao.getWaterLevelListByDTO(dto);
+        List<WaterLevelDevInfoDTO> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        waterLevelList.forEach(devInfoDTO ->{
+            if (devInfoDTO.getLampPoleName() == null){
+                devInfoDTO.setLampPoleName("");
+            }
+            if (devInfoDTO.getArea() == null){
+                devInfoDTO.setArea("");
+            }
+            if (devInfoDTO.getSection() == null){
+                devInfoDTO.setSection("");
+            }
+            if (devInfoDTO.getModel() != null && devInfoDTO.getModel() == 2){
+                devInfoDTO.setModel(2);
+            }else if (devInfoDTO.getModel() != null && devInfoDTO.getModel() == 1){
+                devInfoDTO.setModel(1);
+            }else {
+                devInfoDTO.setModel(0);
+            }
+            if (devInfoDTO.getStatus() != null && devInfoDTO.getStatus() == 1){
+                devInfoDTO.setStatus(1);
+            }else {
+                devInfoDTO.setStatus(0);
+            }
+            if (devInfoDTO.getCreateTime() != null && !devInfoDTO.getCreateTime().equals("")){
+                try {
+                    devInfoDTO.setCreateTime(simpleDateFormat.format(simpleDateFormat.parse(devInfoDTO.getCreateTime())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                devInfoDTO.setCreateTime("");
+            }
+            if (devInfoDTO.getInstallDate() != null && !devInfoDTO.getInstallDate().equals("")){
+                try {
+                    devInfoDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(devInfoDTO.getInstallDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                devInfoDTO.setInstallDate("");
+            }
+            if (devInfoDTO.getExpirationDate() != null && !devInfoDTO.getExpirationDate().equals("")){
+                try {
+                    devInfoDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(devInfoDTO.getExpirationDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                devInfoDTO.setExpirationDate("");
+            }
+            if (devInfoDTO.getUpdateTime() != null && !devInfoDTO.getUpdateTime().equals("")){
+                Date cmdTime;
+                try {
+                    cmdTime = simpleDateFormat.parse(devInfoDTO.getUpdateTime());
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+                //判断时区,为null默认东八区
+                long timezone = devInfoDTO.getTimezone() == null ? 8 : devInfoDTO.getTimezone();
+                long l = cmdTime.getTime() + timezone * 3600 * 1000;
+                cmdTime = new Date(l);
+                devInfoDTO.setUpdateTime(simpleDateFormat.format(cmdTime));
+            }else {
+                devInfoDTO.setUpdateTime("");
+            }
+            if (devInfoDTO.getBroadcastAddress() == null){
+                devInfoDTO.setBroadcastAddress("");
+            }
+            list.add(devInfoDTO);
+        });
+        vo.setList(list);
+        return vo;
+    }
+}

+ 25 - 0
src/main/java/com/welampiot/vo/SmartLockDevInfoVO.java

@@ -0,0 +1,25 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.SmartLockDevInfoDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: SmartLockDevInfoVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 12:42
+ * @Version: v1.0
+ */
+@Data
+public class SmartLockDevInfoVO implements Serializable {
+    private Integer total;
+
+    private List<SmartLockDevInfoDTO> list;
+
+    private static final long serialVersionUID = 1L;
+}

+ 26 - 0
src/main/java/com/welampiot/vo/WaterLevelDevInfoLogVO.java

@@ -0,0 +1,26 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: WaterLevelDevInfoLogDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 17:29
+ * @Version: v1.0
+ */
+@Data
+public class WaterLevelDevInfoLogVO implements Serializable {
+    private List<Object> dateList; // 日期列表
+
+    private List<Object> dataSafeList; // 告警线数据列表
+
+    private List<Object> depthList; // 当前深度数据列表
+
+    private static final long serialVersionUID = 1L;
+}

+ 25 - 0
src/main/java/com/welampiot/vo/WaterLevelDevInfoVO.java

@@ -0,0 +1,25 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.WaterLevelDevInfoDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: WaterLevelDevInfoVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/28 - 16:49
+ * @Version: v1.0
+ */
+@Data
+public class WaterLevelDevInfoVO implements Serializable {
+    private Integer total;
+
+    private List<WaterLevelDevInfoDTO> list;
+
+    private static final long serialVersionUID = 1L;
+}

+ 60 - 0
src/main/resources/mapper/SmartLockDevInfoMapper.xml

@@ -0,0 +1,60 @@
+<?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.welampiot.dao.SmartLockDevInfoDao">
+
+    <select id="getListBySmartLockDevInfoDTO" resultType="SmartLockDevInfoDTO">
+        select
+            <choose>
+                <when test="version == 0">
+                    gl.chinese_name as area,
+                </when>
+                <when test="version == 1">
+                    gl.english_name as area,
+                </when>
+                <otherwise>
+                    gl.ru_name as area,
+                </otherwise>
+            </choose>
+            s.id,s.lamp_pole_id lampPoleId,lp.name as lampPoleName,s1.name as section,s.number,s.name,s.model,s.online,s.status,
+            s.createtime as createTime,s.updatetime as updateTime,s.install_date installDate,s.expiration_date expirationDate,
+            s1.timezone,w.model as cloudBoxModel
+        from smart_lock_dev_info s left join lamp_pole lp on lp.id = s.lamp_pole_id
+                                   left join wifi w on lp.id = w.lamp_pole_id
+                                   left join section s1 on lp.sectionid = s1.id
+                                   left join global_location gl on s1.pid = gl.id
+        where 1=1
+            <if test="sectionList != null and !sectionList.isEmpty()">
+                and lp.sectionid in
+                <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                    #{dto}
+                </foreach>
+            </if>
+            <if test="keyword != null and keyword != ''">
+                and (s.name like '%${keyword}%' or s.number like '%${keyword}%')
+            </if>
+            <choose>
+                <when test="onlineState == 0">
+                    and s.online = 0
+                </when>
+                <when test="onlineState == 1">
+                    and s.online = 1
+                </when>
+            </choose>
+            order by convert(s.name using gbk) asc,s.id desc
+            <if test="page >= 0 and count > 0">
+                limit #{page},#{count}
+            </if>
+    </select>
+
+    <select id="getSmartLockTotalByDTO" resultType="Integer">
+        select count(s.id)
+        from smart_lock_dev_info s left join lamp_pole lp on lp.id = s.lamp_pole_id
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where lp.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
+
+</mapper>

+ 25 - 0
src/main/resources/mapper/WaterLevelDevInfoLogMapper.xml

@@ -0,0 +1,25 @@
+<?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.welampiot.dao.WaterLevelDevInfoLogDao">
+    
+    <select id="getEnvStatisticsInfoByLogDTO" resultType="WaterLevelDevInfoLogDTO">
+        select w.updatetime as updateTime,w.safe_depth safeDepth,w.depth
+        from water_level_dev_info_log w
+        where w.water_level_id = #{waterLevelId}
+        <if test="startDate != null and startDate != ''">
+            and w.updatetime <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="endDate != null and endDate != ''">
+            and w.updatetime <![CDATA[ <= ]]> #{endDate}
+        </if>
+        order by w.updatetime desc
+    </select>
+
+    <select id="getTimezoneByWaterLevelId" resultType="Integer">
+        select s.timezone
+        from water_level_dev_info s1 left join lamp_pole lp on lp.id = s1.lamp_pole_id
+                                     left join section s on lp.sectionid = s.id
+        where s1.id = #{id}
+    </select>
+
+</mapper>

+ 59 - 0
src/main/resources/mapper/WaterLevelDevInfoMapper.xml

@@ -0,0 +1,59 @@
+<?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.welampiot.dao.WaterLevelDevInfoDao">
+    
+    <select id="getWaterLevelListByDTO" resultType="WaterLevelDevInfoDTO">
+        select
+        <choose>
+            <when test="version == 0">
+                gl.chinese_name as area,
+            </when>
+            <when test="version == 1">
+                gl.english_name as area,
+            </when>
+            <otherwise>
+                gl.ru_name as area,
+            </otherwise>
+        </choose>
+        w.id,w.lamp_pole_id lampPoleId,lp.name as lampPoleName,s1.name as section,w.number,w.name,w.model,w.status,w.address,
+        w.createtime as createTime,w.updatetime as updateTime,w.install_date installDate,w.expiration_date expirationDate,
+        s1.timezone,w.screen_number screenNumber,w.depth,w.safe_depth safeDepth,w.broadcast_address broadcastAddress
+        from water_level_dev_info w left join lamp_pole lp on lp.id = w.lamp_pole_id
+                                    left join section s1 on lp.sectionid = s1.id
+                                    left join global_location gl on s1.pid = gl.id
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and lp.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+        <if test="keyword != null and keyword != ''">
+            and (w.name like '%${keyword}%' or w.number like '%${keyword}%')
+        </if>
+        <choose>
+            <when test="online == 0">
+                and w.status = 0
+            </when>
+            <when test="online == 1">
+                and w.status = 1
+            </when>
+        </choose>
+        order by convert(w.name using gbk) asc,w.id desc
+        <if test="page >= 0 and count > 0">
+            limit #{page},#{count}
+        </if>
+    </select>
+
+    <select id="getWaterLevelTotalByDTO" resultType="Integer">
+        select count(w.id)
+        from water_level_dev_info w left join lamp_pole lp on lp.id = w.lamp_pole_id
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where lp.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
+
+</mapper>