SampleController.java 1.16 KB
package com.bsth.controller.forecast;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bsth.controller.BaseController;
import com.bsth.controller.forecast.dto.CreateSampleParam;
import com.bsth.entity.forecast.Sample;
import com.bsth.service.forecast.SampleService;

@RestController
@RequestMapping("sample")
public class SampleController extends BaseController<Sample, Long>{

	@Autowired
	SampleService sampleService;
	
	@RequestMapping("/create/gps")
	public int createDataByGps(@RequestParam String data){
		
		try {
			data = URLDecoder.decode(data, "utf-8");
			CreateSampleParam param = JSONObject.toJavaObject(JSON.parseObject(data), CreateSampleParam.class);
			System.out.println(param);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return 0;
	}
}