SampleController.java
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
}
}