|
@@ -6,10 +6,7 @@ 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 com.welampiot.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -64,6 +61,12 @@ public class BigScreenController {
|
|
|
private WifiService wifiService;
|
|
|
@Autowired
|
|
|
private WifiInfoLogService wifiInfoLogService;
|
|
|
+ @Autowired
|
|
|
+ private EmergencyService emergencyService;
|
|
|
+ @Autowired
|
|
|
+ private BroadcastService broadcastService;
|
|
|
+ @Autowired
|
|
|
+ private AllAlarmInfoLogService allAlarmInfoLogService;
|
|
|
|
|
|
/**
|
|
|
* 用电量统计
|
|
@@ -370,4 +373,276 @@ public class BigScreenController {
|
|
|
lampPoleDataVO.setWifiData(wifi);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDataVO);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏灯杆视屏列表
|
|
|
+ * @param request sectionList
|
|
|
+ * @return 灯杆视屏列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/videoList", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> videoList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer page = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer count = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ if (page == 0) page = 1;
|
|
|
+ if (count == 0) count = 16;
|
|
|
+ VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
|
|
|
+ videoMonitorVO.setLimit(count * (page - 1));
|
|
|
+ videoMonitorVO.setOffset(count);
|
|
|
+ videoMonitorVO.setAreaId(areaId);
|
|
|
+ videoMonitorVO.setSectionId(sectionId);
|
|
|
+ videoMonitorVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ List<VideoMonitorDTO> list = videoMonitorService.getVideoListByVO(videoMonitorVO);
|
|
|
+ Integer videoTotal = videoMonitorService.getVideoTotal(videoMonitorVO);
|
|
|
+ VideoMonitorVO videoMonitorVO1 = new VideoMonitorVO();
|
|
|
+ videoMonitorVO1.setList(list);
|
|
|
+ videoMonitorVO1.setTotal(videoTotal);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorVO1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏视屏监控模块数据
|
|
|
+ * @param request 灯杆id
|
|
|
+ * @return 视屏监控模块数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/lampPoleVideoData", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> lampPoleVideoData(HttpServletRequest request) {
|
|
|
+ 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);
|
|
|
+ // 监控数据
|
|
|
+ LampPoleDataVO lampPoleDataVO = new LampPoleDataVO();
|
|
|
+ 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);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDataVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏灯杆气象站列表
|
|
|
+ * @param request sectionList
|
|
|
+ * @return 灯杆气象站列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/weatherList", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> weatherList(HttpServletRequest request) throws Exception {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer page = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer count = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ if (page == 0) page = 1;
|
|
|
+ if (count == 0) count = 16;
|
|
|
+ EnvmonitorVO envmonitorVO = new EnvmonitorVO();
|
|
|
+ envmonitorVO.setPage(count * (page - 1));
|
|
|
+ envmonitorVO.setCount(count);
|
|
|
+ envmonitorVO.setAreaId(areaId);
|
|
|
+ envmonitorVO.setSectionId(sectionId);
|
|
|
+ envmonitorVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ List<EnvmonitorDTO> list = envmonitorService.getEnvmonitorListByVO(envmonitorVO);
|
|
|
+ for (EnvmonitorDTO dto : list) {
|
|
|
+ if (dto.getProvince() == null) dto.setProvince("");
|
|
|
+ if (dto.getCity() == null) dto.setCity("");
|
|
|
+ if (dto.getArea() == null) dto.setArea("");
|
|
|
+ if (dto.getSection() == null) dto.setSection("");
|
|
|
+ dto.setLocation(dto.getProvince() + dto.getCity() + dto.getArea() + dto.getSection());
|
|
|
+ Double longitude = dto.getLongitude();
|
|
|
+ Double latitude = dto.getLatitude();
|
|
|
+ if (longitude != null && latitude != null) {
|
|
|
+ WeatherDTO weatherInfo = WeatherUtil.getNowWeatherInfo(longitude.toString(), latitude.toString());
|
|
|
+ dto.setWeatherData(weatherInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Integer total = envmonitorService.getEnvmonitorTotalByVO(envmonitorVO);
|
|
|
+ EnvmonitorVO envmonitorVO1 = new EnvmonitorVO();
|
|
|
+ envmonitorVO1.setList(list);
|
|
|
+ envmonitorVO1.setTotal(total);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,envmonitorVO1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏充电桩列表
|
|
|
+ * @param request sectionList
|
|
|
+ * @return 充电桩列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/chargeList", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> chargeList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer page = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer count = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ if (page == 0) page = 1;
|
|
|
+ if (count == 0) count = 16;
|
|
|
+ ChargeDTO chargeDTO = new ChargeDTO();
|
|
|
+ chargeDTO.setVersion(version);
|
|
|
+ chargeDTO.setPage(count * (page - 1));
|
|
|
+ chargeDTO.setCount(count);
|
|
|
+ chargeDTO.setAreaId(areaId);
|
|
|
+ chargeDTO.setSectionId(sectionId);
|
|
|
+ chargeDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ List<ChargeDTO> list = chargeService.getChargeListByDTO(chargeDTO);
|
|
|
+ Integer total = chargeService.getChargeTotalByDTO(chargeDTO);
|
|
|
+ ChargeVO chargeVO = new ChargeVO();
|
|
|
+ chargeVO.setList(list);
|
|
|
+ chargeVO.setTotal(total);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,chargeVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏2数据
|
|
|
+ * @param request 灯杆id
|
|
|
+ * @return 灯杆数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/lampPoleData2", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> lampPoleData2(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);
|
|
|
+ long startTime = System.currentTimeMillis() - 24L * 3600 * 1000 * 29;
|
|
|
+ long endTime = System.currentTimeMillis();
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
+ String startDate = simpleDateFormat.format(startTime);
|
|
|
+ String endDate = simpleDateFormat.format(endTime);
|
|
|
+ LampInfoCacheByDayDTO dto = new LampInfoCacheByDayDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setStartDate(startDate);
|
|
|
+ dto.setEndDate(endDate);
|
|
|
+
|
|
|
+ List<Object> dateList = new ArrayList<>();
|
|
|
+ List<Object> eleList = new ArrayList<>();
|
|
|
+ List<Object> saveList = 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)));
|
|
|
+ eleList.add(0);
|
|
|
+ saveList.add(0);
|
|
|
+ timeT += 3600 * 1000 * 24;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<LampInfoCacheByDayDTO> list = lampInfoCacheByDayService.getNearSaveAndEleList(dto);
|
|
|
+ for (LampInfoCacheByDayDTO dayDTO : list) {
|
|
|
+ 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 (dayDTO.getConSum() != null && !dayDTO.getConSum().equals("0") && integer != null) {
|
|
|
+ Float ele = Float.parseFloat(dto.getConSum());
|
|
|
+ eleList.set(integer,Float.parseFloat(decimalFormat.format(ele)));
|
|
|
+ }
|
|
|
+ // 省电量列表
|
|
|
+ if (dayDTO.getPowerSave() != null && !dayDTO.getPowerSave().equals("0") && integer != null) {
|
|
|
+ Float save = Float.parseFloat(dto.getPowerSave());
|
|
|
+ saveList.set(integer,Float.parseFloat(decimalFormat.format(save)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lampInfoDTO.setUpdateTimeList(dateList);
|
|
|
+ lampInfoDTO.setPowerSaveList(saveList);
|
|
|
+ lampInfoDTO.setEnergyList(eleList);
|
|
|
+ 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) {
|
|
|
+ WeatherDTO weatherInfo = WeatherUtil.getNowWeatherInfo(longitude.toString(), latitude.toString());
|
|
|
+ envmonitor.setWeatherData(weatherInfo);
|
|
|
+ }
|
|
|
+ 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("");
|
|
|
+ lampPoleDataVO.setVideoData(video);
|
|
|
+ // 充电桩数据
|
|
|
+ ChargeDTO chargeDTO = chargeService.getChargeInfoByLampPoleId(lampPoleId);
|
|
|
+ lampPoleDataVO.setChargeData(chargeDTO);
|
|
|
+ // wifi数据
|
|
|
+ WifiDTO wifi = wifiService.getWifiByLampPoleId(lampPoleId);
|
|
|
+ lampPoleDataVO.setWifiData(wifi);
|
|
|
+ // 报警数据
|
|
|
+ EmergencyDTO emergency = emergencyService.getEmergencyByLampPoleId(lampPoleId);
|
|
|
+ lampPoleDataVO.setEmerData(emergency);
|
|
|
+ // 广播数据
|
|
|
+ BroadcastDTO broadcastDTO = broadcastService.getBroadcastDTOByLampPoleId(lampPoleId);
|
|
|
+ lampPoleDataVO.setBroadcastData(broadcastDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDataVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 灯杆大屏运维管理
|
|
|
+ * @param request 灯杆id
|
|
|
+ * @return 运维管理
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/operation", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> operation(HttpServletRequest request) throws ParseException {
|
|
|
+ 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);
|
|
|
+ String usedEnergyTotal = lampInfoDTO.getUsedEnergyTotal(); // 累计用电量
|
|
|
+ String createTime = lampInfoDTO.getCreateTime();
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ long startTime = format.parse(createTime).getTime();
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long dayNumber = (now - startTime) / (1000 * 3600 * 24); // 运行天数
|
|
|
+ VideoMonitorDTO video = videoMonitorService.getVideoMonitorByLampPoleId(lampPoleId);
|
|
|
+ Integer carTotal,peopleTotal;
|
|
|
+ if (video != null) { // 总人流量,总车流量
|
|
|
+ carTotal = video.getCarCountTotal();
|
|
|
+ peopleTotal = video.getPeopleCountTotal();
|
|
|
+ } else {
|
|
|
+ carTotal = 0;
|
|
|
+ peopleTotal = 0;
|
|
|
+ }
|
|
|
+ WifiDTO wifi = wifiService.getWifiByLampPoleId(lampPoleId);
|
|
|
+ Integer wifiTotal;
|
|
|
+ if (wifi != null) { // 总WiFi连接次数
|
|
|
+ wifiTotal = wifi.getDeviceCount();
|
|
|
+ } else {
|
|
|
+ wifiTotal = 0;
|
|
|
+ }
|
|
|
+ Integer alarmTotal = allAlarmInfoLogService.getOneLampPoleAlarmTotal(lampPoleId); // 故障次数
|
|
|
+ List<AllAlarmInfoLogDTO> alarmList = allAlarmInfoLogService.getOneLampPoleAlarmList(lampPoleId);
|
|
|
+ LampPoleInfoVO lampPoleInfoVO = new LampPoleInfoVO();
|
|
|
+ lampPoleInfoVO.setRunDay((int) dayNumber);
|
|
|
+ lampPoleInfoVO.setTotalConsumption(usedEnergyTotal);
|
|
|
+ lampPoleInfoVO.setTotalFaultCount(alarmTotal);
|
|
|
+ lampPoleInfoVO.setTotalPeopleCount(peopleTotal);
|
|
|
+ lampPoleInfoVO.setTotalCarCount(carTotal);
|
|
|
+ lampPoleInfoVO.setTotalWifiLinkCount(wifiTotal);
|
|
|
+ lampPoleInfoVO.setAlarmList(alarmList);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleInfoVO);
|
|
|
+ }
|
|
|
}
|