package com.prolog.rdc.tms.controller.fleetManagement;

import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import com.prolog.rdc.tms.model.dto.fleetManagement.VehicleGpsDTO;
import com.prolog.rdc.tms.model.vo.fleetManagement.VehicleGpsQueryVO;
import com.prolog.rdc.tms.model.vo.fleetManagement.VehicleGpsSaveVO;
import com.prolog.rdc.tms.service.fleetManagement.VehicleGpsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 车辆GPS数据管理控制层
 *
 * @author xiaoyf
 * @date 2022/03/15
 */
@Api(tags = "车辆GPS数据管理控制层")
@RestController
@RequestMapping("/vehicleGps")
public class VehicleGpsController {

    @Autowired
    private VehicleGpsService vehicleGpsService;

    @UserLog("写入车辆GPS数据")
    @ApiOperation(value = "写入车辆GPS数据", notes = "写入车辆GPS数据")
    @PostMapping("/saveVehicleGps")
    public RestMessage<Object> saveVehicleGps(@RequestBody @Valid VehicleGpsSaveVO vo) throws Exception{
        vehicleGpsService.saveVehicleGpsNew(vo);
        return RestMessage.newInstance(true, "操作成功", null);
    }

    @UserLog("车辆GPS列表数据查询")
    @ApiOperation(value = "车辆GPS列表数据查询", notes = "车辆GPS列表数据查询")
    @PostMapping("/queryVehicleGps")
    public RestMessage<List<VehicleGpsDTO>> queryVehicleGps(@RequestBody @Valid VehicleGpsQueryVO vo) throws Exception{
        List<VehicleGpsDTO> list=vehicleGpsService.queryVehicleGps(vo);
        return RestMessage.newInstance(true, "操作成功", list);
    }

}
