package com.njzscloud.supervisory.gps.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.supervisory.gps.tuqiang.jimi.DeviceLocationGetParam;
import com.njzscloud.supervisory.gps.tuqiang.jimi.DeviceLocationGetResult;
import com.njzscloud.supervisory.gps.tuqiang.jimi.DeviceTrackListParam;
import com.njzscloud.supervisory.gps.tuqiang.jimi.DeviceTrackListResult;
import com.njzscloud.supervisory.gps.tuqiang.jimi.util.JimiUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * GPS
 */
@RestController
@RequestMapping("/gps")
public class GPSController {
    /**
     * 实时定位
     */
    @RequestMapping("/obtain_location")
    public R<?> obtainLocation(DeviceLocationGetParam param) {
        DeviceLocationGetResult result = JimiUtil.request(param);
        if (result.isSucc()) {
            return R.success(result.getResult());
        }
        return R.failed();
    }

    /**
     * 轨迹查询
     */
    @RequestMapping("/track_list")
    public R<?> trackList(DeviceTrackListParam param) {
        DeviceTrackListResult result = JimiUtil.request(param);
        if (result.isSucc()) {
            return R.success(result.getResult());
        }
        return R.failed();
    }
}
