IndexController.java
1.15 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
38
39
40
package cn.com.glsx.smart.modules.controller;
import cn.com.glsx.smart.component.DeviceAddressProducer;
import cn.com.glsx.smart.modules.entity.SmartProduct;
import cn.com.glsx.smart.modules.model.pb.InstanceFence.Fence;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Title: IndexController.java
* @Description:访问服务demo
* @author think.wang
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Slf4j
@RestController
public class IndexController {
@Autowired
private DeviceAddressProducer addressProducer;
@ResponseBody
@RequestMapping(value = "/home", method = {RequestMethod.GET, RequestMethod.POST})
public String home(){
addressProducer.pushUserDeviceData("37717106ecfabc73037f",
"99.1233:56.3222", Fence.OperationType.DEL_VALUE);
return "hello, welcome to home!";
}
@ResponseBody
@RequestMapping(value = "/getProduct", method = {RequestMethod.POST})
public String getProduct(@RequestBody SmartProduct product){
log.info("获取参数:{}", product.toString());
return product.getIconUrl();
}
}