| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.googlecode.aviator.AviatorEvaluator; |
| | | import com.googlecode.aviator.Expression; |
| | | import com.moral.common.bean.Constants; |
| | |
| | | |
| | | import static com.moral.common.util.ResourceUtil.getValue; |
| | | import static com.moral.common.util.WebUtils.getParametersStartingWith; |
| | | import static java.util.Calendar.*; |
| | | |
| | | /** |
| | | * The Class ScreenController.大屏接口 |
| | |
| | | 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()); |
| | |
| | | |
| | | @GetMapping("/windAndDeviceData") |
| | | @ResponseBody |
| | | public List windAndDeviceData(HttpServletRequest request, String monitorPointId) { |
| | | Calendar c = Calendar.getInstance();//可以对每个时间域单独修改 对时间进行加减操作等 |
| | | int year = c.get(Calendar.YEAR); |
| | | int month = c.get(Calendar.MONTH); |
| | | String mon=""; |
| | | if (month+1<10){ |
| | | mon="0"+(month+1); |
| | | public List windAndDeviceData(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+1)+""; |
| | | mon=""+month; |
| | | } |
| | | int date = c.get(Calendar.DATE); |
| | | String dt=""; |
| | | if(date<10){ |
| | | dt="0"+date; |
| | | }else { |
| | | dt=""+date; |
| | | } |
| | | int hour = c.get(Calendar.HOUR_OF_DAY); |
| | | String hu=""; |
| | | if (hour<10){ |
| | | hu="0"+hour; |
| | | }else { |
| | | hu=""+hour; |
| | | } |
| | | int minute = c.get(Calendar.MINUTE); |
| | | String mu=""; |
| | | if (minute<10){ |
| | | mu="0"+minute; |
| | | }else { |
| | | mu=""+minute; |
| | | } |
| | | String time=year + "-" + mon + "-" + dt + " " +hu + ":" +mu + ":" + "00"; |
| | | String table="history_minutely_"+year+mon; |
| | | 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; |
| | | log.info(table); |
| | | log.info(time); |
| | | 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); |
| | |
| | | String startTime = parameters.get("startTime").toString(); |
| | | String endTime = parameters.get("endTime").toString(); |
| | | //对时间进行操作的接口 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | Calendar calendar = getInstance(); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | List<Map<String, Object>> list = new ArrayList(); |
| | | Map device = deviceService.getAllFieldByMac(parameters); |