crazycat vor 2 Jahren
Ursprung
Commit
7fd3b340ca
35 geänderte Dateien mit 804 neuen und 21 gelöschten Zeilen
  1. 1 1
      src/main/java/com/welampiot/common/Constant.java
  2. 5 0
      src/main/java/com/welampiot/common/InterfaceResultEnum.java
  3. 61 6
      src/main/java/com/welampiot/controller/LampController.java
  4. 3 0
      src/main/java/com/welampiot/controller/LampPoleController.java
  5. 122 3
      src/main/java/com/welampiot/controller/NewLampPoleController.java
  6. 89 4
      src/main/java/com/welampiot/controller/UserController.java
  7. 1 0
      src/main/java/com/welampiot/dao/GlobalLocationDao.java
  8. 11 0
      src/main/java/com/welampiot/dao/LampPoleAlarmLogDao.java
  9. 4 0
      src/main/java/com/welampiot/dao/LampPoleDao.java
  10. 1 0
      src/main/java/com/welampiot/dao/SectionDao.java
  11. 3 0
      src/main/java/com/welampiot/dao/WifiDao.java
  12. 14 0
      src/main/java/com/welampiot/dto/FreqDTO.java
  13. 13 0
      src/main/java/com/welampiot/dto/GWRSDevDTO.java
  14. 2 2
      src/main/java/com/welampiot/dto/GlobalLocationDTO.java
  15. 12 0
      src/main/java/com/welampiot/dto/LampPoleAlarmLogDTO.java
  16. 24 1
      src/main/java/com/welampiot/dto/LampPoleDTO.java
  17. 2 0
      src/main/java/com/welampiot/dto/UserDTO.java
  18. 2 1
      src/main/java/com/welampiot/dto/WifiDTO.java
  19. 1 0
      src/main/java/com/welampiot/service/GlobalLocationService.java
  20. 11 0
      src/main/java/com/welampiot/service/LampPoleAlarmLogService.java
  21. 5 0
      src/main/java/com/welampiot/service/LampPoleService.java
  22. 1 0
      src/main/java/com/welampiot/service/SectionService.java
  23. 3 0
      src/main/java/com/welampiot/service/WifiService.java
  24. 5 0
      src/main/java/com/welampiot/service/impl/GlobalLocationServiceImpl.java
  25. 26 0
      src/main/java/com/welampiot/service/impl/LampPoleAlarmLogServiceImpl.java
  26. 161 0
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  27. 5 0
      src/main/java/com/welampiot/service/impl/SectionServiceImpl.java
  28. 15 0
      src/main/java/com/welampiot/service/impl/WifiServiceImpl.java
  29. 3 0
      src/main/java/com/welampiot/vo/LampPoleCountVO.java
  30. 9 2
      src/main/java/com/welampiot/vo/LampPoleVO.java
  31. 5 0
      src/main/resources/mapper/GlobalLocationMapper.xml
  32. 27 0
      src/main/resources/mapper/LampPoleAlarmLogMapper.xml
  33. 102 1
      src/main/resources/mapper/LampPoleMapper.xml
  34. 3 0
      src/main/resources/mapper/SectionMapper.xml
  35. 52 0
      src/main/resources/mapper/WifiMapper.xml

+ 1 - 1
src/main/java/com/welampiot/common/Constant.java

@@ -1,5 +1,5 @@
 package com.welampiot.common;
 
 public class Constant {
-    public static String success="000000";
+    public static String success="0000";
 }

+ 5 - 0
src/main/java/com/welampiot/common/InterfaceResultEnum.java

@@ -21,6 +21,11 @@ public enum InterfaceResultEnum {
     LACK_DATE_ERROR("0214","请选择日期范围","",""),
     LACK_DATE_FORMAT_ERROR("0215","日期范围错误,请重新选择日期","",""),
     LACK_DATE_RANGE_ERROR("0216","日期范围不能超过30天","",""),
+    LACK_LAMP_POLE_NUMBER_ERROR("0217","请填写灯杆编号","",""),
+    LACK_LAMP_POLE_NAME_ERROR("0218","请填写灯杆名称","",""),
+    LAMP_POLE_NAME_UNIQUE_ERROR("0219","灯杆名称重复","",""),
+    LAMP_POLE_NUMBER_UNIQUE_ERROR("0220","灯杆编号重复","",""),
+    LAMP_POLE_NUMBER_FORMAT_ERROR("0221","灯杆编号只能包含数字跟字母","",""),
     ;
     private String code;
     private String msgCn;

+ 61 - 6
src/main/java/com/welampiot/controller/LampController.java

@@ -3,12 +3,8 @@ package com.welampiot.controller;
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.common.ResultEnum;
-import com.welampiot.dto.GroupDTO;
-import com.welampiot.dto.LampInfoDTO;
-import com.welampiot.dto.NetworkDTO;
-import com.welampiot.service.GroupService;
-import com.welampiot.service.LampService;
-import com.welampiot.service.NetworkService;
+import com.welampiot.dto.*;
+import com.welampiot.service.*;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.*;
 import org.apache.commons.lang3.ArrayUtils;
@@ -38,6 +34,10 @@ public class LampController {
     private NetworkService networkService;
     @Autowired
     private GroupService groupService;
+    @Autowired
+    private GlobalLocationService globalLocationService;
+    @Autowired
+    private SectionService sectionService;
     /**
      * 灯控列表
      * @param request
@@ -309,5 +309,60 @@ public class LampController {
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
     }
 
+    /**
+     * 频段信息列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/freqList",method = RequestMethod.POST)
+    public BaseResult freqList(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        ArrayList<FreqDTO> freqDTOS = new ArrayList<>();
+        FreqDTO freqDTO = new FreqDTO();
+        freqDTO.setId(1);
+        freqDTO.setName("US915");
+        freqDTOS.add(freqDTO);
+        freqDTO = new FreqDTO();
+        freqDTO.setId(2);
+        freqDTO.setName("EU868");
+        freqDTOS.add(freqDTO);
+        freqDTO = new FreqDTO();
+        freqDTO.setId(3);
+        freqDTO.setName("AS923");
+        freqDTOS.add(freqDTO);
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(freqDTOS);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
+    }
+    /**
+     * 获取经纬度
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/sectionData",method = RequestMethod.POST)
+    public BaseResult sectionData(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
+        LampInfoDTO lampInfoDTO = new LampInfoDTO();
+
+        if ((sectionId == null || sectionId.intValue() == 0) && (areaId == null || areaId.intValue() == 0)) {
+            lampInfoDTO.setLongitude(114.06807299140166f);
+            lampInfoDTO.setLatitude(22.5324106360218f);
+            return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoDTO);
+        }
+        if (areaId == null || areaId.intValue() == 0){
+            SectionDTO oneById = sectionService.getOneById(sectionId);
+            GlobalLocationDTO oneById2 = globalLocationService.getOneById(oneById.getPid());
+            lampInfoDTO.setLongitude(oneById2.getLongitude());
+            lampInfoDTO.setLatitude(oneById2.getLatitude());
+        }else {
+            GlobalLocationDTO oneById = globalLocationService.getOneById(areaId);
+            lampInfoDTO.setLongitude(oneById.getLongitude());
+            lampInfoDTO.setLatitude(oneById.getLatitude());
+        }
+
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoDTO);
+    }
 
 }

+ 3 - 0
src/main/java/com/welampiot/controller/LampPoleController.java

@@ -89,6 +89,8 @@ public class LampPoleController {
     public BaseResult<LampInfoDTO> getList(HttpServletRequest request){
         Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
         Integer groupId = (Integer) toolUtils.getRequestContent(request,"groupId",1);
+
+        List sectionList = toolUtils.getSectionList(request);
         ListResponseVO listResponseVO = new ListResponseVO();
         listResponseVO.setList(new ArrayList());
         listResponseVO.setTotal(1);
@@ -103,6 +105,7 @@ public class LampPoleController {
     public BaseResult<LampInfoDTO> save(LampPoleVO form){
 //        String lightDevList = request.getParameter("lightDevList");
         System.out.println(form.getLightDevList());
+        System.out.println(form.getCloudBox());
 //        System.out.println(request.getParts());
 //        System.out.println(request.getParameterMap().keySet().toString());
 ////        JSONObject.fromObject(map);

+ 122 - 3
src/main/java/com/welampiot/controller/NewLampPoleController.java

@@ -2,6 +2,7 @@ package com.welampiot.controller;
 
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.GWRSDevDTO;
 import com.welampiot.dto.*;
 import com.welampiot.service.*;
 import com.welampiot.utils.ToolUtils;
@@ -55,6 +56,8 @@ public class NewLampPoleController {
     private LampService lampService;
     @Autowired
     private LampInfoLogService lampInfoLogService;
+    @Autowired
+    private LampPoleAlarmLogService lampPoleAlarmLogService;
 
     @RequestMapping(value = "/info",method = RequestMethod.POST)
     public BaseResult info(HttpServletRequest request){
@@ -70,9 +73,9 @@ public class NewLampPoleController {
         lampPoleInfoVO.setWifiCount(listByVO.size());
         lampPoleInfoVO.setEmCount(0);
         for (LampPoleDTO l:listByVO) {
-            String devType = l.getDevType();
-            List split = Arrays.asList(devType.split(","));
-            if (split.contains("5")) lampPoleInfoVO.setEmCount(lampPoleInfoVO.getEmCount()+1);;
+//            String devType = l.getDevType();
+//            List split = Arrays.asList(devType.split(","));
+//            if (split.contains("5")) lampPoleInfoVO.setEmCount(lampPoleInfoVO.getEmCount()+1);;
         }
 //        $data['loopCount'] = $this->Loop_model->get_count(array('sectionid'=>$sectionId));
 //        $id_arr = array_column($lampPoleList, 'id');
@@ -610,4 +613,120 @@ public class NewLampPoleController {
         lampLogVO1.setMaxVol(maxVol.toString());
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampLogVO1);
     }
+
+    /**
+     * 灯杆列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/lampPoleList", method = RequestMethod.POST)
+    public BaseResult lampPoleList(HttpServletRequest request) {
+        Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        Integer isInspec = request.getParameter("isInspec") == null || request.getParameter("isInspec").length() == 0 ? null : Integer.parseInt(request.getParameter("isInspec"));
+        String keyword = request.getParameter("keyword") == null ? "" : request.getParameter("keyword");
+        List sectionList = toolUtils.getSectionList(request);
+        Integer page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        Integer count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+
+        Integer limit = count;
+        Integer offset = (page-1)*count;
+
+        LampPoleVO lampPoleVO = new LampPoleVO();
+        lampPoleVO.setVersion(version);
+        lampPoleVO.setSectionList(sectionList);
+        lampPoleVO.setLimit(limit);
+        lampPoleVO.setOffset(offset);
+
+
+        if (isInspec != null) lampPoleVO.setIsInspec(isInspec);
+        if (keyword != null && keyword.length() != 0) lampPoleVO.setKeyword(keyword);
+        List<LampPoleDTO> lampPoleDTOS = lampPoleService.lampPoleList(lampPoleVO);
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(lampPoleDTOS);
+        listResponseVO.setTotal(lampPoleService.lampPoleCount(lampPoleVO));
+
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
+    }
+
+    /**
+     * 灯杆详情
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/lampPoleInfo", method = RequestMethod.POST)
+    public BaseResult lampPoleInfo(HttpServletRequest request) throws ParseException {
+        Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        List sectionList = toolUtils.getSectionList(request);
+        LampPoleVO lampPoleVO = new LampPoleVO();
+        lampPoleVO.setSectionList(sectionList);
+        List<LampPoleDTO> listByVO = lampPoleService.getListByVO(lampPoleVO);
+        ArrayList<Integer> lampPoleIds = new ArrayList<>();
+        lampPoleIds.add(0);
+        for (LampPoleDTO l :listByVO) {
+            lampPoleIds.add(l.getId());
+        }
+
+        Integer countByLampPoleIdList = lampPoleAlarmLogService.getCountByLampPoleIdList(lampPoleIds);
+        LampPoleInfoVO lampPoleInfoVO = new LampPoleInfoVO();
+        lampPoleInfoVO.setDeviceCount(listByVO.size());
+        lampPoleInfoVO.setRunCount(listByVO.size()-countByLampPoleIdList);
+        lampPoleInfoVO.setFaultCount(countByLampPoleIdList);
+        int newCount = 0;
+        for (LampPoleDTO l :listByVO) {
+            if (l.getCreateTime() != null){
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Date date = sdf.parse(l.getCreateTime());
+                long time = date.getTime();
+                if (System.currentTimeMillis() - time <= 3600*24*30*1000){
+                    newCount ++;
+                }
+            }
+        }
+        lampPoleInfoVO.setNewCount(newCount);
+        lampPoleInfoVO.setDisableCount(0);
+
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleInfoVO);
+    }
+
+    /**
+     * 云盒气象站RS485设备信息列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/GWRS485DevList",method = RequestMethod.POST)
+    public BaseResult GWRS485DevList(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        ArrayList<GWRSDevDTO> gWRSDevDTOS = new ArrayList<>();
+        GWRSDevDTO gWRSDevDTO = new GWRSDevDTO();
+        gWRSDevDTO.setId(1);
+        gWRSDevDTO.setName("百叶箱 X 6");
+        gWRSDevDTOS.add(gWRSDevDTO);
+        gWRSDevDTO = new GWRSDevDTO();
+        gWRSDevDTO.setId(2);
+        gWRSDevDTO.setName("风向");
+        gWRSDevDTOS.add(gWRSDevDTO);
+        gWRSDevDTO = new GWRSDevDTO();
+        gWRSDevDTO.setId(3);
+        gWRSDevDTO.setName("风速");
+        gWRSDevDTOS.add(gWRSDevDTO);
+        gWRSDevDTO = new GWRSDevDTO();
+        gWRSDevDTO.setId(4);
+        gWRSDevDTO.setName("雨量");
+        gWRSDevDTOS.add(gWRSDevDTO);
+        gWRSDevDTO = new GWRSDevDTO();
+        gWRSDevDTO.setId(5);
+        gWRSDevDTO.setName("太阳辐射");
+        gWRSDevDTOS.add(gWRSDevDTO);
+        gWRSDevDTO = new GWRSDevDTO();
+        gWRSDevDTO.setId(6);
+        gWRSDevDTO.setName("百叶箱 X 10");
+        gWRSDevDTOS.add(gWRSDevDTO);
+        gWRSDevDTO = new GWRSDevDTO();
+        gWRSDevDTO.setId(7);
+        gWRSDevDTO.setName("超声波风速风向");
+        gWRSDevDTOS.add(gWRSDevDTO);
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(gWRSDevDTOS);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
+    }
 }

+ 89 - 4
src/main/java/com/welampiot/controller/UserController.java

@@ -2,19 +2,29 @@ package com.welampiot.controller;
 
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.ResultEnum;
+import com.welampiot.dto.GlobalLocationDTO;
+import com.welampiot.dto.SectionDTO;
 import com.welampiot.dto.UserDTO;
+import com.welampiot.service.GlobalLocationService;
+import com.welampiot.service.SectionService;
 import com.welampiot.service.UserService;
 import com.welampiot.utils.MD5Utils;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.GlobalLocationVO;
+import com.welampiot.vo.ListResponseVO;
 import com.welampiot.vo.LoginVO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
+//import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
+import java.util.List;
 
 @RestController
+@CrossOrigin
 @RequestMapping("/user")
 //@Slf4j
 public class UserController {
@@ -22,6 +32,12 @@ public class UserController {
 
     @Autowired
     private UserService userService;
+    @Autowired
+    private ToolUtils toolUtils;
+    @Autowired
+    private GlobalLocationService globalLocationService;
+    @Autowired
+    private SectionService sectionService;
 
     /**
      * 登录demo做测试,后续删除
@@ -40,21 +56,90 @@ public class UserController {
     }
 
     @RequestMapping(value = "/find",method = RequestMethod.POST)
-    @PreAuthorize(value = "isAuthenticated()")//需要登录才可以访问
+//    @PreAuthorize(value = "isAuthenticated()")//需要登录才可以访问
     public BaseResult<?> find(){
         int num = userService.countUser();
         return BaseResult.success(num);
     }
     @RequestMapping(value = "/doIt",method = RequestMethod.POST)
-    @PreAuthorize(value = "isAuthenticated()")//需要登录才可以访问
+//    @PreAuthorize(value = "isAuthenticated()")//需要登录才可以访问
     public BaseResult<?> doIt(){
         int num = userService.countUser();
         return BaseResult.success(num);
     }
     @RequestMapping(value = "/amazing",method = RequestMethod.POST)
-    @PreAuthorize(value = "isAuthenticated()")//需要登录才可以访问
+//    @PreAuthorize(value = "isAuthenticated()")//需要登录才可以访问
     public BaseResult<?> amazing(){
         int num = userService.countUser();
         return BaseResult.success(num);
     }
+
+    /**
+     * 获取用户省份下拉列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/provinceNav",method = RequestMethod.POST)
+    private BaseResult<?> provinceNav(HttpServletRequest request) {
+        String version = request.getParameter("version") == null ? "0" : request.getParameter("version");
+        List sectionList = toolUtils.getSectionList(request);
+        GlobalLocationVO globalLocationVO = new GlobalLocationVO();
+        globalLocationVO.setSectionList(sectionList);
+        globalLocationVO.setVersion(Integer.valueOf(version));
+        List<GlobalLocationDTO> userProvinceNav = globalLocationService.getUserProvinceNav(globalLocationVO);
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(userProvinceNav);
+        return BaseResult.success(listResponseVO);
+    }
+
+    /**
+     * 用户获取城市下拉列表
+     * @param request
+     * @return
+     */
+    @PostMapping("/cityNav")
+    private BaseResult<?> cityNav(HttpServletRequest request){
+        String version = request.getParameter("version") == null ? "0" : request.getParameter("version");
+        List sectionList = toolUtils.getSectionList(request);
+        System.out.println(sectionList);
+        GlobalLocationVO globalLocationVO = new GlobalLocationVO();
+        globalLocationVO.setSectionList(sectionList);
+        globalLocationVO.setVersion(Integer.valueOf(version));
+        List<GlobalLocationDTO> userProvinceNav = globalLocationService.getUserCityNav(globalLocationVO);
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(userProvinceNav);
+        return BaseResult.success(listResponseVO);
+    }
+
+    /**
+     * 用户获取区域下拉列表
+     * @param request
+     * @return
+     */
+    @PostMapping("/areaNav")
+    private BaseResult<?> areaNav(HttpServletRequest request){
+        String version = request.getParameter("version") == null ? "0" : request.getParameter("version");
+        List sectionList = toolUtils.getSectionList(request);
+        GlobalLocationVO globalLocationVO = new GlobalLocationVO();
+        globalLocationVO.setSectionList(sectionList);
+        globalLocationVO.setVersion(Integer.valueOf(version));
+        List<GlobalLocationDTO> userProvinceNav = globalLocationService.getUserAreaNav(globalLocationVO);
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(userProvinceNav);
+        return BaseResult.success(listResponseVO);
+    }
+
+    /**
+     * 用户获取路段下拉列表
+     * @param request
+     * @return
+     */
+    @PostMapping("/sectionNav")
+    private BaseResult<?> sectionNav(HttpServletRequest request){
+        List sectionList = toolUtils.getSectionList(request);
+        List<SectionDTO> sectionDTOList = sectionService.getListByIdList(sectionList);
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(sectionDTOList);
+        return BaseResult.success(listResponseVO);
+    }
 }

+ 1 - 0
src/main/java/com/welampiot/dao/GlobalLocationDao.java

@@ -23,4 +23,5 @@ public interface GlobalLocationDao {
     List<GlobalLocationDTO> getListByPid(@Param("pid") Integer pid);
     List<GlobalLocationDTO> getListByPidList(@Param("pids") List pids);
     List<GlobalLocationDTO> getUserProvinceNav(GlobalLocationVO globalLocationVO);
+    GlobalLocationDTO getOneById(@Param("id") Integer id);
 }

+ 11 - 0
src/main/java/com/welampiot/dao/LampPoleAlarmLogDao.java

@@ -0,0 +1,11 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.LampPoleAlarmLogDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface LampPoleAlarmLogDao {
+    List<LampPoleAlarmLogDTO> getListByLampPoleIdList(@Param("lampPoleIdList") List lampPoleIdList);
+    Integer getCountByLampPoleIdList(@Param("lampPoleIdList") List lampPoleIdList);
+}

+ 4 - 0
src/main/java/com/welampiot/dao/LampPoleDao.java

@@ -11,4 +11,8 @@ public interface LampPoleDao {
     List<LampPoleDTO> getNavByVO(LampPoleVO lampPoleVO);
 
     List<LampPoleDTO> getListByVO(LampPoleVO lampPoleVO);
+    List<LampPoleDTO> lampPoleList(LampPoleVO lampPoleVO);
+    Integer lampPoleCount(LampPoleVO lampPoleVO);
+    Integer add(LampPoleDTO lampPoleDTO);
+    Integer update(LampPoleDTO lampPoleDTO);
 }

+ 1 - 0
src/main/java/com/welampiot/dao/SectionDao.java

@@ -10,4 +10,5 @@ public interface SectionDao {
     List<SectionDTO> getListByPid(@Param("pid") Integer pid);
     List<SectionDTO> getListByPidList(@Param("pidList") List pidList);
     List<SectionDTO> getListByIdList(@Param("idList") List idList);
+    SectionDTO getOneById(@Param("id") Integer id);
 }

+ 3 - 0
src/main/java/com/welampiot/dao/WifiDao.java

@@ -22,4 +22,7 @@ public interface WifiDao {
     Integer getWifiOnlineTotalBySectionList(WifiDTO dto);
 
     WifiDTO getWifiOutInfoByDTO(@Param("id") Integer id, @Param("sectionList") List<WifiDTO> sectionList);
+    Integer getCountByDTO(WifiDTO dto);
+    Integer add(WifiDTO dto);
+    Integer update(WifiDTO dto);
 }

+ 14 - 0
src/main/java/com/welampiot/dto/FreqDTO.java

@@ -0,0 +1,14 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+@Data
+public class FreqDTO {
+    private Integer id;
+    private String name;
+    private String deviceProfileID;
+    private Integer networkServerID;
+    private String serviceProfileID;
+    private Integer dr;
+    private Integer frequency;
+}

+ 13 - 0
src/main/java/com/welampiot/dto/GWRSDevDTO.java

@@ -0,0 +1,13 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+@Data
+public class GWRSDevDTO {
+    private Integer id;
+    private String devNameCH;
+    private String devNameEN;
+    private String devNameRU;
+    private String name;
+    private String cmd;
+}

+ 2 - 2
src/main/java/com/welampiot/dto/GlobalLocationDTO.java

@@ -43,9 +43,9 @@ public class GlobalLocationDTO implements Serializable {
 
     private Integer timeType;//时区类型
 
-    private Double longitude;//经度
+    private float longitude;//经度
 
-    private Double latitude;//纬度
+    private float latitude;//纬度
 
     private String name;
     private String name1;

+ 12 - 0
src/main/java/com/welampiot/dto/LampPoleAlarmLogDTO.java

@@ -0,0 +1,12 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+@Data
+public class LampPoleAlarmLogDTO {
+    private Integer id;
+    private Integer lampPoleId;
+    private String updateTime;
+    private Integer status;
+    private Integer devType;
+}

+ 24 - 1
src/main/java/com/welampiot/dto/LampPoleDTO.java

@@ -6,9 +6,32 @@ import lombok.Data;
 public class LampPoleDTO {
     private Integer id;
     private String name;
+    private String number;
     private Float longitude;
     private Float latitude;
     private String devType;
-    private String createtime;
+    private String createTime;
     private Integer online;
+    private String sn;
+    private String area;
+    private String section;
+    private String city;
+    private String company;
+    private Integer policyId;
+    private Integer timezone;
+    private Integer isInspec;
+    private String updateTime;
+    private String policyName;
+    private Integer policyType;
+    private Integer lighteness;
+    private String power;
+    private Integer faultstatus;
+    private String location;
+    private String alarmInfo;
+    private Integer height;
+    private Integer areaId;
+    private Integer sectionId;
+    private String installDate;
+    private String expirationDate;
+
 }

+ 2 - 0
src/main/java/com/welampiot/dto/UserDTO.java

@@ -23,6 +23,8 @@ public class UserDTO implements UserDetails{
     private String address;
     private String emerUser;
     private String emerPassword;
+    private String token;
+    private String privilege;
 
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {

+ 2 - 1
src/main/java/com/welampiot/dto/WifiDTO.java

@@ -27,6 +27,7 @@ public class WifiDTO implements Serializable {
 
     /** 序列号IMEI **/
     private String num;
+    private String sn;
 
     /** 供电方式(0 = 适配器,1 = POE, 2 = 其他)**/
     private Integer powerModel;
@@ -283,7 +284,7 @@ public class WifiDTO implements Serializable {
     /** 路段id **/
     private Integer sectionId;
 
-    private List<WifiDTO> sectionList;
+    private List sectionList;
 
     private Integer onlineState;
 

+ 1 - 0
src/main/java/com/welampiot/service/GlobalLocationService.java

@@ -24,4 +24,5 @@ public interface GlobalLocationService {
     List<GlobalLocationDTO> getUserProvinceNav(GlobalLocationVO globalLocationVO);
     List<GlobalLocationDTO> getUserCityNav(GlobalLocationVO globalLocationVO);
     List<GlobalLocationDTO> getUserAreaNav(GlobalLocationVO globalLocationVO);
+    GlobalLocationDTO getOneById(@Param("id") Integer id);
 }

+ 11 - 0
src/main/java/com/welampiot/service/LampPoleAlarmLogService.java

@@ -0,0 +1,11 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.LampPoleAlarmLogDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface LampPoleAlarmLogService {
+    List<LampPoleAlarmLogDTO> getListByLampPoleIdList(@Param("lampPoleIdList") List lampPoleIdList);
+    Integer getCountByLampPoleIdList(@Param("lampPoleIdList") List lampPoleIdList);
+}

+ 5 - 0
src/main/java/com/welampiot/service/LampPoleService.java

@@ -1,5 +1,6 @@
 package com.welampiot.service;
 
+import com.welampiot.common.BaseResult;
 import com.welampiot.dto.LampPoleDTO;
 import com.welampiot.vo.LampPoleCountVO;
 import com.welampiot.vo.LampPoleVO;
@@ -10,4 +11,8 @@ public interface LampPoleService {
     Integer getCountByVO(LampPoleCountVO lampPoleCountVO);
     List<LampPoleDTO> getNavByVO(LampPoleVO lampPoleVO);
     List<LampPoleDTO> getListByVO(LampPoleVO lampPoleVO);
+    List<LampPoleDTO> lampPoleList(LampPoleVO lampPoleVO);
+    Integer lampPoleCount(LampPoleVO lampPoleVO);
+    BaseResult add(LampPoleVO lampPoleVO);
+    Integer update(LampPoleDTO lampPoleDTO);
 }

+ 1 - 0
src/main/java/com/welampiot/service/SectionService.java

@@ -11,4 +11,5 @@ public interface SectionService {
     List<SectionDTO> getListByPid(Integer pid);
     List<SectionDTO> getListByPidList(List pidList);
     List<SectionDTO> getListByIdList(@Param("idList") List idList);
+    SectionDTO getOneById(@Param("id") Integer id);
 }

+ 3 - 0
src/main/java/com/welampiot/service/WifiService.java

@@ -21,4 +21,7 @@ public interface WifiService {
     WifiVO getWifiInfo(WifiDTO dto);
 
     WifiOutInfoVO getWifiOutInfo(Integer id, List<WifiDTO> sectionList);
+    Integer getCountByDTO(WifiDTO dto);
+    Integer add(WifiDTO dto);
+    Integer update(WifiDTO dto);
 }

+ 5 - 0
src/main/java/com/welampiot/service/impl/GlobalLocationServiceImpl.java

@@ -155,4 +155,9 @@ public class GlobalLocationServiceImpl implements GlobalLocationService {
 
         return data;
     }
+
+    @Override
+    public GlobalLocationDTO getOneById(Integer id) {
+        return globalLocationDao.getOneById(id);
+    }
 }

+ 26 - 0
src/main/java/com/welampiot/service/impl/LampPoleAlarmLogServiceImpl.java

@@ -0,0 +1,26 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.LampPoleAlarmLogDao;
+import com.welampiot.dto.LampPoleAlarmLogDTO;
+import com.welampiot.service.LampPoleAlarmLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class LampPoleAlarmLogServiceImpl implements LampPoleAlarmLogService {
+    @Autowired
+    private LampPoleAlarmLogDao lampPoleAlarmLogDao;
+    @Override
+    public List<LampPoleAlarmLogDTO> getListByLampPoleIdList(List lampPoleIdList) {
+        List<LampPoleAlarmLogDTO> listByLampPoleIdList = lampPoleAlarmLogDao.getListByLampPoleIdList(lampPoleIdList);
+        return listByLampPoleIdList;
+    }
+
+    @Override
+    public Integer getCountByLampPoleIdList(List lampPoleIdList) {
+        Integer countByLampPoleIdList = lampPoleAlarmLogDao.getCountByLampPoleIdList(lampPoleIdList);
+        return countByLampPoleIdList;
+    }
+}

+ 161 - 0
src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java

@@ -1,14 +1,27 @@
 package com.welampiot.service.impl;
 
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dao.LampPoleDao;
+import com.welampiot.dto.LampInfoDTO;
+import com.welampiot.dto.LampPoleAlarmLogDTO;
 import com.welampiot.dto.LampPoleDTO;
+import com.welampiot.dto.WifiDTO;
+import com.welampiot.service.LampPoleAlarmLogService;
 import com.welampiot.service.LampPoleService;
+import com.welampiot.service.LampService;
+import com.welampiot.service.WifiService;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.LampCountVO;
 import com.welampiot.vo.LampPoleCountVO;
 import com.welampiot.vo.LampPoleVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class LampPoleServiceImpl implements LampPoleService {
@@ -26,4 +39,152 @@ public class LampPoleServiceImpl implements LampPoleService {
     public List<LampPoleDTO> getListByVO(LampPoleVO lampPoleVO) {
         return lampPoleDao.getListByVO(lampPoleVO);
     }
+    @Autowired
+    private LampPoleAlarmLogService lampPoleAlarmLogService;
+    @Autowired
+    private ToolUtils toolUtils;
+    @Autowired
+    private LampService lampService;
+    @Autowired
+    private WifiService wifiService;
+    @Override
+    public List<LampPoleDTO> lampPoleList(LampPoleVO lampPoleVO) {
+        List<LampPoleDTO> lampPoleDTOS = lampPoleDao.lampPoleList(lampPoleVO);
+        ArrayList<LampPoleDTO> lampPoleDTOS1 = new ArrayList<>();
+        ArrayList<Integer> lampPoleIds = new ArrayList<>();
+        lampPoleIds.add(0);
+        for (LampPoleDTO l :lampPoleDTOS){
+            lampPoleIds.add(l.getId());
+        }
+        List<LampPoleAlarmLogDTO> listByLampPoleIdList = lampPoleAlarmLogService.getListByLampPoleIdList(lampPoleIds);
+        HashMap<Integer, LampPoleAlarmLogDTO> integerLampPoleAlarmLogDTOHashMap = new HashMap<>();
+        for (LampPoleAlarmLogDTO l :listByLampPoleIdList) {
+            integerLampPoleAlarmLogDTOHashMap.put(l.getId(),l);
+        }
+        HashMap<Integer, String> integerStringHashMap = new HashMap<>();
+        integerStringHashMap.put(1,"摄像头");
+        integerStringHashMap.put(2,"WIFI");
+        integerStringHashMap.put(3,"RFID");
+        integerStringHashMap.put(4,"LED屏");
+        integerStringHashMap.put(5,"一键报警");
+        integerStringHashMap.put(6,"充电桩");
+        integerStringHashMap.put(7,"气象站");
+        integerStringHashMap.put(8,"微基站");
+        integerStringHashMap.put(9,"音柱");
+        integerStringHashMap.put(10,"云盒");
+        for (LampPoleDTO l :lampPoleDTOS) {
+            if (l.getIsInspec() == null) l.setIsInspec(0);
+            if (l.getCity() != null){
+                l.setLocation(l.getCity()+" "+l.getArea()+" "+l.getSection());
+            }else {
+                l.setLocation(l.getArea()+" "+l.getSection());
+            }
+            if (l.getPolicyName() == null) {
+                if (lampPoleVO.getVersion() == 0){
+                    l.setPolicyName("暂无");
+                } else if (lampPoleVO.getVersion() == 1) {
+                    l.setPolicyName("none");
+                }
+            }
+            if (integerLampPoleAlarmLogDTOHashMap.containsKey(l.getId())){
+                LampPoleAlarmLogDTO lampPoleAlarmLogDTO = integerLampPoleAlarmLogDTOHashMap.get(l.getId());
+                if (integerStringHashMap.containsKey(lampPoleAlarmLogDTO.getDevType())){
+                    String s = integerStringHashMap.get(lampPoleAlarmLogDTO.getDevType());
+                    l.setFaultstatus(0);
+                    l.setAlarmInfo(s+"离线");
+                }else {
+                    l.setFaultstatus(0);
+                    l.setAlarmInfo("");
+                }
+
+            }else {
+                l.setFaultstatus(0);
+            }
+            lampPoleDTOS1.add(l);
+        }
+        return lampPoleDTOS1;
+    }
+
+    @Override
+    public Integer lampPoleCount(LampPoleVO lampPoleVO) {
+        return lampPoleDao.lampPoleCount(lampPoleVO);
+    }
+
+    @Override
+    public BaseResult add(LampPoleVO lampPoleVO) {
+        LampPoleDTO lampPoleDTO = new LampPoleDTO();
+        if (lampPoleVO.getAreaId() == null || lampPoleVO.getAreaId() == 0) return toolUtils.response(InterfaceResultEnum.LACK_AREA_ERROR,lampPoleVO.getVersion());
+        if (lampPoleVO.getSectionId() == null || lampPoleVO.getSectionId() == 0) return toolUtils.response(InterfaceResultEnum.LACK_SECTION_ERROR,lampPoleVO.getVersion());
+
+        if (lampPoleVO.getName() == null || lampPoleVO.getName().length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_NAME_ERROR,lampPoleVO.getVersion());
+        if (lampPoleVO.getNumber() == null || lampPoleVO.getNumber().length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_POLE_NUMBER_ERROR,lampPoleVO.getVersion());
+
+        if (lampPoleVO.getNumber().matches("^[A-Za-z0-9_]+$")) return toolUtils.response(InterfaceResultEnum.LAMP_POLE_NUMBER_FORMAT_ERROR,lampPoleVO.getVersion());
+        LampPoleCountVO lampPoleVO1 = new LampPoleCountVO();
+        lampPoleVO1.setSectionId(lampPoleVO.getSectionId());
+        lampPoleVO1.setName(lampPoleVO.getName());
+        if (lampPoleDao.getCountByVO(lampPoleVO1).intValue() > 0) return toolUtils.response(InterfaceResultEnum.LAMP_POLE_NAME_UNIQUE_ERROR,lampPoleVO.getVersion());
+
+        lampPoleVO1 = new LampPoleCountVO();
+        lampPoleVO1.setSectionId(lampPoleVO.getSectionId());
+        lampPoleVO1.setNumber(lampPoleVO.getNumber());
+        if (lampPoleDao.getCountByVO(lampPoleVO1).intValue() > 0) return toolUtils.response(InterfaceResultEnum.LAMP_POLE_NUMBER_UNIQUE_ERROR,lampPoleVO.getVersion());
+        lampPoleDTO.setName(lampPoleVO.getName());
+        lampPoleDTO.setNumber(lampPoleVO.getNumber());
+        lampPoleDTO.setAreaId(lampPoleVO.getAreaId());
+        lampPoleDTO.setSectionId(lampPoleVO.getSectionId());
+        lampPoleDTO.setHeight(lampPoleVO.getHeight());
+        lampPoleDTO.setInstallDate(lampPoleVO.getInstallDate());
+        lampPoleDTO.setExpirationDate(lampPoleVO.getExpirationDate());
+        lampPoleDao.add(lampPoleDTO);
+
+        Integer id = lampPoleDTO.getId();
+        // 添加云盒
+        Map cloudBox = lampPoleVO.getCloudBox();
+        WifiDTO wifiDTO = new WifiDTO();
+        wifiDTO.setLampPoleId(id);
+        if (cloudBox.containsKey("sn")) wifiDTO.setNum((String) cloudBox.get("sn"));
+        if (cloudBox.containsKey("ipAddr")) wifiDTO.setIpAddr((String) cloudBox.get("ipAddr"));
+        if (cloudBox.containsKey("model")) wifiDTO.setModel((Integer) cloudBox.get("model"));
+        if (cloudBox.containsKey("remark1")) wifiDTO.setRemark1((String) cloudBox.get("remark1"));
+        if (cloudBox.containsKey("remark2")) wifiDTO.setRemark2((String) cloudBox.get("remark2"));
+        if (cloudBox.containsKey("remark3")) wifiDTO.setRemark3((String) cloudBox.get("remark3"));
+        if (cloudBox.containsKey("remark4")) wifiDTO.setRemark4((String) cloudBox.get("remark4"));
+        if (cloudBox.containsKey("remark5")) wifiDTO.setRemark5((String) cloudBox.get("remark5"));
+        if (cloudBox.containsKey("remark6")) wifiDTO.setRemark6((String) cloudBox.get("remark6"));
+        if (cloudBox.containsKey("installDate")) wifiDTO.setInstallDate((String) cloudBox.get("installDate"));
+        if (cloudBox.containsKey("expirationDate")) wifiDTO.setExpirationDate((String) cloudBox.get("expirationDate"));
+//        if (wifiDTO.getSn() == null || wifiDTO.getSn().length() == 0) return toolUtils.response();
+        WifiDTO wifiDTO1 = new WifiDTO();
+        ArrayList<Integer> integers = new ArrayList<>();
+        integers.add(lampPoleVO.getSectionId());
+        wifiDTO1.setSectionList(integers);
+        wifiDTO1.setSn(wifiDTO.getSn());
+//        if (wifiService.getCountByDTO(wifiDTO1).intValue() > 0) return toolUtils.response();
+        wifiService.add(wifiDTO);
+
+        // 添加灯控
+        List<Map> lightDevList = lampPoleVO.getLightDevList();
+        LampInfoDTO lampInfoDTO;
+        for (Map m :lightDevList) {
+            lampInfoDTO = new LampInfoDTO();
+            if (m.containsKey("address")) lampInfoDTO.setSn(m.get("address").toString());
+            if (m.containsKey("number")) lampInfoDTO.setNumber(m.get("number").toString());
+            if (m.containsKey("name")) lampInfoDTO.setName(m.get("name").toString());
+            if (m.containsKey("protocoltype")) lampInfoDTO.setProtocolType((Integer) m.get("protocoltype"));
+            if (m.containsKey("controlType")) lampInfoDTO.setControlType((Integer) m.get("controlType"));
+            if (m.containsKey("ratedpower")) lampInfoDTO.setRatedPower((Integer) m.get("ratedpower"));
+            if (m.containsKey("installDate")) lampInfoDTO.setInstallDate( m.get("installDate").toString());
+            if (m.containsKey("expirationDate")) lampInfoDTO.setExpirationDate( m.get("expirationDate").toString());
+            BaseResult add = lampService.add(lampInfoDTO);
+            if (!add.getCode().equals("0000")) return add;
+        }
+
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,lampPoleVO.getVersion());
+    }
+
+    @Override
+    public Integer update(LampPoleDTO lampPoleDTO) {
+        return lampPoleDao.update(lampPoleDTO);
+    }
 }

+ 5 - 0
src/main/java/com/welampiot/service/impl/SectionServiceImpl.java

@@ -23,4 +23,9 @@ public class SectionServiceImpl implements SectionService {
 
     @Override
     public List<SectionDTO> getListByIdList(List idList) {return sectionDao.getListByIdList(idList);}
+
+    @Override
+    public SectionDTO getOneById(Integer id) {
+        return sectionDao.getOneById(id);
+    }
 }

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

@@ -120,4 +120,19 @@ public class WifiServiceImpl implements WifiService {
         BeanUtils.copyProperties(dto,vo);
         return vo;
     }
+
+    @Override
+    public Integer getCountByDTO(WifiDTO dto) {
+        return wifiDao.getCountByDTO(dto);
+    }
+
+    @Override
+    public Integer add(WifiDTO dto) {
+        return wifiDao.add(dto);
+    }
+
+    @Override
+    public Integer update(WifiDTO dto) {
+        return wifiDao.update(dto);
+    }
 }

+ 3 - 0
src/main/java/com/welampiot/vo/LampPoleCountVO.java

@@ -7,4 +7,7 @@ import java.util.List;
 @Data
 public class LampPoleCountVO {
     private List sectionList; // 路段筛选
+    private String name;
+    private String number;
+    private Integer sectionId;
 }

+ 9 - 2
src/main/java/com/welampiot/vo/LampPoleVO.java

@@ -1,6 +1,7 @@
 package com.welampiot.vo;
 
 import com.welampiot.dto.LampInfoDTO;
+import com.welampiot.dto.WifiDTO;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -21,8 +22,14 @@ public class LampPoleVO implements Serializable {
     private Integer areaId;
     private Integer sectionId;
     private Integer height;
-    private String install_date;
-    private String expiration_date;
+    private String installDate;
+    private String expirationDate;
     private WifiVO cloud_box;
     private List<Map> videoList;
+    private String keyword;  // 关键字搜索
+    private Integer version;
+    private Integer isInspec;
+    private Integer limit;
+    private Integer offset;
+    private Map cloudBox; // 云盒
 }

+ 5 - 0
src/main/resources/mapper/GlobalLocationMapper.xml

@@ -86,4 +86,9 @@
         </if>
         order by convert(b.chinese_name using gbk) ASC
     </select>
+
+    <select id="getOneById" resultType="com.welampiot.dto.GlobalLocationDTO" parameterType="Integer">
+        select id,chinese_name chineseName,longitude,latitude
+        from global_location where id = #{id}
+    </select>
 </mapper>

+ 27 - 0
src/main/resources/mapper/LampPoleAlarmLogMapper.xml

@@ -0,0 +1,27 @@
+<?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.LampPoleAlarmLogDao">
+    <select id="getListByLampPoleIdList" resultType="com.welampiot.dto.LampPoleAlarmLogDTO" parameterType="java.util.List">
+        select lamp_pole_id as lampPoleId,max(updatetime) as updateTime,status,id,devtype as devType from lamp_pole_alarm_log
+        where 1=1
+        <if test="lampPoleIdList != null and !lampPoleIdList.isEmpty()">
+            and lamp_pole_id in
+            <foreach item="vo" collection="lampPoleIdList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        and (status = 0 or status = 1) group by lamp_pole_id
+    </select>
+
+    <select id="getCountByLampPoleIdList" resultType="int" parameterType="java.util.List">
+        select count(*) as total from (select id from lamp_pole_alarm_log
+        where 1=1
+        <if test="lampPoleIdList != null and !lampPoleIdList.isEmpty()">
+            and lamp_pole_id in
+            <foreach item="vo" collection="lampPoleIdList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        and (status = 1 OR status = 0) group by lamp_pole_id) a
+    </select>
+</mapper>

+ 102 - 1
src/main/resources/mapper/LampPoleMapper.xml

@@ -10,6 +10,15 @@
                 #{vo}
             </foreach>
         </if>
+        <if test="name != null">
+            AND a.name = #{name}
+        </if>
+        <if test="number != null">
+            AND a.number = #{number}
+        </if>
+        <if test="sectionId != null">
+            AND a.sectionid = #{sectionId}
+        </if>
     </select>
 
     <select id="getNavByVO" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
@@ -62,7 +71,62 @@
     </select>
 
     <select id="getListByVO" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
-        select LP.id,LP.name,LP.devtype as devType,LP.createtime from lamp_pole LP
+        select LP.id,LP.name,LP.devtype as devType,LP.createtime,LP.sn,LP.longitude,LP.latitude from lamp_pole LP
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and LP.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        <if test="keyword != null">
+            AND (LP.name like '%#{keyword}%' OR LP.sn like '%#{keyword}%')
+        </if>
+    </select>
+    <select id="lampPoleList" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
+        select LP.id,LP.name,LP.devtype as devType,LP.sn,LP.longitude,LP.latitude,LP.createtime as createTime,L.faultstatus,LI.grid_active_power as power,LI.dim_value as lighteness,L.policy_type as policyType,P.name as policyName,LP.devtype as devType,LI.updatetime as updateTime,V.is_inspec as isInspec,S.timezone,S.name as section,C.name as company,L.policyid as policyId,LP.install_date as installDate,LP.expiration_date as expirationDate,
+        <choose>
+            <when test="version == 1">
+                G.english_name as area,G2.english_name as city
+            </when>
+            <when test="version == 2">
+                G.ru_name as area,G2.ru_name as city
+            </when>
+            <otherwise>
+                G.chinese_name as area,G2.chinese_name as city
+            </otherwise>
+        </choose> from lamp_pole LP
+        left join section as S on S.id = LP.sectionid
+        left join lampinfo as L on L.lamp_pole_id = LP.id
+        left join lamp_info_log_new as LI on LI.lampid = L.id
+        left join global_location as G on G.id = S.pid
+        left join global_location as G2 on G.pid = G2.id
+        left join policy as P on L.policyid = P.id
+        left join video_monitor as V on V.lamp_pole_id = LP.id
+        left join user as U on U.id = LP.create_id
+        left join company as C on U.company_id = C.id
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and LP.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        <if test="keyword != null">
+            AND (LP.name like '%#{keyword}%' OR LP.sn like '%#{keyword}%')
+        </if>
+        <if test="isInspec != null">
+            and V.is_inspec = #{isInspec}
+        </if>
+        order by convert(LP.number using gbk) ASC,convert(LP.name using gbk) ASC,LP.id DESC
+        <if test="offset != null and limit != null">
+            limit #{offset},#{limit}
+        </if>
+    </select>
+
+    <select id="lampPoleCount" resultType="int" parameterType="com.welampiot.vo.LampPoleVO">
+        select count(LP.id) as total from lamp_pole LP
+        left join video_monitor as V on V.lamp_pole_id = LP.id
         where 1=1
         <if test="sectionList != null and !sectionList.isEmpty()">
             and LP.sectionid in
@@ -70,5 +134,42 @@
                 #{vo}
             </foreach>
         </if>
+        <if test="keyword != null">
+            AND (LP.name like '%#{keyword}%' OR LP.sn like '%#{keyword}%')
+        </if>
+        <if test="isInspec != null">
+            and V.is_inspec = #{isInspec}
+        </if>
     </select>
+    <insert id="add" parameterType="com.welampiot.dto.LampPoleDTO" useGeneratedKeys="true" keyProperty="id"
+    >
+        insert into lamp_pole(name,number,height,areaid,sectionid,longitude,latitude,createtime,create_id,main_dev_type,install_date,expiration_date
+<!--        <if test="mode != null">-->
+<!--            ,mode-->
+<!--        </if>-->
+        )
+        values
+        (#{name},#{number},#{height},#{areaId},#{sectionId},#{longitude},#{latitude},#{createTime},#{createId},#{mainDevType},#{installDate},#{expirationDate}
+<!--        <if test="mode != null">-->
+<!--            ,#{mode}-->
+<!--        </if>-->
+        )
+    </insert>
+    <insert id="update" parameterType="com.welampiot.dto.LampPoleDTO"
+    >
+        update lamp_pole
+        set
+        sn = #{sn},
+        name = #{name},
+        number = #{number},
+        height = #{height},
+        areaid = #{areaId},
+        sectionid = #{sectionId},
+        longitude = #{longitude},
+        latitude = #{latitude},
+        main_dev_type = #{mainDevType},
+        install_date = #{installDate},
+        expiration_date = #{expirationDate}
+        where id = #{id}
+    </insert>
 </mapper>

+ 3 - 0
src/main/resources/mapper/SectionMapper.xml

@@ -25,4 +25,7 @@
         </if>
 
     </select>
+    <select id="getOneById" parameterType="int" resultType="com.welampiot.dto.SectionDTO">
+        select id,name,pid from section where id = #{id}
+    </select>
 </mapper>

+ 52 - 0
src/main/resources/mapper/WifiMapper.xml

@@ -68,4 +68,56 @@
             </if>
     </select>
 
+    <select id="getCountByDTO" resultType="int" parameterType="WifiDTO">
+        select count(*) as total
+        from wifi w
+        where w.id = #{id}
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and lp.sectionid in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="sn != null">
+            and lp.num = #{sn}
+        </if>
+    </select>
+
+    <insert id="add" parameterType="com.welampiot.dto.WifiDTO" useGeneratedKeys="true" keyProperty="id"
+    >
+        insert into wifi(num,model,lamp_pole_id,install_date,expiration_date
+        <if test="remark1 != null">,remark1</if>
+        <if test="remark2 != null">,remark2</if>
+        <if test="remark3 != null">,remark3</if>
+        <if test="remark4 != null">,remark4</if>
+        <if test="remark5 != null">,remark5</if>
+        <if test="remark6 != null">,remark6</if>
+        )
+        values
+        (#{sn},#{model},#{lampPoleId},#{installDate},#{expirationDate}
+        <if test="remark1 != null">,#{remark1}</if>
+        <if test="remark2 != null">,#{remark2}</if>
+        <if test="remark3 != null">,#{remark3}</if>
+        <if test="remark4 != null">,#{remark4}</if>
+        <if test="remark5 != null">,#{remark5}</if>
+        <if test="remark6 != null">,#{remark6}</if>
+        )
+    </insert>
+    <insert id="update" parameterType="com.welampiot.dto.WifiDTO"
+    >
+        update wifi
+        set
+        num = #{sn},
+        model = #{model},
+        number = #{number},
+        <if test="remark1 != null">,remark1=#{remark1}</if>
+        <if test="remark2 != null">,remark2=#{remark2}</if>
+        <if test="remark3 != null">,remark3=#{remark3}</if>
+        <if test="remark4 != null">,remark4=#{remark4}</if>
+        <if test="remark5 != null">,remark5=#{remark5}</if>
+        <if test="remark6 != null">,remark6=#{remark6}</if>
+        install_date = #{installDate},
+        expiration_date = #{expirationDate}
+        where lamp_pole_id = #{lampPoleId}
+    </insert>
 </mapper>