package com.prolog.rdc.tms.controller;

import java.util.List;

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 com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import com.prolog.rdc.tms.model.dto.IntfErrorLogDTO;
import com.prolog.rdc.tms.model.vo.GpsDataVO;
import com.prolog.rdc.tms.service.GpsService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 *
 * GPS业务控制层
 *
 * @className :GpsController
 * @author :fanzw
 * @creationTime :2023/02/03
 * @description :
 *
 * @modifier :fanzw
 * @modifyTime :2023/02/03
 * @reviseRemarks:
 *
 * @version :1.0.0
 *
 */
@RestController
@Api(tags = "GPS业务控制层")
@RequestMapping("/gps")
public class GpsController {

	@Autowired
	private GpsService gpsService;

	@UserLog("GPS数据保存")
	@ApiOperation(value = "GPS数据保存", notes = "GPS数据保存")
	@PostMapping("/save")
	public RestMessage<List<IntfErrorLogDTO>> saveGpsExecute(@RequestBody List<GpsDataVO> gpsDataVOs) {
		try {
			List<IntfErrorLogDTO> intfErrorLogDTOs = gpsService.saveGpsData(gpsDataVOs);
			return RestMessage.newInstance(true, "保存成功", intfErrorLogDTOs);
		} catch (Exception e) {
			e.printStackTrace();
			return RestMessage.newInstance(false, e.getMessage(), null);
		}
	}

}
