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

路灯台账路段列表,灯杆数量统计,路灯数量统计,电柜数量统计,路等类型下拉列表

zhj 1 éve
szülő
commit
ca205fbc7e
35 módosított fájl, 792 hozzáadás és 11 törlés
  1. 338 0
      src/main/java/com/welampiot/controller/LedgerController.java
  2. 2 0
      src/main/java/com/welampiot/dao/ElectricBoxDao.java
  3. 5 0
      src/main/java/com/welampiot/dao/LampInfoCacheByDayDao.java
  4. 10 0
      src/main/java/com/welampiot/dao/LedgerDao.java
  5. 1 0
      src/main/java/com/welampiot/dao/NetworkDao.java
  6. 1 0
      src/main/java/com/welampiot/dto/ElectricBoxDTO.java
  7. 19 0
      src/main/java/com/welampiot/dto/LampInfoDTO.java
  8. 1 0
      src/main/java/com/welampiot/dto/LampPoleDTO.java
  9. 43 0
      src/main/java/com/welampiot/dto/LedgerLampDTO.java
  10. 18 0
      src/main/java/com/welampiot/dto/LedgerSectionDTO.java
  11. 1 0
      src/main/java/com/welampiot/dto/NetworkDTO.java
  12. 4 0
      src/main/java/com/welampiot/service/ElectricBoxService.java
  13. 5 0
      src/main/java/com/welampiot/service/LampInfoCacheByDayService.java
  14. 1 0
      src/main/java/com/welampiot/service/LampPoleService.java
  15. 10 0
      src/main/java/com/welampiot/service/LedgerService.java
  16. 1 0
      src/main/java/com/welampiot/service/NetworkService.java
  17. 10 0
      src/main/java/com/welampiot/service/impl/ElectricBoxServiceImpl.java
  18. 11 0
      src/main/java/com/welampiot/service/impl/LampInfoCacheByDayServiceImpl.java
  19. 5 0
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  20. 22 0
      src/main/java/com/welampiot/service/impl/LedgerServiceImpl.java
  21. 5 0
      src/main/java/com/welampiot/service/impl/NetworkServiceImpl.java
  22. 11 0
      src/main/java/com/welampiot/utils/ToolUtils.java
  23. 2 0
      src/main/java/com/welampiot/vo/LampListResponseVO.java
  24. 9 0
      src/main/java/com/welampiot/vo/LampTypeNavVO.java
  25. 23 0
      src/main/java/com/welampiot/vo/LedgerEleBoxCountVO.java
  26. 20 0
      src/main/java/com/welampiot/vo/LedgerLampCountVO.java
  27. 16 0
      src/main/java/com/welampiot/vo/LedgerPoleCountVO.java
  28. 29 0
      src/main/java/com/welampiot/vo/LedgerVO.java
  29. 52 10
      src/main/resources/mapper/ElectricBoxMapper.xml
  30. 24 0
      src/main/resources/mapper/LampInfoCacheByDayMapper.xml
  31. 12 1
      src/main/resources/mapper/LampMapper.xml
  32. 3 0
      src/main/resources/mapper/LampPoleMapper.xml
  33. 43 0
      src/main/resources/mapper/LedgerMapper.xml
  34. 3 0
      src/main/resources/mapper/LoopMapper.xml
  35. 32 0
      src/main/resources/mapper/NetworkMapper.xml

+ 338 - 0
src/main/java/com/welampiot/controller/LedgerController.java

@@ -0,0 +1,338 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.*;
+import com.welampiot.service.*;
+import com.welampiot.utils.ToolUtils;
+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.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/ledger")
+public class LedgerController extends BaseController {
+
+    @Autowired
+    private LampPoleService lampPoleService;
+    @Autowired
+    private LampService lampService;
+    @Autowired
+    private ElectricBoxService electricBoxService;
+    @Autowired
+    private NetworkService networkService;
+    @Autowired
+    private LoopService loopService;
+
+    @Autowired
+    private ToolUtils toolUtils;
+
+    @Autowired
+    private LedgerService ledgerService;
+
+    @Autowired
+    private LampInfoCacheByDayService lampInfoCacheByDayService;
+
+    /**
+     * 灯杆数量统计
+     */
+    @RequestMapping(value = "/lampPoleStatistics",method = RequestMethod.POST)
+    public BaseResult<?> lampPoleStatistics(LedgerVO ledgerVO) {
+        Integer version = ledgerVO.getVersion();
+        if (ledgerVO.getUsername() == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR, version);
+
+        LampPoleDTO lampPoleDTO = new LampPoleDTO();
+        lampPoleDTO.setAreaId(ledgerVO.getAreaId());
+        lampPoleDTO.setSectionId(ledgerVO.getSectionId());
+        lampPoleDTO.setSectionList(getSectionList(ledgerVO.getUsername()));
+        Integer lampPoleTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        // 灯杆类型(0 单臂,1 双臂,2 玉兰灯,3 中华灯,4 景观灯,5 高杆灯,6 太阳能灯,7 钠灯)
+        lampPoleDTO.setType(0); // 单臂
+        Integer oneTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        lampPoleDTO.setType(1); // 双臂
+        Integer twoTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        lampPoleDTO.setType(2); // 玉兰灯
+        Integer yuTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        lampPoleDTO.setType(3); // 中华灯
+        Integer huaTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        lampPoleDTO.setType(4); // 景观灯
+        Integer enTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        lampPoleDTO.setType(5); // 高杆灯
+        Integer highTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        lampPoleDTO.setType(6); // 太阳能灯
+        Integer solarTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+        lampPoleDTO.setType(7); // 太阳能灯
+        Integer naTotal = lampPoleService.getLampPoleInstallTotalByDTO(lampPoleDTO);
+
+        LedgerPoleCountVO ledgerPoleCountVO = new LedgerPoleCountVO();
+        ledgerPoleCountVO.setTotal(lampPoleTotal);
+        ledgerPoleCountVO.setOneTotal(oneTotal);
+        ledgerPoleCountVO.setTwoTotal(twoTotal);
+        ledgerPoleCountVO.setYuTotal(yuTotal);
+        ledgerPoleCountVO.setHuaTotal(huaTotal);
+        ledgerPoleCountVO.setEnTotal(enTotal);
+        ledgerPoleCountVO.setHighTotal(highTotal);
+        ledgerPoleCountVO.setSolarTotal(solarTotal);
+        ledgerPoleCountVO.setNaTotal(naTotal);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, ledgerPoleCountVO);
+    }
+
+    /**
+     * 路灯数量统计
+     */
+    @RequestMapping(value = "/lampStatistics",method = RequestMethod.POST)
+    public BaseResult<?> lampStatistics(LedgerVO ledgerVO) {
+        Integer version = ledgerVO.getVersion();
+        LampInfoDTO lampInfoDTO = new LampInfoDTO();
+        lampInfoDTO.setAreaId(ledgerVO.getAreaId());
+        lampInfoDTO.setSectionId(ledgerVO.getSectionId());
+        lampInfoDTO.setSectionList(getSectionList(ledgerVO.getUsername()));
+        Integer total = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(30);
+        Integer power30 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(50);
+        Integer power50 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(60);
+        Integer power60 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(80);
+        Integer power80 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(100);
+        Integer power100 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(120);
+        Integer power120 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(150);
+        Integer power150 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(180);
+        Integer power180 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(200);
+        Integer power200 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(240);
+        Integer power240 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        lampInfoDTO.setRatedPower(300);
+        Integer power300 = lampService.getLampInstallTotalByDTO(lampInfoDTO);
+        Integer otherPower = total - power30 - power50 - power60 - power80 - power100 - power120 - power150 - power180 - power200 - power240 - power300;
+
+        LedgerLampCountVO ledgerLampCountVO = new LedgerLampCountVO();
+        ledgerLampCountVO.setTotal(total);
+        ledgerLampCountVO.setPower30(power30);
+        ledgerLampCountVO.setPower50(power50);
+        ledgerLampCountVO.setPower60(power60);
+        ledgerLampCountVO.setPower80(power80);
+        ledgerLampCountVO.setPower100(power100);
+        ledgerLampCountVO.setPower120(power120);
+        ledgerLampCountVO.setPower150(power150);
+        ledgerLampCountVO.setPower180(power180);
+        ledgerLampCountVO.setPower200(power200);
+        ledgerLampCountVO.setPower240(power240);
+        ledgerLampCountVO.setPower300(power300);
+        ledgerLampCountVO.setOtherPower(otherPower);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, ledgerLampCountVO);
+    }
+
+    /**
+     * 电箱数量统计
+     */
+    @RequestMapping(value = "/eleBoxStatistics",method = RequestMethod.POST)
+    public BaseResult<?> eleBoxStatistics(LedgerVO ledgerVO) {
+        Integer version = ledgerVO.getVersion();
+        List<Integer> sectionList = getSectionList(ledgerVO.getUsername());
+        ElectricBoxDTO dto = new ElectricBoxDTO();
+        dto.setAreaId(ledgerVO.getAreaId());
+        dto.setSectionId(ledgerVO.getSectionId());
+        dto.setSectionList(sectionList);
+        Integer eleBoxTotal = electricBoxService.getTotalByStatus(dto);
+        dto.setLoopCount(1);
+        Integer loop1 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        dto.setLoopCount(2);
+        Integer loop2 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        dto.setLoopCount(3);
+        Integer loop3 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        dto.setLoopCount(4);
+        Integer loop4 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        dto.setLoopCount(5);
+        Integer loop5 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        dto.setLoopCount(6);
+        Integer loop6 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        dto.setLoopCount(7);
+        Integer loop7 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        dto.setLoopCount(8);
+        Integer loop8 = electricBoxService.getLoopEleBoxTotalByDTO(dto);
+        NetworkDTO networkDTO = new NetworkDTO();
+        networkDTO.setAreaId(ledgerVO.getAreaId());
+        networkDTO.setSectionId(ledgerVO.getSectionId());
+        networkDTO.setSectionList(sectionList);
+        Integer networkTotal = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(1);
+        Integer net1 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(2);
+        Integer net2 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(3);
+        Integer net3 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(4);
+        Integer net4 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(5);
+        Integer net5 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(6);
+        Integer net6 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(7);
+        Integer net7 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        networkDTO.setLoopCount(8);
+        Integer net8 = networkService.getLoopNetworkCountByDTO(networkDTO);
+        LoopDTO loopDTO = new LoopDTO();
+        loopDTO.setAreaId(ledgerVO.getAreaId());
+        loopDTO.setSectionId(ledgerVO.getSectionId());
+        loopDTO.setSectionList(sectionList);
+        loopDTO.setNetworkId(0);
+        Integer loopTotal = loopService.getLoopTotalByDTO(loopDTO);
+        LedgerEleBoxCountVO ledgerEleBoxCountVO = new LedgerEleBoxCountVO();
+        ledgerEleBoxCountVO.setEleBoxTotal(eleBoxTotal);
+        ledgerEleBoxCountVO.setTransformerTotal(0);
+        ledgerEleBoxCountVO.setLoopTotal(loopTotal);
+        ledgerEleBoxCountVO.setNetworkTotal(networkTotal);
+        ledgerEleBoxCountVO.setLoop1(loop1 + net1);
+        ledgerEleBoxCountVO.setLoop2(loop2 + net2);
+        ledgerEleBoxCountVO.setLoop3(loop3 + net3);
+        ledgerEleBoxCountVO.setLoop4(loop4 + net4);
+        ledgerEleBoxCountVO.setLoop5(loop5 + net5);
+        ledgerEleBoxCountVO.setLoop6(loop6 + net6);
+        ledgerEleBoxCountVO.setLoop7(loop7 + net7);
+        ledgerEleBoxCountVO.setLoop8(loop8 + net8);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, ledgerEleBoxCountVO);
+    }
+
+    /**
+     * 路灯类型下拉列表
+     */
+    @RequestMapping(value = "/lampTypeNav",method = RequestMethod.POST)
+    public BaseResult<?> lampTypeNav(LedgerVO ledgerVO) {
+        Integer version = ledgerVO.getVersion();
+        List<Integer> sectionList = getSectionList(ledgerVO.getUsername());
+        LampListResponseVO lampListResponseVO = new LampListResponseVO();
+        lampListResponseVO.setAreaId(ledgerVO.getAreaId());
+        lampListResponseVO.setSectionId(ledgerVO.getSectionId());
+        lampListResponseVO.setSectionList(sectionList);
+        List<LampInfoDTO> lampList = lampService.getNavByVO(lampListResponseVO);
+        Set<LampTypeNavVO> lampSet = new HashSet<>();
+        for (LampInfoDTO lampInfoDTO : lampList) {
+            String height = ToolUtils.formatNumber(lampInfoDTO.getHeight());
+            Integer devType = lampInfoDTO.getDevType();
+            LampTypeNavVO lampTypeNavVO = new LampTypeNavVO();
+            lampTypeNavVO.setId(height + "-" + devType);
+            String lampDevTypeStr = LampInfoDTO.getLampDevTypeStr(devType);
+            lampTypeNavVO.setName(height + "米" + lampDevTypeStr);
+            lampSet.add(lampTypeNavVO);
+        }
+        List<LampTypeNavVO> list = new ArrayList<>(lampSet);
+        list.sort(Comparator.comparing(LampTypeNavVO::getId));
+        LedgerVO ledgerVO1 = new LedgerVO();
+        ledgerVO1.setList(list);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, ledgerVO1);
+    }
+
+    /**
+     * 路段列表
+     */
+    @RequestMapping(value = "/sectionStatisticsList",method = RequestMethod.POST)
+    public BaseResult<?> sectionStatisticsList(LedgerVO ledgerVO) {
+        Integer version = ledgerVO.getVersion();
+        List<Integer> sectionList = getSectionList(ledgerVO.getUsername());
+        ledgerVO.setSectionList(sectionList);
+        if (ledgerVO.getPage() == null) ledgerVO.setPage(1);
+        if (ledgerVO.getCount() == null) ledgerVO.setCount(20);
+        ledgerVO.setPage((ledgerVO.getPage() - 1) * ledgerVO.getCount());
+        long l = System.currentTimeMillis() - 24 * 60 * 60 * 1000;
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        ledgerVO.setUpdateTime(simpleDateFormat.format(l));
+        List<LedgerLampDTO> ledgerLampList = ledgerService.getSectionStatisticsListByLedgerVO(ledgerVO);
+        Map<Integer, List<LedgerLampDTO>> map = ledgerLampList.stream().collect(Collectors.groupingBy(LedgerLampDTO::getId));
+
+        List<LedgerSectionDTO> ledgerSectionList = new ArrayList<>();
+        for (Integer sectionId : map.keySet()) {
+            List<LedgerLampDTO> ledgerLampDTOS = map.get(sectionId);
+            LedgerLampDTO oneLedgerLamp = ledgerLampDTOS.get(0);
+            LedgerSectionDTO ledgerSectionDTO = new LedgerSectionDTO();
+            ledgerSectionDTO.setId(oneLedgerLamp.getId());
+            ledgerSectionDTO.setName(oneLedgerLamp.getName());
+            ledgerSectionDTO.setStartName(oneLedgerLamp.getName());
+            ledgerSectionDTO.setEndName(oneLedgerLamp.getName());
+
+            List<ElectricBoxDTO> eleBoxList = electricBoxService.getEleBoxListBySectionId(sectionId);
+            StringBuilder sb = new StringBuilder();
+            eleBoxList.forEach(electricBoxDTO -> {
+                String name = electricBoxDTO.getName();
+                if (sb.length() > 0) {
+                    sb.append(",");
+                    sb.append(name);
+                } else {
+                    sb.append(name);
+                }
+            });
+            ledgerSectionDTO.setBoxName(sb.toString());
+
+            List<LedgerLampDTO> newLedgerLampList = new ArrayList<>();
+            for (LedgerLampDTO ledgerLampDTO : ledgerLampDTOS) {
+                Integer lampTotal = ledgerLampDTO.getLampTotal();
+                if (lampTotal == 0) continue;
+                String height = ToolUtils.formatNumber(ledgerLampDTO.getHeight());
+                String lampDevTypeStr = LampInfoDTO.getLampDevTypeStr(ledgerLampDTO.getDevType());
+                LedgerLampDTO newLedgerLamp = new LedgerLampDTO();
+                newLedgerLamp.setLampTypeName(height + "米" + lampDevTypeStr);
+                newLedgerLamp.setLampTotal(lampTotal);
+                newLedgerLamp.setLampPoleTotal(ledgerLampDTO.getLampPoleTotal());
+                newLedgerLamp.setLightStripTotal(ledgerLampDTO.getLightStripTotal());
+                if (ledgerLampDTO.getLightingType() == 1) {
+                    newLedgerLamp.setLampType("钠灯");
+                    newLedgerLamp.setNaTotal(lampTotal);
+                    newLedgerLamp.setLedTotal(0);
+                } else {
+                    newLedgerLamp.setLampType("LED灯");
+                    newLedgerLamp.setLedTotal(lampTotal);
+                    newLedgerLamp.setNaTotal(0);
+                }
+                newLedgerLamp.setHighRatedPower(ledgerLampDTO.getTotalRatedPower());
+                newLedgerLamp.setLowRatedPower(0);
+                newLedgerLamp.setTotalRatedPower(ledgerLampDTO.getTotalRatedPower());
+                newLedgerLamp.setHighLampTotal(lampTotal);
+                newLedgerLamp.setLowLampTotal(0);
+                // 昨日用电量
+                if (ledgerLampDTO.getDayConSum() == null) {
+                    newLedgerLamp.setLastDayCon("0");
+                } else {
+                    newLedgerLamp.setLastDayCon(ToolUtils.formatNumber(ledgerLampDTO.getDayConSum()));
+                }
+                if (ledgerLampDTO.getDayGenerateEnergy() == null) {
+                    ledgerLampDTO.setDayGenerateEnergy(0.0);
+                }
+                // 本月用电量
+                if (ledgerLampDTO.getMonthConSum() == null) {
+                    newLedgerLamp.setMonthCon("0");
+                } else {
+                    double monthCon = ledgerLampDTO.getMonthConSum() + ledgerLampDTO.getDayGenerateEnergy();
+                    newLedgerLamp.setMonthCon(ToolUtils.formatNumber(monthCon));
+                }
+                // 累计用电量
+                if (ledgerLampDTO.getUsedEnergyTotal() == null) {
+                    newLedgerLamp.setTotalCon("0");
+                } else {
+                    double totalCon = ledgerLampDTO.getUsedEnergyTotal() + ledgerLampDTO.getDayGenerateEnergy();
+                    newLedgerLamp.setTotalCon(ToolUtils.formatNumber(totalCon));
+                }
+                newLedgerLampList.add(newLedgerLamp);
+            }
+            ledgerSectionDTO.setLampList(newLedgerLampList);
+            ledgerSectionList.add(ledgerSectionDTO);
+        }
+
+        LedgerVO ledgerVO1 = new LedgerVO();
+        ledgerVO1.setList(ledgerSectionList);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, ledgerVO1);
+    }
+}

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

@@ -18,6 +18,7 @@ public interface ElectricBoxDao {
     List<ElectricBoxDTO> getElectricBoxListBySectionId(ElectricBoxDTO dto);
 
     Integer getTotalByStatus(ElectricBoxDTO dto);
+    Integer getLoopEleBoxTotalByDTO(ElectricBoxDTO dto);
 
     Integer getOnlineTotalByStatus(ElectricBoxDTO dto);
 
@@ -28,4 +29,5 @@ public interface ElectricBoxDao {
     Integer delete(ElectricBoxDTO dto);
     ElectricBoxDTO getDetailsById(@Param("id") Integer id);
     void changeElectricBoxLocationById(ElectricBoxDTO dto);
+    List<ElectricBoxDTO> getEleBoxListBySectionId(@Param("sectionId") Integer sectionId);
 }

+ 5 - 0
src/main/java/com/welampiot/dao/LampInfoCacheByDayDao.java

@@ -2,6 +2,7 @@ package com.welampiot.dao;
 
 import com.welampiot.dto.LampInfoCacheByDayDTO;
 import com.welampiot.dto.LampInfoDTO;
+import com.welampiot.dto.LedgerLampDTO;
 
 import java.util.List;
 
@@ -40,4 +41,8 @@ public interface LampInfoCacheByDayDao {
     List<LampInfoCacheByDayDTO> getNearDayConSumList(LampInfoCacheByDayDTO dto);
 
     List<LampInfoCacheByDayDTO> getNearSaveAndEleList(LampInfoCacheByDayDTO dto);
+
+    LampInfoCacheByDayDTO getMonthEleConByLedgerLampDTO(LedgerLampDTO ledgerLampDTO);
+
+    LampInfoCacheByDayDTO getDayEleConByLedgerLampDTO(LedgerLampDTO ledgerLampDTO);
 }

+ 10 - 0
src/main/java/com/welampiot/dao/LedgerDao.java

@@ -0,0 +1,10 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.LedgerLampDTO;
+import com.welampiot.vo.LedgerVO;
+
+import java.util.List;
+
+public interface LedgerDao {
+    List<LedgerLampDTO> getSectionStatisticsListByLedgerVO(LedgerVO ledgerVO);
+}

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

@@ -23,4 +23,5 @@ public interface NetworkDao {
     Integer checkSimIdCount(@Param("simId") String simId);
     void updateSimDate(NetworkDTO dto);
     NetworkDTO getSimpleData(NetworkDTO dto);
+    Integer getLoopNetworkCountByDTO(NetworkDTO dto);
 }

+ 1 - 0
src/main/java/com/welampiot/dto/ElectricBoxDTO.java

@@ -83,6 +83,7 @@ public class ElectricBoxDTO implements Serializable {
 
     /** 所有路段的id **/
     private List sectionList;
+    private Integer loopCount;
 
     private static final long serialVersionUID = 1L;
     private Integer devType; // 设备型号(0 曼顿,1 微自然)

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

@@ -100,6 +100,9 @@ public class LampInfoDTO {
     private String endDate;
     private Integer total;
     private String lampCtrId;
+    private Double height;
+    /** 灯具类型(0 LED,1 钠灯) */
+    private Integer lightingType;
     private Integer freqId;
     private String zegbeeSectionId;
     private Integer netType;
@@ -115,4 +118,20 @@ public class LampInfoDTO {
     public LampInfoDTO(Integer id){
         this.id = id;
     }
+
+    public static String getLampDevTypeStr(Integer devType) {
+        if (devType != null && devType == 5) {
+            return "高杆灯";
+        } else if (devType != null && devType == 4) {
+            return "景观灯";
+        } else if (devType != null && devType == 3) {
+            return "中华灯";
+        } else if (devType != null && devType == 2) {
+            return "玉兰灯";
+        } else if (devType != null && devType == 1) {
+            return "双臂";
+        } else {
+            return "单臂";
+        }
+    }
 }

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

@@ -62,6 +62,7 @@ public class LampPoleDTO {
     private List<Map> broadcastList;
     private WifiDTO cloudDev; // 云盒
     private Integer select;
+    private Integer type;
     private Integer dir;
     private String iconInfo;
     private Integer devCount;

+ 43 - 0
src/main/java/com/welampiot/dto/LedgerLampDTO.java

@@ -0,0 +1,43 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+@Data
+public class LedgerLampDTO {
+    private Integer id;
+    private String name;
+    private String startName;
+    private String endName;
+    private String transformer;
+    private String boxName;
+
+    private Integer lampTotal;
+    private Integer lampPoleTotal;
+    private Integer naTotal;
+    private Integer ledTotal;
+    private Integer lightStripTotal;
+
+    /** 灯控类型名称:height + devType */
+    private String lampTypeName;
+    private Integer devType;
+    private Double height;
+    private Integer lightingType;
+    private String lampType;
+
+    private String updateTime;
+
+    private Integer highRatedPower;
+    private Integer lowRatedPower;
+    private Integer totalRatedPower;
+
+    private Integer highLampTotal;
+    private Integer lowLampTotal;
+
+    private String lastDayCon;
+    private String monthCon;
+    private String totalCon;
+    private Double dayConSum;
+    private Double monthConSum;
+    private Double usedEnergyTotal;
+    private Double dayGenerateEnergy;
+}

+ 18 - 0
src/main/java/com/welampiot/dto/LedgerSectionDTO.java

@@ -0,0 +1,18 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class LedgerSectionDTO {
+    private Integer id;
+    private String name;
+    private String startName;
+    private String endName;
+    private String transformer = "";
+    private String boxName;
+
+    private List<LedgerLampDTO> lampList = new ArrayList<>();
+}

+ 1 - 0
src/main/java/com/welampiot/dto/NetworkDTO.java

@@ -33,6 +33,7 @@ public class NetworkDTO {
     private String latitude;
     private String expirationTime; // 过期时间
     private List<Integer> sectionList;
+    private Integer loopCount;
     private Integer expirationStatus;
     private String iccId;
     private String date;

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

@@ -5,6 +5,8 @@ import com.welampiot.dto.ElectricBoxDTO;
 import com.welampiot.vo.ElectricBoxReturnVO;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 
 /**
  * ClassName: ElectricBoxService
@@ -19,6 +21,7 @@ public interface ElectricBoxService {
     ElectricBoxReturnVO getElectricBoxListBySectionId(ElectricBoxDTO dto);
 
     Integer getTotalByStatus(ElectricBoxDTO dto);
+    Integer getLoopEleBoxTotalByDTO(ElectricBoxDTO dto);
 
     Integer getOnlineTotalByStatus(ElectricBoxDTO dto);
 
@@ -30,4 +33,5 @@ public interface ElectricBoxService {
     ElectricBoxDTO getDetailsById(@Param("id") Integer id);
 
     void changeElectricBoxLocationById(ElectricBoxDTO dto);
+    List<ElectricBoxDTO> getEleBoxListBySectionId(Integer sectionId);
 }

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

@@ -2,6 +2,7 @@ package com.welampiot.service;
 
 import com.welampiot.dto.LampInfoCacheByDayDTO;
 import com.welampiot.dto.LampInfoDTO;
+import com.welampiot.dto.LedgerLampDTO;
 
 import java.util.List;
 
@@ -40,4 +41,8 @@ public interface LampInfoCacheByDayService {
     List<LampInfoCacheByDayDTO> getNearDayConSumList(LampInfoCacheByDayDTO dto);
 
     List<LampInfoCacheByDayDTO> getNearSaveAndEleList(LampInfoCacheByDayDTO dto);
+
+    LampInfoCacheByDayDTO getMonthEleConByLedgerLampDTO(LedgerLampDTO ledgerLampDTO);
+
+    LampInfoCacheByDayDTO getDayEleConByLedgerLampDTO(LedgerLampDTO ledgerLampDTO);
 }

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

@@ -37,6 +37,7 @@ public interface LampPoleService {
     List<LampPoleDTO> getLampPoleLightList(LampPoleVO vo);
     Integer getNewCreateLampPoleCount(LampPoleVO vo);
     Integer getLampPoleInstallTotal(LampPoleVO vo);
+    Integer getLampPoleInstallTotalByDTO(LampPoleDTO dto);
     List<LampPoleDTO> getLampPoleInstallList(LampPoleVO vo);
     void updateLampPoleDevType(LampPoleDTO dto);
     List<LampPoleDTO> getSectionLampPoleList(LampPoleVO vo);

+ 10 - 0
src/main/java/com/welampiot/service/LedgerService.java

@@ -0,0 +1,10 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.LedgerLampDTO;
+import com.welampiot.vo.LedgerVO;
+
+import java.util.List;
+
+public interface LedgerService {
+    List<LedgerLampDTO> getSectionStatisticsListByLedgerVO(LedgerVO ledgerVO);
+}

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

@@ -22,4 +22,5 @@ public interface NetworkService {
     Integer checkSimIdCount(String simId);
     void updateSimDate(NetworkDTO dto);
     NetworkDTO getSimpleData(NetworkDTO dto);
+    Integer getLoopNetworkCountByDTO(NetworkDTO dto);
 }

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

@@ -99,6 +99,11 @@ public class ElectricBoxServiceImpl implements ElectricBoxService {
         return electricBoxDao.getTotalByStatus(dto);
     }
 
+    @Override
+    public Integer getLoopEleBoxTotalByDTO(ElectricBoxDTO dto) {
+        return electricBoxDao.getLoopEleBoxTotalByDTO(dto);
+    }
+
     @Override
     public Integer getOnlineTotalByStatus(ElectricBoxDTO dto) {
         return electricBoxDao.getOnlineTotalByStatus(dto);
@@ -196,4 +201,9 @@ public class ElectricBoxServiceImpl implements ElectricBoxService {
     public void changeElectricBoxLocationById(ElectricBoxDTO dto) {
         electricBoxDao.changeElectricBoxLocationById(dto);
     }
+
+    @Override
+    public List<ElectricBoxDTO> getEleBoxListBySectionId(Integer sectionId) {
+        return electricBoxDao.getEleBoxListBySectionId(sectionId);
+    }
 }

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

@@ -3,6 +3,7 @@ package com.welampiot.service.impl;
 import com.welampiot.dao.LampInfoCacheByDayDao;
 import com.welampiot.dto.LampInfoCacheByDayDTO;
 import com.welampiot.dto.LampInfoDTO;
+import com.welampiot.dto.LedgerLampDTO;
 import com.welampiot.service.LampInfoCacheByDayService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -195,4 +196,14 @@ public class LampInfoCacheByDayServiceImpl implements LampInfoCacheByDayService
     public List<LampInfoCacheByDayDTO> getNearSaveAndEleList(LampInfoCacheByDayDTO dto) {
         return lampInfoCacheByDayDao.getNearSaveAndEleList(dto);
     }
+
+    @Override
+    public LampInfoCacheByDayDTO getMonthEleConByLedgerLampDTO(LedgerLampDTO ledgerLampDTO) {
+        return lampInfoCacheByDayDao.getMonthEleConByLedgerLampDTO(ledgerLampDTO);
+    }
+
+    @Override
+    public LampInfoCacheByDayDTO getDayEleConByLedgerLampDTO(LedgerLampDTO ledgerLampDTO) {
+        return lampInfoCacheByDayDao.getDayEleConByLedgerLampDTO(ledgerLampDTO);
+    }
 }

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

@@ -561,6 +561,11 @@ public class LampPoleServiceImpl implements LampPoleService {
         return lampPoleDao.getLampPoleInstallTotal(vo);
     }
 
+    @Override
+    public Integer getLampPoleInstallTotalByDTO(LampPoleDTO dto) {
+        return lampPoleDao.getLampPoleInstallTotalByDTO(dto);
+    }
+
     @Override
     public List<LampPoleDTO> getLampPoleInstallList(LampPoleVO vo) {
         return lampPoleDao.getLampPoleInstallList(vo);

+ 22 - 0
src/main/java/com/welampiot/service/impl/LedgerServiceImpl.java

@@ -0,0 +1,22 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.LedgerDao;
+import com.welampiot.dto.LedgerLampDTO;
+import com.welampiot.service.LedgerService;
+import com.welampiot.vo.LedgerVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class LedgerServiceImpl implements LedgerService {
+
+    @Autowired
+    private LedgerDao ledgerDao;
+
+    @Override
+    public List<LedgerLampDTO> getSectionStatisticsListByLedgerVO(LedgerVO ledgerVO) {
+        return ledgerDao.getSectionStatisticsListByLedgerVO(ledgerVO);
+    }
+}

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

@@ -168,4 +168,9 @@ public class NetworkServiceImpl implements NetworkService {
     public NetworkDTO getSimpleData(NetworkDTO dto) {
         return networkDao.getSimpleData(dto);
     }
+
+    @Override
+    public Integer getLoopNetworkCountByDTO(NetworkDTO dto) {
+        return networkDao.getLoopNetworkCountByDTO(dto);
+    }
 }

+ 11 - 0
src/main/java/com/welampiot/utils/ToolUtils.java

@@ -2288,7 +2288,18 @@ System.out.println(res);
         }
     }
 
+    public static String formatNumber(double number) {
+        DecimalFormat decimalFormat = new DecimalFormat("#.##");
+        String format = decimalFormat.format(number);
+        if (format.endsWith(".00")) {
+            return format.substring(0, format.length() - 3);
+        } else {
+            return format;
+        }
+    }
+
     public static void main(String[] args) {
         System.out.println(getPublicIp());
+        System.out.println(formatNumber(0.0));
     }
 }

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

@@ -15,6 +15,8 @@ public class LampListResponseVO {
     private Integer version;
     private String keyword;
     private List sectionList;
+    private Integer areaId;
+    private Integer sectionId;
     private List<LampInfoDTO> list;
     private Integer lightCount;
     private Integer onlineCount;

+ 9 - 0
src/main/java/com/welampiot/vo/LampTypeNavVO.java

@@ -0,0 +1,9 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+@Data
+public class LampTypeNavVO {
+    private String id;
+    private String name;
+}

+ 23 - 0
src/main/java/com/welampiot/vo/LedgerEleBoxCountVO.java

@@ -0,0 +1,23 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+@Data
+public class LedgerEleBoxCountVO {
+    /** 变压器总数 */
+    private Integer transformerTotal;
+    /** 配电箱总数 */
+    private Integer eleBoxTotal;
+    /** 集中器总数 */
+    private Integer networkTotal;
+    /** 数字断路器总数 */
+    private Integer loopTotal;
+    private Integer loop1;
+    private Integer loop2;
+    private Integer loop3;
+    private Integer loop4;
+    private Integer loop5;
+    private Integer loop6;
+    private Integer loop7;
+    private Integer loop8;
+}

+ 20 - 0
src/main/java/com/welampiot/vo/LedgerLampCountVO.java

@@ -0,0 +1,20 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+@Data
+public class LedgerLampCountVO {
+    private Integer total;
+    private Integer power30;
+    private Integer power50;
+    private Integer power60;
+    private Integer power80;
+    private Integer power100;
+    private Integer power120;
+    private Integer power150;
+    private Integer power180;
+    private Integer power200;
+    private Integer power240;
+    private Integer power300;
+    private Integer otherPower;
+}

+ 16 - 0
src/main/java/com/welampiot/vo/LedgerPoleCountVO.java

@@ -0,0 +1,16 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+@Data
+public class LedgerPoleCountVO {
+    private Integer total;
+    private Integer oneTotal;
+    private Integer twoTotal;
+    private Integer highTotal;
+    private Integer naTotal;
+    private Integer huaTotal;
+    private Integer yuTotal;
+    private Integer enTotal;
+    private Integer solarTotal;
+}

+ 29 - 0
src/main/java/com/welampiot/vo/LedgerVO.java

@@ -0,0 +1,29 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class LedgerVO {
+    /** 0 控制器,1 数智电源,2 太阳能控制器 */
+    private Integer type;
+    /** 0 单臂,1 双臂,2 玉兰灯,3 中华灯,4 景观灯,5 高杆灯 */
+    private Integer devType;
+    /** 灯杆高度 */
+    private Double height;
+    /** 0 LED,1 钠灯 */
+    private Integer lightingType;
+    private Integer areaId;
+    private Integer sectionId;
+    private Integer lampType;
+    private List<Integer> sectionList;
+    private String updateTime;
+
+    private Integer page;
+    private Integer count;
+
+    private Integer version;
+    private String username;
+    private List<?> list;
+}

+ 52 - 10
src/main/resources/mapper/ElectricBoxMapper.xml

@@ -32,16 +32,52 @@
 
     <select id="getTotalByStatus" resultType="Integer" parameterType="ElectricBoxDTO">
         select count(*) as total
-        from (select e.id
-              from electric_box e
-                  left join air_switch_info a on e.id = a.box_id
-        <if test="sectionList != null and !sectionList.isEmpty()">
-          where e.sectionid in
-        <foreach item="dto" collection="sectionList" open="(" separator="," close=")">
-            #{dto}
-        </foreach>
-        </if>
-        group by e.id) b
+        from (
+                select e.id
+                from electric_box e
+                left join air_switch_info a on e.id = a.box_id
+                where 1=1
+                <if test="sectionList != null and !sectionList.isEmpty()">
+                    and e.sectionid in
+                    <foreach item="dto" collection="sectionList" open="(" separator="," close=")">
+                        #{dto}
+                    </foreach>
+                </if>
+                <if test="areaId != null">
+                    and e.areaid = #{areaId}
+                </if>
+                <if test="sectionId != null">
+                    and e.sectionid = #{sectionId}
+                </if>
+                group by e.id
+            ) b
+    </select>
+
+    <select id="getLoopEleBoxTotalByDTO" resultType="Integer">
+        SELECT COUNT(*)
+        FROM (
+                 SELECT e.id
+                 FROM electric_box e
+                 LEFT JOIN air_switch_info a ON a.box_id = e.id
+                 WHERE (
+                           SELECT COUNT(*)
+                           FROM air_switch_info c
+                           WHERE c.box_id = e.id
+                       ) = #{loopCount}
+                 <if test="sectionList != null and !sectionList.isEmpty()">
+                     and e.sectionid in
+                     <foreach item="dto" collection="sectionList" open="(" separator="," close=")">
+                         #{dto}
+                     </foreach>
+                 </if>
+                 <if test="areaId != null and areaId != 0">
+                     and e.areaid = #{areaId}
+                 </if>
+                 <if test="sectionId != null and sectionId != 0">
+                     and e.sectionid = #{sectionId}
+                 </if>
+                 GROUP BY e.id
+             ) b
     </select>
 
     <select id="getOnlineTotalByStatus" resultType="Integer" parameterType="ElectricBoxDTO">
@@ -142,4 +178,10 @@
         where e.id = #{id}
     </update>
 
+    <select id="getEleBoxListBySectionId" resultType="com.welampiot.dto.ElectricBoxDTO">
+        select e.id,e.name
+        from electric_box e
+        where e.sectionid = #{sectionId}
+    </select>
+
 </mapper>

+ 24 - 0
src/main/resources/mapper/LampInfoCacheByDayMapper.xml

@@ -314,4 +314,28 @@
         order by updateTime desc
     </select>
 
+    <!--  计算某个路段下某种类型的灯的当月总耗电量  -->
+    <select id="getMonthEleConByLedgerVO" resultType="LampInfoCacheByDayDTO">
+        SELECT sum(a.consum) as conSum
+        FROM lamp_info_cache_by_day a
+        LEFT JOIN lampinfo b ON a.lampid = b.id
+        WHERE b.height = #{height}
+          AND b.dev_type = #{devType}
+          AND b.lighting_type = #{lightingType}
+          AND b.sectionid = #{id}
+          AND YEAR(a.updatetime) = YEAR(CURDATE()) AND MONTH(a.updatetime) = MONTH(CURDATE())
+    </select>
+
+    <!--  计算某个路段下某种类型的灯的某天总耗电量  -->
+    <select id="getDayEleConByLedgerVO" resultType="LampInfoCacheByDayDTO">
+        SELECT sum(a.consum) as conSum
+        FROM lamp_info_cache_by_day a
+        LEFT JOIN lampinfo b ON a.lampid = b.id
+        WHERE b.height = #{height}
+          AND b.dev_type = #{devType}
+          AND b.lighting_type = #{lightingType}
+          AND b.sectionid = #{id}
+          AND a.updatetime = #{updateTime}
+    </select>
+
 </mapper>

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

@@ -428,7 +428,9 @@
         L.mode,
         N.protocoltype,
         L.areaid as areaId,
-        L.control_type as controlType
+        L.control_type as controlType,
+        L.height,
+        L.dev_type as devType
         from lampinfo L
         left join network as N on N.id = L.networkid
         where 1=1
@@ -438,6 +440,12 @@
                 #{vo}
             </foreach>
         </if>
+        <if test="areaId != null and areaId != 0">
+            and L.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and L.sectionid = #{sectionId}
+        </if>
         <if test="lampType != null and lampType == 1">
             and L.lamp_pole_id != 0
         </if>
@@ -558,6 +566,9 @@
         <if test="sectionId != null and sectionId != 0">
             and l.sectionid = #{sectionId}
         </if>
+        <if test="ratedPower != null">
+            and l.ratedpower = #{ratedPower}
+        </if>
     </select>
 
     <!-- 灯控亮灯数 -->

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

@@ -294,6 +294,9 @@
         <if test="sectionId != null and sectionId != 0">
             and l.sectionid = #{sectionId}
         </if>
+        <if test="type != null">
+            and l.type = #{type}
+        </if>
     </select>
 
     <!-- 摄像头数量 -->

+ 43 - 0
src/main/resources/mapper/LedgerMapper.xml

@@ -0,0 +1,43 @@
+<?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.LedgerDao">
+    
+    <select id="getSectionStatisticsListByLedgerVO" resultType="com.welampiot.dto.LedgerLampDTO">
+        SELECT s.id,s.`name`,count(l.id) AS lampTotal,SUM(l.ratedpower) AS totalRatedPower,
+               l.height,l.lighting_type AS lightingType,l.dev_type AS devType,
+               count(l1.id) AS lampPoleTotal,count(lsd.id) AS lightStripTotal,
+               SUM(l2.used_energy_total) AS usedEnergyTotal,SUM(l2.day_gener_energy) AS dayGenerateEnergy,
+               SUM(l3.consum) AS monthConSum,SUM(l4.consum) AS dayConSum
+        FROM section s
+        LEFT JOIN lampinfo l ON l.sectionid = s.id
+        LEFT JOIN lamp_pole l1 ON l1.id = l.lamp_pole_id
+        LEFT JOIN light_strip_dev lsd ON lsd.lamp_pole_id = l1.id
+        LEFT JOIN lamp_info_log_new l2 ON (l2.lampid = l.id AND l2.used_energy_total <![CDATA[ < ]]> 20000)
+        LEFT JOIN lamp_info_cache_by_day l3 ON (l3.lampid = l.id AND YEAR(l3.updatetime) = YEAR(CURDATE()) AND MONTH(l3.updatetime) = MONTH(CURDATE()))
+        LEFT JOIN lamp_info_cache_by_day l4 ON (l4.lampid = l.id AND l4.updatetime = #{updateTime})
+        WHERE 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            AND s.id IN
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+        <if test="areaId != null and areaId != 0">
+            AND l.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            AND l.sectionid = #{sectionId}
+        </if>
+        <if test="lampType != null and lampType == 1">
+            AND l.lighting_type = 0
+        </if>
+        <if test="lampType != null and lampType == 2">
+            AND l.lighting_type = 1
+        </if>
+        GROUP BY s.id,l.dev_type,l.height,l.lighting_type
+        <if test="page != null and count != null">
+            LIMIT #{page},#{count}
+        </if>
+    </select>
+
+</mapper>

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

@@ -226,6 +226,9 @@
                 #{item}
             </foreach>
         </if>
+        <if test="networkId != null">
+            and l.network_id = #{networkId}
+        </if>
         <if test="areaId != null and areaId != 0">
             and l.areaid = #{areaId}
         </if>

+ 32 - 0
src/main/resources/mapper/NetworkMapper.xml

@@ -384,4 +384,36 @@
         </trim>
         limit 1;
     </select>
+
+    <!--  查询有多少回路的集中器数量  -->
+    <select id="getLoopNetworkCountByDTO" resultType="Integer">
+        SELECT COUNT(*)
+        FROM (
+                 SELECT l.network_id
+                 FROM `loop` l
+                 WHERE l.network_Id IN
+                       (
+                           SELECT n.id
+                           FROM network n
+                           WHERE n.protocoltype IN (11,15)
+                           <if test="sectionList != null and !sectionList.isEmpty()">
+                               and n.sectionid in
+                               <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                                   #{dto}
+                               </foreach>
+                           </if>
+                           <if test="areaId != null and areaId != 0">
+                               and n.areaid = #{areaId}
+                           </if>
+                           <if test="sectionId != null and sectionId != 0">
+                               and n.sectionid = #{sectionId}
+                           </if>
+                       )
+                 GROUP BY l.network_id
+                 <if test="loopCount != null">
+                     HAVING COUNT(l.network_id) = #{loopCount}
+                 </if>
+             ) b
+    </select>
+
 </mapper>