|
@ -2,10 +2,13 @@ package com.yihu.iot.controller.monitorPlatform;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.iot.service.device.IotPatientDeviceService;
|
|
|
import com.yihu.iot.service.dict.IotSystemDictService;
|
|
|
import com.yihu.iot.service.monitorPlatform.MonitorPlatformService;
|
|
|
import com.yihu.iot.service.product.IotProductBaseInfoService;
|
|
|
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
|
|
|
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
|
|
|
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
@ -35,6 +38,28 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
|
|
|
private IotSystemDictService iotSystemDictService;
|
|
|
@Autowired
|
|
|
private IotProductBaseInfoService iotProductBaseInfoService;
|
|
|
@Autowired
|
|
|
private IotPatientDeviceService iotPatientDeviceService;
|
|
|
|
|
|
|
|
|
@PostMapping(value = IotRequestMapping.PatientDevice.addPatientDevice)
|
|
|
@ApiOperation(value = "设备绑定", notes = "设备绑定")
|
|
|
public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> create(@ApiParam(name = "jsonData", value = "", defaultValue = "")
|
|
|
@RequestParam String jsonData) {
|
|
|
try {
|
|
|
//设备绑定
|
|
|
IotPatientDeviceVO deviceVO = toEntity(jsonData, IotPatientDeviceVO.class);
|
|
|
IotPatientDeviceDO patientDevice = convertToModel(deviceVO, IotPatientDeviceDO.class);
|
|
|
iotPatientDeviceService.create(patientDevice);
|
|
|
//地址信息存入es
|
|
|
iotPatientDeviceService.deviceData2Es(deviceVO);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_create);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping(value = IotRequestMapping.System.findDictByCode)
|
|
|
@ApiOperation(value = "获取字典列表(不分页)")
|