From cb888577b99892706860d2732785d22842aae9b0 Mon Sep 17 00:00:00 2001 From: 于紫祥_1901 <email@yuzixiang_1910> Date: Fri, 18 Sep 2020 15:14:34 +0800 Subject: [PATCH] 走行车update --- src/main/java/com/moral/controller/ScreenController.java | 101 +++++++++++++++++++++++++++++++++++++------------- 1 files changed, 75 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java index 2f5c9cd..547446e 100644 --- a/src/main/java/com/moral/controller/ScreenController.java +++ b/src/main/java/com/moral/controller/ScreenController.java @@ -34,26 +34,7 @@ import com.moral.entity.alarm.AlarmSensorLevel; import com.moral.entity.charts.DataSortCondition; import com.moral.entity.layout.RealTimeDeviceLayout; -import com.moral.service.AccountService; -import com.moral.service.AlarmConfigService; -import com.moral.service.AlarmDailyService; -import com.moral.service.AreaService; -import com.moral.service.DeviceService; -import com.moral.service.DeviceVersionService; -import com.moral.service.DictionaryDataService; -import com.moral.service.HangzhouAqiService; -import com.moral.service.HistoryDailyService; -import com.moral.service.HistoryHourlyService; -import com.moral.service.HistoryMinutelyService; -import com.moral.service.HistoryService; -import com.moral.service.MachineActivateService; -import com.moral.service.MonitorPointService; -import com.moral.service.OrganizationLayoutService; -import com.moral.service.OrganizationService; -import com.moral.service.QualityDailyService; -import com.moral.service.SensorService; -import com.moral.service.SensorUnitService; -import com.moral.service.WeatherService; +import com.moral.service.*; import com.moral.util.*; import com.rabbitmq.client.*; @@ -88,7 +69,6 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import org.xml.sax.InputSource; - import static com.moral.common.util.ResourceUtil.getValue; import static com.moral.common.util.WebUtils.getParametersStartingWith; import static java.util.Calendar.*; @@ -116,6 +96,9 @@ MonitorPointService monitorPointService; @Resource DeviceVersionService deviceVersionService; + + /* @Resource + HistorySpecialService historySpecialService;*/ /** * The screen service. @@ -175,6 +158,7 @@ @Resource private QualityDailyService qualityDailyService; + /** * Screen login. ������������ @@ -1500,13 +1484,15 @@ String startHour = st.substring(st.lastIndexOf("-") + 1); String startTime = startYearAndDay + " " + startHour + ":00:00"; String et = parameters.get("endTime").toString(); + String endYearAndDay = et.substring(0, st.lastIndexOf("-")); String endHour = et.substring(et.lastIndexOf("-") + 1); - int endHourValue = Integer.valueOf(endHour); + String endTime=endYearAndDay + " " + endHour + ":00:00"; + /* int endHourValue = Integer.valueOf(endHour); int startHourValue = Integer.valueOf(startHour); if (endHourValue <= startHourValue) { endHourValue = startHourValue + 1; } - String endTime = startYearAndDay + " " + endHourValue + ":00:00"; + String endTime = startYearAndDay + " " + endHourValue + ":00:00";*/ parameters.put("startTime", startTime); parameters.put("endTime", endTime); String mac = parameters.get("mac").toString(); @@ -1521,6 +1507,7 @@ params.put("sensorInfo", sensorList); params.put("sensorsMap", sensorsMap); String paramsJson = params.toJSONString(); + //System.out.println(paramsJson); model.addObject("carTrajectoryParams", paramsJson); model.setViewName("cartrajectory"); return model; @@ -1959,6 +1946,9 @@ if (mac!=null){ Device device=deviceService.byMacGetDevice(mac); List list1= LatLngTransformation.Convert_BD09_To_GCJ02(device.getLatitude(),device.getLongitude()); + if (device.getState()!=4+""){ + devMap.put("state",device.getState()); + } devMap.put("lat",list1.get(1)); devMap.put("lng",list1.get(0)); devMap.put("monitorPointId",device.getMonitorPointId()); @@ -1990,15 +1980,36 @@ mon=""+month; } String table="history_minutely_"+year+mon; - log.info(table); List list=deviceService.byMonitorIdGetDeviceAndWind(monitorPointId,time,table); return list; } + + //������������ + @GetMapping("/windAndDeviceDataByArea") + @ResponseBody + public List windAndDeviceDataByArea(String monitorPointId) { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.MINUTE, (calendar.get(Calendar.MINUTE) - 2)); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + String time = df.format(calendar.getTime())+":00"; + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH) + 1; + String mon; + if (month<10){ + mon="0"+month; + }else { + mon=""+month; + } + String table="history_minutely_"+year+mon; + List list=deviceService.byMonitorIdGetDeviceAndWindSpecial(monitorPointId,time,table); + return list; + } + @GetMapping("forecastO3") @ApiOperation(value = "���������������������������", notes = "���������������������������") @ApiImplicitParams(value = { @ApiImplicitParam(name = "monitorPointId", defaultValue = "1", value = "���������id", required = true, paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "time", value = "������(���������2020-03-19)", required = true, paramType = "query", dataType = "String")}) + @ApiImplicitParam(name = "time", value = "���6���(���������2020-03-19)", required = true, paramType = "query", dataType = "String")}) public ResultBean<List<Map<String, Object>>> getWeatherNextDayDataByRegion(HttpServletRequest request) throws Exception { Map<String, Object> parameters = getParametersStartingWith(request, null); List<Map<String, Object>> resultList = weatherService.getForecastAndReal(parameters); @@ -2006,7 +2017,7 @@ } @GetMapping("weatherData") - @ApiOperation(value = "������city���������������������������", notes = "������city���������������������������") + @ApiOperation(value = "������city���������������������������������", notes = "������city���������������������������������") @ApiImplicitParams(value = { @ApiImplicitParam(name = "city", value = "���������", required = true, paramType = "query", dataType = "String"), @ApiImplicitParam(name = "time", value = "������(���������2020-03-19)", required = true, paramType = "query", dataType = "String")}) @@ -2014,6 +2025,30 @@ Map<String, Object> parameters = getParametersStartingWith(request, null); List<Map<String, Object>> weatherList = weatherService.getWeatherData(parameters); return new ResultBean<List<Map<String, Object>>>(weatherList); + } + + @GetMapping("weatherDataDay") + @ApiOperation(value = "������city���������������������", notes = "������city���������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "city", value = "���������", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "time", value = "������(���������2020-03-19)", required = true, paramType = "query", dataType = "String")}) + public ResultBean<List<Map<String, Object>>> getWeatherDataByDay(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = getParametersStartingWith(request, null); + List<Map<String, Object>> weatherList = weatherService.getWeatherDataByDay(parameters); + return new ResultBean<List<Map<String, Object>>>(weatherList); + } + + @GetMapping("monitorDeviceData") + @ApiOperation(value = "���������������5������������������������", notes = "���������������5������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "city", value = "���������", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "time", value = "������(���������2020-03-15)", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "type", value = "������(5���������m,������������h)", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "range", value = "������������������������(������������������m,���������a)", required = true, paramType = "query", dataType = "String")}) + public ResultBean<List<Map<String, Object>>> get5MinutesOrHalfHour(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = getParametersStartingWith(request, null); + List<Map<String, Object>> deviceData = historyMinutelyService.get5MinutesOrHalfHour(parameters); + return new ResultBean<List<Map<String, Object>>>(deviceData); } @PostMapping("updateForecastWeather") @@ -2165,4 +2200,18 @@ return new ResultBean<List<Map<String, Object>>>(list); } + + + @GetMapping("/contrastFactor") + @ApiOperation(value = "������������", notes = "������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "mac", value = "������mac", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "sensor", value = "������", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "time", value = "������(���������2020-03-19���20���21)", required = true, paramType = "query", dataType = "String")}) + public ResultBean<List<Map<String, Object>>> contrastFactor(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = getParametersStartingWith(request, null); + List list=historyHourlyService.getDataByMacAndTime(parameters); + //System.out.println(list); + return new ResultBean<List<Map<String, Object>>>(list); + } } -- Gitblit v1.8.0