|  | @ -0,0 +1,112 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.web.third.iot;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.third.iot.IotDeviceService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.web.BaseController;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.http.MediaType;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMethod;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * @author yeshijie on 2018/1/3.
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @RestController
 | 
	
		
			
				|  |  | @RequestMapping(value = "/iot",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | @Api(description = "物联网测试类")
 | 
	
		
			
				|  |  | public class IotDeviceController extends BaseController{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private IotDeviceService iotDeviceService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/registedevice",method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation("注册设备")
 | 
	
		
			
				|  |  |     public String registedevice(){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |             JSONObject js = new JSONObject();
 | 
	
		
			
				|  |  |             js.put("sn","2638234828");
 | 
	
		
			
				|  |  |             js.put("ext_code","1");
 | 
	
		
			
				|  |  |             js.put("device_name","血压计-康为A206G");
 | 
	
		
			
				|  |  |             js.put("device_model","血压计-康为A206G");
 | 
	
		
			
				|  |  |             js.put("idcard","350429198905194016");
 | 
	
		
			
				|  |  |             js.put("username","邹林");
 | 
	
		
			
				|  |  |             js.put("manufacture_code","");
 | 
	
		
			
				|  |  |             js.put("manufacture_name","");
 | 
	
		
			
				|  |  |             js.put("owner_org_code","");
 | 
	
		
			
				|  |  |             js.put("owner_org_name","");
 | 
	
		
			
				|  |  |             js.put("sale_org_code","");
 | 
	
		
			
				|  |  |             js.put("sale_org_name","");
 | 
	
		
			
				|  |  |             js.put("manufacture_tel","");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |             jsonArray.add(js);
 | 
	
		
			
				|  |  |             json.put("data",jsonArray);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String re = iotDeviceService.registedevice(json);
 | 
	
		
			
				|  |  |             return write(200, "注册设备成功!", "data", re);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/upload1",method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation("不含居民身份的数据上传协议")
 | 
	
		
			
				|  |  |     public String upload1(){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |             JSONObject js = new JSONObject();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             js.put("measure_time","2018-01-01 01:01:01");
 | 
	
		
			
				|  |  |             js.put("systolic","111");
 | 
	
		
			
				|  |  |             js.put("diastolic","60");
 | 
	
		
			
				|  |  |             js.put("pulse","66");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |             jsonArray.add(js);
 | 
	
		
			
				|  |  |             json.put("data",jsonArray);
 | 
	
		
			
				|  |  |             json.put("sn","2638234828");
 | 
	
		
			
				|  |  |             json.put("ext_code","1");
 | 
	
		
			
				|  |  |             json.put("device_name","血压计-康为A206G");
 | 
	
		
			
				|  |  |             json.put("device_model","血压计-康为A206G");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String re = iotDeviceService.upload(json);
 | 
	
		
			
				|  |  |             return write(200, "注册设备成功!", "data", re);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/upload2",method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation("不含居民身份的数据上传协议")
 | 
	
		
			
				|  |  |     public String upload2(){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |             JSONObject js = new JSONObject();
 | 
	
		
			
				|  |  |             js.put("measure_time","2018-01-01 11:01:01");
 | 
	
		
			
				|  |  |             js.put("blood_sugar","6.7");
 | 
	
		
			
				|  |  |             JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |             jsonArray.add(js);
 | 
	
		
			
				|  |  |             json.put("data",jsonArray);
 | 
	
		
			
				|  |  |             json.put("data",jsonArray);
 | 
	
		
			
				|  |  |             json.put("sn","2638234828");
 | 
	
		
			
				|  |  |             json.put("ext_code","1");
 | 
	
		
			
				|  |  |             json.put("device_name","血压计-康为A206G");
 | 
	
		
			
				|  |  |             json.put("device_model","血压计-康为A206G");
 | 
	
		
			
				|  |  |             json.put("idcard","350429198905194016");
 | 
	
		
			
				|  |  |             json.put("username","邹林");
 | 
	
		
			
				|  |  |             String re = iotDeviceService.upload(json);
 | 
	
		
			
				|  |  |             return write(200, "注册设备成功!", "data", re);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |