Forráskód Böngészése

添加编辑分组

crazycat 2 éve
szülő
commit
274c5f371d
29 módosított fájl, 461 hozzáadás és 102 törlés
  1. 3 0
      src/main/java/com/welampiot/common/InterfaceResultEnum.java
  2. 1 1
      src/main/java/com/welampiot/controller/GroupController.java
  3. 0 8
      src/main/java/com/welampiot/controller/LampController.java
  4. 70 23
      src/main/java/com/welampiot/controller/LampPoleController.java
  5. 1 1
      src/main/java/com/welampiot/controller/LoopController.java
  6. 1 1
      src/main/java/com/welampiot/controller/ManholeController.java
  7. 2 2
      src/main/java/com/welampiot/controller/NewLampPoleController.java
  8. 1 1
      src/main/java/com/welampiot/dao/LampDao.java
  9. 3 0
      src/main/java/com/welampiot/dao/LampPoleDao.java
  10. 2 0
      src/main/java/com/welampiot/dao/WifiDao.java
  11. 2 0
      src/main/java/com/welampiot/dao/WifiInfoLogDao.java
  12. 2 0
      src/main/java/com/welampiot/dto/LampInfoDTO.java
  13. 15 1
      src/main/java/com/welampiot/dto/LampPoleDTO.java
  14. 7 1
      src/main/java/com/welampiot/dto/WifiDTO.java
  15. 4 1
      src/main/java/com/welampiot/service/LampPoleService.java
  16. 1 0
      src/main/java/com/welampiot/service/LampService.java
  17. 2 0
      src/main/java/com/welampiot/service/WifiInfoLogService.java
  18. 7 2
      src/main/java/com/welampiot/service/WifiService.java
  19. 161 24
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  20. 14 0
      src/main/java/com/welampiot/service/impl/LampServiceImpl.java
  21. 6 0
      src/main/java/com/welampiot/service/impl/WifiInfoLogServiceImpl.java
  22. 46 4
      src/main/java/com/welampiot/service/impl/WifiServiceImpl.java
  23. 1 0
      src/main/java/com/welampiot/vo/LampListResponseVO.java
  24. 1 0
      src/main/java/com/welampiot/vo/LampPoleCountVO.java
  25. 4 0
      src/main/java/com/welampiot/vo/LampPoleVO.java
  26. 36 9
      src/main/resources/mapper/LampMapper.xml
  27. 25 13
      src/main/resources/mapper/LampPoleMapper.xml
  28. 4 1
      src/main/resources/mapper/WifiInfoLogMapper.xml
  29. 39 9
      src/main/resources/mapper/WifiMapper.xml

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

@@ -26,6 +26,9 @@ public enum InterfaceResultEnum {
     LAMP_POLE_NAME_UNIQUE_ERROR("0219","灯杆名称重复","",""),
     LAMP_POLE_NUMBER_UNIQUE_ERROR("0220","灯杆编号重复","",""),
     LAMP_POLE_NUMBER_FORMAT_ERROR("0221","灯杆编号只能包含数字跟字母","",""),
+    CLOUD_BOX_SN_UNIQUE_ERROR("0222","云盒序列号已经存在","",""),
+    LACK_CLOUD_BOX_SN_ERROR("0223","云盒序列号不能为空","",""),
+    CLOUD_BOX_SN_FORMAT_ERROR("0224","云盒未授权","",""),
     ;
     private String code;
     private String msgCn;

+ 1 - 1
src/main/java/com/welampiot/controller/GroupController.java

@@ -51,7 +51,7 @@ public class GroupController{
      * @param request
      * @return
      */
-    @PostMapping("/getlist")
+    @PostMapping("/getList")
     private BaseResult getList(HttpServletRequest request){
         Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
         Integer devType = request.getParameter("devType") == null ? null : Integer.parseInt(request.getParameter("devType"));

+ 0 - 8
src/main/java/com/welampiot/controller/LampController.java

@@ -130,16 +130,8 @@ public class LampController {
         String longitude = request.getParameter("longitude") == null || request.getParameter("longitude").length() == 0 ? "0" : request.getParameter("longitude");
         String latitude = request.getParameter("latitude") == null || request.getParameter("latitude").length() == 0 ? "0" : request.getParameter("latitude");
 
-        if (number == null || number.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_NUMBER_ERROR,version);
-        if (!number.matches("^[A-Za-z0-9_]+$")) return toolUtils.response(InterfaceResultEnum.LAMP_NUMBER_FORMAT_ERROR,version);
         String name = request.getParameter("name");
-        if (name == null || name.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_NAME_ERROR,version);
         String sn = request.getParameter("sn");
-        if (sn == null || sn.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_ADDRESS_ERROR,version);
-
-        if (areaId == 0) return toolUtils.response(InterfaceResultEnum.LACK_AREA_ERROR,version);
-        if (sectionId == 0) return toolUtils.response(InterfaceResultEnum.LACK_SECTION_ERROR,version);
-
 
         if (lampId == 0){  // 添加
             LampInfoDTO lampInfoDTO = new LampInfoDTO();

+ 70 - 23
src/main/java/com/welampiot/controller/LampPoleController.java

@@ -1,26 +1,28 @@
 package com.welampiot.controller;
 
-import com.alibaba.fastjson.JSONObject;
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.LampInfoDTO;
 import com.welampiot.dto.LampPoleDTO;
 import com.welampiot.dto.ScreenDTO;
+import com.welampiot.dto.WifiDTO;
 import com.welampiot.service.LampPoleService;
+import com.welampiot.service.LampService;
 import com.welampiot.service.ScreenService;
+import com.welampiot.service.WifiService;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.LampPoleVO;
 import com.welampiot.vo.ListResponseVO;
 import com.welampiot.vo.ScreenDetailsVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
-import javax.validation.Valid;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * ClassName: LampPoleController
@@ -44,6 +46,10 @@ public class LampPoleController {
 
     @Autowired
     private LampPoleService lampPoleService;
+    @Autowired
+    private WifiService wifiService;
+    @Autowired
+    private LampService lampService;
 
     /**
      * 获取屏幕详情
@@ -65,7 +71,7 @@ public class LampPoleController {
     }
 
     @RequestMapping(value = "/nav",method = RequestMethod.POST)
-    public BaseResult<LampInfoDTO> details(HttpServletRequest request){
+    public BaseResult<LampInfoDTO> nav(HttpServletRequest request){
         Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
         Integer devType = request.getParameter("devType") == null || request.getParameter("devType").length() == 0 ? null : Integer.parseInt(request.getParameter("devType"));
         Integer devId = request.getParameter("devId") == null || request.getParameter("devId").length() == 0 ? null : Integer.parseInt(request.getParameter("devId"));
@@ -101,26 +107,67 @@ public class LampPoleController {
      * 添加编辑灯杆
      * @return
      */
+    @Transactional
     @RequestMapping(value = "/save",method = RequestMethod.POST)
-    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);
-//        String s = JSONObject.toJSONString(request.getParameterMap());
-//        System.out.println(s);
-//        JSONObject jsonObject = JSONObject.parseObject(s);
-//        System.out.println(jsonObject.toJSONString());
+    public BaseResult<LampInfoDTO> save(LampPoleVO form,HttpServletRequest request){
+        toolUtils.getSectionList(request);
+        form.setCreateId(toolUtils.getUser().getId());
+        BaseResult baseResult = null;
+        if (form.getId() == null || form.getId() == 0){
+            baseResult = lampPoleService.add(form);
+        }else {
+            baseResult = lampPoleService.update(form);
+        }
+        if (!baseResult.getCode().equals("0000")){
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+        }
+        return baseResult;
+    }
 
-        Integer version = 0;
-//                (Integer) toolUtils.getRequestContent(request,"version",1);
-//        Integer groupId = (Integer) toolUtils.getRequestContent(request,"groupId",1);
-//        ListResponseVO listResponseVO = new ListResponseVO();
-//        listResponseVO.setList(new ArrayList());
-//        listResponseVO.setTotal(1);
-        return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+    /**
+     * 查看灯杆详情
+     * @return
+     */
+    @RequestMapping(value = "/details",method = RequestMethod.POST)
+    public BaseResult details(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
+        if (id == null || id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        LampPoleDTO detailById = lampPoleService.getDetailById(id);
+
+        // 灯控
+        List<LampInfoDTO> lampPoleDetailListByLampPoleId = lampService.getLampPoleDetailListByLampPoleId(id);
+        detailById.setLightDevList(lampPoleDetailListByLampPoleId);
+        detailById.setBenchDevList(new ArrayList<>());
+        detailById.setSolarDevList(new ArrayList<>());
+        detailById.setLightStripList(new ArrayList<>());
+        detailById.setLoopList(new ArrayList<>());
+        detailById.setScreenList(new ArrayList<>());
+        detailById.setSmartLockList(new ArrayList<>());
+        detailById.setWaterImmersionList(new ArrayList<>());
+        detailById.setVideoList(new ArrayList<>());
+        detailById.setBroadcastList(new ArrayList<>());
+        // 云盒
+        WifiDTO wifiDTO = new WifiDTO();
+        wifiDTO.setLampPoleId(id);
+        WifiDTO detailByDTO = wifiService.getDetailByDTO(wifiDTO);
+        detailById.setCloudDev(detailByDTO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,detailById);
     }
 
+    /**
+     * 删除灯杆
+     * @return
+     */
+    @RequestMapping(value = "/del",method = RequestMethod.POST)
+    public BaseResult del(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        String id = (String) toolUtils.getRequestContent(request,"id",2);
+        if (id == null || id.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        String[] split = id.split(",");
+        for (String i:split) {
+            lampPoleService.deleteById(Integer.parseInt(i));
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
 }

+ 1 - 1
src/main/java/com/welampiot/controller/LoopController.java

@@ -27,7 +27,7 @@ import java.util.List;
  */
 @RestController
 @CrossOrigin
-@RequestMapping("/loopController")
+@RequestMapping("/loop")
 public class LoopController {
 
     @Autowired

+ 1 - 1
src/main/java/com/welampiot/controller/ManholeController.java

@@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest;
  */
 @RestController
 @CrossOrigin
-@RequestMapping("/manholeController")
+@RequestMapping("/manhole")
 public class ManholeController {
 
     @Autowired

+ 2 - 2
src/main/java/com/welampiot/controller/NewLampPoleController.java

@@ -156,14 +156,14 @@ public class NewLampPoleController {
     public BaseResult<WifiDTO> wifiList(HttpServletRequest 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 online = request.getParameter("online") == null ? 0 : Integer.parseInt(request.getParameter("online"));
+        Integer online = request.getParameter("online") == null || request.getParameter("online").length() == 0 ? null : Integer.parseInt(request.getParameter("online"));
         String keyword = request.getParameter("keyword") == null ? "" : request.getParameter("keyword");
 
         WifiDTO dto = new WifiDTO();
         dto.setPage(count * (page - 1));
         dto.setCount(count);
         dto.setKeyword(keyword);
-        dto.setOnlineState(online);
+        if (online != null) dto.setOnlineState(online);
         dto.setSectionList(toolUtils.getSectionList(request));
         WifiVO vo = wifiService.getWifiList(dto);
         return BaseResult.success(vo);

+ 1 - 1
src/main/java/com/welampiot/dao/LampDao.java

@@ -23,5 +23,5 @@ public interface LampDao {
     Integer deleteById(@Param("id")Integer id);
     List<LampInfoDTO> groupSelectLamp(LampListResponseVO lampListResponseVO);
     List<LampInfoDTO> getNavByVO(LampListResponseVO lampListResponseVO);
-
+    List<LampInfoDTO> getLampPoleDetailListByLampPoleId(@Param("lampPoleId")Integer lampPoleId);
 }

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

@@ -3,6 +3,7 @@ package com.welampiot.dao;
 import com.welampiot.dto.LampPoleDTO;
 import com.welampiot.vo.LampPoleCountVO;
 import com.welampiot.vo.LampPoleVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -15,4 +16,6 @@ public interface LampPoleDao {
     Integer lampPoleCount(LampPoleVO lampPoleVO);
     Integer add(LampPoleDTO lampPoleDTO);
     Integer update(LampPoleDTO lampPoleDTO);
+    LampPoleDTO getDetailById(@Param("id")Integer id);
+    Integer deleteById(@Param("id")Integer id);
 }

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

@@ -25,4 +25,6 @@ public interface WifiDao {
     Integer getCountByDTO(WifiDTO dto);
     Integer add(WifiDTO dto);
     Integer update(WifiDTO dto);
+    WifiDTO getDetailByDTO(WifiDTO dto);
+    Integer deleteById(@Param("id")Integer id);
 }

+ 2 - 0
src/main/java/com/welampiot/dao/WifiInfoLogDao.java

@@ -1,6 +1,7 @@
 package com.welampiot.dao;
 
 import com.welampiot.dto.WifiInfoLogDTO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,4 +18,5 @@ public interface WifiInfoLogDao {
     List<WifiInfoLogDTO> getWifiOutStatisticsByDTO(WifiInfoLogDTO dto);
 
     Integer getTimezoneById(WifiInfoLogDTO dto);
+    Integer deleteByWifiId(@Param("wifiId")Integer wifiId);
 }

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

@@ -7,6 +7,7 @@ public class LampInfoDTO {
     private Integer id;
     private String number;
     private String sn;
+    private String address;
     private String area;
     private Integer areaId;
     private String section;
@@ -62,4 +63,5 @@ public class LampInfoDTO {
     private int ratedPower;
     private int version;
     private int select;
+    private int lampPoleId;
 }

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

@@ -2,6 +2,9 @@ package com.welampiot.dto;
 
 import lombok.Data;
 
+import java.util.List;
+import java.util.Map;
+
 @Data
 public class LampPoleDTO {
     private Integer id;
@@ -33,5 +36,16 @@ public class LampPoleDTO {
     private Integer sectionId;
     private String installDate;
     private String expirationDate;
-
+    private Integer createId;
+    private List<LampInfoDTO> lightDevList;
+    private List<Map> benchDevList;
+    private List<Map> solarDevList;
+    private List<Map> lightStripList;
+    private List<Map> loopList;
+    private List<Map> screenList;
+    private List<Map> smartLockList;
+    private List<Map> waterImmersionList;
+    private List<Map> videoList;
+    private List<Map> broadcastList;
+    private WifiDTO cloudDev; // 云盒
 }

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

@@ -23,7 +23,7 @@ public class WifiDTO implements Serializable {
      * 3 WE-GW-G300,4 WE-XA-G20(云盒加4G双控设备),
      * 5 WE-GW-G260,6 WE-GW-G600)
      **/
-    private Integer model;
+    private String model;
 
     /** 序列号IMEI **/
     private String num;
@@ -298,4 +298,10 @@ public class WifiDTO implements Serializable {
     private String keyword;
 
     private static final long serialVersionUID = 1L;
+    private Integer version2;
+
+    private Float totalFlaw;
+    private Float dayFlaw;
+    private String upFlaw;
+    private String downFlaw;
 }

+ 4 - 1
src/main/java/com/welampiot/service/LampPoleService.java

@@ -4,6 +4,7 @@ import com.welampiot.common.BaseResult;
 import com.welampiot.dto.LampPoleDTO;
 import com.welampiot.vo.LampPoleCountVO;
 import com.welampiot.vo.LampPoleVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -14,5 +15,7 @@ public interface LampPoleService {
     List<LampPoleDTO> lampPoleList(LampPoleVO lampPoleVO);
     Integer lampPoleCount(LampPoleVO lampPoleVO);
     BaseResult add(LampPoleVO lampPoleVO);
-    Integer update(LampPoleDTO lampPoleDTO);
+    BaseResult update(LampPoleVO lampPoleVO);
+    LampPoleDTO getDetailById(@Param("id")Integer id);
+    Integer deleteById(@Param("id")Integer id);
 }

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

@@ -25,4 +25,5 @@ public interface LampService {
     LampInfoDTO getDetailsByAddress(@Param("address")String address,@Param("version")Integer version);
     List<LampInfoDTO> groupSelectLamp(LampListResponseVO lampListResponseVO);
     List<LampInfoDTO> getNavByVO(LampListResponseVO lampListResponseVO);
+    List<LampInfoDTO> getLampPoleDetailListByLampPoleId(@Param("lampPoleId")Integer lampPoleId);
 }

+ 2 - 0
src/main/java/com/welampiot/service/WifiInfoLogService.java

@@ -1,6 +1,7 @@
 package com.welampiot.service;
 
 import com.welampiot.dto.WifiInfoLogDTO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,4 +18,5 @@ public interface WifiInfoLogService {
     List<WifiInfoLogDTO> getWifiOutStatisticsByDTO(WifiInfoLogDTO dto);
 
     Integer getTimezoneById(WifiInfoLogDTO dto);
+    Integer deleteByWifiId(@Param("wifiId")Integer wifiId);
 }

+ 7 - 2
src/main/java/com/welampiot/service/WifiService.java

@@ -1,8 +1,10 @@
 package com.welampiot.service;
 
+import com.welampiot.common.BaseResult;
 import com.welampiot.dto.WifiDTO;
 import com.welampiot.vo.WifiOutInfoVO;
 import com.welampiot.vo.WifiVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -22,6 +24,9 @@ public interface WifiService {
 
     WifiOutInfoVO getWifiOutInfo(Integer id, List<WifiDTO> sectionList);
     Integer getCountByDTO(WifiDTO dto);
-    Integer add(WifiDTO dto);
-    Integer update(WifiDTO dto);
+    BaseResult add(WifiDTO dto);
+    BaseResult update(WifiDTO dto);
+    WifiDTO getDetailByDTO(WifiDTO dto);
+    Integer deleteById(@Param("id")Integer id);
+    List<WifiDTO> getWifiListByDTO(WifiDTO dto);
 }

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

@@ -3,6 +3,7 @@ package com.welampiot.service.impl;
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dao.LampPoleDao;
+import com.welampiot.dao.WifiDao;
 import com.welampiot.dto.LampInfoDTO;
 import com.welampiot.dto.LampPoleAlarmLogDTO;
 import com.welampiot.dto.LampPoleDTO;
@@ -12,16 +13,13 @@ 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 com.welampiot.vo.*;
+import org.apache.commons.lang3.StringUtils;
 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;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 @Service
 public class LampPoleServiceImpl implements LampPoleService {
@@ -113,13 +111,14 @@ public class LampPoleServiceImpl implements LampPoleService {
     @Override
     public BaseResult add(LampPoleVO lampPoleVO) {
         LampPoleDTO lampPoleDTO = new LampPoleDTO();
+        lampPoleDTO.setCreateId(lampPoleVO.getCreateId());
         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());
+        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());
@@ -133,19 +132,27 @@ public class LampPoleServiceImpl implements LampPoleService {
         lampPoleDTO.setNumber(lampPoleVO.getNumber());
         lampPoleDTO.setAreaId(lampPoleVO.getAreaId());
         lampPoleDTO.setSectionId(lampPoleVO.getSectionId());
-        lampPoleDTO.setHeight(lampPoleVO.getHeight());
+        lampPoleDTO.setHeight(lampPoleVO.getHeight() == null ? 0 : lampPoleVO.getHeight());
+        lampPoleDTO.setLatitude(lampPoleVO.getLatitude());
+        lampPoleDTO.setLongitude(lampPoleVO.getLongitude());
         lampPoleDTO.setInstallDate(lampPoleVO.getInstallDate());
         lampPoleDTO.setExpirationDate(lampPoleVO.getExpirationDate());
+        Date endDate = new Date(System.currentTimeMillis());
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String createTime = simpleDateFormat.format(endDate).toString();
+        lampPoleDTO.setCreateTime(createTime);
         lampPoleDao.add(lampPoleDTO);
+        List<Integer> devType = new ArrayList<>();
 
         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"));
+        wifiDTO.setVersion2(lampPoleVO.getVersion());
+        if (cloudBox.containsKey("sn")) wifiDTO.setSn((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("model")) wifiDTO.setModel((String) 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"));
@@ -154,14 +161,10 @@ public class LampPoleServiceImpl implements LampPoleService {
         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);
+        BaseResult add1 = wifiService.add(wifiDTO);
+        if (!add1.getCode().equals("0000")) return add1;
+        devType.add(10);
+        devType.add(2);
 
         // 添加灯控
         List<Map> lightDevList = lampPoleVO.getLightDevList();
@@ -171,20 +174,154 @@ public class LampPoleServiceImpl implements LampPoleService {
             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("protocolType")) lampInfoDTO.setProtocolType(Integer.parseInt((String) m.get("protocolType")));
+            if (m.containsKey("controlType")) lampInfoDTO.setControlType(Integer.parseInt((String) m.get("controlType")));
+            if (m.containsKey("ratedPower")) {
+                if ( m.get("ratedPower") == null || m.get("ratedPower").toString().length() == 0){
+                    lampInfoDTO.setRatedPower(0);
+                }else {
+                    lampInfoDTO.setRatedPower(Integer.parseInt((String) m.get("ratedPower")));
+                }
+            }
             if (m.containsKey("installDate")) lampInfoDTO.setInstallDate( m.get("installDate").toString());
             if (m.containsKey("expirationDate")) lampInfoDTO.setExpirationDate( m.get("expirationDate").toString());
+            lampInfoDTO.setCreateTime(createTime);
+            lampInfoDTO.setVersion(lampPoleVO.getVersion());
+            lampInfoDTO.setAreaId(lampPoleVO.getAreaId());
+            lampInfoDTO.setSectionId(lampPoleVO.getSectionId());
+            lampInfoDTO.setLatitude(lampPoleVO.getLatitude());
+            lampInfoDTO.setLongitude(lampPoleVO.getLongitude());
+            lampInfoDTO.setLampPoleId(id);
             BaseResult add = lampService.add(lampInfoDTO);
             if (!add.getCode().equals("0000")) return add;
         }
+        devType.add(0);
+        LampPoleDTO lampPoleDTO1 = new LampPoleDTO();
+        lampPoleDTO1.setId(lampPoleDTO.getId());
+        lampPoleDTO1.setDevType(StringUtils.join(devType,","));
+        lampPoleDTO1.setSn(wifiDTO.getSn());
+        lampPoleDao.update(lampPoleDTO1);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,lampPoleVO.getVersion());
+    }
+
+    @Override
+    public BaseResult update(LampPoleVO lampPoleVO) {
+        LampPoleDTO lampPoleDTO = new LampPoleDTO();
+        lampPoleDTO.setId(lampPoleVO.getId());
+        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.setId(lampPoleDTO.getId());
+        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.setId(lampPoleDTO.getId());
+        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() == null ? 0 : lampPoleVO.getHeight());
+        lampPoleDTO.setLatitude(lampPoleVO.getLatitude());
+        lampPoleDTO.setLongitude(lampPoleVO.getLongitude());
+        lampPoleDTO.setInstallDate(lampPoleVO.getInstallDate());
+        lampPoleDTO.setExpirationDate(lampPoleVO.getExpirationDate());
+        lampPoleDao.update(lampPoleDTO);
+
+        Map cloudBox = lampPoleVO.getCloudBox();
+        WifiDTO wifiDTO = new WifiDTO();
+        wifiDTO.setLampPoleId(lampPoleDTO.getId());
+        wifiDTO.setVersion2(lampPoleVO.getVersion());
+        if (cloudBox.containsKey("sn")) wifiDTO.setSn((String) cloudBox.get("sn"));
+        if (cloudBox.containsKey("ipAddr")) wifiDTO.setIpAddr((String) cloudBox.get("ipAddr"));
+        if (cloudBox.containsKey("model")) wifiDTO.setModel((String) 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"));
+        BaseResult add1 = wifiService.update(wifiDTO);
+        if (!add1.getCode().equals("0000")) return add1;
+
+        // 添加灯控
+        Date endDate = new Date(System.currentTimeMillis());
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String createTime = simpleDateFormat.format(endDate).toString();
+        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.parseInt((String) m.get("protocolType")));
+            if (m.containsKey("controlType")) lampInfoDTO.setControlType(Integer.parseInt((String) m.get("controlType")));
+            if (m.containsKey("ratedPower")) {
+                if ( m.get("ratedPower") == null || m.get("ratedPower").toString().length() == 0){
+                    lampInfoDTO.setRatedPower(0);
+                }else {
+                    lampInfoDTO.setRatedPower(Integer.parseInt((String) m.get("ratedPower")));
+                }
+            }
+            if (m.containsKey("installDate")) lampInfoDTO.setInstallDate( m.get("installDate").toString());
+            if (m.containsKey("expirationDate")) lampInfoDTO.setExpirationDate( m.get("expirationDate").toString());
+            if (m.containsKey("id") && m.get("id") != null && m.get("id").toString().length() != 0) lampInfoDTO.setId(Integer.parseInt((String) m.get("id")));
+            lampInfoDTO.setVersion(lampPoleVO.getVersion());
+            lampInfoDTO.setAreaId(lampPoleVO.getAreaId());
+            lampInfoDTO.setSectionId(lampPoleVO.getSectionId());
+            lampInfoDTO.setLatitude(lampPoleVO.getLatitude());
+            lampInfoDTO.setLongitude(lampPoleVO.getLongitude());
+            lampInfoDTO.setLampPoleId(lampPoleVO.getId());
+            BaseResult add;
+            if (lampInfoDTO.getId() != null && lampInfoDTO.getId() != 0){
+                add = lampService.update(lampInfoDTO);
+            }else {
+                lampInfoDTO.setCreateTime(createTime);
+                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);
+    public LampPoleDTO getDetailById(Integer id) {
+        return lampPoleDao.getDetailById(id);
+    }
+
+    @Override
+    public Integer deleteById(Integer id) {
+        if (id == null) return null;
+
+        // 删除灯控
+        LampListResponseVO lampListResponseVO = new LampListResponseVO();
+        lampListResponseVO.setLampPoleId(id);
+        List<LampInfoDTO> listByVO = lampService.getListByVO(lampListResponseVO);
+        for (LampInfoDTO l :listByVO) {
+            if (l.getId() != null) lampService.deleteById(l.getId());
+        }
+
+        // 删除云盒
+        WifiDTO wifiDTO = new WifiDTO();
+        wifiDTO.setLampPoleId(id);
+        List<WifiDTO> wifiList = wifiService.getWifiListByDTO(wifiDTO);
+        for (WifiDTO w :wifiList) {
+            if (w.getId() != null) wifiService.deleteById(w.getId());
+        }
+
+        return lampPoleDao.deleteById(id);
     }
 }

+ 14 - 0
src/main/java/com/welampiot/service/impl/LampServiceImpl.java

@@ -132,6 +132,15 @@ public class LampServiceImpl implements LampService {
 
     @Override
     public BaseResult add(LampInfoDTO lampInfoDTO) {
+
+        if (lampInfoDTO.getNumber() == null || lampInfoDTO.getNumber().length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_NUMBER_ERROR,lampInfoDTO.getVersion());
+        if (!lampInfoDTO.getNumber().matches("^[A-Za-z0-9_]+$")) return toolUtils.response(InterfaceResultEnum.LAMP_NUMBER_FORMAT_ERROR,lampInfoDTO.getVersion());
+        if (lampInfoDTO.getName() == null || lampInfoDTO.getName().length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_NAME_ERROR,lampInfoDTO.getVersion());
+        if (lampInfoDTO.getSn() == null || lampInfoDTO.getSn().length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_LAMP_ADDRESS_ERROR,lampInfoDTO.getVersion());
+
+        if (lampInfoDTO.getAreaId() == 0) return toolUtils.response(InterfaceResultEnum.LACK_AREA_ERROR,lampInfoDTO.getVersion());
+        if (lampInfoDTO.getSectionId() == 0) return toolUtils.response(InterfaceResultEnum.LACK_SECTION_ERROR,lampInfoDTO.getVersion());
+
         LampInfoDTO lampInfoDTO1 = new LampInfoDTO();
         lampInfoDTO1.setSn(lampInfoDTO.getSn());
         if (lampDao.findByVO(lampInfoDTO1) > 0) return toolUtils.response(InterfaceResultEnum.LAMP_ADDRESS_UNIQUE_ERROR,lampInfoDTO.getVersion());
@@ -289,4 +298,9 @@ public class LampServiceImpl implements LampService {
         }
         return list;
     }
+
+    @Override
+    public List<LampInfoDTO> getLampPoleDetailListByLampPoleId(Integer lampPoleId) {
+        return lampDao.getLampPoleDetailListByLampPoleId(lampPoleId);
+    }
 }

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

@@ -32,4 +32,10 @@ public class WifiInfoLogServiceImpl implements WifiInfoLogService {
     public Integer getTimezoneById(WifiInfoLogDTO dto) {
         return wifiInfoLogDao.getTimezoneById(dto);
     }
+
+    @Override
+    public Integer deleteByWifiId(Integer wifiId) {
+        return wifiInfoLogDao.deleteByWifiId(wifiId);
+    }
+
 }

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

@@ -1,8 +1,12 @@
 package com.welampiot.service.impl;
 
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dao.WifiDao;
 import com.welampiot.dto.WifiDTO;
+import com.welampiot.service.WifiInfoLogService;
 import com.welampiot.service.WifiService;
+import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.WifiOutInfoVO;
 import com.welampiot.vo.WifiVO;
 import org.springframework.beans.BeanUtils;
@@ -28,6 +32,10 @@ import java.util.List;
 public class WifiServiceImpl implements WifiService {
     @Autowired
     private WifiDao wifiDao;
+    @Autowired
+    private ToolUtils toolUtils;
+    @Autowired
+    private WifiInfoLogService wifiInfoLogService;
 
     @Override
     public WifiVO getWifiList(WifiDTO dto) {
@@ -37,6 +45,11 @@ public class WifiServiceImpl implements WifiService {
         List<WifiDTO> list = new ArrayList<>();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         wifiList.forEach(wifiDTO ->{
+            wifiDTO.setSn(wifiDTO.getNum());
+            wifiDTO.setTotalFlaw(wifiDTO.getFlow());
+            wifiDTO.setDayFlaw(wifiDTO.getDayFlow());
+            wifiDTO.setUpFlaw("0Mbps");
+            wifiDTO.setDownFlaw("0Mbps");
             if (wifiDTO.getNetType() != null && wifiDTO.getNetType() == 1){
                 wifiDTO.setNetType(1);
             }else {
@@ -127,12 +140,41 @@ public class WifiServiceImpl implements WifiService {
     }
 
     @Override
-    public Integer add(WifiDTO dto) {
-        return wifiDao.add(dto);
+    public BaseResult add(WifiDTO dto) {
+        if (dto.getSn() == null || dto.getSn().length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_CLOUD_BOX_SN_ERROR,dto.getVersion2());
+
+        WifiDTO wifiDTO = new WifiDTO();
+        wifiDTO.setSn(dto.getSn());
+        if (wifiDao.getCountByDTO(wifiDTO) > 0) return toolUtils.response(InterfaceResultEnum.CLOUD_BOX_SN_UNIQUE_ERROR,dto.getVersion2());
+        wifiDao.add(dto);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,dto.getVersion2());
+    }
+
+    @Override
+    public BaseResult update(WifiDTO dto) {
+        if (dto.getSn() == null || dto.getSn().length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_CLOUD_BOX_SN_ERROR,dto.getVersion2());
+
+        WifiDTO wifiDTO = new WifiDTO();
+        wifiDTO.setSn(dto.getSn());
+        wifiDTO.setLampPoleId(dto.getLampPoleId());
+        if (wifiDao.getCountByDTO(wifiDTO) > 0) return toolUtils.response(InterfaceResultEnum.CLOUD_BOX_SN_UNIQUE_ERROR,dto.getVersion2());
+        wifiDao.update(dto);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,dto.getVersion2());
+    }
+
+    @Override
+    public WifiDTO getDetailByDTO(WifiDTO dto) {
+        return wifiDao.getDetailByDTO(dto);
+    }
+
+    @Override
+    public Integer deleteById(Integer id) {
+        wifiInfoLogService.deleteByWifiId(id);
+        return wifiDao.deleteById(id);
     }
 
     @Override
-    public Integer update(WifiDTO dto) {
-        return wifiDao.update(dto);
+    public List<WifiDTO> getWifiListByDTO(WifiDTO dto) {
+        return wifiDao.getWifiListByDTO(dto);
     }
 }

+ 1 - 0
src/main/java/com/welampiot/vo/LampListResponseVO.java

@@ -24,4 +24,5 @@ public class LampListResponseVO {
     private Integer total2;
     private String lampIds;  // 灯控id筛选
     private Integer lampType;
+    private Integer lampPoleId;
 }

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

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

+ 4 - 0
src/main/java/com/welampiot/vo/LampPoleVO.java

@@ -5,6 +5,7 @@ import com.welampiot.dto.WifiDTO;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -32,4 +33,7 @@ public class LampPoleVO implements Serializable {
     private Integer limit;
     private Integer offset;
     private Map cloudBox; // 云盒
+    private Integer createId;
+    private Float longitude;
+    private Float latitude;
 }

+ 36 - 9
src/main/resources/mapper/LampMapper.xml

@@ -174,6 +174,9 @@
         <if test="alarmType != null">
             AND L.faultstatus = #{alarmType}
         </if>
+        <if test="lampPoleId != null">
+            AND L.lamp_pole_id = #{lampPoleId}
+        </if>
 
         order by L.number asc,L.mode asc,L.createtime desc,L.id desc
         <if test="offset != null and limit != null">
@@ -302,15 +305,17 @@
     <insert id="add" parameterType="com.welampiot.dto.LampInfoDTO" useGeneratedKeys="true" keyProperty="id"
     >
         insert into lampinfo(networkid,name,number,address,areaid,sectionid,longitude,latitude,createtime,ratedpower,control_type
-        <if test="mode != null">
-            ,mode
-        </if>
+        <if test="mode != null">,mode</if>
+        <if test="lampPoleId != null">,lamp_pole_id</if>
+        <if test="installDate != null">,install_date</if>
+        <if test="expirationDate != null">,expiration_date</if>
         )
         values
         (#{networkId},#{name},#{number},#{sn},#{areaId},#{sectionId},#{longitude},#{latitude},#{createTime},#{ratedPower},#{controlType}
-        <if test="mode != null">
-            ,#{mode}
-        </if>
+        <if test="mode != null">,#{mode}</if>
+        <if test="lampPoleId != null">,#{lampPoleId}</if>
+        <if test="installDate != null">,#{installDate}</if>
+        <if test="expirationDate != null">,#{expirationDate}</if>
         )
     </insert>
     <update id="update" parameterType="com.welampiot.dto.LampInfoDTO"
@@ -326,9 +331,10 @@
         sectionid=#{sectionId},
         longitude=#{longitude},
         latitude=#{latitude},
-        <if test="mode != null">
-            mode=#{mode},
-        </if>
+        <if test="mode != null">mode=#{mode},</if>
+        <if test="lampPoleId != null">lamp_pole_id=#{lampPoleId},</if>
+        <if test="installDate != null">install_date=#{installDate},</if>
+        <if test="expirationDate != null">expiration_date=#{expirationDate},</if>
         ratedpower=#{ratedPower}
 
         where id = #{id}
@@ -422,4 +428,25 @@
         </if>
         order by L.number asc,L.mode asc,L.createtime desc,L.id desc
     </select>
+
+    <select id="getLampPoleDetailListByLampPoleId" resultType="com.welampiot.dto.LampInfoDTO" parameterType="int">
+        select
+        L.number,
+        L.id,
+        L.address as sn,
+        L.address,
+        L.areaid as areaId,
+        L.sectionid as sectionId,
+        L.name,
+        N.protocoltype,
+        L.control_type as controlType,
+        L.macAddress,
+        L.dev_addr as devAddr,
+        L.longitude,
+        L.latitude,L.install_date as installDate,L.expiration_date as expirationDate,L.ratedpower as ratedPower
+        from lampinfo L
+        left join section as S on S.id = L.sectionid
+        left join network as N on N.id = L.networkid
+        where lamp_pole_id=#{lampPoleId}
+    </select>
 </mapper>

+ 25 - 13
src/main/resources/mapper/LampPoleMapper.xml

@@ -19,6 +19,9 @@
         <if test="sectionId != null">
             AND a.sectionid = #{sectionId}
         </if>
+        <if test="id != null">
+            AND a.id != #{id}
+        </if>
     </select>
 
     <select id="getNavByVO" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
@@ -143,13 +146,13 @@
     </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
+        insert into lamp_pole(name,number,height,areaid,sectionid,longitude,latitude,createtime,create_id,install_date,expiration_date
 <!--        <if test="mode != null">-->
 <!--            ,mode-->
 <!--        </if>-->
         )
         values
-        (#{name},#{number},#{height},#{areaId},#{sectionId},#{longitude},#{latitude},#{createTime},#{createId},#{mainDevType},#{installDate},#{expirationDate}
+        (#{name},#{number},#{height},#{areaId},#{sectionId},#{longitude},#{latitude},#{createTime},#{createId},#{installDate},#{expirationDate}
 <!--        <if test="mode != null">-->
 <!--            ,#{mode}-->
 <!--        </if>-->
@@ -159,17 +162,26 @@
     >
         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}
+        <if test="sn != null">sn = #{sn},</if>
+        <if test="name != null">name = #{name},</if>
+        <if test="number != null">number = #{number},</if>
+        <if test="height != null">height = #{height},</if>
+        <if test="areaId != null">areaid = #{areaId},</if>
+        <if test="devType != null">devtype = #{devType},</if>
+        <if test="sectionId != null">sectionid = #{sectionId},</if>
+        <if test="longitude != null">longitude = #{longitude},</if>
+        <if test="latitude != null">latitude = #{latitude},</if>
+        <if test="installDate != null">install_date = #{installDate},</if>
+        <if test="expirationDate != null">expiration_date = #{expirationDate},</if>
+        id=#{id}
         where id = #{id}
     </insert>
+    <select id="getDetailById" resultType="com.welampiot.dto.LampPoleDTO" parameterType="int">
+        select id,name,number,height,areaid as areaId,sectionid as sectionId,longitude,latitude,install_date as installDate,expiration_date as expirationDate,devtype as devType from lamp_pole
+        where id=#{id}
+    </select>
+    <delete id="deleteById" parameterType="int">
+        delete from lamp_pole
+        where id=#{id}
+    </delete>
 </mapper>

+ 4 - 1
src/main/resources/mapper/WifiInfoLogMapper.xml

@@ -42,5 +42,8 @@
         left join section s on lp.sectionid = s.id
         where w.id = #{wifiId}
     </select>
-
+    <delete id="deleteByWifiId" parameterType="int">
+        delete from wifi_info_log
+        where wifiid=#{wifiId}
+    </delete>
 </mapper>

+ 39 - 9
src/main/resources/mapper/WifiMapper.xml

@@ -25,6 +25,9 @@
             <if test="keyword != null and keyword != ''">
                 and w.num like '%${keyword}%'
             </if>
+            <if test="lampPoleId != null">
+                and w.lamp_pole_id = #{lampPoleId}
+            </if>
             order by w.id desc
             <if test="page >= 0 and count > 0">
                 limit #{page},#{count}
@@ -79,13 +82,17 @@
             </foreach>
         </if>
         <if test="sn != null">
-            and lp.num = #{sn}
+            and w.num = #{sn}
+        </if>
+        <if test="lampPoleId != null">
+            and w.lamp_pole_id != #{lampPoleId}
         </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="ipAddr != null">,ip_addr</if>
         <if test="remark1 != null">,remark1</if>
         <if test="remark2 != null">,remark2</if>
         <if test="remark3 != null">,remark3</if>
@@ -95,6 +102,7 @@
         )
         values
         (#{sn},#{model},#{lampPoleId},#{installDate},#{expirationDate}
+        <if test="ipAddr != null">,#{ipAddr}</if>
         <if test="remark1 != null">,#{remark1}</if>
         <if test="remark2 != null">,#{remark2}</if>
         <if test="remark3 != null">,#{remark3}</if>
@@ -109,15 +117,37 @@
         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>
+        <if test="ipAddr != null">ip_addr=#{ipAddr},</if>
+        <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}
+        where 1=1
+        <if test="lampPoleId != null">
+            and lamp_pole_id = #{lampPoleId}
+        </if>
+        <if test="id != null">
+            and id = #{id}
+        </if>
     </insert>
+
+    <select id="getDetailByDTO" resultType="com.welampiot.dto.WifiDTO" parameterType="com.welampiot.dto.WifiDTO">
+        select id,num,model,lamp_pole_id as lampPoleId,install_date as installDate,expiration_date as expirationDate,remark1,remark2,remark3,remark4,remark5,remark6,ip_addr as ipAddr,num as sn
+        from wifi w
+        where 1=1
+        <if test="lampPoleId != null">
+            and w.lamp_pole_id = #{lampPoleId}
+        </if>
+        <if test="id != null">
+            and w.id = #{id}
+        </if>
+    </select>
+    <delete id="deleteById" parameterType="int">
+        delete from wifi
+        where id=#{id}
+    </delete>
 </mapper>