浏览代码

智能照明概览信息页面接口

crazycat 2 年之前
父节点
当前提交
0c9f027fcd
共有 42 个文件被更改,包括 748 次插入19 次删除
  1. 185 0
      src/main/java/com/welampiot/controller/DataController.java
  2. 10 0
      src/main/java/com/welampiot/dao/AllAlarmInfoLogDao.java
  3. 13 0
      src/main/java/com/welampiot/dao/LampDao.java
  4. 7 0
      src/main/java/com/welampiot/dao/LampPoleDao.java
  5. 10 0
      src/main/java/com/welampiot/dao/OperationLogDao.java
  6. 2 2
      src/main/java/com/welampiot/dao/SectionDao.java
  7. 1 0
      src/main/java/com/welampiot/dao/UserDao.java
  8. 10 0
      src/main/java/com/welampiot/dao/VideoMonitorDao.java
  9. 12 0
      src/main/java/com/welampiot/dto/AllAlarmInfoLogDTO.java
  10. 14 0
      src/main/java/com/welampiot/dto/OperationLogDTO.java
  11. 5 0
      src/main/java/com/welampiot/dto/UserDTO.java
  12. 10 0
      src/main/java/com/welampiot/dto/VideoMonitorDTO.java
  13. 10 0
      src/main/java/com/welampiot/service/AllAlarmInfoLogService.java
  14. 7 0
      src/main/java/com/welampiot/service/LampPoleService.java
  15. 13 0
      src/main/java/com/welampiot/service/LampService.java
  16. 10 0
      src/main/java/com/welampiot/service/OperationLogService.java
  17. 3 2
      src/main/java/com/welampiot/service/SectionService.java
  18. 2 0
      src/main/java/com/welampiot/service/UserService.java
  19. 10 0
      src/main/java/com/welampiot/service/VideoMonitorService.java
  20. 18 0
      src/main/java/com/welampiot/service/impl/AllAlarmInfoLogServiceImpl.java
  21. 15 0
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  22. 28 0
      src/main/java/com/welampiot/service/impl/LampServiceImpl.java
  23. 18 0
      src/main/java/com/welampiot/service/impl/OperationLogServiceImpl.java
  24. 4 2
      src/main/java/com/welampiot/service/impl/SectionServiceImpl.java
  25. 3 0
      src/main/java/com/welampiot/service/impl/UserServiceImpl.java
  26. 18 0
      src/main/java/com/welampiot/service/impl/VideoMonitorServiceImpl.java
  27. 9 12
      src/main/java/com/welampiot/utils/ToolUtils.java
  28. 13 0
      src/main/java/com/welampiot/vo/AllAlarmInfoLogVO.java
  29. 25 0
      src/main/java/com/welampiot/vo/InfoResponseVO.java
  30. 15 0
      src/main/java/com/welampiot/vo/LampCountVO.java
  31. 12 0
      src/main/java/com/welampiot/vo/LampLogVO.java
  32. 10 0
      src/main/java/com/welampiot/vo/LampPoleCountVO.java
  33. 10 0
      src/main/java/com/welampiot/vo/ListResponseVO.java
  34. 15 0
      src/main/java/com/welampiot/vo/OperationLogVO.java
  35. 12 0
      src/main/java/com/welampiot/vo/VideoMonitorVO.java
  36. 30 0
      src/main/resources/mapper/AllAlarmInfoLogMapper.xml
  37. 73 0
      src/main/resources/mapper/LampMapper.xml
  38. 14 0
      src/main/resources/mapper/LampPoleMapper.xml
  39. 35 0
      src/main/resources/mapper/OperationLogMapper.xml
  40. 10 0
      src/main/resources/mapper/SectionMapper.xml
  41. 9 1
      src/main/resources/mapper/UserMapper.xml
  42. 18 0
      src/main/resources/mapper/VideoMonitorMapper.xml

+ 185 - 0
src/main/java/com/welampiot/controller/DataController.java

@@ -0,0 +1,185 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.dto.*;
+import com.welampiot.service.*;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.*;
+import org.apache.catalina.User;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/data")
+public class DataController {
+    @Autowired
+    private LampService lampService;
+    @Autowired
+    private ToolUtils toolUtils;
+    @Autowired
+    private SectionService sectionService;
+    @Autowired
+    private LampPoleService lampPoleService;
+    @Autowired
+    private AllAlarmInfoLogService alarmInfoLogService;
+    @Autowired
+    private VideoMonitorService videoMonitorService;
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private OperationLogService operationLogService;
+    @RequestMapping(value = "/info",method = RequestMethod.POST)
+    public BaseResult<InfoResponseVO> info(HttpServletRequest request){
+        Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        Integer type = request.getParameter("type") == null ? 0 : Integer.parseInt(request.getParameter("type"));
+        Integer operaType = request.getParameter("operaType") == null ? 0 : Integer.parseInt(request.getParameter("operaType"));
+        List sectionList = toolUtils.getSectionList(request);
+        InfoResponseVO data = new InfoResponseVO();
+        data.setCompany(toolUtils.getUser().getCompany());
+        data.setCompanyAddress(toolUtils.getUser().getAddress());
+        Integer userId = toolUtils.getUser().getId();
+        Integer role = toolUtils.getUser().getRole();
+        //设备数量,路灯数量,灯杆数量
+        LampCountVO lampCountVO = new LampCountVO();
+        if (!sectionList.isEmpty()) lampCountVO.setSectionList(sectionList);
+        data.setLampCount(lampService.getCountByVO(lampCountVO)); // 灯控总数
+        lampCountVO.setOnlineStatus(1);
+        lampCountVO.setLampStatus(1);
+        data.setLightCount(lampService.getCountByVO(lampCountVO)); // 亮灯数
+        List<SectionDTO> listByIdList = sectionService.getListByIdList(sectionList);
+        List sectionNameList = new ArrayList();
+        for (SectionDTO s :listByIdList) {
+            sectionNameList.add(s.getName());
+        }
+        if (sectionNameList.isEmpty()){
+            data.setArea("");
+        }else {
+            data.setArea(StringUtils.join(sectionNameList, ','));
+        }
+        data.setAreaCount(listByIdList.size());
+
+        // 灯杆数
+        LampPoleCountVO lampPoleCountVO = new LampPoleCountVO();
+        lampPoleCountVO.setSectionList(sectionList);
+        data.setLampPoleCount(lampPoleService.getCountByVO(lampPoleCountVO));
+
+        Float dayConsumptionByVO = lampService.getDayConsumptionByVO(lampCountVO);
+        data.setDayConsumption((float) (Math.round(dayConsumptionByVO*100)/100f));
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-01 00:00:00");
+        // 当月
+        lampCountVO.setStartDate(simpleDateFormat.format(new Date()).toString());
+        Float monthConsumption = lampService.getConsumptionByVO(lampCountVO);
+        monthConsumption = monthConsumption == null ? 0 : monthConsumption;
+        data.setMonthConsumption((float) (Math.round((dayConsumptionByVO+monthConsumption)*100)/100f));
+        // 当年
+        simpleDateFormat = new SimpleDateFormat("yyyy-01-01 00:00:00");
+        lampCountVO.setStartDate(simpleDateFormat.format(new Date()).toString());
+        Float yearConsumption = lampService.getConsumptionByVO(lampCountVO);
+        yearConsumption = yearConsumption == null ? 0 : yearConsumption;
+        data.setYearConsumption((float) (Math.round((dayConsumptionByVO+yearConsumption)*100)/100f));
+        // 累计
+        lampCountVO.setStartDate(null);
+        Float totalConsumption = lampService.getConsumptionByVO(lampCountVO);
+        totalConsumption = totalConsumption == null ? 0 : totalConsumption;
+        data.setTotalConsumption((float) (Math.round((dayConsumptionByVO+totalConsumption)*100)/100f));
+//        Date startDate = new Date(System.currentTimeMillis() - 20*24*3600*1000);
+        Date endDate = new Date(System.currentTimeMillis() - 24*3600*1000);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(endDate);
+        calendar.add(Calendar.MONDAY, -1);
+
+        simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+//        Date startDate = simpleDateFormat.format(calendar.getTime());
+//        for (int i = 0; i < 30; i++) {
+//            long t = startDate.getTime() + i * 24 * 3600 * 1000;
+//        }
+        lampCountVO.setStartDate(simpleDateFormat.format(calendar.getTime()));
+        lampCountVO.setEndDate(simpleDateFormat.format(endDate).toString());
+        System.out.println(lampCountVO.getStartDate());
+        System.out.println(lampCountVO.getEndDate());
+        List<LampLogVO> consumptionListByVO = lampService.getConsumptionListByVO(lampCountVO);
+        simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        List date = new ArrayList<>();
+        List value = new ArrayList<>();
+        List savePower = new ArrayList<>();
+        for (LampLogVO t :consumptionListByVO) {
+            String updateTime = simpleDateFormat.format(t.getUpdateTime()).toString();
+            Float consumption = t.getConsumption();
+            Float powerSave = t.getPowerSave();
+            date.add(updateTime);
+            value.add((float) (Math.round((consumption)*100)/100f));
+            savePower.add((float) (Math.round((powerSave)*100)/100f));
+        }
+        data.setDate(date);
+        data.setValue(value);
+        data.setSavePower(savePower);
+        return BaseResult.success(data);
+    }
+
+    @RequestMapping(value = "/syslog",method = RequestMethod.POST)
+    public BaseResult<List> syslog(HttpServletRequest request){
+
+        Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        Integer type = request.getParameter("type") == null ? 0 : Integer.parseInt(request.getParameter("type"));
+        Integer operaType = request.getParameter("operaType") == null ? 0 : Integer.parseInt(request.getParameter("operaType"));
+        List sectionList = toolUtils.getSectionList(request);
+//        if (type == 0) return weResponse.response("0007",version);
+        Integer userId = toolUtils.getUser().getId();
+        Integer role = toolUtils.getUser().getRole();;
+        ListResponseVO data = new ListResponseVO();
+        if (type == 4){  // 故障
+            AllAlarmInfoLogVO allAlarmInfoLogVO = new AllAlarmInfoLogVO();
+            allAlarmInfoLogVO.setSectionList(sectionList);
+            allAlarmInfoLogVO.setOffset(0);
+            allAlarmInfoLogVO.setLimit(50);
+            List<AllAlarmInfoLogDTO> listByVO = alarmInfoLogService.getListByVO(allAlarmInfoLogVO);
+            data.setList(listByVO);
+        }else if (type == 3){  // 监控
+            VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
+            videoMonitorVO.setSectionList(sectionList);
+            videoMonitorVO.setLimit(50);
+            videoMonitorVO.setOffset(0);
+            List<VideoMonitorDTO> listByVO = videoMonitorService.getListByVO(videoMonitorVO);
+            data.setList(listByVO);
+        }else{ //  日志
+            OperationLogVO operationLogVO = new OperationLogVO();
+            List userList = new ArrayList<>();
+            if (role != 1){
+                if (role == 2){
+                    userList.add(userId);
+                    List<UserDTO> listByParentId = userService.getListByParentId(userId);
+                    for (UserDTO u :listByParentId) {
+                        userList.add(u.getId());
+                    }
+                }else {
+                    userList.add(userId);
+                }
+                operationLogVO.setUserIdList(userList);
+            }
+            if (operaType != 0) operationLogVO.setOperaType(operaType);
+            operationLogVO.setVersion(version);
+            if (type == 1){ // 路灯
+                operationLogVO.setDevType(1);
+            }else { // 灯杆
+                operationLogVO.setDevType(2);
+            }
+            operationLogVO.setOffset(0);
+            operationLogVO.setLimit(50);
+            List<OperationLogDTO> listByVO = operationLogService.getListByVO(operationLogVO);
+            data.setList(listByVO);
+        }
+        return BaseResult.success(data);
+    }
+}

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

@@ -0,0 +1,10 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.AllAlarmInfoLogDTO;
+import com.welampiot.vo.AllAlarmInfoLogVO;
+
+import java.util.List;
+
+public interface AllAlarmInfoLogDao {
+    List<AllAlarmInfoLogDTO> getListByVO(AllAlarmInfoLogVO allAlarmInfoLogVO);
+}

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

@@ -0,0 +1,13 @@
+package com.welampiot.dao;
+
+import com.welampiot.vo.LampCountVO;
+import com.welampiot.vo.LampLogVO;
+
+import java.util.List;
+
+public interface LampDao {
+    Integer getCountByVO(LampCountVO lampCountVO);  // 查询灯控数量
+    Float getDayConsumptionByVO(LampCountVO lampCountVO);
+    Float getConsumptionByVO(LampCountVO lampCountVO);
+    List<LampLogVO> getConsumptionListByVO(LampCountVO lampCountVO);
+}

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

@@ -0,0 +1,7 @@
+package com.welampiot.dao;
+
+import com.welampiot.vo.LampPoleCountVO;
+
+public interface LampPoleDao {
+    Integer getCountByVO(LampPoleCountVO lampPoleCountVO);
+}

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

@@ -0,0 +1,10 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.OperationLogDTO;
+import com.welampiot.vo.OperationLogVO;
+
+import java.util.List;
+
+public interface OperationLogDao {
+    List<OperationLogDTO> getListByVO(OperationLogVO operationLogVO);
+}

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

@@ -4,10 +4,10 @@ import com.welampiot.dto.SectionDTO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
 public interface SectionDao {
     List<SectionDTO> getAllList();
     List<SectionDTO> getListByPid(@Param("pid") Integer pid);
-    List<SectionDTO> getLIstByPidList(@Param("pidList") List pidList);
+    List<SectionDTO> getListByPidList(@Param("pidList") List pidList);
+    List<SectionDTO> getListByIdList(@Param("idList") List idList);
 }

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

@@ -16,4 +16,5 @@ public interface UserDao {
     List<MenuDTO> queryMenuList(@Param("username") String username);
     List<PathDTO> queryUserGrantUrl(@Param("username") String username);
     List<RoleDTO> queryUserRole(@Param("username") String username);
+    List<UserDTO> getListByParentId(@Param("parentId") Integer parentId);
 }

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

@@ -0,0 +1,10 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.VideoMonitorDTO;
+import com.welampiot.vo.VideoMonitorVO;
+
+import java.util.List;
+
+public interface VideoMonitorDao {
+    List<VideoMonitorDTO> getListByVO(VideoMonitorVO vo);
+}

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

@@ -0,0 +1,12 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+@Data
+public class AllAlarmInfoLogDTO {
+    private String number;
+    private String section;
+    private String strAlarmType;
+    private String updateTime;
+    private String area;
+}

+ 14 - 0
src/main/java/com/welampiot/dto/OperationLogDTO.java

@@ -0,0 +1,14 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+@Data
+public class OperationLogDTO {
+    private String time;
+    private String acount;
+    private String remark;
+    private String operaType;
+    private String operation;
+    private String sectionId;
+    private String areaId;
+}

+ 5 - 0
src/main/java/com/welampiot/dto/UserDTO.java

@@ -12,12 +12,17 @@ import java.util.List;
 
 @Data
 public class UserDTO implements UserDetails{
+    private int id;
     private String username;
     private String password;
     private int status;
     private String privilegeList;
     private String zoneList;
     private int role;
+    private String company;
+    private String address;
+    private String emerUser;
+    private String emerPassword;
 
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {

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

@@ -0,0 +1,10 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+@Data
+public class VideoMonitorDTO {
+    private Integer id;
+    private String name;
+    private String image;
+}

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

@@ -0,0 +1,10 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.AllAlarmInfoLogDTO;
+import com.welampiot.vo.AllAlarmInfoLogVO;
+
+import java.util.List;
+
+public interface AllAlarmInfoLogService {
+    List<AllAlarmInfoLogDTO> getListByVO(AllAlarmInfoLogVO allAlarmInfoLogVO);
+}

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

@@ -0,0 +1,7 @@
+package com.welampiot.service;
+
+import com.welampiot.vo.LampPoleCountVO;
+
+public interface LampPoleService {
+    Integer getCountByVO(LampPoleCountVO lampPoleCountVO);
+}

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

@@ -0,0 +1,13 @@
+package com.welampiot.service;
+
+import com.welampiot.vo.LampCountVO;
+import com.welampiot.vo.LampLogVO;
+
+import java.util.List;
+
+public interface LampService {
+    Integer getCountByVO(LampCountVO lampCountVO);  // 查询灯控数量
+    Float getDayConsumptionByVO(LampCountVO lampCountVO);  // 查询用电量
+    Float getConsumptionByVO(LampCountVO lampCountVO);  // 查询当天用电量
+    List<LampLogVO> getConsumptionListByVO(LampCountVO lampCountVO);
+}

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

@@ -0,0 +1,10 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.OperationLogDTO;
+import com.welampiot.vo.OperationLogVO;
+
+import java.util.List;
+
+public interface OperationLogService {
+    List<OperationLogDTO> getListByVO(OperationLogVO operationLogVO);
+}

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

@@ -1,13 +1,14 @@
 package com.welampiot.service;
 
 import com.welampiot.dto.SectionDTO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
 public interface SectionService {
     List<SectionDTO> getAllList();
 
     List<SectionDTO> getListByPid(Integer pid);
-    List<SectionDTO> getLIstByPidList(List pidList);
+    List<SectionDTO> getListByPidList(List pidList);
+    List<SectionDTO> getListByIdList(@Param("idList") List idList);
 }

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

@@ -4,6 +4,7 @@ import com.welampiot.dto.MenuDTO;
 import com.welampiot.dto.PathDTO;
 import com.welampiot.dto.UserDTO;
 import com.welampiot.vo.LoginVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -14,4 +15,5 @@ public interface UserService {
     int countUser();
     UserDTO findUserByUserName(String username);
     List<PathDTO> queryUserGrantUrl(String username);
+    List<UserDTO> getListByParentId(@Param("parentId") Integer parentId);
 }

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

@@ -0,0 +1,10 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.VideoMonitorDTO;
+import com.welampiot.vo.VideoMonitorVO;
+
+import java.util.List;
+
+public interface VideoMonitorService {
+    List<VideoMonitorDTO> getListByVO(VideoMonitorVO vo);
+}

+ 18 - 0
src/main/java/com/welampiot/service/impl/AllAlarmInfoLogServiceImpl.java

@@ -0,0 +1,18 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.AllAlarmInfoLogDao;
+import com.welampiot.dto.AllAlarmInfoLogDTO;
+import com.welampiot.service.AllAlarmInfoLogService;
+import com.welampiot.vo.AllAlarmInfoLogVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class AllAlarmInfoLogServiceImpl implements AllAlarmInfoLogService {
+    @Autowired
+    private AllAlarmInfoLogDao allAlarmInfoLogDao;
+    @Override
+    public List<AllAlarmInfoLogDTO> getListByVO(AllAlarmInfoLogVO allAlarmInfoLogVO) {return allAlarmInfoLogDao.getListByVO(allAlarmInfoLogVO);}
+}

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

@@ -0,0 +1,15 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.LampPoleDao;
+import com.welampiot.service.LampPoleService;
+import com.welampiot.vo.LampPoleCountVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class LampPoleServiceImpl implements LampPoleService {
+    @Autowired
+    private LampPoleDao lampPoleDao;
+    @Override
+    public Integer getCountByVO(LampPoleCountVO lampPoleCountVO) {return lampPoleDao.getCountByVO(lampPoleCountVO);}
+}

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

@@ -0,0 +1,28 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.LampDao;
+import com.welampiot.service.LampService;
+import com.welampiot.vo.LampCountVO;
+import com.welampiot.vo.LampLogVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class LampServiceImpl implements LampService {
+    @Autowired
+    private LampDao lampDao;
+    @Override
+    public Integer getCountByVO(LampCountVO lampCountVO) {return lampDao.getCountByVO(lampCountVO);}
+
+    @Override
+    public Float getDayConsumptionByVO(LampCountVO lampCountVO) {return lampDao.getDayConsumptionByVO(lampCountVO);}
+
+    @Override
+    public Float getConsumptionByVO(LampCountVO lampCountVO) {return lampDao.getConsumptionByVO(lampCountVO);}
+
+    @Override
+    public List<LampLogVO> getConsumptionListByVO(LampCountVO lampCountVO) {return lampDao.getConsumptionListByVO(lampCountVO);}
+
+}

+ 18 - 0
src/main/java/com/welampiot/service/impl/OperationLogServiceImpl.java

@@ -0,0 +1,18 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.OperationLogDao;
+import com.welampiot.dto.OperationLogDTO;
+import com.welampiot.service.OperationLogService;
+import com.welampiot.vo.OperationLogVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class OperationLogServiceImpl implements OperationLogService {
+    @Autowired
+    private OperationLogDao operationLogDao;
+    @Override
+    public List<OperationLogDTO> getListByVO(OperationLogVO operationLogVO) {return operationLogDao.getListByVO(operationLogVO);}
+}

+ 4 - 2
src/main/java/com/welampiot/service/impl/SectionServiceImpl.java

@@ -7,7 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
-import java.util.Map;
 
 @Service
 public class SectionServiceImpl implements SectionService {
@@ -20,5 +19,8 @@ public class SectionServiceImpl implements SectionService {
     public List<SectionDTO> getListByPid(Integer pid) {return sectionDao.getListByPid(pid);}
 
     @Override
-    public List<SectionDTO> getLIstByPidList(List pidList) {return sectionDao.getLIstByPidList(pidList);}
+    public List<SectionDTO> getListByPidList(List pidList) {return sectionDao.getListByPidList(pidList);}
+
+    @Override
+    public List<SectionDTO> getListByIdList(List idList) {return sectionDao.getListByIdList(idList);}
 }

+ 3 - 0
src/main/java/com/welampiot/service/impl/UserServiceImpl.java

@@ -48,4 +48,7 @@ public class UserServiceImpl implements UserService {
     public List<PathDTO> queryUserGrantUrl(String username) {
         return userDao.queryUserGrantUrl(username);
     }
+
+    @Override
+    public List<UserDTO> getListByParentId(Integer parentId) {return userDao.getListByParentId(parentId);}
 }

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

@@ -0,0 +1,18 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.VideoMonitorDao;
+import com.welampiot.dto.VideoMonitorDTO;
+import com.welampiot.service.VideoMonitorService;
+import com.welampiot.vo.VideoMonitorVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class VideoMonitorServiceImpl implements VideoMonitorService {
+    @Autowired
+    private VideoMonitorDao videoMonitorDao;
+    @Override
+    public List<VideoMonitorDTO> getListByVO(VideoMonitorVO vo) {return videoMonitorDao.getListByVO(vo);}
+}

+ 9 - 12
src/main/java/com/welampiot/utils/ToolUtils.java

@@ -1,9 +1,5 @@
 package com.welampiot.utils;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.welampiot.dao.GlobalLocationDao;
-import com.welampiot.dao.UserDao;
 import com.welampiot.dto.GlobalLocationDTO;
 import com.welampiot.dto.SectionDTO;
 import com.welampiot.dto.UserDTO;
@@ -14,7 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
-import java.lang.reflect.Field;
 import java.util.*;
 
 @Component
@@ -40,8 +35,8 @@ public class ToolUtils {
             sectionList.add(0);
             return sectionList;
         }
-        UserDTO user1 = userService.findUserByUserName(username);
-        if (user1 == null) {
+        user = userService.findUserByUserName(username);
+        if (user == null) {
             sectionList.add(0);
             return sectionList;
         }
@@ -54,14 +49,12 @@ public class ToolUtils {
         areaid = areaid == null || areaid.equals("0") ? request.getParameter("areaId") : areaid;
         String sectionid = request.getParameter("sectionid");
         sectionid = sectionid == null || sectionid.equals("0") ? request.getParameter("sectionId") : sectionid;
-
-
         if (sectionid != null && sectionid.length() != 0 && !sectionid.equals("0")){
             sectionList.add(sectionid);
             return sectionList;
         }
-        String zone = user1.getZoneList();
-        int role = user1.getRole();
+        String zone = user.getZoneList();
+        int role = user.getRole();
         List<SectionDTO> maps;
         List<GlobalLocationDTO> globalLocationList;
         ArrayList areaList = new ArrayList<>();
@@ -100,7 +93,7 @@ public class ToolUtils {
             }
         }else {
             if (areaid == null || areaid.equals("0")){
-                maps = sectionService.getLIstByPidList(areaList);
+                maps = sectionService.getListByPidList(areaList);
                 if (role != 1){
                     return Arrays.asList(zone.split(","));
                 }
@@ -116,4 +109,8 @@ public class ToolUtils {
         if (sectionList.isEmpty()) sectionList.add("0");
         return sectionList;
     }
+
+    public UserDTO getUser() {
+        return user;
+    }
 }

+ 13 - 0
src/main/java/com/welampiot/vo/AllAlarmInfoLogVO.java

@@ -0,0 +1,13 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AllAlarmInfoLogVO {
+    private List sectionList; // 路段筛选
+    private Integer version;
+    private Integer limit;
+    private Integer offset;
+}

+ 25 - 0
src/main/java/com/welampiot/vo/InfoResponseVO.java

@@ -0,0 +1,25 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class InfoResponseVO {
+    private Integer lightCount; // 亮灯数
+    private Integer lampCount; // 灯控总数
+    private Integer devCount; // 设备总数
+    private String  company; // 公司名称
+    private String  companyAddress; // 公司地址
+    private String area; // 分布区域
+    private Integer areaCount; // 分布区域数量
+    private Integer lampPoleCount; // 灯杆数量
+    private Float dayConsumption; // 当日用电量
+    private Float monthConsumption; // 当月用电量
+    private Float yearConsumption; // 当年用电量
+    private Float totalConsumption; // 	累计用电量
+    private List date; // 报表时间轴
+    private List value; // 用电量报表值
+    private List savePower; // 	省电量报表值
+
+}

+ 15 - 0
src/main/java/com/welampiot/vo/LampCountVO.java

@@ -0,0 +1,15 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class LampCountVO {
+    private Integer onlineStatus; // 在线状态筛选
+    private Integer lampStatus; // 开关灯状态筛选
+    private List sectionList; // 路段筛选
+    private String startDate; // 开始时间
+    private String endDate; // 结束时间
+    private String test; // 结束时间
+}

+ 12 - 0
src/main/java/com/welampiot/vo/LampLogVO.java

@@ -0,0 +1,12 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class LampLogVO {
+    private Date updateTime; // 更新时间
+    private Float consumption; // 用电量
+    private Float powerSave; // 省电量
+}

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

@@ -0,0 +1,10 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class LampPoleCountVO {
+    private List sectionList; // 路段筛选
+}

+ 10 - 0
src/main/java/com/welampiot/vo/ListResponseVO.java

@@ -0,0 +1,10 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ListResponseVO {
+    private List list;
+}

+ 15 - 0
src/main/java/com/welampiot/vo/OperationLogVO.java

@@ -0,0 +1,15 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class OperationLogVO {
+    private List userIdList;
+    private Integer operaType;
+    private Integer devType;
+    private Integer version;
+    private Integer limit;
+    private Integer offset;
+}

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

@@ -0,0 +1,12 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class VideoMonitorVO {
+    private List sectionList; // 路段筛选
+    private Integer limit;
+    private Integer offset;
+}

+ 30 - 0
src/main/resources/mapper/AllAlarmInfoLogMapper.xml

@@ -0,0 +1,30 @@
+<?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.AllAlarmInfoLogDao">
+    <select id="getListByVO" resultType="com.welampiot.dto.AllAlarmInfoLogDTO" parameterType="com.welampiot.vo.LampCountVO">
+        select L.number,
+        <choose>
+            <when test="version == 1">
+                G.english_name as area,
+            </when>
+            <when test="version == 2">
+                G.ru_name as area,
+            </when>
+            <otherwise>
+                G.chinese_name as area,
+            </otherwise>
+        </choose>
+        S.name as section,AI.stralarmtype as strAlarmType,AI.updatetime from all_alarm_info_log AI inner join lampinfo L on L.id = AI.lampid left join section S on L.sectionid = S.id left join global_location G on S.pid = G.id
+        where L.faultstatus != 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and L.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        order by AI.updatetime desc
+        <if test="offset != null and limit != null">
+            limit #{offset},#{limit}
+        </if>
+    </select>
+</mapper>

+ 73 - 0
src/main/resources/mapper/LampMapper.xml

@@ -0,0 +1,73 @@
+<?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.LampDao">
+    <select id="getCountByVO" resultType="Integer" parameterType="com.welampiot.vo.LampCountVO">
+        select count(*) from lampinfo a left join network b on a.networkid = b.id
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        <if test="onlineStatus != null">
+            and b.status = #{onlineStatus}
+        </if>
+        <if test="lampStatus != null">
+            <if test="lampStatus == 0">
+                and a.lighteness = 0
+            </if>
+            <if test="lampStatus == 1">
+                and a.lighteness > 0
+            </if>
+        </if>
+    </select>
+
+    <select id="getConsumptionByVO" resultType="Float" parameterType="com.welampiot.vo.LampCountVO">
+        select sum((select sum(consum) from lamp_info_cache_by_day t
+        where t.lampid = a.id
+        <if test="startDate != null and startDate != ''">
+            and t.updatetime >= #{startDate}
+        </if>
+        )) as consum
+        from lampinfo a
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
+    <select id="getDayConsumptionByVO" resultType="Float" parameterType="com.welampiot.vo.LampCountVO">
+        select sum(b.day_gener_energy) as consum
+        from lampinfo a left join lamp_info_log_new b on a.id = b.lampid
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
+    <select id="getConsumptionListByVO" resultType="com.welampiot.vo.LampLogVO" parameterType="com.welampiot.vo.LampCountVO">
+        select * from (
+            select sum(a.consum) as consumption,sum(a.powerSave) as powerSave,a.updatetime as updateTime
+            from lamp_info_cache_by_day a left join lampinfo b on b.id = a.lampid
+            where b.id is not null
+            <if test="sectionList != null and !sectionList.isEmpty()">
+                and a.sectionid in
+                <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                    #{vo}
+                </foreach>
+            </if>
+            <if test="startDate != null and startDate != ''">
+                and a.updatetime >= #{startDate}
+            </if>
+            <if test="endDate != null and endDate != ''">
+                and a.updatetime &lt;= #{endDate}
+            </if>
+            group by a.updatetime
+        ) as t order by t.updatetime asc
+    </select>
+</mapper>

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

@@ -0,0 +1,14 @@
+<?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.LampPoleDao">
+    <select id="getCountByVO" resultType="Integer" parameterType="com.welampiot.vo.LampPoleCountVO">
+        select count(*) from lamp_pole a
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+    </select>
+</mapper>

+ 35 - 0
src/main/resources/mapper/OperationLogMapper.xml

@@ -0,0 +1,35 @@
+<?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.OperationLogDao">
+    <select id="getListByVO" resultType="com.welampiot.dto.OperationLogDTO" parameterType="com.welampiot.vo.OperationLogVO">
+        select time,acount,remark,operaType,operation,sectionid as sectionId,areaid as areaId from operation_log a
+        where 1=1
+        <if test="userIdList != null and !userIdList.isEmpty()">
+            and a.userid in
+            <foreach item="vo" collection="userIdList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        <if test="devType != null">
+            and a.devtype = #{devType}
+        </if>
+        <choose>
+            <when test="version == 1">
+                and a.type = 1
+            </when>
+            <when test="version == 2">
+                and a.type = 2
+            </when>
+            <otherwise>
+                and a.type = 0
+            </otherwise>
+        </choose>
+        <if test="operaType != null">
+            and a.operaType = #{operaType}
+        </if>
+        order by a.time desc
+        <if test="offset != null and limit != null">
+            limit #{offset},#{limit}
+        </if>
+    </select>
+</mapper>

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

@@ -15,4 +15,14 @@
             #{item}
         </foreach>
     </select>
+    <select id="getListByIdList" parameterType="java.util.List" resultType="com.welampiot.dto.SectionDTO">
+        select id,name from section
+        <if test="idList != null and !idList.isEmpty()">
+            where id in
+            <foreach item="item" collection="idList" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
+    </select>
 </mapper>

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

@@ -9,7 +9,15 @@
         select username,password,status,privilege_list privilegeList from user where username=#{username,jdbcType=VARCHAR}
     </select>
     <select id="findUserByUserName" resultType="com.welampiot.dto.UserDTO">
-        select username,role,status,privilege_list privilegeList,zone_list zoneList from user where username=#{username,jdbcType=VARCHAR}
+        select id,username,role,status,privilege_list privilegeList,zone_list zoneList,
+        (select name from company c where c.id = u.company_id) as company,address from user u where u.username=#{username,jdbcType=VARCHAR}
+    </select>
+    <select id="getListByParentId" resultType="com.welampiot.dto.UserDTO">
+        select id,username
+         from user
+        <if test="parentId != null and parentId != ''">
+            where parent_id=#{parent_id}
+        </if>
     </select>
     <select id="queryMenuList" parameterType="list" resultType="com.welampiot.dto.MenuDTO">
         <!--select id,parentid parentId,name,en_name enName,ru_name ruName,level,action from privilnode where status=1

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

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.welampiot.dao.VideoMonitorDao">
+    <select id="getListByVO" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="com.welampiot.vo.VideoMonitorVO">
+        select id,name,image from video_monitor
+        where lamp_pole_id = 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and sectionid in
+            <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
+                #{vo}
+            </foreach>
+        </if>
+        order by id desc
+        <if test="offset != null and limit != null">
+            limit #{offset},#{limit}
+        </if>
+    </select>
+</mapper>