|
@@ -2,13 +2,14 @@ package com.welampiot.controller;
|
|
|
|
|
|
import com.welampiot.common.BaseResult;
|
|
|
import com.welampiot.common.InterfaceResultEnum;
|
|
|
-import com.welampiot.dto.LampInfoCacheByDayDTO;
|
|
|
-import com.welampiot.dto.LampInfoDTO;
|
|
|
-import com.welampiot.service.LampInfoCacheByDayService;
|
|
|
-import com.welampiot.service.LampService;
|
|
|
+import com.welampiot.dto.*;
|
|
|
+import com.welampiot.service.*;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
+import com.welampiot.utils.WeatherUtil;
|
|
|
import com.welampiot.vo.LampInfoCacheByDayVO;
|
|
|
import com.welampiot.vo.LampInfoVO;
|
|
|
+import com.welampiot.vo.LampPoleDataVO;
|
|
|
+import com.welampiot.vo.LampPoleInfoVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -43,6 +44,26 @@ public class BigScreenController {
|
|
|
private LampInfoCacheByDayService lampInfoCacheByDayService;
|
|
|
@Autowired
|
|
|
private LampService lampService;
|
|
|
+ @Autowired
|
|
|
+ private LampPoleService lampPoleService;
|
|
|
+ @Autowired
|
|
|
+ private EnvmonitorService envmonitorService;
|
|
|
+ @Autowired
|
|
|
+ private ScreenService screenService;
|
|
|
+ @Autowired
|
|
|
+ private VideoMonitorService videoMonitorService;
|
|
|
+ @Autowired
|
|
|
+ private VideoCarService videoCarService;
|
|
|
+ @Autowired
|
|
|
+ private VideoFaceService videoFaceService;
|
|
|
+ @Autowired
|
|
|
+ private TrailInfoService trailInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ChargeService chargeService;
|
|
|
+ @Autowired
|
|
|
+ private WifiService wifiService;
|
|
|
+ @Autowired
|
|
|
+ private WifiInfoLogService wifiInfoLogService;
|
|
|
|
|
|
/**
|
|
|
* 用电量统计
|
|
@@ -216,4 +237,137 @@ public class BigScreenController {
|
|
|
lampInfoVO.setValue(valueList);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoVO);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏统计数据
|
|
|
+ * @param request sectionList
|
|
|
+ * @return 灯杆数量统计
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/lampPoleTotalData", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> lampPoleTotalData(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ LampPoleDTO lampPoleDTO = new LampPoleDTO();
|
|
|
+ lampPoleDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ LampInfoDTO lampInfoDTO = new LampInfoDTO();
|
|
|
+ lampInfoDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ LampPoleInfoVO lampPoleData = lampPoleService.getLampPoleBigScreenCount(lampPoleDTO, lampInfoDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleData);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏灯杆数据
|
|
|
+ * @param request 灯杆id
|
|
|
+ * @return 灯杆数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/lampPoleData", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> lampPoleData(HttpServletRequest request) throws Exception {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer lampPoleId = (Integer) toolUtils.getRequestContent(request,"lampPoleId",1);
|
|
|
+ if (lampPoleId == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ // 照明数据
|
|
|
+ LampInfoDTO lampInfoDTO = lampService.getLampOfLampPoleById(lampPoleId, 0);
|
|
|
+ LampPoleDataVO lampPoleDataVO = new LampPoleDataVO();
|
|
|
+ lampPoleDataVO.setLampData(lampInfoDTO);
|
|
|
+ // 气象数据
|
|
|
+ EnvmonitorDTO envmonitor = envmonitorService.getEnvmonitorByLampPoleId(lampPoleId);
|
|
|
+ Double longitude = null,latitude = null;
|
|
|
+ if (envmonitor != null) {
|
|
|
+ longitude = envmonitor.getLongitude();
|
|
|
+ latitude = envmonitor.getLatitude();
|
|
|
+ }
|
|
|
+ if (longitude != null && latitude != null) {
|
|
|
+ List<WeatherDTO> weatherList = WeatherUtil.getNearWeatherInfo(longitude.toString(), latitude.toString());
|
|
|
+ envmonitor.setWeatherList(weatherList);
|
|
|
+ }
|
|
|
+ lampPoleDataVO.setWeatherData(envmonitor);
|
|
|
+ // 屏幕数据
|
|
|
+ ScreenDTO screen = screenService.getScreenByLampPoleId(lampPoleId);
|
|
|
+ if (screen != null) screen.setName(screen.getPlay());
|
|
|
+ lampPoleDataVO.setScreenData(screen);
|
|
|
+ // 监控数据
|
|
|
+ VideoMonitorDTO video = videoMonitorService.getVideoMonitorByLampPoleId(lampPoleId);
|
|
|
+ video.setVideoPath("");
|
|
|
+ video.setVideoPathHd("");
|
|
|
+ VideoCarDTO videoCar = videoCarService.getVideoCarByVideoId(video.getId());
|
|
|
+ if (videoCar != null) video.setCarImage(videoCar.getImage());
|
|
|
+ List<VideoCarDTO> carList = videoCarService.getVideoCarListByVideoId(video.getId());
|
|
|
+ video.setCarList(carList); // 车牌识别列表
|
|
|
+ List<VideoFaceDTO> videoFace = videoFaceService.getVideoFaceListByVideoId(lampPoleId);
|
|
|
+ video.setFaceList(videoFace); // 人脸识别列表
|
|
|
+ List<TrailInfoDTO> trailList = trailInfoService.getTrailInfoListByVideoId(video.getId());
|
|
|
+ video.setTrailList(trailList); // 轨迹列表
|
|
|
+ List<TrailInfoDTO> smailList = trailInfoService.getSmailListByVideoId(video.getId());
|
|
|
+ video.setSmailList(smailList); // 相似度列表
|
|
|
+ lampPoleDataVO.setVideoData(video);
|
|
|
+ // 充电桩数据
|
|
|
+ ChargeDTO chargeDTO = chargeService.getChargeInfoByLampPoleId(lampPoleId);
|
|
|
+ lampPoleDataVO.setChargeData(chargeDTO);
|
|
|
+ // wifi数据
|
|
|
+ WifiDTO wifi = wifiService.getWifiByLampPoleId(lampPoleId);
|
|
|
+ if (wifi.getFlow() != null) {
|
|
|
+ Float flow = wifi.getFlow();
|
|
|
+ if (flow < 1024) {
|
|
|
+ wifi.setType(0);
|
|
|
+ } else if (1024 <= flow && flow < 1024 * 1024) {
|
|
|
+ wifi.setType(1);
|
|
|
+ flow = flow / 1024;
|
|
|
+ wifi.setFlow(flow);
|
|
|
+ } else if (1024 * 1024 <= flow) {
|
|
|
+ wifi.setType(2);
|
|
|
+ flow = flow / (1024 * 1024);
|
|
|
+ wifi.setFlow(flow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 流量列表
|
|
|
+ List<Object> dateList = new ArrayList<>();
|
|
|
+ List<Object> flowList = new ArrayList<>();
|
|
|
+ long l = System.currentTimeMillis();
|
|
|
+ long startTime = l - 24 * 3600 * 1000 * 6;
|
|
|
+ HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
|
|
|
+ long timeT = startTime;
|
|
|
+ int i = 0;
|
|
|
+
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
|
|
|
+ SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ while (timeT <= l) {
|
|
|
+ objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)), i);
|
|
|
+ dateList.add(simpleDateFormat.format(new Date(timeT)));
|
|
|
+ flowList.add(0);
|
|
|
+ timeT += 3600 * 1000;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ int dayNumber = 1;
|
|
|
+ WifiInfoLogDTO wifiInfoLogDTO = new WifiInfoLogDTO();
|
|
|
+ wifiInfoLogDTO.setDayNum(7);
|
|
|
+ wifiInfoLogDTO.setDayNumber(dayNumber);
|
|
|
+ wifiInfoLogDTO.setLampPoleId(lampPoleId);
|
|
|
+ List<WifiInfoLogDTO> wifiInfoLogList = wifiInfoLogService.getWifiStatisticsListByDTO(wifiInfoLogDTO);
|
|
|
+ for (WifiInfoLogDTO dto1 : wifiInfoLogList) {
|
|
|
+ Date date = new Date(simpleDateFormat2.parse(dto1.getUpdateTime()).getTime());
|
|
|
+ String s = simpleDateFormat.format(date);
|
|
|
+ long time = simpleDateFormat.parse(s).getTime();
|
|
|
+ String formatStart = simpleDateFormat.format(startTime);
|
|
|
+ startTime = simpleDateFormat.parse(formatStart).getTime();
|
|
|
+ long timespan = (time - startTime) / (3600 * 1000 * dayNumber);
|
|
|
+ long newTime = startTime + timespan * (3600 * 1000 * dayNumber);
|
|
|
+ date = new Date(newTime);
|
|
|
+ s = simpleDateFormat.format(date);
|
|
|
+ Integer integer = null;
|
|
|
+ if (objectObjectHashMap.containsKey(s)) {
|
|
|
+ integer = objectObjectHashMap.get(s);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dto1.getMinFlow() != null && !dto1.getMinFlow().equals("0") && integer != null &&
|
|
|
+ dto1.getMaxFlow() != null && !dto1.getMaxFlow().equals("0")) {
|
|
|
+ Float flow = Float.parseFloat(dto1.getMaxFlow()) - Float.parseFloat(dto1.getMinFlow());
|
|
|
+ flowList.set(integer,Float.parseFloat(decimalFormat.format(flow)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wifi.setDateList(dateList);
|
|
|
+ wifi.setFlowList(flowList);
|
|
|
+ lampPoleDataVO.setWifiData(wifi);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDataVO);
|
|
|
+ }
|
|
|
}
|