crazycat vor 2 Jahren
Ursprung
Commit
6b9a797bcf
29 geänderte Dateien mit 383 neuen und 48 gelöschten Zeilen
  1. 15 9
      src/main/java/com/welampiot/controller/DataController.java
  2. 46 2
      src/main/java/com/welampiot/controller/GroupController.java
  3. 159 24
      src/main/java/com/welampiot/controller/NewLampPoleController.java
  4. 2 0
      src/main/java/com/welampiot/dao/LampDao.java
  5. 2 0
      src/main/java/com/welampiot/dao/LampPoleDao.java
  6. 1 0
      src/main/java/com/welampiot/dao/SmartLockDevInfoDao.java
  7. 1 0
      src/main/java/com/welampiot/dao/WaterImmersionDevInfoDao.java
  8. 2 0
      src/main/java/com/welampiot/dto/EnvmonitorDTO.java
  9. 1 0
      src/main/java/com/welampiot/service/BroadcastService.java
  10. 2 0
      src/main/java/com/welampiot/service/LampPoleService.java
  11. 2 0
      src/main/java/com/welampiot/service/LampService.java
  12. 1 0
      src/main/java/com/welampiot/service/SmartLockDevInfoService.java
  13. 1 0
      src/main/java/com/welampiot/service/WaterImmersionDevInfoService.java
  14. 5 0
      src/main/java/com/welampiot/service/impl/BroadcastServiceImpl.java
  15. 67 2
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  16. 6 0
      src/main/java/com/welampiot/service/impl/LampServiceImpl.java
  17. 5 0
      src/main/java/com/welampiot/service/impl/SmartLockDevInfoServiceImpl.java
  18. 5 0
      src/main/java/com/welampiot/service/impl/WaterImmersionDevInfoServiceImpl.java
  19. 4 4
      src/main/java/com/welampiot/vo/LampPoleInfoVO.java
  20. 1 0
      src/main/java/com/welampiot/vo/LampPoleVO.java
  21. 1 1
      src/main/java/com/welampiot/vo/SectionVO.java
  22. 1 1
      src/main/resources/mapper/GlobalLocationMapper.xml
  23. 13 1
      src/main/resources/mapper/LampMapper.xml
  24. 16 1
      src/main/resources/mapper/LampPoleMapper.xml
  25. 1 1
      src/main/resources/mapper/ScreenMapper.xml
  26. 11 0
      src/main/resources/mapper/SmartLockDevInfoMapper.xml
  27. 1 1
      src/main/resources/mapper/UserMapper.xml
  28. 1 1
      src/main/resources/mapper/VideoMonitorMapper.xml
  29. 10 0
      src/main/resources/mapper/WaterImmersionDevInfoMapper.xml

+ 15 - 9
src/main/java/com/welampiot/controller/DataController.java

@@ -89,20 +89,26 @@ public class DataController {
         data.setDayConsumption((float) (Math.round(dayConsumptionByVO*100)/100f));
         simpleDateFormat = new SimpleDateFormat("yyyy-MM-01 00:00:00");
         // 当月
-        lampCountVO.setStartDate(simpleDateFormat.format(new Date()).toString());
-        Float monthConsumption = lampService.getConsumptionByVO(lampCountVO);
-        monthConsumption = monthConsumption == null ? 0 : monthConsumption;
+        LampVO lampVO = new LampVO();
+        lampVO.setSectionList(sectionList);
+        LampInfoLogNewDTO comBySectionList = lampService.getComBySectionList(lampVO);
+        comBySectionList.getDayGeneraEnergy();
+//        lampCountVO.setStartDate(simpleDateFormat.format(new Date()).toString());
+        Float monthConsumption = Float.valueOf(comBySectionList.getDayGeneraEnergy())+Float.valueOf(comBySectionList.getMonthGeneraEnergyCache());
+//        monthConsumption = monthConsumption == null ? 0 : monthConsumption;
         data.setMonthConsumption((float) (Math.round((dayConsumptionByVO+monthConsumption)*100)/100f));
         // 当年
         simpleDateFormat = new SimpleDateFormat("yyyy-01-01 00:00:00");
-        lampCountVO.setStartDate(simpleDateFormat.format(new Date()).toString());
-        Float yearConsumption = lampService.getConsumptionByVO(lampCountVO);
-        yearConsumption = yearConsumption == null ? 0 : yearConsumption;
+//        lampCountVO.setStartDate(simpleDateFormat.format(new Date()).toString());
+//        Float yearConsumption = lampService.getConsumptionByVO(lampCountVO);
+//        yearConsumption = yearConsumption == null ? 0 : yearConsumption;
+        Float yearConsumption = Float.valueOf(comBySectionList.getDayGeneraEnergy())+Float.valueOf(comBySectionList.getYearGeneraEnergyCache());
         data.setYearConsumption((float) (Math.round((dayConsumptionByVO+yearConsumption)*100)/100f));
         // 累计
-        lampCountVO.setStartDate(null);
-        Float totalConsumption = lampService.getConsumptionByVO(lampCountVO);
-        totalConsumption = totalConsumption == null ? 0 : totalConsumption;
+//        lampCountVO.setStartDate(null);
+//        Float totalConsumption = lampService.getConsumptionByVO(lampCountVO);
+//        totalConsumption = totalConsumption == null ? 0 : totalConsumption;
+        Float totalConsumption = Float.valueOf(comBySectionList.getDayGeneraEnergy())+Float.valueOf(comBySectionList.getTotalGeneraEnergyCache());
         data.setTotalConsumption((float) (Math.round((dayConsumptionByVO+totalConsumption)*100)/100f));
 //        Date startDate = new Date(System.currentTimeMillis() - 20*24*3600*1000);
         Date endDate = new Date(System.currentTimeMillis() - 24*3600*1000);

+ 46 - 2
src/main/java/com/welampiot/controller/GroupController.java

@@ -3,7 +3,9 @@ package com.welampiot.controller;
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.GroupDTO;
+import com.welampiot.dto.LampInfoDTO;
 import com.welampiot.service.GroupService;
+import com.welampiot.service.LampService;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.GroupVO;
 import com.welampiot.vo.LampListResponseVO;
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 @RestController
@@ -22,8 +25,8 @@ public class GroupController{
     private GroupService groupService;
     @Autowired
     private ToolUtils toolUtils;
-//    @Autowired
-//    private PolicyMapper policyMapper;
+    @Autowired
+    private LampService lampService;
 //    @Autowired
 //    private PlcPolicyMapper plcPolicyMapper;
 //    @Autowired
@@ -237,4 +240,45 @@ public class GroupController{
         groupVO1.setPatrolInterval(patrolInterval);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,groupVO1);
     }
+
+    /**
+     * 分组设置
+     * @param request
+     * @return
+     */
+    @PostMapping("/set")
+    private BaseResult set(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer groupId = (Integer) toolUtils.getRequestContent(request,"groupId",1);
+        Integer value = (Integer) toolUtils.getRequestContent(request,"value",1);
+        Integer type = (Integer) toolUtils.getRequestContent(request,"type",1);
+        if (groupId == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        if (type == 0){  // 亮度
+            GroupVO groupVO = new GroupVO();
+            groupVO.setId(groupId);
+            groupVO.setVersion(version);
+            GroupDTO detailByVO = groupService.getDetailByVO(groupVO);
+            String lampId = detailByVO.getLampId();
+            List<LampInfoDTO> listByIdList = lampService.getListByIdList(Arrays.asList(lampId.split(",")));
+            ArrayList<Integer> ids = new ArrayList<>();
+            for (LampInfoDTO l : listByIdList) {
+                int protocolType = l.getProtocolType();
+                int controlType = l.getControlType();
+                if (protocolType == 8 || protocolType == 10){  // 4G
+                    ids.add(l.getId());
+                }
+            }
+
+            if (!ids.isEmpty()){
+                for (Integer id : ids) {
+                    System.out.println(request.getRequestURI());
+                }
+            }
+        } else if (type == 1) { // 策略
+
+        } else {
+
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
 }

+ 159 - 24
src/main/java/com/welampiot/controller/NewLampPoleController.java

@@ -79,6 +79,12 @@ public class NewLampPoleController {
     private ProgramService programService;
     @Autowired
     private EmergencyService emergencyService;
+    @Autowired
+    private BroadcastService broadcastService;
+    @Autowired
+    private WaterImmersionDevInfoService waterImmersionDevInfoService;
+    @Autowired
+    private SmartLockDevInfoService smartLockDevInfoService;
 
     @RequestMapping(value = "/info",method = RequestMethod.POST)
     public BaseResult info(HttpServletRequest request){
@@ -118,6 +124,21 @@ public class NewLampPoleController {
         loopDTO.setSectionList(sectionList);
         lampPoleInfoVO.setLoopCount(loopService.getTotalBySectionList(loopDTO));
 
+        // 音柱设备数量
+        BroadcastDTO broadcastDTO = new BroadcastDTO();
+        broadcastDTO.setSectionList(sectionList);
+        lampPoleInfoVO.setRadioCount(broadcastService.getTotalBySectionList(broadcastDTO));
+
+        // 水浸设备数量
+        WaterImmersionDevInfoDTO waterImmersionDevInfoDTO = new WaterImmersionDevInfoDTO();
+        waterImmersionDevInfoDTO.setSectionList(sectionList);
+        lampPoleInfoVO.setWaterImmersionCount(waterImmersionDevInfoService.getTotalBySectionList(waterImmersionDevInfoDTO));
+
+        // 门锁设备数量
+        SmartLockDevInfoDTO smartLockDevInfoDTO = new SmartLockDevInfoDTO();
+        smartLockDevInfoDTO.setSectionList(sectionList);
+        lampPoleInfoVO.setLockCount(smartLockDevInfoService.getTotalBySectionList(smartLockDevInfoDTO));
+
         for (LampPoleDTO l:listByVO) {
             String devType = l.getDevType();
             List split = Arrays.asList(devType.split(","));
@@ -128,7 +149,7 @@ public class NewLampPoleController {
         }
 
         // 近期创建数据
-        Date date = new Date(System.currentTimeMillis() - 24 * 3600 * 30 * 1000);
+        Date date = new Date(System.currentTimeMillis() - (24L * 3600 * 30 * 1000));
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String createTime = simpleDateFormat.format(date);
         LampPoleCountVO lampPoleCountVO = new LampPoleCountVO();
@@ -141,9 +162,16 @@ public class NewLampPoleController {
         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);
+        lampPoleInfoVO.setRunCount(lampPoleInfoVO.getDeviceCount() - lampPoleInfoVO.getFaultCount());
+
+//        LampPoleVO lampPoleVO1 = new LampPoleVO();
+        LampInfoLogNewDTO comBySectionList = lampPoleService.getComBySectionList(lampPoleVO);
+        lampPoleInfoVO.setDayCom(Float.parseFloat(comBySectionList.getDayGeneraEnergy()));
+        lampPoleInfoVO.setMonthCom(Float.parseFloat(comBySectionList.getDayGeneraEnergy())+Float.parseFloat(comBySectionList.getMonthGeneraEnergyCache()));
+        lampPoleInfoVO.setTotalCom(Float.parseFloat(comBySectionList.getDayGeneraEnergy())+Float.parseFloat(comBySectionList.getTotalGeneraEnergyCache()));
+//        lampPoleInfoVO.setDayCom((float) Math.round(lampPoleInfoVO.getDayCom()/100*100));
+//        lampPoleInfoVO.setMonthCom((float)Math.round(lampPoleInfoVO.getMonthCom()/100*100));
+//        lampPoleInfoVO.setTotalCom((float)Math.round(lampPoleInfoVO.getTotalCom()/100*100));
 
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleInfoVO);
     }
@@ -944,15 +972,23 @@ public class NewLampPoleController {
         Integer mode = (Integer) toolUtils.getRequestContent(request,"mode",1);
         List sectionList1 = toolUtils.getSectionList(request);
         SectionVO sectionVO = new SectionVO();
-        sectionVO.setSectionList(sectionList1);
+        sectionVO.setIdList(sectionList1);
         sectionVO.setVersion(version);
-        HashMap<Integer, LampPoleInfoVO> integerObjectHashMap = new HashMap<>();
+        HashMap<String, LampPoleInfoVO> integerObjectHashMap = new HashMap<>();
+
+        LampListResponseVO lampListResponseVO = new LampListResponseVO();
+        lampListResponseVO.setSectionList(sectionList1);
+        List<LampInfoDTO> listByVO = lampService.areaInfoLampList(lampListResponseVO);
+
+        LampPoleVO lampPoleVO = new LampPoleVO();
+        lampPoleVO.setSectionList(sectionList1);
+        List<LampPoleDTO> listByVO1 = lampPoleService.getListByVO(lampPoleVO);
 
         if (mode == 0){  // 区域
             List<SectionDTO> listByIdList = sectionService.getListByVO(sectionVO);
             for (SectionDTO s :listByIdList) {
                 LampPoleInfoVO lampPoleInfoVO = new LampPoleInfoVO();
-                lampPoleInfoVO.setAreaId(s.getPid());
+                lampPoleInfoVO.setAreaId(s.getPid().toString());
                 lampPoleInfoVO.setName(s.getArea());
                 lampPoleInfoVO.setDeviceCount(0);
                 lampPoleInfoVO.setNewCount(0);
@@ -966,15 +1002,37 @@ public class NewLampPoleController {
                 lampPoleInfoVO.setRadioCount(0);
                 lampPoleInfoVO.setEmCount(0);
                 lampPoleInfoVO.setChargeCount(0);
-                if (!integerObjectHashMap.containsKey(s.getPid())) integerObjectHashMap.put(s.getPid(),lampPoleInfoVO);
+                lampPoleInfoVO.setWaterImmersionCount(0);
+                lampPoleInfoVO.setTiltCount(0);
+                lampPoleInfoVO.setLockCount(0);
+                if (!integerObjectHashMap.containsKey(s.getPid())) integerObjectHashMap.put(s.getPid().toString(),lampPoleInfoVO);
             }
         }else {  // 公司
-
+            List<SectionDTO> listByIdList = sectionService.getListByVO(sectionVO);
+            for (LampPoleDTO dto :listByVO1) {
+                LampPoleInfoVO lampPoleInfoVO = new LampPoleInfoVO();
+                lampPoleInfoVO.setAreaId(dto.getCompany());
+                lampPoleInfoVO.setName(dto.getCompany());
+                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);
+                lampPoleInfoVO.setWaterImmersionCount(0);
+                lampPoleInfoVO.setTiltCount(0);
+                lampPoleInfoVO.setLockCount(0);
+                if (!integerObjectHashMap.containsKey(dto.getCompany())) integerObjectHashMap.put(dto.getCompany(),lampPoleInfoVO);
+            }
         }
 
-        LampListResponseVO lampListResponseVO = new LampListResponseVO();
-        lampListResponseVO.setSectionList(sectionList1);
-        List<LampInfoDTO> listByVO = lampService.areaInfoLampList(lampListResponseVO);
+
         for (LampInfoDTO l :listByVO) {
             Integer id;
             if (mode == 0){
@@ -985,23 +1043,94 @@ public class NewLampPoleController {
             if (integerObjectHashMap.containsKey(id)){
                 LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(id);
                 lampPoleInfoVO.setLampCount(lampPoleInfoVO.getLampCount()+1);
-                integerObjectHashMap.put(id,lampPoleInfoVO);
+                integerObjectHashMap.put(id.toString(),lampPoleInfoVO);
             }
         }
 
+        for (LampPoleDTO dto :listByVO1) {
+            String areaId;
+            if (mode == 0) {
+                areaId = dto.getAreaId().toString();
+            }else {
+                areaId = dto.getCompany();
+            }
+
+            if (integerObjectHashMap.containsKey(areaId)){
+                LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(areaId);
+                System.out.println(dto.getCreateTime());
+                if (!dto.getCreateTime().isEmpty()) {
+                    String pattern = "yyyy-MM-dd HH:mm:ss";
+                    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+                    try {
+                        if (System.currentTimeMillis() - sdf.parse(dto.getCreateTime()).getTime() <= 3600 * 24 * 30 * 1000) {
+                            lampPoleInfoVO.setNewCount(lampPoleInfoVO.getNewCount() + 1);
+                        }
+                    } catch (ParseException e) {
+                    }
+                }
 
+                lampPoleInfoVO.setDeviceCount(lampPoleInfoVO.getDeviceCount()+1);
+                lampPoleInfoVO.setWifiCount(lampPoleInfoVO.getWifiCount()+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<>();
+                String[] split = dto.getDevType().split(",");
+                if (Arrays.binarySearch(split,"5") != -1) lampPoleInfoVO.setEmCount(lampPoleInfoVO.getEmCount()+1);
+                if (Arrays.binarySearch(split,"6") != -1) lampPoleInfoVO.setChargeCount(lampPoleInfoVO.getChargeCount()+1);
+                if (Arrays.binarySearch(split,"7") != -1) lampPoleInfoVO.setWeatherCount(lampPoleInfoVO.getWeatherCount()+1);
+                if (Arrays.binarySearch(split,"9") != -1) lampPoleInfoVO.setRadioCount(lampPoleInfoVO.getRadioCount()+1);
+                if (Arrays.binarySearch(split,"14") != -1) lampPoleInfoVO.setWaterImmersionCount(lampPoleInfoVO.getWaterImmersionCount()+1);
+                if (Arrays.binarySearch(split,"18") != -1) lampPoleInfoVO.setTiltCount(lampPoleInfoVO.getTiltCount()+1);
+
+                integerObjectHashMap.put(areaId.toString(),lampPoleInfoVO);
+            }
+
+        }
+
+        List sectionList = toolUtils.getSectionList(request);
+        VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
+        videoMonitorVO.setVersion(version);
+        videoMonitorVO.setSectionList(sectionList);
+        List<VideoMonitorDTO> lampPoleListByVO = videoMonitorService.getLampPoleListByVO(videoMonitorVO);
+        List<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
+        for (VideoMonitorDTO dto :videoMonitorDTOS) {
+            String areaId = dto.getAreaId().toString();
+            if (integerObjectHashMap.containsKey(areaId)) {
+                LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(areaId);
+                lampPoleInfoVO.setVideoCount(lampPoleInfoVO.getVideoCount() + 1);
+                integerObjectHashMap.put(areaId, lampPoleInfoVO);
+            }
+        }
+        ScreenDTO screenDTO = new ScreenDTO();
+        screenDTO.setSectionList(sectionList);
+        ScreenVO screenList = screenService.getScreenList(screenDTO);
+        for (ScreenDTO dto :screenList.getList()) {
+            if (dto.getAreaId() != null){
+                String areaId = dto.getAreaId().toString();
+                if (integerObjectHashMap.containsKey(areaId)) {
+                    LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(areaId);
+                    lampPoleInfoVO.setScreenCount(lampPoleInfoVO.getScreenCount() + 1);
+                    integerObjectHashMap.put(areaId, lampPoleInfoVO);
+                }
+            }
+        }
+        LampListResponseVO lampVO = new LampListResponseVO();
+        lampVO.setSectionList(sectionList);
+        List<LampInfoDTO> navByVO = lampService.getNavByVO(lampVO);
+        for (LampInfoDTO dto :navByVO) {
+            if (dto.getAreaId() != null){
+                String areaId = dto.getAreaId().toString();
+                if (integerObjectHashMap.containsKey(areaId)) {
+                    LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(areaId);
+                    lampPoleInfoVO.setLampCount(lampPoleInfoVO.getLampCount() + 1);
+                    integerObjectHashMap.put(areaId, lampPoleInfoVO);
+                }
+            }
+        }
 
         ArrayList<LampPoleInfoVO> lampPoleInfoVOS = new ArrayList<>();
-        Set<Integer> integers = integerObjectHashMap.keySet();
-        for (Integer i :integers) {
+        Set<String> integers = integerObjectHashMap.keySet();
+        for (String i :integers) {
+            LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(i);
+            if (lampPoleInfoVO.getDeviceCount() == 0 && type == 0) continue;
             lampPoleInfoVOS.add(integerObjectHashMap.get(i));
         }
         ListResponseVO listResponseVO = new ListResponseVO();
@@ -1242,11 +1371,17 @@ public class NewLampPoleController {
         Integer areaId = (Integer) toolUtils.getRequestContent(request, "areaId", 1);
         Integer sectionId = (Integer) toolUtils.getRequestContent(request, "sectionId", 1);
         LampPoleVO lampPoleVO = new LampPoleVO();
+        List sectionList = toolUtils.getSectionList(request);
         lampPoleVO.setAreaId(areaId);
         lampPoleVO.setSectionId(sectionId);
-        lampPoleVO.setSectionList(toolUtils.getSectionList(request));
+        lampPoleVO.setSectionList(sectionList);
         Integer deviceCount = lampPoleService.getLampPoleInstallTotal(lampPoleVO);
-        Integer faultCount = lampPoleService.getLampPoleAlarmTotal(lampPoleVO);
+        // 故障数
+        LampPoleCountVO lampPoleCountVO = new LampPoleCountVO();
+        lampPoleCountVO.setSectionList(sectionList);
+        Integer faultCount = lampPoleService.getAlarmCountByVO(lampPoleCountVO);
+
+//        Integer faultCount = lampPoleService.getLampPoleAlarmTotal(lampPoleVO);
         Integer newCount = lampPoleService.getNewCreateLampPoleCount(lampPoleVO);
         LampPoleVO vo = new LampPoleVO();
         vo.setDeviceCount(deviceCount);

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

@@ -1,5 +1,6 @@
 package com.welampiot.dao;
 
+import com.welampiot.dto.LampInfoLogNewDTO;
 import com.welampiot.dto.LampInfoDTO;
 import com.welampiot.vo.LampCountVO;
 import com.welampiot.vo.LampListResponseVO;
@@ -47,6 +48,7 @@ public interface LampDao {
     Integer getLampPoleIdByLampId(@Param("id") Integer id);
     Integer getLampCountByLampPoleId(@Param("lampPoleId") Integer lampPoleId);
     void updateLampInfoForLoopId(LampInfoDTO dto);
+    LampInfoLogNewDTO getComBySectionList(LampVO vo);
     List<LampInfoDTO> getLampInfoListForGroup(LampVO vo);
     List<LampInfoDTO> getAlarmAreaCountTop(LampInfoDTO dto);
     List<LampInfoDTO> getLampEleUseSectionTop(LampInfoDTO dto);

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

@@ -1,5 +1,6 @@
 package com.welampiot.dao;
 
+import com.welampiot.dto.LampInfoLogNewDTO;
 import com.welampiot.dto.LampPoleDTO;
 import com.welampiot.vo.LampPoleCountVO;
 import com.welampiot.vo.LampPoleVO;
@@ -38,6 +39,7 @@ public interface LampPoleDao {
     void updateLampPoleDevType(LampPoleDTO dto);
     List<LampPoleDTO> getSectionLampPoleList(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleByLampIds(@Param("lampIds") List<String> lampIds);
+    LampInfoLogNewDTO getComBySectionList(LampPoleVO lampPoleVO);
     void updateLampPoleIcon(LampPoleDTO dto);
     List<LampPoleDTO> getNewLampPoleList2(LampPoleVO vo);
     LampPoleDTO getLampPoleDetails(LampPoleVO vo);

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

@@ -19,4 +19,5 @@ public interface SmartLockDevInfoDao {
 
     Integer getSmartLockTotalByDTO(SmartLockDevInfoDTO dto);
     SmartLockDevInfoDTO getOneById(@Param("id") int id);
+    int getTotalBySectionList(SmartLockDevInfoDTO dto);
 }

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

@@ -46,4 +46,5 @@ public interface WaterImmersionDevInfoDao {
 
     Integer getWaterImmersionNewCount(WaterImmersionDevInfoDTO dto);
     void updateDelayTimeByDto(WaterImmersionDevInfoDTO dto);
+    int getTotalBySectionList(WaterImmersionDevInfoDTO dto);
 }

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

@@ -210,5 +210,7 @@ public class EnvmonitorDTO implements Serializable {
 
     private String area;
 
+    List<WeatherRS485DevInfoDTO> devList;
+
     private static final long serialVersionUID = 1L;
 }

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

@@ -37,4 +37,5 @@ public interface BroadcastService {
     Integer checkBroadcastData(BroadcastDTO dto);
     void updateBroadcastById(BroadcastDTO dto);
     List<BroadcastDTO> getListByIds(@Param("ids")String ids);
+    Integer getTotalBySectionList(BroadcastDTO dto);
 }

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

@@ -2,6 +2,7 @@ package com.welampiot.service;
 
 import com.welampiot.common.BaseResult;
 import com.welampiot.dto.LampInfoDTO;
+import com.welampiot.dto.LampInfoLogNewDTO;
 import com.welampiot.dto.LampPoleDTO;
 import com.welampiot.vo.LampPoleCountVO;
 import com.welampiot.vo.LampPoleInfoVO;
@@ -32,6 +33,7 @@ public interface LampPoleService {
     void updateLampPoleDevType(LampPoleDTO dto);
     List<LampPoleDTO> getSectionLampPoleList(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleByLampIds(List<String> lampIds);
+    LampInfoLogNewDTO getComBySectionList(LampPoleVO lampPoleVO);
     void updateLampPoleIcon(LampPoleDTO dto);
     List<LampPoleDTO> getNewLampPoleList2(LampPoleVO vo);
     LampPoleDTO getLampPoleDetails(LampPoleVO vo);

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

@@ -2,6 +2,7 @@ package com.welampiot.service;
 
 import com.welampiot.common.BaseResult;
 import com.welampiot.dto.LampInfoDTO;
+import com.welampiot.dto.LampInfoLogNewDTO;
 import com.welampiot.vo.*;
 import org.apache.ibatis.annotations.Param;
 
@@ -47,6 +48,7 @@ public interface LampService {
     Integer getLampCountByLampPoleId(Integer lampPoleId);
     void updateLampInfoForLoopId(LampInfoDTO dto);
     List<LampInfoDTO> getLampInfoListForGroup(LampVO vo);
+    LampInfoLogNewDTO getComBySectionList(LampVO vo);
     LampInfoVO getLampConsumptionData(LampInfoDataVO vo) throws ParseException;
     List<LampInfoDTO> getAlarmAreaCountTop(LampInfoDTO dto);
     List<LampInfoDTO> getLampEleUseSectionTop(LampInfoDTO dto);

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

@@ -16,4 +16,5 @@ import org.apache.ibatis.annotations.Param;
 public interface SmartLockDevInfoService {
     SmartLockDevInfoVO getListBySmartLockDevInfoDTO(SmartLockDevInfoDTO dto);
     SmartLockDevInfoDTO getOneById(@Param("id") int id);
+    int getTotalBySectionList(SmartLockDevInfoDTO dto);
 }

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

@@ -39,4 +39,5 @@ public interface WaterImmersionDevInfoService {
 
     Integer getWaterImmersionNewCount(WaterImmersionDevInfoDTO dto);
     void updateDelayTimeByDto(WaterImmersionDevInfoDTO dto);
+    int getTotalBySectionList(WaterImmersionDevInfoDTO dto);
 }

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

@@ -168,4 +168,9 @@ public class BroadcastServiceImpl implements BroadcastService {
     public List<BroadcastDTO> getListByIds(String ids) {
         return broadcastDao.getListByIds(ids);
     }
+
+    @Override
+    public Integer getTotalBySectionList(BroadcastDTO dto) {
+        return broadcastDao.getTotalBySectionList(dto);
+    }
 }

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

@@ -1,5 +1,7 @@
 package com.welampiot.service.impl;
-
+import com.welampiot.dto.*;
+import com.welampiot.service.*;
+import com.welampiot.utils.VideoUtil;
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dao.LampPoleDao;
@@ -45,6 +47,10 @@ public class LampPoleServiceImpl implements LampPoleService {
     private LampService lampService;
     @Autowired
     private WifiService wifiService;
+    @Autowired
+    private VideoMonitorService videoMonitorService;
+    @Autowired
+    private VideoGbInfoService videoGbInfoService;
     @Override
     public List<LampPoleDTO> lampPoleList(LampPoleVO lampPoleVO) {
         List<LampPoleDTO> lampPoleDTOS = lampPoleDao.lampPoleList(lampPoleVO);
@@ -196,12 +202,66 @@ public class LampPoleServiceImpl implements LampPoleService {
             if (!add.getCode().equals("0000")) return add;
         }
         devType.add(0);
+
+
+        // 添加摄像头
+//        设备类型(0 路灯,2 WIFI,3 RFID,4 LED屏,5 一键报警,6 充电桩,7 气象站,8 微基站,9 广播音柱,10 云盒,11 电缆,12 太阳能板凳,13 超级电源,14 水浸传感器,15 智能门锁,16 储能逆变,17 噪声监控,18 倾斜监测,19 液位传感器,20 灯带)多种类型用逗号隔开
+        List<Map> videoList = lampPoleVO.getVideoList();
+        if (videoList != null && !videoList.isEmpty()){
+            for (Map m :videoList) {
+                VideoMonitorDTO videoMonitorDTO = new VideoMonitorDTO();
+                if (m.containsKey("id")) videoMonitorDTO.setId((Integer) m.get("id"));
+                if (m.containsKey("name")) {
+                    videoMonitorDTO.setName((String) m.get("name"));
+                }else {
+
+                }
+                if (m.containsKey("devId")) videoMonitorDTO.setDevId((String) m.get("devId"));
+                if (m.containsKey("password")) videoMonitorDTO.setPassword((String) m.get("password"));
+                if (m.containsKey("channel")) videoMonitorDTO.setChannel((String) m.get("channel"));
+                if (m.containsKey("faceImage")) videoMonitorDTO.setFaceImage((String) m.get("faceImage"));
+                if (m.containsKey("deviceType")) videoMonitorDTO.setDeviceType((Integer) m.get("deviceType"));
+                if (m.containsKey("netType")) videoMonitorDTO.setNetType((Integer) m.get("netType"));
+                if (m.containsKey("ipAddr")) videoMonitorDTO.setIpAddr((String) m.get("ipAddr"));
+                if (m.containsKey("devPwd")) videoMonitorDTO.setDevPwd((String) m.get("devPwd"));
+                if (m.containsKey("installDate")) videoMonitorDTO.setInstallDate((String) m.get("installDate"));
+                if (m.containsKey("expirationDate")) videoMonitorDTO.setExpirationDate((String) m.get("expirationDate"));
+                if (m.containsKey("type")) videoMonitorDTO.setType((Integer) m.get("type"));
+                String gbAddressByDevId = VideoUtil.getGbAddressByDevId(videoMonitorDTO.getDevId(), videoGbInfoService);
+                videoMonitorDTO.setGbAddress(gbAddressByDevId);
+                if (m.containsKey("id")){
+                    videoMonitorService.updateVideoMonitorData(videoMonitorDTO);
+                }else {
+                    videoMonitorService.addVideoMonitorData(videoMonitorDTO);
+                }
+            }
+            devType.add(1);
+        }
+
+        // 添加气象站
+        if (lampPoleVO.getWeatherDev() != null){
+            Map weatherDev = lampPoleVO.getWeatherDev();
+            EnvmonitorDTO envmonitorDTO = new EnvmonitorDTO();
+            if (weatherDev.containsKey("model")) envmonitorDTO.setModel(String.valueOf(weatherDev.get("model")));
+            if (weatherDev.containsKey("address")) envmonitorDTO.setAddress(String.valueOf(weatherDev.get("address")));
+            if (weatherDev.containsKey("devType")) envmonitorDTO.setDevType((Integer) weatherDev.get("devType"));
+            if (weatherDev.containsKey("pramType")) envmonitorDTO.setPramType((Integer) weatherDev.get("pramType"));
+            if (weatherDev.containsKey("rate")) envmonitorDTO.setRate((Integer) weatherDev.get("rate"));
+            if (weatherDev.containsKey("netType")) envmonitorDTO.setNetType((Integer) weatherDev.get("netType"));
+            if (weatherDev.containsKey("serialPort")) envmonitorDTO.setSerialPort((Integer) weatherDev.get("serialPort"));
+            if (weatherDev.containsKey("mp")) envmonitorDTO.setMp((Integer) weatherDev.get("mp"));
+            if (weatherDev.containsKey("devList")){
+                Object devList = weatherDev.get("devList");
+                System.out.println(devList);
+            }
+        }
         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());
+//        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,lampPoleVO.getVersion());
+        return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,lampPoleVO.getVersion());
     }
 
     @Override
@@ -454,6 +514,11 @@ public class LampPoleServiceImpl implements LampPoleService {
         return lampPoleDao.getLampPoleDetails(vo);
     }
 
+    @Override
+    public LampInfoLogNewDTO getComBySectionList(LampPoleVO lampPoleVO) {
+        return lampPoleDao.getComBySectionList(lampPoleVO);
+    }
+
     @Override
     public Integer getAlarmCountByVO(LampPoleCountVO lampPoleCountVO) {
         return lampPoleDao.getAlarmCountByVO(lampPoleCountVO);

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

@@ -2,6 +2,7 @@ package com.welampiot.service.impl;
 
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.*;
 import com.welampiot.dao.LampDao;
 import com.welampiot.dto.LampInfoCacheByDayDTO;
 import com.welampiot.dto.LampInfoDTO;
@@ -674,6 +675,11 @@ public class LampServiceImpl implements LampService {
         return lampDao.getLampAlarmTotal(dto);
     }
 
+    @Override
+    public LampInfoLogNewDTO getComBySectionList(LampVO vo) {
+        return lampDao.getComBySectionList(vo);
+    }
+
     @Override
     public Integer updateLight(LampInfoDTO lampInfoDTO) {
         return lampDao.updateLight(lampInfoDTO);

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

@@ -122,4 +122,9 @@ public class SmartLockDevInfoServiceImpl implements SmartLockDevInfoService {
     public SmartLockDevInfoDTO getOneById(int id) {
         return smartLockDevInfoDao.getOneById(id);
     }
+
+    @Override
+    public int getTotalBySectionList(SmartLockDevInfoDTO dto) {
+        return smartLockDevInfoDao.getTotalBySectionList(dto);
+    }
 }

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

@@ -310,4 +310,9 @@ public class WaterImmersionDevInfoServiceImpl implements WaterImmersionDevInfoSe
     public void updateDelayTimeByDto(WaterImmersionDevInfoDTO dto) {
         waterImmersionDevInfoDao.updateDelayTimeByDto(dto);
     }
+
+    @Override
+    public int getTotalBySectionList(WaterImmersionDevInfoDTO dto) {
+        return waterImmersionDevInfoDao.getTotalBySectionList(dto);
+    }
 }

+ 4 - 4
src/main/java/com/welampiot/vo/LampPoleInfoVO.java

@@ -5,7 +5,7 @@ import lombok.Data;
 @Data
 public class LampPoleInfoVO {
     private String name;
-    private Integer areaId;
+    private String areaId;
     private Integer deviceCount;
     private Integer runCount;
     private Integer faultCount;
@@ -15,9 +15,9 @@ public class LampPoleInfoVO {
     private Integer rfidCount;
     private Integer newCount;
     private Integer disableCount;
-    private Integer dayCom;
-    private Integer monthCom;
-    private Integer totalCom;
+    private float dayCom;
+    private float monthCom;
+    private float totalCom;
     private Integer lampCount;
     private Integer videoCount;
     private Integer weatherCount;

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

@@ -42,6 +42,7 @@ public class LampPoleVO implements Serializable {
     private Integer disableCount; // 禁用数
     private Integer dir;
     private String iconInfo;
+    private Map weatherDev;
     private List<LampPoleDTO> list;
     private LampPoleDTO lampPoleInfo;
 }

+ 1 - 1
src/main/java/com/welampiot/vo/SectionVO.java

@@ -6,6 +6,6 @@ import java.util.List;
 
 @Data
 public class SectionVO {
-    private List sectionList;
+    private List idList;
     private Integer version;
 }

+ 1 - 1
src/main/resources/mapper/GlobalLocationMapper.xml

@@ -88,7 +88,7 @@
     </select>
 
     <select id="getOneById" resultType="com.welampiot.dto.GlobalLocationDTO" parameterType="Integer">
-        select id,chinese_name chineseName,longitude,latitude
+        select id,chinese_name as chineseName,longitude,latitude,pid,level,english_name as englishName,ru_name as ruName
         from global_location where id = #{id}
     </select>
 

+ 13 - 1
src/main/resources/mapper/LampMapper.xml

@@ -49,6 +49,7 @@
         </if>
         )) as consum
         from lampinfo a
+        left join lamp_info_log_new b on a.id = b.lampid
         where 1=1
         <if test="sectionList != null and !sectionList.isEmpty()">
             and a.sectionid in
@@ -413,6 +414,7 @@
         L.id,
         L.mode,
         N.protocoltype,
+        L.areaid as areaId,
         L.control_type as controlType
         from lampinfo L
         left join network as N on N.id = L.networkid
@@ -1003,5 +1005,15 @@
         GROUP BY DATE(a.updatetime)
         ORDER BY DATE(a.updatetime) DESC
     </select>
-    
+    <select id="getComBySectionList" resultType="com.welampiot.dto.LampInfoLogNewDTO" parameterType="com.welampiot.vo.LampVO">
+        select sum(day_gener_energy) as dayGeneraEnergy,sum(month_gener_energy_cache) as monthGeneraEnergyCache,sum(year_gener_energy_cache) as yearGeneraEnergyCache,sum(total_gener_energy_cache) as totalGeneraEnergyCache from lampinfo a
+        left join lamp_info_log_new b on b.lampid = a.id
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and LP.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
 </mapper>

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

@@ -77,7 +77,9 @@
     </select>
 
     <select id="getListByVO" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
-        select LP.id,LP.name,LP.devtype as devType,LP.createtime,LP.sn,LP.longitude,LP.latitude from lamp_pole LP
+        select LP.id,LP.name,LP.devtype as devType,LP.createtime as createTime,LP.sn,LP.longitude,LP.latitude,LP.areaid as areaId,c.name as company from lamp_pole LP
+        left join user u on LP.create_id = u.id
+        left join company c on u.company_id = c.id
         where 1=1
         <if test="sectionList != null and !sectionList.isEmpty()">
             and LP.sectionid in
@@ -555,6 +557,19 @@
         where
             l.id = #{id}
     </update>
+
+    <select id="getComBySectionList" resultType="com.welampiot.dto.LampInfoLogNewDTO" parameterType="com.welampiot.vo.LampPoleVO">
+        select sum(day_gener_energy) as dayGeneraEnergy,sum(month_gener_energy_cache) as monthGeneraEnergyCache,sum(year_gener_energy_cache) as yearGeneraEnergyCache,sum(total_gener_energy_cache) as totalGeneraEnergyCache from lampinfo a
+        left join lamp_pole LP on a.lamp_pole_id = LP.id
+        left join lamp_info_log_new b on b.lampid = a.id
+        where LP.id is not null
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and LP.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
     
     <select id="getSectionLampPoleList" resultType="LampPoleDTO">
         select

+ 1 - 1
src/main/resources/mapper/ScreenMapper.xml

@@ -5,7 +5,7 @@
     <select id="getScreenListByDTO" resultType="ScreenDTO">
         select s.id,s.lamp_pole_id lampPoleId,s.model as name,s.num,s.netStatus,s.open_mode openMode,
                s.light,s.volume,s.width,s.light,s.height,lp.name as lampPoleName,s.maxLight,s.install_date installDate,
-               s.expiration_date expirationDate,s2.timezone,p.name as programName
+               s.expiration_date expirationDate,s2.timezone,p.name as programName,lp.areaid as areaId
         from screen s left join lamp_pole lp on s.lamp_pole_id = lp.id
             left join program p on s.playingid = p.id
             left join section s2 on lp.sectionid = s2.id

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

@@ -67,4 +67,15 @@
         from smart_lock_dev_info
         where id = #{id}
     </select>
+
+    <select id="getTotalBySectionList" resultType="Integer">
+        select count(b.id) as total from smart_lock_dev_info b
+        left join lamp_pole lp on b.lamp_pole_id = lp.id
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where lp.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/UserMapper.xml

@@ -158,7 +158,7 @@
 
     <!-- role为1时查询所有用户 -->
     <select id="getAllUserListByUserDTO" resultType="com.welampiot.dto.UserDTO">
-        select u.id,u.name,u.avatar,u.username,u.company,u.department,u.privilege_list as privilegeList
+        select u.id,u.name,u.avatar,u.username,u.company,u.role,u.department,u.privilege_list as privilegeList
         from user u
         where 1=1
         <if test="keyword != null and keyword != ''">

+ 1 - 1
src/main/resources/mapper/VideoMonitorMapper.xml

@@ -13,7 +13,7 @@
     </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
+        select a.id,a.name,a.image,b.name as section,a.gb_address as gbAddress,b.pid as areaId
         <choose>
             <when test="version == 1">
                 ,c.english_name as area

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

@@ -235,4 +235,14 @@
         </if>
     </select>
 
+    <select id="getTotalBySectionList" resultType="Integer">
+        select count(b.id) as total from water_immersion_dev_info b
+        left join lamp_pole lp on b.lamp_pole_id = lp.id
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where lp.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
 </mapper>