Pārlūkot izejas kodu

云盒电源设置,摄像头回放列表

crazycat 2 gadi atpakaļ
vecāks
revīzija
d296a17de9
34 mainītis faili ar 798 papildinājumiem un 90 dzēšanām
  1. 3 0
      src/main/java/com/welampiot/common/InterfaceResultEnum.java
  2. 60 5
      src/main/java/com/welampiot/controller/LampController.java
  3. 318 67
      src/main/java/com/welampiot/controller/NewLampPoleController.java
  4. 76 0
      src/main/java/com/welampiot/controller/VideoController.java
  5. 4 0
      src/main/java/com/welampiot/dao/LampDao.java
  6. 1 0
      src/main/java/com/welampiot/dao/LampPoleDao.java
  7. 2 0
      src/main/java/com/welampiot/dao/SectionDao.java
  8. 4 0
      src/main/java/com/welampiot/dao/VideoMonitorDao.java
  9. 11 10
      src/main/java/com/welampiot/dto/LampInfoDTO.java
  10. 3 0
      src/main/java/com/welampiot/dto/SectionDTO.java
  11. 6 0
      src/main/java/com/welampiot/dto/VideoMonitorDTO.java
  12. 1 0
      src/main/java/com/welampiot/service/LampPoleService.java
  13. 4 1
      src/main/java/com/welampiot/service/LampService.java
  14. 2 0
      src/main/java/com/welampiot/service/LoopService.java
  15. 1 1
      src/main/java/com/welampiot/service/ScreenService.java
  16. 2 0
      src/main/java/com/welampiot/service/SectionService.java
  17. 4 0
      src/main/java/com/welampiot/service/VideoMonitorService.java
  18. 5 0
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  19. 20 0
      src/main/java/com/welampiot/service/impl/LampServiceImpl.java
  20. 5 0
      src/main/java/com/welampiot/service/impl/LoopServiceImpl.java
  21. 5 0
      src/main/java/com/welampiot/service/impl/ScreenServiceImpl.java
  22. 6 0
      src/main/java/com/welampiot/service/impl/SectionServiceImpl.java
  23. 21 0
      src/main/java/com/welampiot/service/impl/VideoMonitorServiceImpl.java
  24. 21 0
      src/main/java/com/welampiot/utils/WebUtils.java
  25. 1 0
      src/main/java/com/welampiot/vo/LampPoleCountVO.java
  26. 2 0
      src/main/java/com/welampiot/vo/LampPoleInfoVO.java
  27. 1 0
      src/main/java/com/welampiot/vo/LoginVO.java
  28. 11 0
      src/main/java/com/welampiot/vo/SectionVO.java
  29. 2 0
      src/main/java/com/welampiot/vo/VideoMonitorVO.java
  30. 59 3
      src/main/resources/mapper/LampMapper.xml
  31. 29 0
      src/main/resources/mapper/LampPoleMapper.xml
  32. 22 1
      src/main/resources/mapper/SectionMapper.xml
  33. 59 0
      src/main/resources/mapper/VideoMonitorMapper.xml
  34. 27 2
      src/main/resources/mapper/WifiMapper.xml

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

@@ -4,7 +4,10 @@ public enum InterfaceResultEnum {
 
     OPERATION_SUCCESS("0000","操作成功","Operation successful","Операция прошла успешно"),
     PARAM_FAIL("0001","参数异常","Parameter abnormality","Параметры аномалии"),
+    TOKEN_FAIL("0004","登录信息已过期,请重新登录","Parameter abnormality","Параметры аномалии"),
     LACK_PARAM_ERROR("0007","缺少必要参数","",""),
+    USERNAME_PASSWORD_PARAM_ERROR("0101","用户名或密码错误","",""),
+    SEND_CMD_TIME_OUT("0014","下发命令超时,请稍后重试!","",""),
     LACK_LAMP_NUMBER_ERROR("0201","请填写灯控编号","",""),
     LAMP_NUMBER_FORMAT_ERROR("0202","灯控编号只能包含数字跟字母","",""),
     LAMP_NUMBER_UNIQUE_ERROR("0203","灯控编号重复","",""),

+ 60 - 5
src/main/java/com/welampiot/controller/LampController.java

@@ -217,16 +217,71 @@ public class LampController {
     public BaseResult dimming(HttpServletRequest request){
         Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
         Integer light = request.getParameter("light") == null ? 0 : Integer.parseInt(request.getParameter("light"));
+        Integer isGroup = request.getParameter("isGroup") == null ? 0 : Integer.parseInt(request.getParameter("isGroup"));
         Integer id = request.getParameter("id") == null ? 0 : Integer.parseInt(request.getParameter("id"));
         LampInfoDTO lamp = lampService.getDetailsById(id, version);
+        light = light > 100 ? 100 : light;
         if (lamp.getProtocolType() == 10){ // 4G
             String sendTopic = "/Lamp/TransIn/"+lamp.getSn();
             String backTopic = "/Lamp/TransOut/"+lamp.getSn();
-
-            if (lamp.getMode() == 1){  // B 路
-
-            }else {  // A 路
-
+            if (isGroup == 1){
+                String cmd;
+                if (lamp.getMode() == 0){  // B 路
+                    cmd = "0110DF090102";
+                }else {  // A 路
+                    cmd = "0110DF0B0102";
+                }
+                if (light == 0){
+                    cmd += "5F";
+                }else {
+                    cmd += "A0";
+                }
+                cmd += toolUtils.getCRC(cmd.getBytes());
+                String s = toolUtils.sendMqttCmd(sendTopic, "0232"+cmd, backTopic, 10);
+                if (s == null || s.length() == 0){
+                    return toolUtils.response(InterfaceResultEnum.SEND_CMD_TIME_OUT,version);
+                }else {
+                    if (lamp.getMode() == 0){  // A 路
+                        cmd = "0106DF0A";
+                    }else {  // B 路
+                        cmd = "0106DF0C";
+                    }
+                    String lightStr = "0000"+Integer.toHexString(light).toString();
+                    lightStr = lightStr.substring(-4);
+                    cmd += lightStr;
+                    cmd += toolUtils.getCRC(cmd.getBytes());
+                    s = toolUtils.sendMqttCmd(sendTopic, "0232"+cmd, backTopic, 10);
+                    if (s == null || s.length() == 0){
+                        return toolUtils.response(InterfaceResultEnum.SEND_CMD_TIME_OUT,version);
+                    }else {
+                        LampInfoDTO lampInfoDTO = new LampInfoDTO();
+                        lampInfoDTO.setLighteness(light);
+                        lampInfoDTO.setPolicyId(0);
+                        lampInfoDTO.setPolicyType(0);
+                        lampService.updateLight(lampInfoDTO);
+                        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+                    }
+                }
+            }else {
+                String cmd;
+                if (lamp.getMode() == 0){  // A 路
+                    cmd = "0106DF0A";
+                }else {  // B 路
+                    cmd = "0106DF0C";
+                }
+                String lightStr = "0000"+Integer.toHexString(light).toString();
+                lightStr = lightStr.substring(-4);
+                cmd += lightStr;
+                cmd += toolUtils.getCRC(cmd.getBytes());
+                String s = toolUtils.sendMqttCmd(sendTopic, "0232"+cmd, backTopic, 10);
+                if (s == null || s.length() == 0){
+                    return toolUtils.response(InterfaceResultEnum.SEND_CMD_TIME_OUT,version);
+                }else {
+                    LampInfoDTO lampInfoDTO = new LampInfoDTO();
+                    lampInfoDTO.setLighteness(light);
+                    lampService.updateLight(lampInfoDTO);
+                    return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+                }
             }
         }
 //        String lampId = request.getParameter("lampId");

+ 318 - 67
src/main/java/com/welampiot/controller/NewLampPoleController.java

@@ -7,13 +7,14 @@ import com.welampiot.dto.*;
 import com.welampiot.service.*;
 import com.welampiot.utils.ExcelUtil;
 import com.welampiot.utils.ToolUtils;
+import com.welampiot.utils.WebUtils;
 import com.welampiot.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
-
+import java.io.File;
 import javax.servlet.http.HttpServletRequest;
 import java.text.DecimalFormat;
 import java.text.ParseException;
@@ -57,6 +58,8 @@ public class NewLampPoleController {
     @Autowired
     private LampService lampService;
     @Autowired
+    private LoopService loopService;
+    @Autowired
     private LampInfoLogService lampInfoLogService;
     @Autowired
     private LampPoleAlarmLogService lampPoleAlarmLogService;
@@ -86,74 +89,54 @@ public class NewLampPoleController {
         lampPoleInfoVO.setRunCount(listByVO.size());
         lampPoleInfoVO.setWifiCount(listByVO.size());
         lampPoleInfoVO.setEmCount(0);
+        lampPoleInfoVO.setTiltCount(0);
+        lampPoleInfoVO.setChargeCount(0);
+        lampPoleInfoVO.setWeatherCount(0);
+        lampPoleInfoVO.setDisableCount(0);
+
+        // 灯控数
+        LampCountVO lampCountVO = new LampCountVO();
+        lampCountVO.setSectionList(sectionList);
+        lampPoleInfoVO.setLampCount(lampService.getLampPoleCountByVO(lampCountVO));
+
+        // 摄像头设备数量
+        VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
+        videoMonitorVO.setSectionList(sectionList);
+        lampPoleInfoVO.setVideoCount(videoMonitorService.getLampPoleCountByVO(videoMonitorVO));
+
+        // 广告屏设备数量
+        ScreenDTO screenDTO = new ScreenDTO();
+        screenDTO.setSectionList(sectionList);
+        lampPoleInfoVO.setScreenCount(screenService.getTotalBySectionList(screenDTO));
+
+        // 空开设备数量
+        LoopDTO loopDTO = new LoopDTO();
+        loopDTO.setSectionList(sectionList);
+        lampPoleInfoVO.setLoopCount(loopService.getTotalBySectionList(loopDTO));
+
         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);
+            if (split.contains("6")) lampPoleInfoVO.setChargeCount(lampPoleInfoVO.getChargeCount()+1);
+            if (split.contains("7")) lampPoleInfoVO.setWeatherCount(lampPoleInfoVO.getWeatherCount()+1);
+            if (split.contains("18")) lampPoleInfoVO.setTiltCount(lampPoleInfoVO.getTiltCount()+1);
         }
-//        $data['loopCount'] = $this->Loop_model->get_count(array('sectionid'=>$sectionId));
-//        $id_arr = array_column($lampPoleList, 'id');
-//        $temp_l = [];
-//        if (!empty($id_arr)) {
-//            $sql = 'select lamp_pole_id,max(updatetime),status,id,devtype from lamp_pole_alarm_log where lamp_pole_id in ('.implode(',', $id_arr).') and (status = 0 or status = 1) group by lamp_pole_id';
-//            $l_list = $this->db->query($sql)->result_array();
-//            foreach ($l_list as $key => $value) {
-//                // if ($value['status'] != 1 && $value['status'] != 0) continue;
-//                $temp_l[$value['lamp_pole_id']] = $value;
-//            }
-//        }
-//
-//        $lampPoleId = array();
-//        foreach ($lampPoleList as $lampPole) {
-//            $data['deviceCount'] += 1;
-//            $data['runCount'] += 1;
-//            if (time() - strtotime($lampPole['createtime']) <= 3600*24*30) {
-//                $data['newCount'] += 1;
-//            }
-//            $typeArr = explode(',', $lampPole['devtype']);
-//            if (in_array('0', $typeArr)) $data['lampCount'] += 1;
-//            if (in_array('1', $typeArr)) $data['videoCount'] += 1;
-//            if (in_array('2', $typeArr)) $data['wifiCount'] += 1;
-//            if (in_array('4', $typeArr)) $data['screenCount'] += 1;
-//            if (in_array('5', $typeArr)) $data['emCount'] += 1;
-//            if (in_array('6', $typeArr)) $data['chargeCount'] += 1;
-//            if (in_array('7', $typeArr)) $data['weatherCount'] += 1;
-//            if (in_array('9', $typeArr)) $data['radioCount'] += 1;
-//            if (in_array('14', $typeArr)) $data['waterImmersionCount'] += 1;
-//            if (in_array('18', $typeArr)) $data['tiltCount'] += 1;
-//            if (in_array('15', $typeArr)) $data['lockCount'] += 1;
-//            if (isset($temp_l[$lampPole['id']])) {
-//                $data['faultCount'] += 1;
-//                $data['runCount'] -= 1;
-//            }
-//
-//            $lampPoleId[] = $lampPole['id'];
-//        }
-//
-//        if (!empty($lampPoleId)) {
-//            // smart_lock_dev_info
-//            $res = $this->db->query('select count(*) as total from smart_lock_dev_info where lamp_pole_id in ('.implode(',', $lampPoleId).')')->row_array();
-//            $data['lockCount'] = intval($res['total']);
-//
-//            $lampinfoList = $this->Lampinfo_model->get_list(array('lamp_pole_id'=>$lampPoleId),'id');
-//            $lampId = array();
-//            $data['lampCount'] = count($lampinfoList);
-//            foreach ($lampinfoList as $l) {
-//                $lampId[] = $l['id'];
-//            }
-//            if (!empty($lampId)) {
-//                $join = array(
-//                        array('table'=>'lamp_info_log_new as t1','cond'=>'t1.updatetime = LI.updatetime AND t1.lampid = LI.lampid','type'=>'inner')
-//                );
-//                $sql = "select day_gener_energy,month_gener_energy,used_energy_total from lamp_info_log_new a where a.lampid in (".implode(',', $lampId).")";
-//                $lampInfoLogList = $this->db->query($sql)->result_array();
-//                foreach ($lampInfoLogList as $lampLog) {
-//                    $data['dayCom'] += $lampLog['day_gener_energy'];
-//                    $data['monthCom'] += $lampLog['month_gener_energy'];
-//                    $data['totalCom'] += $lampLog['used_energy_total'];
-//                }
-//            }
-//        }
+
+        // 近期创建数据
+        Date date = new Date(System.currentTimeMillis() - 24 * 3600 * 30 * 1000);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String createTime = simpleDateFormat.format(date);
+        LampPoleCountVO lampPoleCountVO = new LampPoleCountVO();
+        lampPoleCountVO.setCreateTime(createTime);
+        lampPoleCountVO.setSectionList(sectionList);
+        lampPoleInfoVO.setNewCount(lampPoleService.getCountByVO(lampPoleCountVO));
+
+        // 故障数
+        lampPoleCountVO = new LampPoleCountVO();
+        lampPoleCountVO.setSectionList(sectionList);
+        lampPoleInfoVO.setFaultCount(lampPoleService.getAlarmCountByVO(lampPoleCountVO));
+
 //        $data['dayCom'] = round($data['dayCom'],1);
 //        $data['monthCom'] = round($data['monthCom'],1);
 //        $data['totalCom'] = round($data['totalCom'],1);
@@ -884,6 +867,143 @@ public class NewLampPoleController {
 
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleInfoVO);
     }
+    /**
+     * 摄像头随机预览
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/videoList",method = RequestMethod.POST)
+    public BaseResult videoList(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        List sectionList = toolUtils.getSectionList(request);
+        VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
+        videoMonitorVO.setVersion(version);
+        videoMonitorVO.setSectionList(sectionList);
+        videoMonitorVO.setNetStatus(1);
+        List<VideoMonitorDTO> lampPoleListByVO = videoMonitorService.getLampPoleListByVO(videoMonitorVO);
+        List<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
+        if (lampPoleListByVO.size() > 4){
+            Random random = new Random();
+            int i = random.nextInt(lampPoleListByVO.size());
+            VideoMonitorDTO remove = lampPoleListByVO.remove(i);
+            videoMonitorDTOS.add(remove);
+
+            i = random.nextInt(lampPoleListByVO.size());
+            remove = lampPoleListByVO.remove(i);
+            videoMonitorDTOS.add(remove);
+
+            i = random.nextInt(lampPoleListByVO.size());
+            remove = lampPoleListByVO.remove(i);
+            videoMonitorDTOS.add(remove);
+
+            i = random.nextInt(lampPoleListByVO.size());
+            remove = lampPoleListByVO.remove(i);
+            videoMonitorDTOS.add(remove);
+        }else {
+            videoMonitorDTOS = lampPoleListByVO;
+        }
+
+        List<VideoMonitorDTO> list = new ArrayList<>();
+
+        for (VideoMonitorDTO v : videoMonitorDTOS) {
+            if (v.getCity() != null){
+                v.setName(v.getCity()+" "+v.getArea()+" "+v.getSection()+" "+v.getName());
+            }else {
+                v.setName(v.getArea()+" "+v.getSection()+" "+v.getName());
+            }
+            String path = "/upload/videoImage/"+v.getGbAddress()+".png";
+            File file = new File(".."+path);
+            if (file.exists()){
+                v.setImage(path);
+            }else {
+                v.setImage("");
+            }
+            list.add(v);
+        }
+
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(list);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
+    }
+
+    @Autowired
+    private SectionService sectionService;
+    /**
+     * 区域概览列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/areaList",method = RequestMethod.POST)
+    public BaseResult areaList(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer type = (Integer) toolUtils.getRequestContent(request,"type",1);
+        Integer mode = (Integer) toolUtils.getRequestContent(request,"mode",1);
+        List sectionList1 = toolUtils.getSectionList(request);
+        SectionVO sectionVO = new SectionVO();
+        sectionVO.setSectionList(sectionList1);
+        sectionVO.setVersion(version);
+        HashMap<Integer, LampPoleInfoVO> integerObjectHashMap = new HashMap<>();
+
+        if (mode == 0){  // 区域
+            List<SectionDTO> listByIdList = sectionService.getListByVO(sectionVO);
+            for (SectionDTO s :listByIdList) {
+                LampPoleInfoVO lampPoleInfoVO = new LampPoleInfoVO();
+                lampPoleInfoVO.setAreaId(s.getPid());
+                lampPoleInfoVO.setName(s.getArea());
+                lampPoleInfoVO.setDeviceCount(0);
+                lampPoleInfoVO.setNewCount(0);
+                lampPoleInfoVO.setDisableCount(0);
+                lampPoleInfoVO.setLampCount(0);
+                lampPoleInfoVO.setVideoCount(0);
+                lampPoleInfoVO.setWeatherCount(0);
+                lampPoleInfoVO.setWifiCount(0);
+                lampPoleInfoVO.setScreenCount(0);
+                lampPoleInfoVO.setLoopCount(0);
+                lampPoleInfoVO.setRadioCount(0);
+                lampPoleInfoVO.setEmCount(0);
+                lampPoleInfoVO.setChargeCount(0);
+                if (!integerObjectHashMap.containsKey(s.getPid())) integerObjectHashMap.put(s.getPid(),lampPoleInfoVO);
+            }
+        }else {  // 公司
+
+        }
+
+        LampListResponseVO lampListResponseVO = new LampListResponseVO();
+        lampListResponseVO.setSectionList(sectionList1);
+        List<LampInfoDTO> listByVO = lampService.areaInfoLampList(lampListResponseVO);
+        for (LampInfoDTO l :listByVO) {
+            Integer id;
+            if (mode == 0){
+                id = l.getAreaId();
+            }else {
+                id = l.getCompanyId();
+            }
+            if (integerObjectHashMap.containsKey(id)){
+                LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(id);
+                lampPoleInfoVO.setLampCount(lampPoleInfoVO.getLampCount()+1);
+                integerObjectHashMap.put(id,lampPoleInfoVO);
+            }
+        }
+
+
+
+//        List sectionList = toolUtils.getSectionList(request);
+//        VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
+//        videoMonitorVO.setVersion(version);
+//        videoMonitorVO.setSectionList(sectionList);
+//        videoMonitorVO.setNetStatus(1);
+//        List<VideoMonitorDTO> lampPoleListByVO = videoMonitorService.getLampPoleListByVO(videoMonitorVO);
+//        List<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
+
+        ArrayList<LampPoleInfoVO> lampPoleInfoVOS = new ArrayList<>();
+        Set<Integer> integers = integerObjectHashMap.keySet();
+        for (Integer i :integers) {
+            lampPoleInfoVOS.add(integerObjectHashMap.get(i));
+        }
+        ListResponseVO listResponseVO = new ListResponseVO();
+        listResponseVO.setList(lampPoleInfoVOS);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
+    }
 
     /**
      * 云盒气象站RS485设备信息列表
@@ -1164,6 +1284,137 @@ public class NewLampPoleController {
         lampPoleVO1.setFaultCount(lampPoleAlarmTotal);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleVO1);
     }
+    /**
+     * 设置云盒电源
+     * @param request sectionList
+     * @return 获取故障数
+     */
+    @RequestMapping(value = "/setWifiOutInfo", method = RequestMethod.POST)
+//    public BaseResult<?> setWifiOutInfo(HttpServletRequest request) {
+    public BaseResult<?> setWifiOutInfo(WifiDTO wifiDTO) {
+        Integer version = Integer.valueOf(wifiDTO.getVersion());
+        WifiDTO wifiDTO1 = new WifiDTO();
+        wifiDTO1.setId(wifiDTO1.getId());
+        WifiDTO detailByDTO = wifiService.getDetailByDTO(wifiDTO1);
+        Integer sectionId = detailByDTO.getSectionId();
+        SectionDTO oneById = sectionService.getOneById(sectionId);
+        Integer timezone = oneById.getTimezone();
+        String cmdInfo = "{";
+        if (wifiDTO.getType1() == null || wifiDTO.getType1() == 0){
+            if (wifiDTO.getAC1() == null || wifiDTO.getAC1() == 0){
+                cmdInfo += "\"D5\":\"0000000000\",";
+            }else {
+                cmdInfo += "\"D5\":\"0001000000\",";
+            }
+        }else {
+            String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime1(), timezone);
+            String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime1(), timezone);
+            cmdInfo += "\"D5\":01\""+dateFormat+dateFormat2+"\",";
+        }
+
+        if (wifiDTO.getType2() == null || wifiDTO.getType2() == 0){
+            if (wifiDTO.getAC2() == null || wifiDTO.getAC2() == 0){
+                cmdInfo += "\"D6\":\"0000000000\",";
+            }else {
+                cmdInfo += "\"D6\":\"0001000000\",";
+            }
+        }else {
+            String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime2(), timezone);
+            String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime2(), timezone);
+            cmdInfo += "\"D6\":01\""+dateFormat+dateFormat2+"\",";
+        }
+
+        if (wifiDTO.getType3() == null || wifiDTO.getType3() == 0){
+            if (wifiDTO.getAC3() == null || wifiDTO.getAC3() == 0){
+                cmdInfo += "\"D7\":\"0000000000\",";
+            }else {
+                cmdInfo += "\"D7\":\"0001000000\",";
+            }
+        }else {
+            String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime3(), timezone);
+            String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime3(), timezone);
+            cmdInfo += "\"D7\":01\""+dateFormat+dateFormat2+"\",";
+        }
+
+        if (wifiDTO.getType4() == null || wifiDTO.getType4() == 0){
+            if (wifiDTO.getLna1Status() == null || wifiDTO.getLna1Status() == 0){
+                cmdInfo += "\"D8\":\"0000000000\",";
+            }else {
+                cmdInfo += "\"D8\":\"0001000000\",";
+            }
+        }else {
+            String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime4(), timezone);
+            String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime4(), timezone);
+            cmdInfo += "\"D8\":01\""+dateFormat+dateFormat2+"\",";
+        }
+
+        if (wifiDTO.getType5() == null || wifiDTO.getType5() == 0){
+            if (wifiDTO.getLna2Status() == null || wifiDTO.getLna2Status() == 0){
+                cmdInfo += "\"D9\":\"0000000000\",";
+            }else {
+                cmdInfo += "\"D9\":\"0001000000\",";
+            }
+        }else {
+            String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime5(), timezone);
+            String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime5(), timezone);
+            cmdInfo += "\"D9\":01\""+dateFormat+dateFormat2+"\",";
+        }
+
+        if (wifiDTO.getType6() == null || wifiDTO.getType6() == 0){
+            if (wifiDTO.getLna3Status() == null || wifiDTO.getLna3Status() == 0){
+                cmdInfo += "\"DA\":\"0000000000\",";
+            }else {
+                cmdInfo += "\"DA\":\"0001000000\",";
+            }
+        }else {
+            String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime6(), timezone);
+            String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime6(), timezone);
+            cmdInfo += "\"DA\":01\""+dateFormat+dateFormat2+"\",";
+        }
+        cmdInfo += "}";
+
+        cmdInfo = "01"+cmdInfo;
+        String sendTopic = "/WEGW3/WriteIn/"+detailByDTO.getNum();
+        String resTopic = "/WEGW3/WriteOut/"+detailByDTO.getNum();
+        String resCmd = toolUtils.sendMqttCmd(sendTopic,cmdInfo,resTopic);
+        if (resCmd == null || resCmd.length() == 0) return toolUtils.response(InterfaceResultEnum.SEND_CMD_TIME_OUT,version);
+        wifiService.update(wifiDTO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 设置DO状态
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/setWifiDo", method = RequestMethod.POST)
+    public BaseResult<?> setWifiDo(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer id = (Integer) toolUtils.getRequestContent(request, "id", 0);
+        Integer type = (Integer) toolUtils.getRequestContent(request, "type", 0);
+        Integer status = (Integer) toolUtils.getRequestContent(request, "status", 0);
+        if (id == 0) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+        WifiDTO wifiDTO = new WifiDTO();
+        wifiDTO.setId(id);
+        WifiDTO detailByDTO = wifiService.getDetailByDTO(wifiDTO);
+        String sendTopic = "/WEGW3/WriteIn/"+detailByDTO.getNum();
+        String resTopic = "/WEGW3/WriteOut/"+detailByDTO.getNum();
+        String cmdInfo;
+        if (status == 0){
+            cmdInfo = "01{" + "\"DO0\":" + "\"0000\"}";
+        }else {
+            cmdInfo = "01{" + "\"DO0\":" + "\"0001\"}";
+        }
+
+        String resCmd = toolUtils.sendMqttCmd(sendTopic,cmdInfo,resTopic);
+        if (resCmd == null || resCmd.length() == 0) return toolUtils.response(InterfaceResultEnum.SEND_CMD_TIME_OUT,version);
+//        LampPoleVO lampPoleVO = new LampPoleVO();
+//        lampPoleVO.setSectionList(toolUtils.getSectionList(request));
+//        Integer lampPoleAlarmTotal = lampPoleService.getLampPoleAlarmTotal(lampPoleVO);
+//        LampPoleVO lampPoleVO1 = new LampPoleVO();
+//        lampPoleVO1.setFaultCount(lampPoleAlarmTotal);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
 
     /**
      * 云盒sn批量授权接口

+ 76 - 0
src/main/java/com/welampiot/controller/VideoController.java

@@ -0,0 +1,76 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.common.ResultEnum;
+import com.welampiot.dto.UserDTO;
+import com.welampiot.dto.VideoMonitorDTO;
+import com.welampiot.dto.WaterImmersionDevInfoDTO;
+import com.welampiot.service.VideoMonitorService;
+import com.welampiot.utils.MD5Utils;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.LoginVO;
+import com.welampiot.vo.VideoMonitorVO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/video")
+public class VideoController {
+    private final static Logger log = LoggerFactory.getLogger(VideoController.class);
+    @Autowired
+    private ToolUtils toolUtils;
+
+    @Autowired
+    private VideoMonitorService videoMonitorService;
+    /**
+     * 设置AI开关状态
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/setAiStatus", method = RequestMethod.POST)
+    public BaseResult setAiStatus(HttpServletRequest request){
+        int version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        int lampPoleId = request.getParameter("lampPoleId") == null ? 0 : Integer.parseInt(request.getParameter("lampPoleId"));
+        int status = request.getParameter("status") == null ? 0 : Integer.parseInt(request.getParameter("status"));
+        VideoMonitorDTO videoMonitorDTO = new VideoMonitorDTO();
+        videoMonitorDTO.setLampPoleId(lampPoleId);
+        videoMonitorDTO.setIsInspect(status);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 获取摄像头回放列表
+     * @param videoMonitorDTO
+     * @return
+     */
+    @RequestMapping(value = "/getRecordList", method = RequestMethod.POST)
+    public BaseResult getRecordList(VideoMonitorDTO videoMonitorDTO){
+        int version = videoMonitorDTO.getVersion();
+//        Integer id = videoMonitorDTO.getId();
+        long startTime = System.currentTimeMillis() - 24 * 3600 * 1000;
+        ArrayList<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        while (System.currentTimeMillis() > startTime + 20 * 60 * 1000) {
+            VideoMonitorDTO videoMonitorDTO1 = new VideoMonitorDTO();
+            videoMonitorDTO1.setStartTime(simpleDateFormat.format(new Date(startTime)));
+            videoMonitorDTO1.setEndTime(simpleDateFormat.format(new Date(startTime + 20 * 60 * 1000)));
+            videoMonitorDTOS.add(videoMonitorDTO1);
+        }
+        VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
+        videoMonitorVO.setList(videoMonitorDTOS);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorVO);
+    }
+}

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

@@ -22,6 +22,10 @@ public interface LampDao {
     Integer add(LampInfoDTO lampInfoDTO);
     Integer update(LampInfoDTO lampInfoDTO);
     Integer deleteById(@Param("id")Integer id);
+    Integer updateLight(LampInfoDTO lampInfoDTO);
+    List<LampInfoDTO> getListByIdList(@Param("idList")List idList);
+    Integer getLampPoleCountByVO(LampCountVO lampCountVO);
+    List<LampInfoDTO> areaInfoLampList(LampListResponseVO lampListResponseVO);
     List<LampInfoDTO> groupSelectLamp(LampListResponseVO lampListResponseVO);
     List<LampInfoDTO> getNavByVO(LampListResponseVO lampListResponseVO);
     List<LampInfoDTO> getLampPoleDetailListByLampPoleId(@Param("lampPoleId")Integer lampPoleId);

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

@@ -17,6 +17,7 @@ public interface LampPoleDao {
     Integer add(LampPoleDTO lampPoleDTO);
     Integer update(LampPoleDTO lampPoleDTO);
     LampPoleDTO getDetailById(@Param("id")Integer id);
+    Integer getAlarmCountByVO(LampPoleCountVO lampPoleCountVO);
     Integer deleteById(@Param("id")Integer id);
     List<LampPoleDTO> getLampPoleListByDTO(LampPoleDTO dto);
     Integer getLampPoleInstallTotalByDTO(LampPoleDTO dto);

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

@@ -1,6 +1,7 @@
 package com.welampiot.dao;
 
 import com.welampiot.dto.SectionDTO;
+import com.welampiot.vo.SectionVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -17,6 +18,7 @@ public interface SectionDao {
     Integer checkNameRepeated(SectionDTO dto);
     Integer getSectionPidById(@Param("id") Integer id);
     void updateSectionData(SectionDTO dto);
+    List<SectionDTO> getListByVO(SectionVO sectionVO);
     void deleteSectionDataById(@Param("id") Integer id);
     List<SectionDTO> getAllSectionList();
     List<SectionDTO> getAllSectionListByPid(@Param("id") Integer id);

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

@@ -7,6 +7,10 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface VideoMonitorDao {
+    Integer getLampPoleCountByVO(VideoMonitorVO videoMonitorVO);
+    List<VideoMonitorDTO> getLampPoleListByVO(VideoMonitorVO videoMonitorVO);
+    void setAIStatus(VideoMonitorDTO dto);
+    VideoMonitorDTO getOneById(@Param("id")Integer id);
     List<VideoMonitorDTO> getListByVO(VideoMonitorVO vo);
     List<VideoMonitorDTO> getVideoListBySectionList(@Param("sectionList") List<Integer> sectionList);
     void changeVideoMonitorLocationById(VideoMonitorDTO dto);

+ 11 - 10
src/main/java/com/welampiot/dto/LampInfoDTO.java

@@ -15,7 +15,7 @@ public class LampInfoDTO {
     private String section;
     private Integer sectionId;
     private Integer timezone;
-    private Integer lighteness;
+    private int lighteness;
     private Integer status;
     private String gridPF;
     private String name;
@@ -29,16 +29,16 @@ public class LampInfoDTO {
     private Integer ledLuxValue;
     private Float leakageCur;
     private String networkStatus;
-    private Integer lampStatus;
+    private int lampStatus;
     private String lampStatusStr;
     private String lampOnline;
     private Integer rssi;
     private Integer snr;
-    private Integer protocolType;
+    private int protocolType;
     private String groupId;
     private String group;
     private String network;
-    private Integer networkId;
+    private int networkId;
     private String netStatus;
     private String lampPoleName;
     private String loopNumber;
@@ -47,12 +47,12 @@ public class LampInfoDTO {
     private Integer mode;
     private String hwVersion;
     private String swVersion;
-    private Integer controlType;
+    private int controlType;
     private String macAddress;
     private String devAddr;
     private Integer bindStatus;
     private Integer policyType;
-    private Integer policyid;
+    private Integer policyId;
     private Float longitude;
     private Float latitude;
     private Integer newFaultstatus;
@@ -65,10 +65,11 @@ public class LampInfoDTO {
     private String dueDate;
     private String controlTypeStr;
     private String createTime;
-    private Integer ratedPower;
-    private Integer version;
-    private Integer select;
-    private Integer lampPoleId;
+    private int companyId;
+    private int ratedPower;
+    private int version;
+    private int select;
+    private int lampPoleId;
     private Integer loopId;
     private String colourVal;
     private String keyword;

+ 3 - 0
src/main/java/com/welampiot/dto/SectionDTO.java

@@ -68,5 +68,8 @@ public class SectionDTO implements Serializable {
 
     private Integer select;
 
+    /** 区域名称 **/
+    private String area;
+
     private static final long serialVersionUID = 1L;
 }

+ 6 - 0
src/main/java/com/welampiot/dto/VideoMonitorDTO.java

@@ -7,6 +7,9 @@ public class VideoMonitorDTO {
     private Integer id;
     private String name;
     private String image;
+    private String section;
+    private String area;
+    private String city;
     private String longitude;
     private String latitude;
     private Integer sectionId;
@@ -60,4 +63,7 @@ public class VideoMonitorDTO {
     private Integer isMse;
     private String mseUrl;
     private String uuid;
+    private int version;
+    private String startTime;
+    private String endTime;
 }

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

@@ -19,6 +19,7 @@ public interface LampPoleService {
     BaseResult add(LampPoleVO lampPoleVO);
     BaseResult update(LampPoleVO lampPoleVO);
     LampPoleDTO getDetailById(@Param("id")Integer id);
+    Integer getAlarmCountByVO(LampPoleCountVO lampPoleCountVO);
     Integer deleteById(@Param("id")Integer id);
     LampPoleVO getLampPoleListByDTO(LampPoleDTO dto);
     LampPoleInfoVO getLampPoleCount(LampPoleDTO lampPoleDTO, LampInfoDTO lampInfoDTO);

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

@@ -22,7 +22,10 @@ public interface LampService {
     BaseResult add(LampInfoDTO lampInfoDTO);
     BaseResult update(LampInfoDTO lampInfoDTO);
     Integer deleteById(@Param("id")Integer id);
-
+    Integer updateLight(LampInfoDTO lampInfoDTO);
+    List<LampInfoDTO> getListByIdList(@Param("idList")List idList);
+    Integer getLampPoleCountByVO(LampCountVO lampCountVO);
+    List<LampInfoDTO> areaInfoLampList(LampListResponseVO lampListResponseVO);
     LampInfoDTO getDetailsByAddress(@Param("address")String address,@Param("version")Integer version);
     List<LampInfoDTO> groupSelectLamp(LampListResponseVO lampListResponseVO);
     List<LampInfoDTO> getNavByVO(LampListResponseVO lampListResponseVO);

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

@@ -46,4 +46,6 @@ public interface LoopService {
     Integer getCloseLoopTotalByDTO(LoopDTO dto);
 
     void changeLoopLocationById(LoopDTO dto);
+
+    Integer getTotalBySectionList(LoopDTO loopDTO);
 }

+ 1 - 1
src/main/java/com/welampiot/service/ScreenService.java

@@ -19,7 +19,7 @@ public interface ScreenService {
     ScreenVO getScreenList(ScreenDTO dto);
 
     ScreenVO getScreenNavByDTO(ScreenDTO dto);
-
+    Integer getTotalBySectionList(ScreenDTO dto);
     ScreenDetailsVO getScreenDetails(ScreenDTO dto);
 
     List<ScreenDTO> getAllScreenListBySectionId(Integer sectionId);

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

@@ -1,6 +1,7 @@
 package com.welampiot.service;
 
 import com.welampiot.dto.SectionDTO;
+import com.welampiot.vo.SectionVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -18,6 +19,7 @@ public interface SectionService {
     Integer checkNameRepeated(SectionDTO dto);
     Integer getSectionPidById(Integer id);
     void updateSectionData(SectionDTO dto);
+    List<SectionDTO> getListByVO(SectionVO sectionVO);
     void deleteSectionDataById(Integer id);
     List<SectionDTO> getAllSectionList();
     List<SectionDTO> getAllSectionListByPid(@Param("id") Integer id);

+ 4 - 0
src/main/java/com/welampiot/service/VideoMonitorService.java

@@ -6,6 +6,10 @@ import com.welampiot.vo.VideoMonitorVO;
 import java.util.List;
 
 public interface VideoMonitorService {
+    Integer getLampPoleCountByVO(VideoMonitorVO videoMonitorVO);
+    List<VideoMonitorDTO> getLampPoleListByVO(VideoMonitorVO videoMonitorVO);
+    void setAIStatus(VideoMonitorDTO dto);
+    VideoMonitorDTO getOneById(int id);
     List<VideoMonitorDTO> getListByVO(VideoMonitorVO vo);
     VideoMonitorVO getVideoListBySectionList(List<Integer> sectionList);
     void changeVideoMonitorLocationById(VideoMonitorDTO dto);

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

@@ -438,4 +438,9 @@ public class LampPoleServiceImpl implements LampPoleService {
     public List<LampPoleDTO> getLampPoleByLampIds(List<String> lampIds) {
         return lampPoleDao.getLampPoleByLampIds(lampIds);
     }
+
+    @Override
+    public Integer getAlarmCountByVO(LampPoleCountVO lampPoleCountVO) {
+        return lampPoleDao.getAlarmCountByVO(lampPoleCountVO);
+    }
 }

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

@@ -381,4 +381,24 @@ public class LampServiceImpl implements LampService {
     public Integer getLampCountByLampPoleId(Integer lampPoleId) {
         return lampDao.getLampCountByLampPoleId(lampPoleId);
     }
+
+    @Override
+    public Integer updateLight(LampInfoDTO lampInfoDTO) {
+        return lampDao.updateLight(lampInfoDTO);
+    }
+
+    @Override
+    public List<LampInfoDTO> getListByIdList(List idList) {
+        return lampDao.getListByIdList(idList);
+    }
+
+    @Override
+    public Integer getLampPoleCountByVO(LampCountVO lampCountVO) {
+        return lampDao.getLampPoleCountByVO(lampCountVO);
+    }
+
+    @Override
+    public List<LampInfoDTO> areaInfoLampList(LampListResponseVO lampListResponseVO) {
+        return lampDao.areaInfoLampList(lampListResponseVO);
+    }
 }

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

@@ -228,4 +228,9 @@ public class LoopServiceImpl implements LoopService {
     public void changeLoopLocationById(LoopDTO dto) {
         loopDao.changeLoopLocationById(dto);
     }
+
+    @Override
+    public Integer getTotalBySectionList(LoopDTO loopDTO) {
+        return loopDao.getTotalBySectionList(loopDTO);
+    }
 }

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

@@ -252,4 +252,9 @@ public class ScreenServiceImpl implements ScreenService {
     public Integer checkScreenData(ScreenDTO dto) {
         return screenDao.checkScreenData(dto);
     }
+
+    @Override
+    public Integer getTotalBySectionList(ScreenDTO dto) {
+        return screenDao.getTotalBySectionList(dto);
+    }
 }

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

@@ -3,6 +3,7 @@ package com.welampiot.service.impl;
 import com.welampiot.dao.SectionDao;
 import com.welampiot.dto.SectionDTO;
 import com.welampiot.service.SectionService;
+import com.welampiot.vo.SectionVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -73,4 +74,9 @@ public class SectionServiceImpl implements SectionService {
     public List<SectionDTO> getAllSectionListByPid(Integer id) {
         return sectionDao.getAllSectionListByPid(id);
     }
+
+    @Override
+    public List<SectionDTO> getListByVO(SectionVO sectionVO) {
+        return sectionDao.getListByVO(sectionVO);
+    }
 }

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

@@ -13,9 +13,30 @@ import java.util.List;
 public class VideoMonitorServiceImpl implements VideoMonitorService {
     @Autowired
     private VideoMonitorDao videoMonitorDao;
+
     @Override
     public List<VideoMonitorDTO> getListByVO(VideoMonitorVO vo) {return videoMonitorDao.getListByVO(vo);}
 
+    @Override
+    public Integer getLampPoleCountByVO(VideoMonitorVO videoMonitorVO) {
+        return videoMonitorDao.getLampPoleCountByVO(videoMonitorVO);
+    }
+
+    @Override
+    public List<VideoMonitorDTO> getLampPoleListByVO(VideoMonitorVO videoMonitorVO) {
+        return videoMonitorDao.getLampPoleListByVO(videoMonitorVO);
+    }
+
+    @Override
+    public void setAIStatus(VideoMonitorDTO dto) {
+        videoMonitorDao.setAIStatus(dto);
+    }
+
+    @Override
+    public VideoMonitorDTO getOneById(int id) {
+        return videoMonitorDao.getOneById(id);
+    }
+
     @Override
     public VideoMonitorVO getVideoListBySectionList(List<Integer> sectionList) {
         List<VideoMonitorDTO> videoListBySectionList = videoMonitorDao.getVideoListBySectionList(sectionList);

+ 21 - 0
src/main/java/com/welampiot/utils/WebUtils.java

@@ -25,4 +25,25 @@ public class WebUtils
             log.error("renderString error",e);
         }
     }
+
+    public static String getDateFormat(String time,int timezone){
+        String res = "";
+        try {
+            String[] split = time.split(":");
+            Integer h = Integer.parseInt(split[0]);
+            Integer i = Integer.parseInt(split[1]);
+            if (h - timezone < 0) {
+                h = h - timezone + 24;
+            }else if(h - timezone >= 24){
+                h = h - timezone - 24;
+            }else{
+                h = h - timezone;
+            }
+            res += ("00"+Integer.toHexString(h)).substring(-2);
+            res += ("00"+Integer.toHexString(i)).substring(-2);
+        }catch (Exception e){
+            log.error("renderString error",e);
+        }
+        return res;
+    }
 }

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

@@ -11,4 +11,5 @@ public class LampPoleCountVO {
     private String name;
     private String number;
     private Integer sectionId;
+    private String createTime;
 }

+ 2 - 0
src/main/java/com/welampiot/vo/LampPoleInfoVO.java

@@ -4,6 +4,8 @@ import lombok.Data;
 
 @Data
 public class LampPoleInfoVO {
+    private String name;
+    private Integer areaId;
     private Integer deviceCount;
     private Integer runCount;
     private Integer faultCount;

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

@@ -13,4 +13,5 @@ public class LoginVO implements Serializable {
     @NotEmpty(message = "password不允许为空")
     private String password;
     private String token;
+    private Integer version;
 }

+ 11 - 0
src/main/java/com/welampiot/vo/SectionVO.java

@@ -0,0 +1,11 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SectionVO {
+    private List sectionList;
+    private Integer version;
+}

+ 2 - 0
src/main/java/com/welampiot/vo/VideoMonitorVO.java

@@ -9,6 +9,8 @@ import java.util.List;
 public class VideoMonitorVO {
     private List sectionList; // 路段筛选
     private Integer limit;
+    private Integer netStatus;
+    private Integer version;
     private Integer offset;
     private Integer areaId;
     private Integer sectionId;

+ 59 - 3
src/main/resources/mapper/LampMapper.xml

@@ -135,7 +135,7 @@
         L.dev_addr as devAddr,
         L.bindStatus,
         L.policy_type as policyType,
-        L.policyid,
+        L.policyid as policyId,
         L.longitude,
         L.latitude,L.new_faultstatus,L.install_date,L.expiration_date,
         P.name as policyName,AI.status as alarmStatus,AI.id as alarmid,AI.stralarmtype,
@@ -383,7 +383,7 @@
         L.dev_addr as devAddr,
         L.bindStatus,
         L.policy_type as policyType,
-        L.policyid,
+        L.policyid as policyId,
         L.longitude,
         L.latitude,L.new_faultstatus
         from lampinfo L
@@ -766,7 +766,63 @@
             #{item}
         </foreach>
     </select>
-    
+    <update id="updateLight" parameterType="com.welampiot.dto.LampInfoDTO"
+    >
+        update lampinfo
+        set
+        lighteness=#{light}
+        <if test="policyId != null">,policyid=#{policyId}</if>
+        <if test="policyType != null">,policy_type=#{policyType}</if>
+        <if test="light > 0">,status=1</if>
+        <if test="light == 0">,status=0</if>
+        where id = #{id}
+    </update>
+
+    <select id="getListByIdList" resultType="com.welampiot.dto.LampInfoDTO" parameterType="java.util.List">
+        select
+        L.id,
+        L.address as sn,
+        N.protocoltype,
+        L.mode,
+        L.control_type as controlType,
+        from lampinfo L
+        left join section as S on S.id = L.sectionid
+        left join network as N on N.id = L.networkid
+        where 1=1
+        <if test="idList != null and !idList.isEmpty()">
+            and L.id in
+            <foreach item="vo" collection="idList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getLampPoleCountByVO" resultType="Integer" parameterType="com.welampiot.vo.LampCountVO">
+        select count(*) from lampinfo L
+        left join section as S on S.id = L.sectionid
+        left join network as N on N.id = L.networkid
+        where L.lamp_pole_id != 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and L.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="areaInfoLampList" parameterType="com.welampiot.vo.LampListResponseVO" resultType="com.welampiot.dto.LampInfoDTO">
+        select a.areaid as areaId,a.id,d.id as companyId from lampinfo a
+        left join lamp_pole b on a.lamp_pole_id = b.id
+        left join user c on b.create_id = c.id
+        left join company d on d.id = c.company_id
+        where a.lamp_pole_id != 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
     <select id="getLampListByLampPoleId" resultType="LampInfoDTO">
         select
             l.id,

+ 29 - 0
src/main/resources/mapper/LampPoleMapper.xml

@@ -22,6 +22,9 @@
         <if test="id != null">
             AND a.id != #{id}
         </if>
+        <if test="createTime != null">
+            AND a.createtime >= #{createTime}
+        </if>
     </select>
 
     <select id="getNavByVO" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
@@ -180,6 +183,32 @@
         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>
+    <select id="getAlarmCountByVO" resultType="Integer" parameterType="com.welampiot.vo.LampPoleCountVO">
+        select count(distinct a.id) from lamp_pole a
+        left join lamp_pole_alarm_log b on a.id = b.lamp_pole_id
+        where (b.status = 0 or b.status = 1)
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{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>
+        <if test="id != null">
+            AND a.id != #{id}
+        </if>
+        <if test="createTime != null">
+            AND a.createtime >= #{createTime}
+        </if>
+    </select>
     <delete id="deleteById" parameterType="int">
         delete from lamp_pole
         where id=#{id}

+ 22 - 1
src/main/resources/mapper/SectionMapper.xml

@@ -39,7 +39,28 @@
             </foreach>
         </if>
     </select>
-
+    <select id="getListByVO" parameterType="com.welampiot.vo.SectionVO" resultType="com.welampiot.dto.SectionDTO">
+        select a.id,a.name,a.pid
+        <choose>
+            <when test="version == 1">
+                ,b.english_name as area
+            </when>
+            <when test="version == 2">
+                ,b.ru_name as area
+            </when>
+            <otherwise>
+                ,b.chinese_name as area
+            </otherwise>
+        </choose>
+        from section a
+        left join global_location as b on b.id = a.pid
+        <if test="idList != null and !idList.isEmpty()">
+            where a.id in
+            <foreach item="item" collection="idList" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
     <select id="getSectionListByDTO" resultType="sectionDTO">
         SELECT s.id,s.`name`
         FROM section s

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

@@ -1,6 +1,65 @@
 <?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.VideoMonitorDao">
+    <select id="getLampPoleCountByVO" resultType="int" parameterType="com.welampiot.vo.VideoMonitorVO">
+        select count(*) from video_monitor
+        where lamp_pole_id != 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getLampPoleListByVO" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="com.welampiot.vo.VideoMonitorVO">
+        select a.id,a.name,a.image,b.name as section,a.gb_address as gbAddress
+        <choose>
+            <when test="version == 1">
+                ,c.english_name as area
+                ,d.english_name as city
+            </when>
+            <when test="version == 2">
+                ,c.ru_name as area
+                ,d.ru_name as city
+            </when>
+            <otherwise>
+                ,c.chinese_name as area
+                ,d.chinese_name as city
+            </otherwise>
+        </choose>
+        from video_monitor a
+        left join section b on a.sectionid = b.id
+        left join global_location as c on c.id = b.pid
+        left join global_location as d on d.id = c.pid
+        where a.lamp_pole_id != 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        <if test="netStatus != null">
+            and a.netStatus = #{netStatus}
+        </if>
+        order by a.id desc
+        <if test="offset != null and limit != null">
+            limit #{offset},#{limit}
+        </if>
+    </select>
+    <update id="setAIStatus" parameterType="VideoMonitorDTO">
+        update
+        video_monitor v
+        set
+        v.status = #{isInspect},
+        where v.lamp_pole_id = #{lampPoleId}
+    </update>
+
+    <select id="getOneById" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="int">
+        select a.gb_address as gbAddress,a.netStatus from video_monitor a
+        where a.id = #{id}
+    </select>
+
     <select id="getListByVO" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="com.welampiot.vo.VideoMonitorVO">
         select id,name,image from video_monitor
         where lamp_pole_id = 0

+ 27 - 2
src/main/resources/mapper/WifiMapper.xml

@@ -131,6 +131,31 @@
         <if test="remark4 != null">remark4=#{remark4},</if>
         <if test="remark5 != null">remark5=#{remark5},</if>
         <if test="remark6 != null">remark6=#{remark6},</if>
+        <if test="type1 != null">type1=#{type1},</if>
+        <if test="type2 != null">type2=#{type2},</if>
+        <if test="type3 != null">type3=#{type3},</if>
+        <if test="type4 != null">type4=#{type4},</if>
+        <if test="type5 != null">type5=#{type5},</if>
+        <if test="type6 != null">type6=#{type6},</if>
+        <if test="AC1 != null">AC1=#{AC1},</if>
+        <if test="AC2 != null">AC2=#{AC2},</if>
+        <if test="AC3 != null">AC3=#{AC3},</if>
+        <if test="lna1Status != null">lna1_status=#{lna1Status},</if>
+        <if test="lna2Status != null">lna2_status=#{lna2Status},</if>
+        <if test="lna3Status != null">lna3_status=#{lna3Status},</if>
+        <if test="closeTime1 != null">close_time1=#{closeTime1},</if>
+        <if test="closeTime2 != null">close_time2=#{closeTime2},</if>
+        <if test="closeTime3 != null">close_time3=#{closeTime3},</if>
+        <if test="closeTime4 != null">close_time4=#{closeTime4},</if>
+        <if test="closeTime5 != null">close_time5=#{closeTime5},</if>
+        <if test="closeTime6 != null">close_time6=#{closeTime6},</if>
+        <if test="openTime1 != null">open_time1=#{openTime1},</if>
+        <if test="openTime2 != null">open_time1=#{openTime2},</if>
+        <if test="openTime3 != null">open_time1=#{openTime3},</if>
+        <if test="openTime4 != null">open_time1=#{openTime4},</if>
+        <if test="openTime5 != null">open_time1=#{openTime5},</if>
+        <if test="openTime6 != null">open_time1=#{openTime6},</if>
+
         install_date = #{installDate},
         expiration_date = #{expirationDate}
         where 1=1
@@ -143,8 +168,8 @@
     </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
+        select w.id,w.num,w.model,w.lamp_pole_id as lampPoleId,w.install_date as installDate,w.expiration_date as expirationDate,w.remark1,w.remark2,w.remark3,w.remark4,w.remark5,w.remark6,w.ip_addr as ipAddr,w.num as sn,b.sectionid as sectionId
+        from wifi w left join lamp_pole b on w.lamp_pole_id = b.id
         where 1=1
         <if test="lampPoleId != null">
             and w.lamp_pole_id = #{lampPoleId}