|
@@ -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);
|
|
|
+ }
|
|
|
}
|