于紫祥_1901
2020-09-10 9a3d7f190717a6e3af608ffa0d78c66b6bcc0e8a
src/main/java/com/moral/controller/ScreenController.java
@@ -88,7 +88,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.*;
@@ -175,6 +174,7 @@
    @Resource
    private QualityDailyService qualityDailyService;
    /**
     * Screen login. 大屏登录
@@ -1959,6 +1959,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,16 +1993,36 @@
            mon=""+month;
        }
        String table="history_minutely_"+year+mon;
        log.info(table);
        log.info(time);
        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);
@@ -2007,7 +2030,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")})
@@ -2015,6 +2038,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")
@@ -2166,4 +2213,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);
    }
}