IndexController.java 1.11 KB
package com.glsx.smart.controller;

import com.glsx.smart.config.DeviceAddressProducer;
import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.pojo.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();
	}

}