ZhuDongming
2019-07-25 1923b712144b38969095c23b55699a6639155288
src/main/java/com/moral/controller/ScreenController.java
@@ -121,15 +121,21 @@
    @Resource
    DeviceVersionService deviceVersionService;
    /** The screen service. */
    /**
     * The screen service.
     */
    @Resource
    private HistoryService historyService;
    /** The account service. */
    /**
     * The account service.
     */
    @Resource
    private AccountService accountService;
    /** The device service. */
    /**
     * The device service.
     */
    @Resource
    private DeviceService deviceService;
@@ -143,11 +149,15 @@
//   @Value(value = "classpath:system/alarmLevels.json")
//   private org.springframework.core.io.Resource resource;
    /** The redis template. */
    /**
     * The redis template.
     */
    @Resource
    private RedisTemplate<String, String> redisTemplate;
    /** The level key. */
    /**
     * The level key.
     */
    private String levelKey = "alarm_";
    @Resource
@@ -319,7 +329,6 @@
    }
    /**
     *
     * @param dataSortCondition 数据排名查询条件
     * @return
     */
@@ -884,13 +893,13 @@
    }
    /**
     * @description 根据设备mac,监测因子,时间查询返回界面
     * @author ZhuDongming
     * @date 2019-06-05 10:02:10
     * @param model
     * @param request
     * @return
     * @throws Exception
     * @description 根据设备mac,监测因子,时间查询返回界面
     * @author ZhuDongming
     * @date 2019-06-05 10:02:10
     */
    @GetMapping("/map-traceability")
    @ApiOperation(value = "获取污染溯源", notes = "获取污染溯源")
@@ -1097,4 +1106,33 @@
        return new ResultBean<Map<String, Object>>(tempMap);
   }
    @GetMapping("/uavTrajectory")
    @ApiOperation(value = "显示无人机飞行轨迹", notes = "显示无人机飞行轨迹")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "mac", value = "设备mac(格式:p5dnd7a0392068)", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "startTime", value = "开始时间(格式:2019-07-17 17:07:00)", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "endTime", value = "结束时间(格式:2019-07-17 17:07:00)", required = false, paramType = "query", dataType = "String")
    })
    public ModelAndView uavTrajectory(ModelAndView model, HttpServletRequest request) throws Exception {
        Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
        String mac = parameters.get("mac").toString();
        if (mac != null && mac.length() != 0) {
            List<Map<String, Object>> sensorList = historyMinutelyService.getSensorData(parameters);
            JSONObject params = new JSONObject();
            params.put("sensorInfo", sensorList);
            String paramsJson = params.toJSONString();
            model.addObject("uavTrajectoryParams", paramsJson);
            model.setViewName("uavTrajectory");
            return model;
        }else {
            StringBuilder msg = new StringBuilder();
            msg.append(" param[0] mac:");
            msg.append(mac);
            log.warn(msg);
            model.setViewName("403");
            return model;
        }
    }
}