소스 검색

获取和设置空开经纬度时控;sim列表信息;能源监控数据及导出数据;

zhj 2 년 전
부모
커밋
f6af223b6b
22개의 변경된 파일998개의 추가작업 그리고 11개의 파일을 삭제
  1. 401 5
      src/main/java/com/welampiot/controller/DataController.java
  2. 54 4
      src/main/java/com/welampiot/controller/ElectricBoxController.java
  3. 51 0
      src/main/java/com/welampiot/controller/NetworkController.java
  4. 23 0
      src/main/java/com/welampiot/dao/AirSwitchInfoTimeDao.java
  5. 8 0
      src/main/java/com/welampiot/dao/LampInfoCacheByDayDao.java
  6. 3 0
      src/main/java/com/welampiot/dao/NetworkDao.java
  7. 31 0
      src/main/java/com/welampiot/dto/AirSwitchInfoTimeDTO.java
  8. 12 0
      src/main/java/com/welampiot/dto/LampInfoCacheByDayDTO.java
  9. 3 0
      src/main/java/com/welampiot/dto/NetworkDTO.java
  10. 22 0
      src/main/java/com/welampiot/service/AirSwitchInfoTimeService.java
  11. 8 0
      src/main/java/com/welampiot/service/LampInfoCacheByDayService.java
  12. 2 0
      src/main/java/com/welampiot/service/NetworkService.java
  13. 42 0
      src/main/java/com/welampiot/service/impl/AirSwitchInfoTimeServiceImpl.java
  14. 20 0
      src/main/java/com/welampiot/service/impl/LampInfoCacheByDayServiceImpl.java
  15. 10 0
      src/main/java/com/welampiot/service/impl/NetworkServiceImpl.java
  16. 3 2
      src/main/java/com/welampiot/service/VideoPointInfoServiceImpl.java
  17. 33 0
      src/main/java/com/welampiot/vo/AirSwitchInfoTimeVO.java
  18. 45 0
      src/main/java/com/welampiot/vo/LampInfoCacheByDayVO.java
  19. 6 0
      src/main/java/com/welampiot/vo/NetworkVO.java
  20. 32 0
      src/main/resources/mapper/AirSwitchInfoTimeMapper.xml
  21. 105 0
      src/main/resources/mapper/LampInfoCacheByDayMapper.xml
  22. 84 0
      src/main/resources/mapper/NetworkMapper.xml

+ 401 - 5
src/main/java/com/welampiot/controller/DataController.java

@@ -4,22 +4,22 @@ import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.*;
 import com.welampiot.service.*;
+import com.welampiot.utils.ExcelUtil;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.security.access.prepost.PreAuthorize;
 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.DecimalFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.time.YearMonth;
+import java.util.*;
 
 @RestController
 @CrossOrigin
@@ -45,6 +45,9 @@ public class DataController {
     private ProReviewerService proReviewerService;
     @Autowired
     private RepairPersonnelService repairPersonnelService;
+    @Autowired
+    private LampInfoCacheByDayService lampInfoCacheByDayService;
+
     @RequestMapping(value = "/info",method = RequestMethod.POST)
     public BaseResult<InfoResponseVO> info(HttpServletRequest request){
         Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
@@ -244,4 +247,397 @@ public class DataController {
             return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
         }
     }
+
+    /**
+     * 能源监控数据
+     * @param request 日期类型
+     * @return 能源监控数据
+     */
+    @RequestMapping(value = "/energyMoniData", method = RequestMethod.POST)
+    public BaseResult<?> energyMoniData(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer dateType = (Integer) toolUtils.getRequestContent(request,"dateType",1);
+
+        long l = System.currentTimeMillis();
+        Date date1 = new Date(l);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date1);
+        int year = calendar.get(Calendar.YEAR); // 获取年份
+        int month = calendar.get(Calendar.MONTH) + 1; // 获取月份
+
+        long startTime;
+        long endTime;
+        String startDate;
+        DecimalFormat decimalFormat = new DecimalFormat("0.00");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
+        String endDate = simpleDateFormat.format(l);
+        if (dateType == 0) { // 当月
+            if (month < 10) {
+                startDate = year + "-0" + month + "-01";
+            } else {
+                startDate = year + "-" + month + "-01";
+            }
+            startTime = simpleDateFormat.parse(startDate).getTime();
+            endTime = simpleDateFormat.parse(endDate).getTime();
+        } else if (dateType == 1) { // 当年
+            month = 1;
+            startDate = year + "-0" + month + "-01";
+            endDate = simpleDateFormat.format(l);
+            startTime = simpleDateFormat.parse(startDate).getTime();
+            endTime = simpleDateFormat.parse(endDate).getTime();
+        } else if (dateType == 2) { // 具体月份
+            String date = (String) toolUtils.getRequestContent(request, "date", 2);
+            if (date.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_DATE_ERROR, version);
+            List<String> list = Arrays.asList(date.split("-"));
+            int yearNum = Integer.parseInt(list.get(0));
+            int monthNum = Integer.parseInt(list.get(1));
+            int daysInMonth = YearMonth.of(yearNum, monthNum).lengthOfMonth();
+            if (yearNum == year && monthNum == month) {
+                if (month < 10) {
+                    startDate = year + "-" + "0" + month + "-01";
+                } else {
+                    startDate = year + "-" + month + "-01";
+                }
+                startTime = simpleDateFormat.parse(startDate).getTime();
+                endTime = simpleDateFormat.parse(endDate).getTime();
+            } else if ((yearNum == year && monthNum > month) || (yearNum > year)) {
+                return toolUtils.response(InterfaceResultEnum.DATE_CHOOSE_ERROR,version);
+            } else {
+                startTime = simpleDateFormat.parse(date + "-01").getTime();
+                endTime = simpleDateFormat.parse(date + "-" + daysInMonth).getTime();
+                startDate = simpleDateFormat.format(startTime);
+                endDate = simpleDateFormat.format(endTime);
+            }
+        } else { // 全部
+            startDate = "2020-01-01";
+            startTime = simpleDateFormat.parse(startDate).getTime();
+            endTime = simpleDateFormat.parse(endDate).getTime();
+            month = 1;
+            year = 2020;
+        }
+
+        HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
+        long timeT = startTime;
+        int i = 0;
+        List<Object> dateList = new ArrayList<>();
+        List<Object> valueList1 = new ArrayList<>();
+        List<Object> valueList2 = new ArrayList<>();
+        List<Object> valueList3 = new ArrayList<>();
+        List<Object> valueList4 = new ArrayList<>();
+        List<LampInfoCacheByDayDTO> conSumList;
+        LampInfoCacheByDayDTO dayDTO = new LampInfoCacheByDayDTO();
+        dayDTO.setAreaId(areaId);
+        dayDTO.setSectionId(sectionId);
+        dayDTO.setStartDate(startDate);
+        dayDTO.setEndDate(endDate);
+        dayDTO.setSectionList(toolUtils.getSectionList(request));
+
+        if (dateType == 0 || dateType == 2) { // 当月和具体日期
+            conSumList = lampInfoCacheByDayService.getSectionOfMonthConSum(dayDTO);
+        } else { // 当年和全部
+            conSumList = lampInfoCacheByDayService.getSectionOfYearConSum(dayDTO);
+        }
+
+        for (LampInfoCacheByDayDTO dto1 : conSumList) {
+            if (dto1.getConSum() != null) {
+                float v = Float.parseFloat(dto1.getConSum());
+                String format = decimalFormat.format(v);
+                dto1.setConSum(format);
+                float v1 = v * 0.75f;
+                String format1 = decimalFormat.format(v1);
+                dto1.setEleFree(format1);
+            } else {
+                dto1.setConSum("0");
+                dto1.setEleFree("0");
+            }
+            if (dto1.getPowerSave() != null) {
+                float v = Float.parseFloat(dto1.getPowerSave());
+                String format = decimalFormat.format(v);
+                dto1.setPowerSave(format);
+                float v1 = v * 0.75f;
+                String format1 = decimalFormat.format(v1);
+                dto1.setSaveEleFree(format1);
+            } else {
+                dto1.setPowerSave("0");
+                dto1.setSaveEleFree("0");
+            }
+        }
+
+        // 折线统计数据
+        if (dateType == 0 || dateType == 2) { // 当月和具体日期
+            while (timeT <= endTime) {
+                objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)),i);
+                dateList.add(simpleDateFormat.format(new Date(timeT)));
+                valueList1.add(0);
+                valueList2.add(0);
+                valueList3.add(0);
+                valueList4.add(0);
+                timeT += 3600 * 1000 * 24;
+                i ++;
+            }
+
+            for (LampInfoCacheByDayDTO dto : conSumList) {
+                Date date = new Date(simpleDateFormat.parse(dto.getUpdateTime()).getTime());
+                String s = simpleDateFormat.format(date);
+                Integer integer = null;
+                if (objectObjectHashMap.containsKey(s)) {
+                    integer = objectObjectHashMap.get(s);
+                }
+
+                // 用电量和电费
+                if (dto.getConSum() != null && !dto.getConSum().equals("0") && integer != null) {
+                    float conSum = Float.parseFloat(dto.getConSum());
+                    float eleFree = conSum * 0.75f;
+                    String formatConSum = decimalFormat.format(conSum);
+                    String formatEleFree = decimalFormat.format(eleFree);
+                    valueList1.set(integer, Float.parseFloat(formatConSum)); // 当月和具体月份的用电量折线数据
+                    valueList2.set(integer,Float.parseFloat(formatEleFree)); // 当月和具体月份的电费折线数据
+                }
+                // 省电量和省电费
+                if (dto.getPowerSave() != null && !dto.getPowerSave().equals("0") && integer != null) {
+                    float powerSave = Float.parseFloat(dto.getPowerSave());
+                    float eleFree = powerSave * 0.75f;
+                    String formatConSum = decimalFormat.format(powerSave);
+                    String formatEleFree = decimalFormat.format(eleFree);
+                    valueList3.set(integer, Float.parseFloat(formatConSum)); // 当月和具体月份的用电量折线数据
+                    valueList4.set(integer,Float.parseFloat(formatEleFree)); // 当月和具体月份的电费折线数据
+                }
+            }
+        } else { // 当年和全部
+            String dateStr;
+            while (timeT <= endTime) {
+                objectObjectHashMap.put(dateFormat.format(new Date(timeT)),i);
+                dateList.add(dateFormat.format(new Date(timeT)));
+                valueList1.add(0);
+                valueList2.add(0);
+                valueList3.add(0);
+                valueList4.add(0);
+                month ++;
+                if (month == 13) {
+                    month = 1;
+                    year ++;
+                }
+                if (month < 10) {
+                    dateStr = year + "-0" + month;
+                } else {
+                    dateStr = year + "-" + month;
+                }
+                timeT = dateFormat.parse(dateStr).getTime();
+                i ++;
+            }
+
+            for (LampInfoCacheByDayDTO dto : conSumList) {
+                Date date = new Date(dateFormat.parse(dto.getUpdateTime()).getTime());
+                String s = dateFormat.format(date);
+                dto.setUpdateTime(s);
+                Integer integer = null;
+                if (objectObjectHashMap.containsKey(s)) {
+                    integer = objectObjectHashMap.get(s);
+                }
+
+                // 用电量和电费
+                if (dto.getConSum() != null && !dto.getConSum().equals("0") && integer != null) {
+                    float conSum = Float.parseFloat(dto.getConSum());
+                    float eleFree = conSum * 0.75f;
+                    String formatConSum = decimalFormat.format(conSum);
+                    String formatEleFree = decimalFormat.format(eleFree);
+                    valueList1.set(integer, Float.parseFloat(formatConSum)); // 当年和全部的用电量折线数据
+                    valueList2.set(integer,Float.parseFloat(formatEleFree)); // 当年和全部的电费折线数据
+                }
+                // 省电量和省电费
+                if (dto.getPowerSave() != null && !dto.getPowerSave().equals("0") && integer != null) {
+                    float powerSave = Float.parseFloat(dto.getPowerSave());
+                    float eleFree = powerSave * 0.75f;
+                    String formatConSum = decimalFormat.format(powerSave);
+                    String formatEleFree = decimalFormat.format(eleFree);
+                    valueList3.set(integer, Float.parseFloat(formatConSum)); // 当年和全部的用电量折线数据
+                    valueList4.set(integer,Float.parseFloat(formatEleFree)); // 当年和全部的电费折线数据
+                }
+            }
+        }
+
+        LampInfoCacheByDayDTO dto = lampInfoCacheByDayService.getAreaOrSectionOfConSum(dayDTO);
+        String conSum,powerSave,eleFree,save;
+        if (dto == null) {
+            conSum = "0";
+            powerSave = "0";
+            eleFree = "0";
+            save = "0";
+        } else {
+            conSum = dto.getConSum();
+            powerSave = dto.getPowerSave();
+            conSum = decimalFormat.format(Float.parseFloat(conSum));
+            powerSave = decimalFormat.format(Float.parseFloat(powerSave));
+            eleFree = String.valueOf(Float.parseFloat(conSum) * 0.75f);
+            save = String.valueOf(Float.parseFloat(powerSave) * 0.75f);
+        }
+        List<LampInfoCacheByDayDTO> dataList = lampInfoCacheByDayService.getConSumListBySection(dayDTO);
+        for (LampInfoCacheByDayDTO dto1 : dataList) {
+            if (dto1.getConSum() != null) {
+                float v = Float.parseFloat(dto1.getConSum());
+                String format = decimalFormat.format(v);
+                dto1.setConSum(format);
+                float v1 = v * 0.75f;
+                String format1 = decimalFormat.format(v1);
+                dto1.setEleFree(format1);
+            } else {
+                dto1.setConSum("0");
+                dto1.setEleFree("0");
+            }
+            if (dto1.getPowerSave() != null) {
+                float v = Float.parseFloat(dto1.getPowerSave());
+                String format = decimalFormat.format(v);
+                dto1.setPowerSave(format);
+                float v1 = v * 0.75f;
+                String format1 = decimalFormat.format(v1);
+                dto1.setSaveEleFree(format1);
+            } else {
+                dto1.setPowerSave("0");
+                dto1.setSaveEleFree("0");
+            }
+        }
+        LampInfoCacheByDayVO lampInfoCacheByDayVO = new LampInfoCacheByDayVO();
+        lampInfoCacheByDayVO.setSaveEleFree(save);
+        lampInfoCacheByDayVO.setTotalEleFree(eleFree);
+        lampInfoCacheByDayVO.setTotalConSum(conSum);
+        lampInfoCacheByDayVO.setTotalPowerSave(powerSave);
+        lampInfoCacheByDayVO.setConSumList(valueList1);
+        lampInfoCacheByDayVO.setEleFreeList(valueList2);
+        lampInfoCacheByDayVO.setPowerSaveList(valueList3);
+        lampInfoCacheByDayVO.setSaveEleFreeList(valueList4);
+        lampInfoCacheByDayVO.setUpdateTimeList(dateList);
+        lampInfoCacheByDayVO.setDataList(dataList);
+        lampInfoCacheByDayVO.setList(conSumList);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoCacheByDayVO);
+    }
+
+    /**
+     * 导出列表数据
+     * @param request 日期类型
+     * @return 导出列表数据
+     */
+    @RequestMapping(value = "/inputEnergyMoniData", method = RequestMethod.POST)
+    public BaseResult<?> inputEnergyMoniData(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer dateType = (Integer) toolUtils.getRequestContent(request,"dateType",1);
+
+        long l = System.currentTimeMillis();
+        Date date1 = new Date(l);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date1);
+        int year = calendar.get(Calendar.YEAR); // 获取年份
+        int month = calendar.get(Calendar.MONTH) + 1; // 获取月份
+
+        long startTime;
+        long endTime;
+        String startDate;
+        DecimalFormat decimalFormat = new DecimalFormat("0.00");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String endDate = simpleDateFormat.format(l);
+        if (dateType == 0) { // 当月
+            if (month < 10) {
+                startDate = year + "-0" + month + "-01";
+            } else {
+                startDate = year + "-" + month + "-01";
+            }
+        } else if (dateType == 1) { // 当年
+            month = 1;
+            startDate = year + "-0" + month + "-01";
+            endDate = simpleDateFormat.format(l);
+        } else if (dateType == 2) { // 具体月份
+            String date = (String) toolUtils.getRequestContent(request, "date", 2);
+            if (date.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_DATE_ERROR, version);
+            List<String> list = Arrays.asList(date.split("-"));
+            int yearNum = Integer.parseInt(list.get(0));
+            int monthNum = Integer.parseInt(list.get(1));
+            int daysInMonth = YearMonth.of(yearNum, monthNum).lengthOfMonth();
+            if (yearNum == year && monthNum == month) {
+                if (month < 10) {
+                    startDate = year + "-" + "0" + month + "-01";
+                } else {
+                    startDate = year + "-" + month + "-01";
+                }
+            } else if ((yearNum == year && monthNum > month) || (yearNum > year)) {
+                return toolUtils.response(InterfaceResultEnum.DATE_CHOOSE_ERROR,version);
+            } else {
+                startTime = simpleDateFormat.parse(date + "-01").getTime();
+                endTime = simpleDateFormat.parse(date + "-" + daysInMonth).getTime();
+                startDate = simpleDateFormat.format(startTime);
+                endDate = simpleDateFormat.format(endTime);
+            }
+        } else { // 全部
+            startDate = "2020-01-01";
+        }
+        List<LampInfoCacheByDayDTO> conSumList;
+        LampInfoCacheByDayDTO dayDTO = new LampInfoCacheByDayDTO();
+        dayDTO.setAreaId(areaId);
+        dayDTO.setSectionId(sectionId);
+        dayDTO.setStartDate(startDate);
+        dayDTO.setEndDate(endDate);
+        dayDTO.setSectionList(toolUtils.getSectionList(request));
+
+        if (dateType == 0 || dateType == 2) { // 当月和具体日期
+            conSumList = lampInfoCacheByDayService.getSectionOfMonthConSum(dayDTO);
+        } else { // 当年和全部
+            conSumList = lampInfoCacheByDayService.getSectionOfYearConSum(dayDTO);
+        }
+
+        for (LampInfoCacheByDayDTO dto1 : conSumList) {
+            if (dto1.getConSum() != null) {
+                float v = Float.parseFloat(dto1.getConSum());
+                String format = decimalFormat.format(v);
+                dto1.setConSum(format);
+                float v1 = v * 0.75f;
+                String format1 = decimalFormat.format(v1);
+                dto1.setEleFree(format1);
+            } else {
+                dto1.setConSum("0");
+                dto1.setEleFree("0");
+            }
+            if (dto1.getPowerSave() != null) {
+                float v = Float.parseFloat(dto1.getPowerSave());
+                String format = decimalFormat.format(v);
+                dto1.setPowerSave(format);
+                float v1 = v * 0.75f;
+                String format1 = decimalFormat.format(v1);
+                dto1.setSaveEleFree(format1);
+            } else {
+                dto1.setPowerSave("0");
+                dto1.setSaveEleFree("0");
+            }
+            if (dateType == 1 || dateType == 3) {
+                String dateTime = dto1.getDateTime();
+                dto1.setUpdateTime(dateTime);
+            }
+        }
+
+        String title;
+        if (version == 0) {
+            title = "用电量,省电量,电费,节省电费,更新时间";
+        } else if (version == 1) {
+            title = "Electricity Consumption,Electricity Saving,Electricity Cost,Electricity Saving,Update Time";
+        } else {
+            title = "Потребление электроэнергии,экономия электроэнергии,экономия электричества,время обновления";
+        }
+        List<String> titleList = Arrays.asList(title.split(","));
+        List<List<String>> contentList = new ArrayList<>();
+        for (LampInfoCacheByDayDTO dto : conSumList) {
+            List<String> newString = new ArrayList<>();
+            newString.add(0,dto.getConSum());
+            newString.add(1,dto.getPowerSave());
+            newString.add(2,dto.getEleFree());
+            newString.add(3,dto.getSaveEleFree());
+            newString.add(4,dto.getUpdateTime());
+            contentList.add(conSumList.indexOf(dto),newString);
+        }
+        String path = ExcelUtil.outExcel(titleList, contentList);
+        LampInfoCacheByDayVO lampInfoCacheByDayVO = new LampInfoCacheByDayVO();
+        lampInfoCacheByDayVO.setPath(path);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoCacheByDayVO);
+    }
 }

+ 54 - 4
src/main/java/com/welampiot/controller/ElectricBoxController.java

@@ -5,10 +5,8 @@ import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.*;
 import com.welampiot.service.*;
 import com.welampiot.utils.ToolUtils;
-import com.welampiot.vo.AirSwitchDetailVO;
-import com.welampiot.vo.AirSwitchInfoReturnVO;
-import com.welampiot.vo.ElectricBoxReturnVO;
-import com.welampiot.vo.LampVO;
+import com.welampiot.vo.*;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -55,6 +53,9 @@ public class ElectricBoxController {
     @Autowired
     private AirSwitchLampService airSwitchLampService;
 
+    @Autowired
+    private AirSwitchInfoTimeService airSwitchInfoTimeService;
+
     /**
      * 获取电箱列表
      * @param request
@@ -794,4 +795,53 @@ public class ElectricBoxController {
         lampVO.setList(airSwitchLampList);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampVO);
     }
+
+    /**
+     * 获取经纬度设置
+     * @param vo id
+     * @return 获取经纬度设置
+     */
+    @RequestMapping(value = "/getLonLat", method = RequestMethod.POST)
+    public BaseResult<?> getLonLat(AirSwitchInfoTimeVO vo) {
+        if (vo.getVersion() == null) vo.setVersion(0);
+        Integer version = vo.getVersion();
+        Integer id = vo.getId();
+        if (id == null || id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        AirSwitchInfoTimeDTO airSwitchInfoTimeDTO = airSwitchInfoTimeService.getAirSwitchInfoTimeByAirId(id);
+        AirSwitchInfoTimeVO airSwitchInfoTimeVO = new AirSwitchInfoTimeVO();
+        if (airSwitchInfoTimeDTO == null)
+            return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,airSwitchInfoTimeVO);
+        BeanUtils.copyProperties(airSwitchInfoTimeDTO,airSwitchInfoTimeVO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,airSwitchInfoTimeVO);
+    }
+
+    /**
+     * 设置经纬度时控
+     * @param vo 属性
+     * @return 设置经纬度时控
+     */
+    @RequestMapping(value = "/setLonLat", method = RequestMethod.POST)
+    public BaseResult<?> setLonLat(AirSwitchInfoTimeVO vo) {
+        if (vo.getVersion() == null) vo.setVersion(0);
+        Integer version = vo.getVersion();
+        Integer id = vo.getId();
+        if (id == null || id == 0)
+            return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        Integer time1 = vo.getTime1();
+        Integer time2 = vo.getTime2();
+        Integer status1 = vo.getStatus1();
+        Integer status2 = vo.getStatus2();
+        if (time1 == null || time2 == null || status1 == null || status2 == null)
+            return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        Integer count = airSwitchInfoTimeService.findAirSwitchInfoTimeData(id);
+        AirSwitchInfoTimeDTO airSwitchInfoTimeDTO = new AirSwitchInfoTimeDTO();
+        BeanUtils.copyProperties(vo,airSwitchInfoTimeDTO);
+        airSwitchInfoTimeDTO.setAirSwitchId(id);
+        if (count > 0) { // 编辑
+            airSwitchInfoTimeService.updateAirSwitchInfoTimeData(airSwitchInfoTimeDTO);
+        } else { // 添加
+            airSwitchInfoTimeService.addAirSwitchInfoTimeData(airSwitchInfoTimeDTO);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
 }

+ 51 - 0
src/main/java/com/welampiot/controller/NetworkController.java

@@ -15,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -286,4 +288,53 @@ public class NetworkController {
         netInfoService.updateNetInfoData(netInfoDTO);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
     }
+
+    /**
+     * sim列表信息
+     * @param request sectionList,分页
+     * @return sim列表信息
+     */
+    @PostMapping("/simList")
+    private BaseResult<?> simList(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer page = (Integer) toolUtils.getRequestContent(request,"page",1);
+        Integer count = (Integer) toolUtils.getRequestContent(request,"count",1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer expirationStatus = (Integer) toolUtils.getRequestContent(request,"expirationStatus",1);
+        if (page == 0) page = 1;
+        if (count == 0) count = 16;
+        NetworkVO networkVO = new NetworkVO();
+        networkVO.setPage(count * (page - 1));
+        networkVO.setCount(count);
+        networkVO.setAreaId(areaId);
+        networkVO.setSectionId(sectionId);
+        networkVO.setExpirationStatus(expirationStatus);
+        networkVO.setVersion(version);
+        networkVO.setSectionList(toolUtils.getSectionList(request));
+        List<NetworkDTO> simList = networkService.getSimList(networkVO);
+        for (NetworkDTO dto : simList) {
+            if (dto.getExpirationTime() != null && !dto.getExpirationTime().isEmpty()) {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Date date = simpleDateFormat.parse(dto.getExpirationTime());
+                long time = date.getTime(); // 过期时间戳
+                long currentTimeMillis = System.currentTimeMillis(); // 当前时间戳
+                if (currentTimeMillis > time) { // 已过期
+                    dto.setExpirationStatus(3);
+                } else {
+                    long l = time - currentTimeMillis;
+                    if (l > 30 * 24 * 3600 * 1000L) { // 正常
+                        dto.setExpirationStatus(1);
+                    } else { // 快过期(大于当前时间30天以内)
+                        dto.setExpirationStatus(2);
+                    }
+                }
+            }
+        }
+        Integer total = networkService.getSimTotal(networkVO);
+        NetworkVO networkVO1 = new NetworkVO();
+        networkVO1.setList(simList);
+        networkVO1.setTotal(total);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,networkVO1);
+    }
 }

+ 23 - 0
src/main/java/com/welampiot/dao/AirSwitchInfoTimeDao.java

@@ -0,0 +1,23 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.AirSwitchInfoTimeDTO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * ClassName: AirSwitchInfoTimeDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 18:12
+ * @Version: v1.0
+ */
+public interface AirSwitchInfoTimeDao {
+    AirSwitchInfoTimeDTO getAirSwitchInfoTimeByAirId(@Param("airSwitchId") Integer airSwitchId);
+
+    void addAirSwitchInfoTimeData(AirSwitchInfoTimeDTO dto);
+
+    void updateAirSwitchInfoTimeData(AirSwitchInfoTimeDTO dto);
+
+    Integer findAirSwitchInfoTimeData(@Param("airSwitchId") Integer airSwitchId);
+}

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

@@ -22,4 +22,12 @@ public interface LampInfoCacheByDayDao {
     List<LampInfoCacheByDayDTO> getMonthConSum(LampInfoCacheByDayDTO dto);
 
     List<LampInfoCacheByDayDTO> getYearConSum(LampInfoCacheByDayDTO dto);
+
+    LampInfoCacheByDayDTO getAreaOrSectionOfConSum(LampInfoCacheByDayDTO dto);
+
+    List<LampInfoCacheByDayDTO> getSectionOfYearConSum(LampInfoCacheByDayDTO dto);
+
+    List<LampInfoCacheByDayDTO> getSectionOfMonthConSum(LampInfoCacheByDayDTO dto);
+
+    List<LampInfoCacheByDayDTO> getConSumListBySection(LampInfoCacheByDayDTO dto);
 }

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

@@ -1,6 +1,7 @@
 package com.welampiot.dao;
 
 import com.welampiot.dto.NetworkDTO;
+import com.welampiot.vo.NetworkVO;
 
 import java.util.List;
 
@@ -10,4 +11,6 @@ public interface NetworkDao {
     List<NetworkDTO> getNetListByDTO(NetworkDTO networkDTO);
     NetworkDTO getNetworkDetails(NetworkDTO networkDTO);
     List<NetworkDTO> getNetworkNavList(NetworkDTO networkDTO);
+    List<NetworkDTO> getSimList(NetworkVO vo);
+    Integer getSimTotal(NetworkVO vo);
 }

+ 31 - 0
src/main/java/com/welampiot/dto/AirSwitchInfoTimeDTO.java

@@ -0,0 +1,31 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: AirSwitchInfoTimeDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 17:51
+ * @Version: v1.0
+ */
+@Data
+public class AirSwitchInfoTimeDTO implements Serializable {
+    private Integer id;
+
+    private Integer airSwitchId;
+
+    private Integer status1; // 日出开关状态(0 分闸,1 合闸)
+
+    private Integer status2; // 日落开关状态(0 分闸,1 合闸)
+
+    private Integer time1; // 日出延时时间
+
+    private Integer time2; // 日落延时时间
+
+    private static final long serialVersionUID = 1L;
+}

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

@@ -2,6 +2,8 @@ package com.welampiot.dto;
 
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * ClassName: LampInfoCacheByDayDTO
  * Package: com.welampiot.dto
@@ -33,6 +35,8 @@ public class LampInfoCacheByDayDTO {
 
     private String updateTime; // 更新时间
 
+    private String dateTime;
+
     private Integer type;
 
     private Integer value;
@@ -40,4 +44,12 @@ public class LampInfoCacheByDayDTO {
     private String startDate;
 
     private String endDate;
+
+    private String name;
+
+    private String eleFree; // 电费
+
+    private String saveEleFree; // 节省电费
+
+    private List<Integer> sectionList;
 }

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

@@ -30,5 +30,8 @@ public class NetworkDTO {
     private Integer version;
     private String longitude;
     private String latitude;
+    private String expirationTime; // 过期时间
     private List<Integer> sectionList;
+    private Integer expirationStatus;
+    private String iccId;
 }

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

@@ -0,0 +1,22 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.AirSwitchInfoTimeDTO;
+
+/**
+ * ClassName: AirSwitchInfoTimeService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 18:14
+ * @Version: v1.0
+ */
+public interface AirSwitchInfoTimeService {
+    AirSwitchInfoTimeDTO getAirSwitchInfoTimeByAirId(Integer airSwitchId);
+
+    void addAirSwitchInfoTimeData(AirSwitchInfoTimeDTO dto);
+
+    void updateAirSwitchInfoTimeData(AirSwitchInfoTimeDTO dto);
+
+    Integer findAirSwitchInfoTimeData(Integer airSwitchId);
+}

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

@@ -22,4 +22,12 @@ public interface LampInfoCacheByDayService {
     List<LampInfoCacheByDayDTO> getMonthConSum(LampInfoCacheByDayDTO dto);
 
     List<LampInfoCacheByDayDTO> getYearConSum(LampInfoCacheByDayDTO dto);
+
+    LampInfoCacheByDayDTO getAreaOrSectionOfConSum(LampInfoCacheByDayDTO dto);
+
+    List<LampInfoCacheByDayDTO> getSectionOfYearConSum(LampInfoCacheByDayDTO dto);
+
+    List<LampInfoCacheByDayDTO> getSectionOfMonthConSum(LampInfoCacheByDayDTO dto);
+
+    List<LampInfoCacheByDayDTO> getConSumListBySection(LampInfoCacheByDayDTO dto);
 }

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

@@ -11,4 +11,6 @@ public interface NetworkService {
     NetworkVO getNetListByDTO(NetworkDTO networkDTO);
     NetworkDTO getNetworkDetails(NetworkDTO networkDTO);
     List<NetworkDTO> getNetworkNavList(NetworkDTO networkDTO);
+    List<NetworkDTO> getSimList(NetworkVO vo);
+    Integer getSimTotal(NetworkVO vo);
 }

+ 42 - 0
src/main/java/com/welampiot/service/impl/AirSwitchInfoTimeServiceImpl.java

@@ -0,0 +1,42 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.AirSwitchInfoTimeDao;
+import com.welampiot.dto.AirSwitchInfoTimeDTO;
+import com.welampiot.service.AirSwitchInfoTimeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * ClassName: AirSwitchInfoTimeServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 18:14
+ * @Version: v1.0
+ */
+@Service
+public class AirSwitchInfoTimeServiceImpl implements AirSwitchInfoTimeService {
+    @Autowired
+    private AirSwitchInfoTimeDao airSwitchInfoTimeDao;
+
+    @Override
+    public AirSwitchInfoTimeDTO getAirSwitchInfoTimeByAirId(Integer airSwitchId) {
+        return airSwitchInfoTimeDao.getAirSwitchInfoTimeByAirId(airSwitchId);
+    }
+
+    @Override
+    public void addAirSwitchInfoTimeData(AirSwitchInfoTimeDTO dto) {
+        airSwitchInfoTimeDao.addAirSwitchInfoTimeData(dto);
+    }
+
+    @Override
+    public void updateAirSwitchInfoTimeData(AirSwitchInfoTimeDTO dto) {
+        airSwitchInfoTimeDao.updateAirSwitchInfoTimeData(dto);
+    }
+
+    @Override
+    public Integer findAirSwitchInfoTimeData(Integer airSwitchId) {
+        return airSwitchInfoTimeDao.findAirSwitchInfoTimeData(airSwitchId);
+    }
+}

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

@@ -42,4 +42,24 @@ public class LampInfoCacheByDayServiceImpl implements LampInfoCacheByDayService
     public List<LampInfoCacheByDayDTO> getYearConSum(LampInfoCacheByDayDTO dto) {
         return lampInfoCacheByDayDao.getYearConSum(dto);
     }
+
+    @Override
+    public LampInfoCacheByDayDTO getAreaOrSectionOfConSum(LampInfoCacheByDayDTO dto) {
+        return lampInfoCacheByDayDao.getAreaOrSectionOfConSum(dto);
+    }
+
+    @Override
+    public List<LampInfoCacheByDayDTO> getSectionOfYearConSum(LampInfoCacheByDayDTO dto) {
+        return lampInfoCacheByDayDao.getSectionOfYearConSum(dto);
+    }
+
+    @Override
+    public List<LampInfoCacheByDayDTO> getSectionOfMonthConSum(LampInfoCacheByDayDTO dto) {
+        return lampInfoCacheByDayDao.getSectionOfMonthConSum(dto);
+    }
+
+    @Override
+    public List<LampInfoCacheByDayDTO> getConSumListBySection(LampInfoCacheByDayDTO dto) {
+        return lampInfoCacheByDayDao.getConSumListBySection(dto);
+    }
 }

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

@@ -113,4 +113,14 @@ public class NetworkServiceImpl implements NetworkService {
     public List<NetworkDTO> getNetworkNavList(NetworkDTO networkDTO) {
         return networkDao.getNetworkNavList(networkDTO);
     }
+
+    @Override
+    public List<NetworkDTO> getSimList(NetworkVO vo) {
+        return networkDao.getSimList(vo);
+    }
+
+    @Override
+    public Integer getSimTotal(NetworkVO vo) {
+        return networkDao.getSimTotal(vo);
+    }
 }

+ 3 - 2
src/main/java/com/welampiot/service/VideoPointInfoServiceImpl.java

@@ -1,7 +1,8 @@
-package com.welampiot.service;
+package com.welampiot.service.impl;
 
 import com.welampiot.dao.VideoPointInfoDao;
 import com.welampiot.dto.VideoPointInfoDTO;
+import com.welampiot.service.VideoPointInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -17,7 +18,7 @@ import java.util.List;
  * @Version: v1.0
  */
 @Service
-public class VideoPointInfoServiceImpl implements VideoPointInfoService{
+public class VideoPointInfoServiceImpl implements VideoPointInfoService {
     @Autowired
     private VideoPointInfoDao videoPointInfoDao;
 

+ 33 - 0
src/main/java/com/welampiot/vo/AirSwitchInfoTimeVO.java

@@ -0,0 +1,33 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: AirSwitchInfoTimeVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 18:17
+ * @Version: v1.0
+ */
+@Data
+public class AirSwitchInfoTimeVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    private Integer airSwitchId;
+
+    private Integer time1;
+
+    private Integer time2;
+
+    private Integer status1;
+
+    private Integer status2;
+
+    private Integer version;
+}

+ 45 - 0
src/main/java/com/welampiot/vo/LampInfoCacheByDayVO.java

@@ -0,0 +1,45 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.LampInfoCacheByDayDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: LampInfoCacheByDayVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/25 - 18:10
+ * @Version: v1.0
+ */
+@Data
+public class LampInfoCacheByDayVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String path;
+
+    private String totalConSum; // 累计用电量
+
+    private String totalPowerSave; // 累计省电量
+
+    private String totalEleFree; // 累计电费
+
+    private String saveEleFree; // 节省电费
+
+    private List<Object> conSumList; // 用电量
+
+    private List<Object> powerSaveList; // 省电量
+
+    private List<Object> eleFreeList; // 电费
+
+    private List<Object> saveEleFreeList; // 节省电费
+
+    private List<Object> updateTimeList; // 更新时间
+
+    private List<LampInfoCacheByDayDTO> list; // 统计列表
+
+    private List<LampInfoCacheByDayDTO> dataList; // 根据区域中的各路段数据占比
+}

+ 6 - 0
src/main/java/com/welampiot/vo/NetworkVO.java

@@ -33,4 +33,10 @@ public class NetworkVO {
     private Integer freBandInfo;
     private String freBandInfoStr;
     private List<NetworkDTO> list;
+    private Integer page;
+    private Integer count;
+    private Integer version;
+    private Integer expirationStatus;
+    private List<String> sectionList;
+    private Integer total;
 }

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

@@ -0,0 +1,32 @@
+<?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.AirSwitchInfoTimeDao">
+
+    <select id="getAirSwitchInfoTimeByAirId" resultType="AirSwitchInfoTimeDTO">
+        select a.id,a.air_switch_id as airSwitchId,a.status1,a.status2,a.time1,a.time2
+        from air_switch_info_time a
+        where a.air_switch_id = #{airSwitchId}
+    </select>
+
+    <insert id="addAirSwitchInfoTimeData" parameterType="AirSwitchInfoTimeDTO" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO air_switch_info_time(air_switch_id, status1, status2, time1, time2)
+        VALUES (#{airSwitchId},#{status1},#{status2},#{time1},#{time2})
+    </insert>
+
+    <update id="updateAirSwitchInfoTimeData" parameterType="AirSwitchInfoTimeDTO">
+        update air_switch_info_time a
+        set
+            a.status1 = #{status1},
+            a.status2 = #{status2},
+            a.time1 = #{time1},
+            a.time2 = #{time2}
+        where a.air_switch_id = #{airSwitchId}
+    </update>
+
+    <select id="findAirSwitchInfoTimeData" resultType="Integer">
+        select count(*)
+        from air_switch_info_time a
+        where a.air_switch_id = #{airSwitchId}
+    </select>
+
+</mapper>

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

@@ -78,4 +78,109 @@
         ORDER BY l.updatetime DESC
     </select>
 
+    <select id="getAreaOrSectionOfConSum" resultType="LampInfoCacheByDayDTO">
+        SELECT SUM(l.consum) AS conSum,
+        SUM(l.powerSave) AS powerSave,
+        SUM(l.lightTime) AS lightTime
+        FROM lamp_info_cache_by_day l
+        WHERE l.updatetime <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            AND l.updatetime <![CDATA[ >= ]]> #{startDate}
+        </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="sectionList != null and !sectionList.isEmpty()">
+            and l.sectionid in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getSectionOfYearConSum" resultType="LampInfoCacheByDayDTO">
+        SELECT SUM(l.consum) AS conSum,
+        SUM(l.powerSave) AS powerSave,
+        SUM(l.lightTime) AS lightTime,
+        l.updatetime AS updateTime,
+        DATE_FORMAT(l.updatetime, '%Y-%m') AS `dateTime`
+        FROM lamp_info_cache_by_day l
+        WHERE l.updatetime <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            AND l.updatetime <![CDATA[ >= ]]> #{startDate}
+        </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="sectionList != null and !sectionList.isEmpty()">
+            AND l.sectionid IN
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY `dateTime`
+        ORDER BY `dateTime` DESC
+    </select>
+
+    <select id="getSectionOfMonthConSum" resultType="LampInfoCacheByDayDTO">
+        SELECT SUM(l.consum) AS conSum,
+        SUM(l.powerSave) AS powerSave,
+        SUM(l.lightTime) AS lightTime,
+        l.updatetime AS updateTime
+        FROM lamp_info_cache_by_day l
+        WHERE l.updatetime <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate != ''">
+            AND l.updatetime <![CDATA[ >= ]]> #{startDate}
+        </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="sectionList != null and !sectionList.isEmpty()">
+            AND l.sectionid IN
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY l.updatetime
+        ORDER BY l.updatetime DESC
+    </select>
+
+    <select id="getConSumListBySection" resultType="LampInfoCacheByDayDTO">
+        SELECT
+        SUM(l.consum) AS conSum,
+        SUM(l.powerSave) AS powerSave,
+        SUM(l.lightTime) AS lightTime,
+        s.id,
+        s.name
+        FROM lamp_info_cache_by_day l
+        LEFT JOIN section s ON s.id = l.sectionid
+        WHERE l.updatetime <![CDATA[ <= ]]> #{endDate}
+        AND s.id IS NOT NULL
+        <if test="startDate != null and startDate != ''">
+            AND l.updatetime <![CDATA[ >= ]]> #{startDate}
+        </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="sectionList != null and !sectionList.isEmpty()">
+            AND l.sectionid IN
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY l.sectionid
+    </select>
+
 </mapper>

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

@@ -95,4 +95,88 @@
             </foreach>
         </if>
     </select>
+    
+    <select id="getSimList" resultType="NetworkDTO">
+        select
+            n.id,
+            n.devicesn as deviceSn,
+            n.status,
+            n.expiration_time as expirationTime,
+            s.name as section,
+            n.simid as iccId
+            <choose>
+                <when test="version == 0">
+                    ,gl.chinese_name as area
+                </when>
+                <when test="version == 1">
+                    ,gl.english_name as area
+                </when>
+                <otherwise>
+                    ,gl.ru_name as area
+                </otherwise>
+            </choose>
+        from network n
+        left join section s on s.id = n.sectionid
+        left join global_location gl on s.pid = gl.id
+        where n.net_type = 1 and n.protocoltype in (0,1,2,3,4,5,6,7,8,10)
+        <choose>
+            <when test="expirationStatus == 3">
+                and now() > n.expiration_time
+            </when>
+            <when test="expirationStatus == 2">
+                and n.expiration_time <![CDATA[ <= ]]> (now() + interval  30 day)
+            </when>
+            <when test="expirationStatus == 1">
+                and n.expiration_time > (now() + interval  30 day)
+            </when>
+        </choose>
+        <if test="areaId != null and areaId != 0">
+            and n.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and n.sectionid = #{sectionId}
+        </if>
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and n.sectionid in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="page >= 0 and count > 0">
+            limit #{page},#{count}
+        </if>
+    </select>
+
+    <select id="getSimTotal" resultType="Integer">
+        select
+        count(*)
+        from network n
+        left join section s on s.id = n.sectionid
+        left join global_location gl on s.pid = gl.id
+        where n.net_type = 1 and n.protocoltype in (0,1,2,3,4,5,6,7,8,10)
+        <choose>
+            <when test="expirationStatus == 3">
+                and now() > n.expiration_time
+            </when>
+            <when test="expirationStatus == 2">
+                and n.expiration_time <![CDATA[ <= ]]> (now() + interval  30 day)
+            </when>
+            <when test="expirationStatus == 1">
+                and n.expiration_time > (now() + interval  30 day)
+            </when>
+        </choose>
+        <if test="areaId != null and areaId != 0">
+            and n.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and n.sectionid = #{sectionId}
+        </if>
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and n.sectionid in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+    
 </mapper>