Prechádzať zdrojové kódy

智诺云运维数据

zhj 2 rokov pred
rodič
commit
8adfdb2754
26 zmenil súbory, kde vykonal 620 pridanie a 2 odobranie
  1. 186 0
      src/main/java/com/welampiot/controller/NewLampPoleController2.java
  2. 2 0
      src/main/java/com/welampiot/dao/AllAlarmInfoLogDao.java
  3. 2 0
      src/main/java/com/welampiot/dao/LampPoleDao.java
  4. 19 0
      src/main/java/com/welampiot/dao/OnlineLogDao.java
  5. 6 0
      src/main/java/com/welampiot/dao/OperationLogDao.java
  6. 1 0
      src/main/java/com/welampiot/dao/UserDao.java
  7. 25 0
      src/main/java/com/welampiot/dto/OnlineLogDTO.java
  8. 2 0
      src/main/java/com/welampiot/service/AllAlarmInfoLogService.java
  9. 2 0
      src/main/java/com/welampiot/service/LampPoleService.java
  10. 19 0
      src/main/java/com/welampiot/service/OnlineLogService.java
  11. 6 0
      src/main/java/com/welampiot/service/OperationLogService.java
  12. 1 0
      src/main/java/com/welampiot/service/UserService.java
  13. 5 0
      src/main/java/com/welampiot/service/impl/AllAlarmInfoLogServiceImpl.java
  14. 10 0
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  15. 30 0
      src/main/java/com/welampiot/service/impl/OnlineLogServiceImpl.java
  16. 15 0
      src/main/java/com/welampiot/service/impl/OperationLogServiceImpl.java
  17. 5 0
      src/main/java/com/welampiot/service/impl/UserServiceImpl.java
  18. 1 1
      src/main/java/com/welampiot/vo/LampVO.java
  19. 23 0
      src/main/java/com/welampiot/vo/OnlineLogVO.java
  20. 32 0
      src/main/java/com/welampiot/vo/OperationDataVO.java
  21. 2 0
      src/main/java/com/welampiot/vo/OperationLogVO.java
  22. 36 0
      src/main/resources/mapper/AllAlarmInfoLogMapper.xml
  23. 111 0
      src/main/resources/mapper/LampPoleMapper.xml
  24. 12 0
      src/main/resources/mapper/OnlineLogMapper.xml
  25. 60 1
      src/main/resources/mapper/OperationLogMapper.xml
  26. 7 0
      src/main/resources/mapper/UserMapper.xml

+ 186 - 0
src/main/java/com/welampiot/controller/NewLampPoleController2.java

@@ -68,6 +68,8 @@ public class NewLampPoleController2 {
     private ManholeService manholeService;
     @Autowired
     private LightStripDevService lightStripDevService;
+    @Autowired
+    private OnlineLogService onlineLogService;
 
     /**
      * 智诺云智慧灯杆列表
@@ -671,4 +673,188 @@ public class NewLampPoleController2 {
         }
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDataVO);
     }
+
+    /**
+     * 运维数据
+     * @param request 数据类型,日期类型
+     * @return 运维数据
+     */
+    @RequestMapping(value = "/operationData", method = RequestMethod.POST)
+    public BaseResult<?> operationData(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer type = (Integer) toolUtils.getRequestContent(request, "type", 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);
+        String username = (String) toolUtils.getRequestContent(request, "username", 2);
+
+        OperationDataVO operationDataVO = new OperationDataVO();
+        UserDTO userDTO = userService.queryUserIdByUsername(username);
+        if (userDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+        if (type == 0) { // 运维概览
+            Integer dayLoginCount = operationLogService.getDayLoginCount(userDTO.getRole(), userDTO.getId()); // 当天登录数
+            Integer dayOptCount = operationLogService.getDayOptCount(userDTO.getRole(), userDTO.getId()); // 当天操作数
+            Integer userOnlineCount = userService.getUserOnlineCount(); // 当前在线人数
+
+            long startTime = System.currentTimeMillis() - 24L * 3600 * 1000 * 9;
+            long endTime = System.currentTimeMillis();
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+            String startDate = simpleDateFormat.format(startTime);
+            String endDate = simpleDateFormat.format(endTime);
+            OnlineLogVO onlineLogVO = new OnlineLogVO();
+            onlineLogVO.setStartDate(startDate);
+            onlineLogVO.setEndDate(endDate);
+
+            List<Object> dateList = new ArrayList<>();
+            List<Object> countList = new ArrayList<>();
+            HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
+            long timeT = startTime;
+            int i = 0;
+            while (timeT <= endTime) {
+                objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)), i);
+                dateList.add(simpleDateFormat.format(new Date(timeT)));
+                countList.add(0);
+                timeT += 3600 * 1000;
+                i++;
+            }
+
+            List<OnlineLogDTO> list = onlineLogService.getOnlineLogList(onlineLogVO);
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            for (OnlineLogDTO dto : list) {
+                Date date = new Date(format.parse(dto.getUpdateTime()).getTime());
+                String s = simpleDateFormat.format(date);
+                Integer integer = null;
+                if (objectObjectHashMap.containsKey(s)) {
+                    integer = objectObjectHashMap.get(s);
+                }
+
+                // 用电量列表
+                if (dto.getOnlineCount() != null && dto.getOnlineCount() != 0 && integer != null) {
+                    countList.set(integer,dto.getOnlineCount());
+                }
+            }
+
+            operationDataVO.setDataType("operationView");
+            operationDataVO.setOnlineCount(userOnlineCount);
+            operationDataVO.setDayLoginCount(dayLoginCount);
+            operationDataVO.setDayOptCount(dayOptCount);
+            operationDataVO.setDateList(dateList);
+            operationDataVO.setDataList(countList);
+        } else if (type == 1) { // 调度维修
+            LampPoleVO lampPoleVO = new LampPoleVO();
+            lampPoleVO.setAreaId(areaId);
+            lampPoleVO.setSectionId(sectionId);
+            lampPoleVO.setSectionList(toolUtils.getSectionList(request));
+
+            lampPoleVO.setType(0); // 故障中
+            Integer alarming = lampPoleService.getLampPoleAlarmStatusTotal(lampPoleVO);
+            lampPoleVO.setType(1); // 处理中
+            Integer repairing = lampPoleService.getLampPoleAlarmStatusTotal(lampPoleVO);
+            lampPoleVO.setType(2); // 已处理
+            Integer processed = lampPoleService.getLampPoleAlarmStatusTotal(lampPoleVO);
+
+            lampPoleVO.setType(0); // 灯杆绑定的路灯故障数
+            Integer lampCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+            lampPoleVO.setType(1); // 灯杆绑定的摄像头故障数
+            Integer videoCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+            lampPoleVO.setType(2); // 灯杆绑定的wifi故障数
+            Integer wifiCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+            lampPoleVO.setType(4); // 灯杆绑定的屏幕故障数
+            Integer screenCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+            lampPoleVO.setType(5); // 灯杆绑定的一键报警故障数
+            Integer emCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+            lampPoleVO.setType(6); // 灯杆绑定的充电桩故障数
+            Integer chargeCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+            lampPoleVO.setType(7); // 灯杆绑定的气象站故障数
+            Integer weatherCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+            lampPoleVO.setType(9); // 灯杆绑定的广播音柱故障数
+            Integer broadcastCount = lampPoleService.getLampPoleOfDevAlarmTotal(lampPoleVO);
+
+            operationDataVO.setDataType("alarmInfo");
+            operationDataVO.setAlarming(alarming);
+            operationDataVO.setRepairing(repairing);
+            operationDataVO.setProcessed(processed);
+            operationDataVO.setLampAlarm(lampCount);
+            operationDataVO.setVideoAlarm(videoCount);
+            operationDataVO.setWifiAlarm(wifiCount);
+            operationDataVO.setLedAlarm(screenCount);
+            operationDataVO.setEmAlarm(emCount);
+            operationDataVO.setChargeAlarm(chargeCount);
+            operationDataVO.setWeatherAlarm(weatherCount);
+            operationDataVO.setBroadcastAlarm(broadcastCount);
+        } else if (type == 2) { // 操作统计
+            String startDate = null,endDate;
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            long endTime = System.currentTimeMillis();
+            endDate = simpleDateFormat.format(endTime);
+            if (dateType == 0) { // 当天
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+                startDate = format.format(endTime);
+            } else if (dateType == 1) { // 7天
+                long startTime = System.currentTimeMillis() - 24L * 3600 * 1000 * 6;
+                startDate = simpleDateFormat.format(startTime);
+            } else if (dateType == 2) { // 30天
+                long startTime = System.currentTimeMillis() - 24L * 3600 * 1000 * 29;
+                startDate = simpleDateFormat.format(startTime);
+            }
+
+            OperationLogVO operationLogVO = new OperationLogVO();
+            operationLogVO.setRole(userDTO.getRole());
+            operationLogVO.setUserId(userDTO.getId());
+            operationLogVO.setStartDate(startDate);
+            operationLogVO.setEndDate(endDate);
+
+            // 登录次数
+            operationLogVO.setOperaType(0);
+            Integer loginCount = operationLogService.getOperationCount(operationLogVO);
+            // 添加次数
+            operationLogVO.setOperaType(1);
+            Integer saveCount = operationLogService.getOperationCount(operationLogVO);
+            // 删除次数
+            operationLogVO.setOperaType(2);
+            Integer delCount = operationLogService.getOperationCount(operationLogVO);
+            // 编辑次数
+            operationLogVO.setOperaType(3);
+            Integer updateCount = operationLogService.getOperationCount(operationLogVO);
+            // 调光次数
+            operationLogVO.setOperaType(6);
+            Integer dimmingCount = operationLogService.getOperationCount(operationLogVO);
+            // 节目次数
+            operationLogVO.setOperaType(7);
+            Integer proCount = operationLogService.getOperationCount(operationLogVO);
+            // 广播次数
+            operationLogVO.setOperaType(8);
+            Integer broadcastCount = operationLogService.getOperationCount(operationLogVO);
+            // 喊话次数
+            operationLogVO.setOperaType(9);
+            Integer emCount = operationLogService.getOperationCount(operationLogVO);
+            // 充电次数
+            operationDataVO.setChargeCount(0);
+            operationDataVO.setLoginCount(loginCount);
+            operationDataVO.setSaveCount(saveCount);
+            operationDataVO.setDelCount(delCount);
+            operationDataVO.setUpdateCount(updateCount);
+            operationDataVO.setDimmingCount(dimmingCount);
+            operationDataVO.setProCount(proCount);
+            operationDataVO.setBroadcastCount(broadcastCount);
+            operationDataVO.setEmCount(emCount);
+            operationDataVO.setDataType("operationStatistics");
+        } else if (type == 3) { // 运维日志
+            OperationLogVO operationLogVO = new OperationLogVO();
+            operationLogVO.setRole(userDTO.getRole());
+            operationLogVO.setUserId(userDTO.getId());
+            List<OperationLogDTO> logList = operationLogService.getLessOperationLogList(operationLogVO);
+            operationDataVO.setDataType("operationLog");
+            operationDataVO.setList(logList);
+        } else if (type == 4) { // 最新故障
+            AllAlarmInfoLogVO allAlarmInfoLogVO = new AllAlarmInfoLogVO();
+            allAlarmInfoLogVO.setAreaId(areaId);
+            allAlarmInfoLogVO.setSectionId(sectionId);
+            allAlarmInfoLogVO.setSectionList(toolUtils.getSectionList(request));
+            List<AllAlarmInfoLogDTO> list = allAlarmInfoLogService.getLessLampAlarmInfoList(allAlarmInfoLogVO);
+            operationDataVO.setDataType("lampPoleAlarmLog");
+            operationDataVO.setList(list);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,operationDataVO);
+    }
 }

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

@@ -49,6 +49,8 @@ public interface AllAlarmInfoLogDao {
 
     List<AllAlarmInfoLogDTO> getLampAlarmInfoList(AllAlarmInfoLogVO vo);
 
+    List<AllAlarmInfoLogDTO> getLessLampAlarmInfoList(AllAlarmInfoLogVO vo);
+
     Integer getOneLampPoleAlarmTotal(@Param("lampPoleId") Integer lampPoleId);
 
     List<AllAlarmInfoLogDTO> getOneLampPoleAlarmList(@Param("lampPoleId") Integer lampPoleId);

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

@@ -38,6 +38,8 @@ public interface LampPoleDao {
     void changeLampPoleLocationById(LampPoleDTO dto);
     LampPoleDTO getLampPoleDTOById(@Param("id") Integer id);
     Integer getLampPoleAlarmTotal(LampPoleVO vo);
+    Integer getLampPoleAlarmStatusTotal(LampPoleVO vo);
+    Integer getLampPoleOfDevAlarmTotal(LampPoleVO vo);
     List<LampPoleDTO> getAlarmLampPoleList(LampPoleVO vo);
     Integer getLampPoleLightCount(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleLightList(LampPoleVO vo);

+ 19 - 0
src/main/java/com/welampiot/dao/OnlineLogDao.java

@@ -0,0 +1,19 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.OnlineLogDTO;
+import com.welampiot.vo.OnlineLogVO;
+
+import java.util.List;
+
+/**
+ * ClassName: OnlineLogDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/9/13 - 11:23
+ * @Version: v1.0
+ */
+public interface OnlineLogDao {
+    List<OnlineLogDTO> getOnlineLogList(OnlineLogVO vo);
+}

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

@@ -24,4 +24,10 @@ public interface OperationLogDao {
     List<OperationLogDTO> getNewOperationLogList(OperationLogVO vo);
 
     List<OperationLogDTO> getLessOperationLogList(OperationLogVO vo);
+
+    Integer getDayLoginCount(@Param("role") Integer role, @Param("userid") Integer userid);
+
+    Integer getDayOptCount(@Param("role") Integer role, @Param("userid") Integer userid);
+
+    Integer getOperationCount(OperationLogVO vo);
 }

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

@@ -38,4 +38,5 @@ public interface UserDao {
     UserDTO getPrivilegeList(@Param("username") String username);
     UserDTO getZoneListByUserid(@Param("id") Integer id);
     List<UserDTO> getReviewerList();
+    Integer getUserOnlineCount();
 }

+ 25 - 0
src/main/java/com/welampiot/dto/OnlineLogDTO.java

@@ -0,0 +1,25 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: OnlineLogDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/9/13 - 11:14
+ * @Version: v1.0
+ */
+@Data
+public class OnlineLogDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    private Integer onlineCount; // 在线人数
+
+    private String updateTime; // 更新时间
+}

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

@@ -51,4 +51,6 @@ public interface AllAlarmInfoLogService {
     Integer getOneLampPoleAlarmTotal(Integer lampPoleId);
 
     List<AllAlarmInfoLogDTO> getOneLampPoleAlarmList(Integer lampPoleId);
+
+    List<AllAlarmInfoLogDTO> getLessLampAlarmInfoList(AllAlarmInfoLogVO vo);
 }

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

@@ -28,6 +28,8 @@ public interface LampPoleService {
     void changeLampPoleLocationById(LampPoleDTO dto);
     LampPoleDTO getLampPoleDTOById(Integer id);
     Integer getLampPoleAlarmTotal(LampPoleVO vo);
+    Integer getLampPoleAlarmStatusTotal(LampPoleVO vo);
+    Integer getLampPoleOfDevAlarmTotal(LampPoleVO vo);
     List<LampPoleDTO> getAlarmLampPoleList(LampPoleVO vo);
     Integer getLampPoleLightCount(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleLightList(LampPoleVO vo);

+ 19 - 0
src/main/java/com/welampiot/service/OnlineLogService.java

@@ -0,0 +1,19 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.OnlineLogDTO;
+import com.welampiot.vo.OnlineLogVO;
+
+import java.util.List;
+
+/**
+ * ClassName: OnlineLogService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/9/13 - 11:27
+ * @Version: v1.0
+ */
+public interface OnlineLogService {
+    List<OnlineLogDTO> getOnlineLogList(OnlineLogVO vo);
+}

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

@@ -16,4 +16,10 @@ public interface OperationLogService {
     int add(OperationLogDTO operationLogDTO);
     List<OperationLogDTO> getNewOperationLogList(OperationLogVO vo);
     List<OperationLogDTO> getLessOperationLogList(OperationLogVO vo);
+
+    Integer getDayLoginCount(Integer role, Integer userid);
+
+    Integer getDayOptCount(Integer role, Integer userid);
+
+    Integer getOperationCount(OperationLogVO vo);
 }

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

@@ -37,4 +37,5 @@ public interface UserService {
     UserDTO getPrivilegeList(String username);
     UserDTO getZoneListByUserid(Integer id);
     List<UserDTO> getReviewerList();
+    Integer getUserOnlineCount();
 }

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

@@ -207,4 +207,9 @@ public class AllAlarmInfoLogServiceImpl implements AllAlarmInfoLogService {
     public List<AllAlarmInfoLogDTO> getOneLampPoleAlarmList(Integer lampPoleId) {
         return allAlarmInfoLogDao.getOneLampPoleAlarmList(lampPoleId);
     }
+
+    @Override
+    public List<AllAlarmInfoLogDTO> getLessLampAlarmInfoList(AllAlarmInfoLogVO vo) {
+        return allAlarmInfoLogDao.getLessLampAlarmInfoList(vo);
+    }
 }

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

@@ -474,6 +474,16 @@ public class LampPoleServiceImpl implements LampPoleService {
         return lampPoleDao.getLampPoleAlarmTotal(vo);
     }
 
+    @Override
+    public Integer getLampPoleAlarmStatusTotal(LampPoleVO vo) {
+        return lampPoleDao.getLampPoleAlarmStatusTotal(vo);
+    }
+
+    @Override
+    public Integer getLampPoleOfDevAlarmTotal(LampPoleVO vo) {
+        return lampPoleDao.getLampPoleOfDevAlarmTotal(vo);
+    }
+
     @Override
     public List<LampPoleDTO> getAlarmLampPoleList(LampPoleVO vo) {
         return lampPoleDao.getAlarmLampPoleList(vo);

+ 30 - 0
src/main/java/com/welampiot/service/impl/OnlineLogServiceImpl.java

@@ -0,0 +1,30 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.OnlineLogDao;
+import com.welampiot.dto.OnlineLogDTO;
+import com.welampiot.service.OnlineLogService;
+import com.welampiot.vo.OnlineLogVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: OnlineLogServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/9/13 - 11:28
+ * @Version: v1.0
+ */
+@Service
+public class OnlineLogServiceImpl implements OnlineLogService {
+    @Autowired
+    private OnlineLogDao onlineLogDao;
+
+    @Override
+    public List<OnlineLogDTO> getOnlineLogList(OnlineLogVO vo) {
+        return onlineLogDao.getOnlineLogList(vo);
+    }
+}

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

@@ -125,4 +125,19 @@ public class OperationLogServiceImpl implements OperationLogService {
     public List<OperationLogDTO> getLessOperationLogList(OperationLogVO vo) {
         return operationLogDao.getLessOperationLogList(vo);
     }
+
+    @Override
+    public Integer getDayLoginCount(Integer role, Integer userid) {
+        return operationLogDao.getDayLoginCount(role, userid);
+    }
+
+    @Override
+    public Integer getDayOptCount(Integer role, Integer userid) {
+        return operationLogDao.getDayOptCount(role, userid);
+    }
+
+    @Override
+    public Integer getOperationCount(OperationLogVO vo) {
+        return operationLogDao.getOperationCount(vo);
+    }
 }

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

@@ -169,4 +169,9 @@ public class UserServiceImpl implements UserService {
     public List<UserDTO> getReviewerList() {
         return userDao.getReviewerList();
     }
+
+    @Override
+    public Integer getUserOnlineCount() {
+        return userDao.getUserOnlineCount();
+    }
 }

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

@@ -29,7 +29,7 @@ public class LampVO implements Serializable {
 
     private Integer sectionId;
 
-    private List<Integer> sectionList;
+    private List<?> sectionList;
 
     private Integer online;
 

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

@@ -0,0 +1,23 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: OnlineLogVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/9/13 - 11:24
+ * @Version: v1.0
+ */
+@Data
+public class OnlineLogVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String startDate;
+
+    private String endDate;
+}

+ 32 - 0
src/main/java/com/welampiot/vo/OperationDataVO.java

@@ -3,6 +3,7 @@ package com.welampiot.vo;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * ClassName: OperationDataVO
@@ -21,4 +22,35 @@ public class OperationDataVO implements Serializable {
     private Integer data3;
     private Integer data4;
     private Integer data5;
+
+    private String dataType;
+    private Integer onlineCount; // 当前在线人数
+    private Integer dayLoginCount; // 当天登录次数
+    private Integer dayOptCount; // 当天操作次数
+    private List<Object> dateList;
+    private List<Object> dataList;
+
+    private Integer alarming; // 故障中
+    private Integer repairing; // 维修中
+    private Integer processed; // 已处理
+    private Integer lampAlarm; // 路灯故障数
+    private Integer videoAlarm; // 摄像头数
+    private Integer wifiAlarm; // wifi数
+    private Integer ledAlarm; // 屏幕故障数
+    private Integer emAlarm; // 一键报警故障数
+    private Integer chargeAlarm; // 充电桩故障数
+    private Integer weatherAlarm; // 气象站故障数
+    private Integer broadcastAlarm; // 广播音柱故障数
+
+    private Integer loginCount; // 登录次数
+    private Integer saveCount; // 添加次数
+    private Integer delCount; // 删除次数
+    private Integer updateCount; // 编辑次数
+    private Integer dimmingCount; // 调光次数
+    private Integer proCount; // 节目次数
+    private Integer broadcastCount; // 广播次数
+    private Integer emCount; // 喊话次数
+    private Integer chargeCount; // 充电次数
+
+    private List<?> list;
 }

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

@@ -9,6 +9,8 @@ import java.util.List;
 public class OperationLogVO {
     private List userIdList;
     private Integer operaType;
+    private String startDate;
+    private String endDate;
     private Integer devType;
     private Integer version;
     private Integer limit;

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

@@ -863,9 +863,12 @@
         select
             a.updatetime as updateTime,
             lp.name,
+            s.name as section,
+            a.status,
             a.stralarmtype as strAlarmType
         from all_alarm_info_log a
         left join lamp_pole lp on a.lampid = lp.id
+        left join section s on lp.sectionid = s.id
         where a.devType = 1
         <if test="sectionList != null and !sectionList.isEmpty()">
             and lp.sectionId in
@@ -873,10 +876,43 @@
                 #{item}
             </foreach>
         </if>
+        <if test="areaId != null and areaId != 0">
+            and lp.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and lp.sectionid = #{sectionId}
+        </if>
         order by a.updatetime desc
         limit 100
     </select>
 
+    <select id="getLessLampAlarmInfoList" resultType="AllAlarmInfoLogDTO">
+        select
+        a.updatetime as updateTime,
+        lp.name,
+        s.name as section,
+        a.status,
+        a.stralarmtype as strAlarmType
+        from all_alarm_info_log a
+        left join lamp_pole lp on a.lampid = lp.id
+        left join section s on lp.sectionid = s.id
+        where a.devType = 1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and lp.sectionId in
+            <foreach collection="sectionList" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="areaId != null and areaId != 0">
+            and lp.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and lp.sectionid = #{sectionId}
+        </if>
+        order by a.updatetime desc
+        limit 50
+    </select>
+
     <!-- 单个灯杆故障次数 -->
     <select id="getOneLampPoleAlarmTotal" resultType="Integer">
         select count(*)

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

@@ -623,6 +623,117 @@
               ORDER BY maxTime) t2
         WHERE t1.id = t2.alarmId AND t1.`status` != 2
     </select>
+
+    <!--  获取灯杆故障(故障中、处理中、已处理)数  -->
+    <select id="getLampPoleAlarmStatusTotal" resultType="Integer">
+        SELECT
+        count(*) AS total
+        FROM all_alarm_info_log t1,
+        (SELECT
+        l.id,
+        MAX(a.id) AS alarmId,
+        MAX(a.updatetime) as maxTime,
+        a.lampid,
+        a.`status`,
+        a.devType
+        FROM
+        lamp_pole l
+        LEFT JOIN
+        all_alarm_info_log a
+        ON a.lampid = l.id
+        WHERE
+        a.devType = 1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            AND l.sectionid IN
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </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>
+        GROUP BY
+        a.lampid
+        ORDER BY maxTime) t2
+        WHERE t1.id = t2.alarmId
+        <choose>
+            <when test="type == 0">
+                AND t1.`status` = 0
+            </when>
+            <when test="type == 1">
+                AND t1.`status` = 1
+            </when>
+            <when test="type == 2">
+                AND t1.`status` = 2
+            </when>
+        </choose>
+    </select>
+
+    <!--  获取灯杆上绑定的设备故障数  -->
+    <select id="getLampPoleOfDevAlarmTotal" resultType="Integer">
+        SELECT
+        count(*) AS total
+        FROM all_alarm_info_log t1,
+        (SELECT
+        l.id,
+        MAX(a.id) AS alarmId,
+        MAX(a.updatetime) as maxTime,
+        a.lampid,
+        a.`status`,
+        a.devType
+        FROM
+        lamp_pole l
+        LEFT JOIN
+        all_alarm_info_log a
+        ON a.lampid = l.id
+        WHERE
+        a.devType = 1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            AND l.sectionid IN
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </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>
+        GROUP BY
+        a.lampid
+        ORDER BY maxTime) t2
+        WHERE t1.id = t2.alarmId AND t1.status != 2
+        <choose>
+            <when test="type == 0">
+                AND t1.`dType` = 0
+            </when>
+            <when test="type == 1">
+                AND t1.`dType` = 1
+            </when>
+            <when test="type == 2">
+                AND t1.`dType` = 2
+            </when>
+            <when test="type == 4">
+                AND t1.`dType` = 4
+            </when>
+            <when test="type == 5">
+                AND t1.`dType` = 5
+            </when>
+            <when test="type == 6">
+                AND t1.`dType` = 6
+            </when>
+            <when test="type == 7">
+                AND t1.`dType` = 7
+            </when>
+            <when test="type == 9">
+                AND t1.`dType` = 9
+            </when>
+        </choose>
+    </select>
     
     <!--  获取灯杆故障列表  -->
     <select id="getAlarmLampPoleList" resultType="LampPoleDTO">

+ 12 - 0
src/main/resources/mapper/OnlineLogMapper.xml

@@ -0,0 +1,12 @@
+<?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.OnlineLogDao">
+
+    <select id="getOnlineLogList" resultType="OnlineLogDTO">
+        select o.online_count as onlineCount,o.updatetime as updateTime
+        from online_log o
+        where o.updatetime >= #{startDate}
+        and o.updatetime <![CDATA[ <= ]]> #{endDate}
+    </select>
+
+</mapper>

+ 60 - 1
src/main/resources/mapper/OperationLogMapper.xml

@@ -160,7 +160,7 @@
     </select>
 
     <select id="getLessOperationLogList" resultType="com.welampiot.dto.OperationLogDTO" parameterType="com.welampiot.vo.OperationLogVO">
-        select o.time as updateTime,o.remark as logInfo,o.acount as `name`
+        select o.time as updateTime,o.remark as logInfo,o.acount as `name`,o.deviceName,o.operaType
         from operation_log o
         where 1=1
         <if test="role != 1">
@@ -170,4 +170,63 @@
         limit 50
     </select>
 
+    <!-- 当天登录次数 -->
+    <select id="getDayLoginCount" resultType="Integer">
+        select count(*)
+        from operation_log o
+        where o.operaType = 0 and date(o.time) = curdate()
+        <if test="role != 1">
+            and o.userid = #{userid}
+        </if>
+    </select>
+
+    <!-- 当天操作次数 -->
+    <select id="getDayOptCount" resultType="Integer">
+        select count(*)
+        from operation_log o
+        where o.operaType in (1,2,3,4) and date(o.time) = curdate()
+        <if test="role != 1">
+            and o.userid = #{userid}
+        </if>
+    </select>
+
+    <!-- 获取日志操作次数 -->
+    <select id="getOperationCount" resultType="Integer">
+        select count(*)
+        from operation_log o
+        where o.time <![CDATA[ <= ]]> #{endDate}
+        <if test="role != 1">
+            and o.userid = #{userId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            and o.time >= #{startDate}
+        </if>
+        <choose>
+            <when test="operaType == 0">
+                and o.operaType = 0
+            </when>
+            <when test="operaType == 1">
+                and o.operaType = 1
+            </when>
+            <when test="operaType == 2">
+                and o.operaType = 2
+            </when>
+            <when test="operaType == 3">
+                and o.operaType = 3
+            </when>
+            <when test="operaType == 6">
+                and o.remark like '%调光%'
+            </when>
+            <when test="operaType == 7">
+                and o.remark like '%节目%'
+            </when>
+            <when test="operaType == 8">
+                and o.remark like '%广播%'
+            </when>
+            <when test="operaType == 9">
+                and o.remark like '%报警%'
+            </when>
+        </choose>
+    </select>
+
 </mapper>

+ 7 - 0
src/main/resources/mapper/UserMapper.xml

@@ -356,5 +356,12 @@
         from user u
         where u.is_examine = 1
     </select>
+
+    <!-- 当前用户在线人数 -->
+    <select id="getUserOnlineCount" resultType="Integer">
+        select count(*)
+        from `user` u
+        where u.online = 1
+    </select>
     
 </mapper>