ソースを参照

水浸传感器列表和日志列表接口

zhj 2 年 前
コミット
e72f158c3b

+ 87 - 0
src/main/java/com/welampiot/controller/WaterImmersionController.java

@@ -0,0 +1,87 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.dto.WaterImmersionDevInfoDTO;
+import com.welampiot.dto.WaterImmersionDevInfoLogDTO;
+import com.welampiot.service.WaterImmersionDevInfoService;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.WaterImmersionDevInfoLogVO;
+import com.welampiot.vo.WaterImmersionDevInfoVO;
+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;
+
+/**
+ * ClassName: WaterImmersionController
+ * Package: com.welampiot.controller
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/19 - 14:23
+ * @Version: v1.0
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/api/waterImmersion")
+public class WaterImmersionController {
+    @Autowired
+    private WaterImmersionDevInfoService waterImmersionDevInfoService;
+
+    @Autowired
+    private ToolUtils toolUtils;
+
+    /**
+     * 获取水浸传感器列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/getList", method = RequestMethod.POST)
+    public BaseResult<WaterImmersionDevInfoDTO> getList(HttpServletRequest request){
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+        int online = request.getParameter("online") == null ? 0 : Integer.parseInt(request.getParameter("online"));
+        int version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        String keyword = request.getParameter("keyword") == null ? "" : request.getParameter("keyword");
+
+        WaterImmersionDevInfoDTO dto = new WaterImmersionDevInfoDTO();
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+        dto.setOnline(online);
+        dto.setKeyword(keyword);
+        dto.setSectionList(toolUtils.getSectionList(request));
+
+        WaterImmersionDevInfoVO vo = waterImmersionDevInfoService.getWaterImmersionList(dto, version);
+        return BaseResult.success(vo);
+    }
+
+    /**
+     * 获取水浸传感器日志列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/getLogList", method = RequestMethod.POST)
+    public BaseResult<WaterImmersionDevInfoLogDTO> getLogList(HttpServletRequest request) throws ParseException {
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+        int waterImmersionId = request.getParameter("waterImmersionId") == null ? 0 : Integer.parseInt(request.getParameter("waterImmersionId"));
+        String beginTime = request.getParameter("beginTime") == null ? "" : request.getParameter("beginTime");
+        String endTime = request.getParameter("endTime") == null ? "" : request.getParameter("endTime");
+
+        WaterImmersionDevInfoLogDTO dto = new WaterImmersionDevInfoLogDTO();
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+        dto.setWaterImmersionId(waterImmersionId);
+        dto.setBeginTime(beginTime);
+        dto.setEndTime(endTime);
+        dto.setSectionList(toolUtils.getSectionList(request));
+
+        WaterImmersionDevInfoLogVO vo = waterImmersionDevInfoService.getLogList(dto);
+        return BaseResult.success(vo);
+    }
+
+}

+ 27 - 0
src/main/java/com/welampiot/dao/WaterImmersionDevInfoDao.java

@@ -0,0 +1,27 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.WaterImmersionDevInfoDTO;
+import com.welampiot.dto.WaterImmersionDevInfoLogDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: WaterImmersionDevInfoDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/19 - 11:07
+ * @Version: v1.0
+ */
+public interface WaterImmersionDevInfoDao {
+    List<WaterImmersionDevInfoDTO> getWaterImmersionListByDTO(WaterImmersionDevInfoDTO dto);
+
+    Integer getDeviceTotalByDTO(WaterImmersionDevInfoDTO dto);
+
+    Integer getDeviceTotalByDTO(WaterImmersionDevInfoLogDTO dto);
+
+    List<WaterImmersionDevInfoLogDTO> getLogListByDTO(WaterImmersionDevInfoLogDTO dto);
+
+    Integer getTimezoneById(WaterImmersionDevInfoLogDTO dto);
+}

+ 115 - 0
src/main/java/com/welampiot/dto/WaterImmersionDevInfoDTO.java

@@ -0,0 +1,115 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: WaterImmersionDevInfoDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/19 - 10:49
+ * @Version: v1.0
+ */
+@Data
+public class WaterImmersionDevInfoDTO implements Serializable {
+    /** 主键 **/
+    private Integer id;
+
+    /** 灯杆id **/
+    private Integer lampPoleId;
+
+    /** 编号 **/
+    private String number;
+
+    /** 名称 **/
+    private String name;
+
+    /** 型号(0:RS-SJ-R01-4,1:RS485-WT10) **/
+    private Integer model;
+
+    /** 厂家(0 建大仁科,1 红斯迈科技,2 云之声)**/
+    private Integer factory;
+
+    /** 在线状态(0 离线,1 在线)**/
+    private Integer status;
+
+    /** 串口(0 3号串口,1 2号串口,3 1号串口)**/
+    private Integer serialPort;
+
+    /** 探头1(0 正常,1 有水)**/
+    private Integer probe1;
+
+    /** 探头2(0 正常,1 有水)**/
+    private Integer probe2;
+
+    /** 报警延时时间(单位:s)**/
+    private String delayTime;
+
+    /** 巡检命令(0 未下发,1 已下发)**/
+    private Integer patrolCmd;
+
+    /** 报警等级(0 一级,1 二级,2 三级)**/
+    private Integer level;
+
+    /** 配电箱断电的状态(0 否,1 是)**/
+    private Integer powerStatus;
+
+    /** 水浸设备地址 **/
+    private String address;
+
+    /** 配电网地址 **/
+    private String boxAddress;
+
+    /** 电箱的子模块地址(多个模块时用逗号隔开)**/
+    private String boxSubAddress;
+
+    /** nb水浸创建成功后,返回的值 **/
+    private String deviceId;
+
+    /** 订阅返回的id(多项用逗号分隔)**/
+    private String subId;
+
+    /** 创建时间 **/
+    private String createTime;
+
+    /** 更新时间 **/
+    private String updateTime;
+
+    /** 安装时间 **/
+    private String installDate;
+
+    /** 过期时间 **/
+    private String expirationDate;
+
+    private Integer timezone;
+
+    private String lampPoleName;
+
+    private String section;
+
+    private String area;
+
+    private String chArea;
+
+    private String enArea;
+
+    private String ruArea;
+
+    private Integer cloudBoxModel;
+
+    private List<Integer> sectionList;
+
+    private Integer page;
+
+    private Integer count;
+
+    private String keyword;
+
+    private Integer online;
+
+    private static final long serialVersionUID = 1L;
+}

+ 56 - 0
src/main/java/com/welampiot/dto/WaterImmersionDevInfoLogDTO.java

@@ -0,0 +1,56 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: WaterImmersionDevInfoLogDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/19 - 15:03
+ * @Version: v1.0
+ */
+@Data
+public class WaterImmersionDevInfoLogDTO implements Serializable {
+    /** 主键 **/
+    private Integer id;
+
+    /** 水浸传感器id **/
+    private Integer waterImmersionId;
+
+    /** 探头1(0 正常,1 有水)**/
+    private Integer probe1;
+
+    /** 探头2(0 正常,1 有水)**/
+    private Integer probe2;
+
+    /** 报警等级(0 一级,1 二级,3 三级)**/
+    private Integer level;
+
+    /** 空开是否断电(0 否,1 是)**/
+    private Integer powerStatus;
+
+    /** 报警状态(0 待处理,1 已调度, 2 已完成)**/
+    private Integer status;
+
+    /** 更新时间 **/
+    private String updateTime;
+
+    private Integer page;
+
+    private Integer count;
+
+    private String beginTime;
+
+    private String endTime;
+
+    private Integer timezone;
+
+    private List<Integer> sectionList;
+
+    private static final long serialVersionUID = 1L;
+}

+ 21 - 0
src/main/java/com/welampiot/service/WaterImmersionDevInfoService.java

@@ -0,0 +1,21 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.WaterImmersionDevInfoDTO;
+import com.welampiot.dto.WaterImmersionDevInfoLogDTO;
+import com.welampiot.vo.WaterImmersionDevInfoLogVO;
+import com.welampiot.vo.WaterImmersionDevInfoVO;
+
+/**
+ * ClassName: WaterImmersionDevInfoService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/19 - 12:43
+ * @Version: v1.0
+ */
+public interface WaterImmersionDevInfoService {
+    WaterImmersionDevInfoVO getWaterImmersionList(WaterImmersionDevInfoDTO dto, Integer version);
+
+    WaterImmersionDevInfoLogVO getLogList(WaterImmersionDevInfoLogDTO dto);
+}

+ 3 - 3
src/main/java/com/welampiot/service/impl/BroadcastServiceImpl.java

@@ -60,7 +60,7 @@ public class BroadcastServiceImpl implements BroadcastService {
             }else {
                 broadcastDTO.setIsPlay(0);
             }
-            if (broadcastDTO.getInstallDate() != null){
+            if (broadcastDTO.getInstallDate() != null && !broadcastDTO.getInstallDate().equals("")){
                 try {
                     broadcastDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(broadcastDTO.getInstallDate())));
                 } catch (ParseException e) {
@@ -69,7 +69,7 @@ public class BroadcastServiceImpl implements BroadcastService {
             }else {
                 broadcastDTO.setInstallDate("");
             }
-            if (broadcastDTO.getExpirationDate() != null){
+            if (broadcastDTO.getExpirationDate() != null && !broadcastDTO.getExpirationDate().equals("")){
                 try {
                     broadcastDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(broadcastDTO.getExpirationDate())));
                 } catch (ParseException e) {
@@ -114,7 +114,7 @@ public class BroadcastServiceImpl implements BroadcastService {
             }else {
                 broadcastItemDTO.setStatus(0);
             }
-            if (broadcastItemDTO.getCreateTime() != null){
+            if (broadcastItemDTO.getCreateTime() != null && !broadcastItemDTO.getCreateTime().equals("")){
                 try {
                     broadcastItemDTO.setCreateTime(simpleDateFormat.format(simpleDateFormat.parse(broadcastItemDTO.getCreateTime())));
                 } catch (ParseException e) {

+ 4 - 4
src/main/java/com/welampiot/service/impl/ChargeServiceImpl.java

@@ -59,7 +59,7 @@ public class ChargeServiceImpl implements ChargeService {
             }else {
                 chargeDTO.setUpdateTime("");
             }
-            if (chargeDTO.getStartTime() != null){
+            if (chargeDTO.getStartTime() != null && !chargeDTO.getStartTime().equals("")){
                 try {
                     chargeDTO.setStartTime(simpleDateFormat.format(simpleDateFormat.parse(chargeDTO.getStartTime())));
                 } catch (ParseException e) {
@@ -68,7 +68,7 @@ public class ChargeServiceImpl implements ChargeService {
             }else {
                 chargeDTO.setStartTime("");
             }
-            if (chargeDTO.getEndTime() != null){
+            if (chargeDTO.getEndTime() != null && !chargeDTO.getEndTime().equals("")){
                 try {
                     chargeDTO.setEndTime(simpleDateFormat.format(simpleDateFormat.parse(chargeDTO.getEndTime())));
                 } catch (ParseException e) {
@@ -85,7 +85,7 @@ public class ChargeServiceImpl implements ChargeService {
             if (chargeDTO.getAlarmInfo() == null){
                 chargeDTO.setAlarmInfo("");
             }
-            if (chargeDTO.getInstallDate() != null){
+            if (chargeDTO.getInstallDate() != null && !chargeDTO.getInstallDate().equals("")){
                 try {
                     chargeDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(chargeDTO.getInstallDate())));
                 } catch (ParseException e) {
@@ -94,7 +94,7 @@ public class ChargeServiceImpl implements ChargeService {
             }else {
                 chargeDTO.setInstallDate("");
             }
-            if (chargeDTO.getExpirationDate() != null){
+            if (chargeDTO.getExpirationDate() != null && !chargeDTO.getExpirationDate().equals("")){
                 try {
                     chargeDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(chargeDTO.getExpirationDate())));
                 } catch (ParseException e) {

+ 6 - 6
src/main/java/com/welampiot/service/impl/ElectricBoxServiceImpl.java

@@ -39,23 +39,23 @@ public class ElectricBoxServiceImpl implements ElectricBoxService {
         List<ElectricBoxDTO> electricBoxDTOS = new ArrayList<>();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         electricBoxList.forEach(electricBoxDTO ->{
-            if (electricBoxDTO.getInstallDate() == null){
-                electricBoxDTO.setInstallDate("");
-            }else {
+            if (electricBoxDTO.getInstallDate() != null && !electricBoxDTO.getInstallDate().equals("")){
                 try {
                     electricBoxDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(electricBoxDTO.getInstallDate())));
                 } catch (ParseException e) {
                     throw new RuntimeException(e);
                 }
-            }
-            if (electricBoxDTO.getExpirationDate() == null){
-                electricBoxDTO.setExpirationDate("");
             }else {
+                electricBoxDTO.setInstallDate("");
+            }
+            if (electricBoxDTO.getExpirationDate() != null && !electricBoxDTO.getExpirationDate().equals("")){
                 try {
                     electricBoxDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(electricBoxDTO.getExpirationDate())));
                 } catch (ParseException e) {
                     throw new RuntimeException(e);
                 }
+            }else {
+                electricBoxDTO.setExpirationDate("");
             }
             if (electricBoxDTO.getOnlineCount() != null && electricBoxDTO.getOnlineCount() > 0){
                 electricBoxDTO.setOnline(1);

+ 6 - 6
src/main/java/com/welampiot/service/impl/EnvmonitorServiceImpl.java

@@ -66,24 +66,24 @@ public class EnvmonitorServiceImpl implements EnvmonitorService {
                 envmonitorDTO.setUpdateTime("");
             }
             //获取设备安装时间
-            if (envmonitorDTO.getInstallDate() == null){
-                envmonitorDTO.setInstallDate("");
-            }else {
+            if (envmonitorDTO.getInstallDate() != null && !envmonitorDTO.getInstallDate().equals("")){
                 try {
                     envmonitorDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(envmonitorDTO.getInstallDate())));
                 } catch (ParseException e) {
                     throw new RuntimeException(e);
                 }
+            }else {
+                envmonitorDTO.setInstallDate("");
             }
             //获取设备过期时间
-            if (envmonitorDTO.getExpirationDate() == null){
-                envmonitorDTO.setExpirationDate("");
-            }else {
+            if (envmonitorDTO.getExpirationDate() != null && !envmonitorDTO.getExpirationDate().equals("")){
                 try {
                     envmonitorDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(envmonitorDTO.getExpirationDate())));
                 } catch (ParseException e) {
                     throw new RuntimeException(e);
                 }
+            }else {
+                envmonitorDTO.setExpirationDate("");
             }
             if (envmonitorDTO.getHumidity() == null){
                 envmonitorDTO.setHumidity(0.0f);

+ 1 - 1
src/main/java/com/welampiot/service/impl/LoopServiceImpl.java

@@ -41,7 +41,7 @@ public class LoopServiceImpl implements LoopService {
             if (loopDTO.getPolicyId() == null || loopDTO.getPolicyId() == 0){
                 loopDTO.setPolicyName("");
             }
-            if (loopDTO.getUpdateTime() != null){
+            if (loopDTO.getUpdateTime() != null && !loopDTO.getUpdateTime().equals("")){
                 Date cmdTime;
                 try {
                     cmdTime = simpleDateFormat.parse(loopDTO.getUpdateTime());

+ 7 - 7
src/main/java/com/welampiot/service/impl/ManholeServiceImpl.java

@@ -95,7 +95,7 @@ public class ManholeServiceImpl implements ManholeService {
                         manholeDTO.setUpdateTime("");
                     }
                     //获取设备创建时间
-                    if (manholeDTO.getCreateTime() == null){
+                    if (manholeDTO.getCreateTime() == null && !manholeDTO.getCreateTime().equals("")){
                         manholeDTO.setCreateTime("");
                     }else {
                         try {
@@ -105,24 +105,24 @@ public class ManholeServiceImpl implements ManholeService {
                         }
                     }
                     //获取设备安装时间
-                    if (manholeDTO.getInstallDate() == null){
-                        manholeDTO.setInstallDate("");
-                    }else {
+                    if (manholeDTO.getInstallDate() != null && !manholeDTO.getInstallDate().equals("")){
                         try {
                             manholeDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(manholeDTO.getInstallDate())));
                         } catch (ParseException e) {
                             throw new RuntimeException(e);
                         }
+                    }else {
+                        manholeDTO.setInstallDate("");
                     }
                     //获取设备过期时间
-                    if (manholeDTO.getExpirationDate() == null){
-                        manholeDTO.setExpirationDate("");
-                    }else {
+                    if (manholeDTO.getExpirationDate() != null && !manholeDTO.getExpirationDate().equals("")){
                         try {
                             manholeDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(manholeDTO.getExpirationDate())));
                         } catch (ParseException e) {
                             throw new RuntimeException(e);
                         }
+                    }else {
+                        manholeDTO.setExpirationDate("");
                     }
                     //获取设备位置信息
                     if (version == 0){

+ 2 - 2
src/main/java/com/welampiot/service/impl/ScreenServiceImpl.java

@@ -94,7 +94,7 @@ public class ScreenServiceImpl implements ScreenService {
             }else {
                 screenDTO.setUpdateTime("");
             }
-            if (screenDTO.getInstallDate() != null){
+            if (screenDTO.getInstallDate() != null && !screenDTO.getInstallDate().equals("")){
                 try {
                     screenDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(screenDTO.getInstallDate())));
                 } catch (ParseException e) {
@@ -103,7 +103,7 @@ public class ScreenServiceImpl implements ScreenService {
             }else {
                 screenDTO.setInstallDate("");
             }
-            if (screenDTO.getExpirationDate() != null){
+            if (screenDTO.getExpirationDate() != null && !screenDTO.getExpirationDate().equals("")){
                 try {
                     screenDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(screenDTO.getExpirationDate())));
                 } catch (ParseException e) {

+ 7 - 4
src/main/java/com/welampiot/service/impl/TranshInfoServiceImpl.java

@@ -106,7 +106,7 @@ public class TranshInfoServiceImpl implements TranshInfoService {
                 transhInfoDTO.setUpdateTime("");
             }
             //设备创建时间
-            if (transhInfoDTO.getCreateTime() != null){
+            if (transhInfoDTO.getCreateTime() != null && !transhInfoDTO.getCreateTime().equals("")){
                 try {
                     transhInfoDTO.setCreateTime(simpleDateFormat.format(simpleDateFormat.parse(transhInfoDTO.getCreateTime())));
                 } catch (ParseException e) {
@@ -174,6 +174,7 @@ public class TranshInfoServiceImpl implements TranshInfoService {
                 //组合设备位置名称:城市 + 区域 + 路段
                 transhInfoDTO.setLocation(transhInfoDTO.getCity() + " " + transhInfoDTO.getArea() + " " + transhInfoDTO.getSection());
             }
+            transhInfoDTO.setTotal(transhInfoDao.getTotalBySectionList(dto.getSectionList()));
             list.add(transhInfoDTO);
         });
         vo.setList(list);
@@ -220,9 +221,8 @@ public class TranshInfoServiceImpl implements TranshInfoService {
             }else if (transhInfoDTO.getAlarmStatus() != null && transhInfoDTO.getAlarmStatus() == 0){
                 transhInfoDTO.setAlarmInfo("");
             }
-            if (transhInfoDTO.getUpdateTime() == null){
-                transhInfoDTO.setUpdateTime("");
-            }else {
+            //数据更新时间
+            if (transhInfoDTO.getUpdateTime() != null && !transhInfoDTO.getUpdateTime().equals("")){
                 Date cmdTime;
                 try {
                     cmdTime = simpleDateFormat.parse(transhInfoDTO.getUpdateTime());
@@ -234,7 +234,10 @@ public class TranshInfoServiceImpl implements TranshInfoService {
                 long l = cmdTime.getTime() + timezone * 3600 * 1000;
                 cmdTime = new Date(l);
                 transhInfoDTO.setUpdateTime(simpleDateFormat.format(cmdTime));
+            }else {
+                transhInfoDTO.setUpdateTime("");
             }
+            transhInfoDTO.setTotal(transhInfoDao.getTotalBySectionList(dto.getSectionList()));
             list.add(transhInfoDTO);
         });
         vo.setList(list);

+ 257 - 0
src/main/java/com/welampiot/service/impl/WaterImmersionDevInfoServiceImpl.java

@@ -0,0 +1,257 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.WaterImmersionDevInfoDao;
+import com.welampiot.dto.WaterImmersionDevInfoDTO;
+import com.welampiot.dto.WaterImmersionDevInfoLogDTO;
+import com.welampiot.service.WaterImmersionDevInfoService;
+import com.welampiot.vo.WaterImmersionDevInfoLogVO;
+import com.welampiot.vo.WaterImmersionDevInfoVO;
+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: WaterImmersionDevInfoServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/19 - 12:45
+ * @Version: v1.0
+ */
+@Service
+public class WaterImmersionDevInfoServiceImpl implements WaterImmersionDevInfoService {
+    @Autowired
+    private WaterImmersionDevInfoDao waterImmersionDevInfoDao;
+
+    @Override
+    public WaterImmersionDevInfoVO getWaterImmersionList(WaterImmersionDevInfoDTO dto, Integer version) {
+        WaterImmersionDevInfoVO vo = new WaterImmersionDevInfoVO();
+        vo.setTotal(waterImmersionDevInfoDao.getDeviceTotalByDTO(dto));
+        List<WaterImmersionDevInfoDTO> waterImmersionList = waterImmersionDevInfoDao.getWaterImmersionListByDTO(dto);
+        List<WaterImmersionDevInfoDTO> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        waterImmersionList.forEach(waterImmersionDTO ->{
+            //灯杆名
+            if (waterImmersionDTO.getLampPoleName() == null){
+                waterImmersionDTO.setLampPoleName("");
+            }
+            //区域名
+            if (version == 0){
+                if (waterImmersionDTO.getChArea() != null){
+                    waterImmersionDTO.setArea(waterImmersionDTO.getChArea());
+                }else {
+                    waterImmersionDTO.setArea("");
+                }
+            }else if (version == 1){
+                if (waterImmersionDTO.getEnArea() != null){
+                    waterImmersionDTO.setArea(waterImmersionDTO.getEnArea());
+                }else {
+                    waterImmersionDTO.setArea("");
+                }
+            }else {
+                if (waterImmersionDTO.getRuArea() != null){
+                    waterImmersionDTO.setArea(waterImmersionDTO.getRuArea());
+                }else {
+                    waterImmersionDTO.setArea("");
+                }
+            }
+            //路段名
+            if (waterImmersionDTO.getSection() == null){
+                waterImmersionDTO.setSection("");
+            }
+            //设备型号(0 RS-SJ-R01-4,1 RS485-WT10)
+            if (waterImmersionDTO.getModel() != null && waterImmersionDTO.getModel() == 1){
+                waterImmersionDTO.setModel(1);
+            }else {
+                waterImmersionDTO.setModel(0);
+            }
+            //网络状态(0:离线,1:在线)
+            if (waterImmersionDTO.getStatus() != null && waterImmersionDTO.getStatus() == 1){
+                waterImmersionDTO.setStatus(1);
+            }else {
+                waterImmersionDTO.setStatus(0);
+            }
+            //水浸探针1(0 正常,1 浸水)
+            if (waterImmersionDTO.getProbe1() != null && waterImmersionDTO.getProbe1() == 1){
+                waterImmersionDTO.setProbe1(1);
+            }else {
+                waterImmersionDTO.setProbe1(0);
+            }
+            //水浸探针2(0 正常,1 浸水)
+            if (waterImmersionDTO.getProbe2() != null && waterImmersionDTO.getProbe2() == 1){
+                waterImmersionDTO.setProbe2(1);
+            }else {
+                waterImmersionDTO.setProbe2(0);
+            }
+            //报警等级(0: 一级,1: 二级,2: 三级)
+            if (waterImmersionDTO.getLevel() != null && waterImmersionDTO.getLevel() == 2){
+                waterImmersionDTO.setLevel(2);
+            }else if (waterImmersionDTO.getLevel() != null && waterImmersionDTO.getLevel() == 1){
+                waterImmersionDTO.setLevel(1);
+            }else {
+                waterImmersionDTO.setLevel(0);
+            }
+            //关联设备是否要断电(0: 否,1:是)
+            if (waterImmersionDTO.getPowerStatus() != null && waterImmersionDTO.getPowerStatus() == 1){
+                waterImmersionDTO.setPowerStatus(1);
+            }else {
+                waterImmersionDTO.setPowerStatus(0);
+            }
+            //厂家(0:建大仁科,1:红斯迈科技,2:云之声)
+            if (waterImmersionDTO.getFactory() != null && waterImmersionDTO.getFactory() == 2){
+                waterImmersionDTO.setFactory(2);
+            }else if (waterImmersionDTO.getFactory() != null && waterImmersionDTO.getFactory() == 1){
+                waterImmersionDTO.setFactory(1);
+            }else {
+                waterImmersionDTO.setFactory(0);
+            }
+            //云盒的型号(0 G100,1 G200,2 G300)
+            if (waterImmersionDTO.getCloudBoxModel() != null && waterImmersionDTO.getCloudBoxModel() == 2){
+                waterImmersionDTO.setCloudBoxModel(2);
+            }else if (waterImmersionDTO.getCloudBoxModel() != null && waterImmersionDTO.getCloudBoxModel() == 1){
+                waterImmersionDTO.setCloudBoxModel(1);
+            }else {
+                waterImmersionDTO.setCloudBoxModel(0);
+            }
+            //创建时间
+            if (waterImmersionDTO.getCreateTime() != null && !waterImmersionDTO.getCreateTime().equals("")){
+                try {
+                    waterImmersionDTO.setCreateTime(simpleDateFormat.format(simpleDateFormat.parse(waterImmersionDTO.getCreateTime())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                waterImmersionDTO.setCreateTime("");
+            }
+            //安装时间
+            if (waterImmersionDTO.getInstallDate() != null && !waterImmersionDTO.getInstallDate().equals("")){
+                try {
+                    waterImmersionDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(waterImmersionDTO.getInstallDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                waterImmersionDTO.setInstallDate("");
+            }
+            //过期时间
+            if (waterImmersionDTO.getExpirationDate() != null && !waterImmersionDTO.getExpirationDate().equals("")){
+                try {
+                    waterImmersionDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(waterImmersionDTO.getExpirationDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                waterImmersionDTO.setExpirationDate("");
+            }
+            //更新时间
+            if (waterImmersionDTO.getUpdateTime() != null && !waterImmersionDTO.getUpdateTime().equals("")){
+                Date cmdTime;
+                try {
+                    cmdTime = simpleDateFormat.parse(waterImmersionDTO.getUpdateTime());
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+                //判断时区,为null默认东八区
+                long timezone = waterImmersionDTO.getTimezone() == null ? 8 : waterImmersionDTO.getTimezone();
+                long l = cmdTime.getTime() + timezone * 3600 * 1000;
+                cmdTime = new Date(l);
+                waterImmersionDTO.setUpdateTime(simpleDateFormat.format(cmdTime));
+            }else {
+                waterImmersionDTO.setUpdateTime("");
+            }
+            list.add(waterImmersionDTO);
+        });
+        vo.setList(list);
+        return vo;
+    }
+
+    @Override
+    public WaterImmersionDevInfoLogVO getLogList(WaterImmersionDevInfoLogDTO dto) {
+        WaterImmersionDevInfoLogVO vo = new WaterImmersionDevInfoLogVO();
+        vo.setTotal(waterImmersionDevInfoDao.getDeviceTotalByDTO(dto));
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        //开始时间
+        if (dto.getBeginTime() != null && !dto.getBeginTime().equals("")){
+            Date cmdTime;
+            try {
+                cmdTime = simpleDateFormat.parse(dto.getBeginTime());
+            } catch (ParseException e) {
+                throw new RuntimeException(e);
+            }
+            //判断时区,为null默认东八区
+            long timezone = waterImmersionDevInfoDao.getTimezoneById(dto) == null ? 8 : waterImmersionDevInfoDao.getTimezoneById(dto);
+            long l = cmdTime.getTime() - timezone * 3600 * 1000;
+            cmdTime = new Date(l);
+            dto.setBeginTime(simpleDateFormat.format(cmdTime));
+        }else {
+            dto.setBeginTime("");
+        }
+        //结束时间
+        if (dto.getEndTime() != null && !dto.getEndTime().equals("")){
+            Date cmdTime;
+            try {
+                cmdTime = simpleDateFormat.parse(dto.getEndTime());
+            } catch (ParseException e) {
+                throw new RuntimeException(e);
+            }
+            //判断时区,为null默认东八区
+            long timezone = waterImmersionDevInfoDao.getTimezoneById(dto) == null ? 8 : waterImmersionDevInfoDao.getTimezoneById(dto);
+            long l = cmdTime.getTime() - timezone * 3600 * 1000;
+            cmdTime = new Date(l);
+            dto.setEndTime(simpleDateFormat.format(cmdTime));
+        }else {
+            dto.setEndTime("");
+        }
+        List<WaterImmersionDevInfoLogDTO> logList = waterImmersionDevInfoDao.getLogListByDTO(dto);
+        List<WaterImmersionDevInfoLogDTO> list = new ArrayList<>();
+        logList.forEach(logDTO ->{
+            if (logDTO.getProbe1() != null && logDTO.getProbe1() == 1){
+                logDTO.setProbe1(1);
+            }else {
+                logDTO.setProbe1(0);
+            }
+            if (logDTO.getProbe2() != null && logDTO.getProbe2() == 2){
+                logDTO.setProbe2(1);
+            }else {
+                logDTO.setProbe2(0);
+            }
+            if (logDTO.getLevel() != null && logDTO.getLevel() == 2){
+                logDTO.setLevel(2);
+            }else if (logDTO.getLevel() != null && logDTO.getLevel() == 1){
+                logDTO.setLevel(1);
+            }else {
+                logDTO.setLevel(0);
+            }
+            if (logDTO.getPowerStatus() != null && logDTO.getPowerStatus() == 1){
+                logDTO.setPowerStatus(1);
+            }else {
+                logDTO.setPowerStatus(0);
+            }
+            //更新时间
+            if (logDTO.getUpdateTime() != null && !logDTO.getUpdateTime().equals("")){
+                Date cmdTime;
+                try {
+                    cmdTime = simpleDateFormat.parse(logDTO.getUpdateTime());
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+                //判断时区,为null默认东八区
+                long timezone = logDTO.getTimezone() == null ? 8 : logDTO.getTimezone();
+                long l = cmdTime.getTime() + timezone * 3600 * 1000;
+                cmdTime = new Date(l);
+                logDTO.setUpdateTime(simpleDateFormat.format(cmdTime));
+            }else {
+                logDTO.setUpdateTime("");
+            }
+            list.add(logDTO);
+        });
+        vo.setList(list);
+        return vo;
+    }
+}

+ 1 - 1
src/main/java/com/welampiot/service/impl/WifiServiceImpl.java

@@ -52,7 +52,7 @@ public class WifiServiceImpl implements WifiService {
             }else {
                 wifiDTO.setStatus(0);
             }
-            if (wifiDTO.getUpdateTime() != null){
+            if (wifiDTO.getUpdateTime() != null && !wifiDTO.getUpdateTime().equals("")){
                 Date cmdTime;
                 try {
                     cmdTime = simpleDateFormat.parse(wifiDTO.getUpdateTime());

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

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

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

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

+ 2 - 2
src/main/resources/mapper/TranshInfoMapper.xml

@@ -49,7 +49,7 @@
         select t.id,t.name,t.areaid as areaId,t.sectionid as sectionId,t.address,
                t.online,t.rssi,t.rsrp as rsRp,t.snr,t.distance,t.state,t.angle,
                t.longitude,t.latitude,t.batt as batT,t.temperature,t.updateTime,
-               t.createTime,count(t.id) as total,t.full,t.deviceId,s.name as section,
+               t.createTime,t.full,t.deviceId,s.name as section,
                g.english_name englishName,g.ru_name ruName,g.chinese_name chineseName,
                p.chinese_name as chCity,p.english_name as enCity,p.ru_name as ruCity,s.timezone
         from transh_info t left join section s on t.sectionid = s.id
@@ -72,7 +72,7 @@
 
     <select id="getHistoryListByDTO" resultType="TranshInfoDTO">
         select t.rssi,t.rsrp as rsRp,t.snr,t.distance,t.angle,t.state,t.batt as batT,
-               t.temperature,t.online,t.full,t.updateTime,count(t.id) as total,s.timezone
+               t.temperature,t.online,t.full,t.updateTime,s.timezone
         from transh_info t left join section s on t.sectionid = s.id
         where t.id = #{id}
             <if test="sectionList != null and !sectionList.isEmpty()">

+ 84 - 0
src/main/resources/mapper/WaterImmersionDevInfoMapper.xml

@@ -0,0 +1,84 @@
+<?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.WaterImmersionDevInfoDao">
+
+    <select id="getWaterImmersionListByDTO" resultType="WaterImmersionDevInfoDTO">
+        select w.id,w.lamp_pole_id lampPoleId,s.name as section,g.chinese_name chArea,g.english_name enArea,
+               g.ru_name ruArea,lp.name lampPoleName,w.number,w.name,w.model,w.status,w.probe1,w.probe2,w.delaytime as delayTime,
+               w.level,w.powerstatus as powerStatus,w.address,w.box_address boxAddress,w.box_sub_address boxSubAddress,w.factory,
+               w.deviceId,wifi.model as cloudBoxModel,w.createtime as createTime,w.updatetime as updateTime,w.install_date installDate,
+               w.expiration_date expirationDate,s.timezone
+        from water_immersion_dev_info w left join lamp_pole lp on lp.id = w.lamp_pole_id
+            left join wifi on wifi.lamp_pole_id = lp.id
+            left join section s on lp.sectionid = s.id
+            left join global_location g on s.pid = g.id
+        where w.lamp_pole_id != 0
+            <if test="sectionList != null and !sectionList.isEmpty()">
+                and lp.sectionid in
+                <foreach collection="sectionList" open="(" separator="," close=")" item="dto">
+                    #{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(lp.number using gbk) asc,
+                     convert(w.name using gbk) asc,w.id desc
+            <if test="page >= 0 and count > 0">
+                limit #{page},#{count}
+            </if>
+    </select>
+
+    <select id="getDeviceTotalByDTO" resultType="Integer">
+        select count(w.id) as total
+        from water_immersion_dev_info w left join lamp_pole lp on w.lamp_pole_id = lp.id
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where lp.sectionid in
+            <foreach collection="sectionList" open="(" separator="," close=")" item="dto">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
+    
+    <select id="getLogListByDTO" resultType="WaterImmersionDevInfoLogDTO">
+        select w1.id,w1.water_immersion_id waterImmersionId,w1.probe1,w1.probe2,w1.level,w1.powerstatus,w1.updatetime as updateTime,s.timezone
+        from water_immersion_dev_info_log w1 left join water_immersion_dev_info w2 on w1.water_immersion_id = w2.id
+            left join lamp_pole lp on lp.id = w2.lamp_pole_id
+            left join section s on lp.sectionid = s.id
+        where 1=1
+            <if test="waterImmersionId != null and waterImmersionId != 0">
+                and w1.water_immersion_id = #{waterImmersionId}
+            </if>
+            <if test="sectionList != null and !sectionList.isEmpty()">
+                and lp.sectionid in
+                <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                    #{dto}
+                </foreach>
+            </if>
+            <if test="beginTime != null and beginTime != ''">
+                and date_format(w1.updatetime,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and date_format(w1.updatetime,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
+            </if>
+            <if test="page >= 0 and count > 0">
+                limit #{page},#{count}
+            </if>
+    </select>
+
+    <select id="getTimezoneById" resultType="Integer">
+        select s.timezone
+        from water_immersion_dev_info w1 left join lamp_pole lp on lp.id = w1.lamp_pole_id
+            left join section s on lp.sectionid = s.id
+        where w1.id = #{waterImmersionId}
+    </select>
+
+</mapper>