|
@ -134,6 +134,13 @@ public class DataInputService {
|
|
|
public String uploadDeviceInfo(String json){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
|
|
String deviceSn = jsonObject.getString("deviceSn");
|
|
|
if(StringUtils.isBlank(deviceSn)){
|
|
|
throw new ServiceException("设备编码不能为空");
|
|
|
}
|
|
|
IotDeviceDO iotDeviceDO = iotDeviceService.findByDeviceSn(deviceSn);
|
|
|
if(iotDeviceDO==null){
|
|
|
throw new ServiceException("请先注册设备后在上传");
|
|
|
}
|
|
|
try {
|
|
|
IotDeviceUploadRecordDO recordDO = new IotDeviceUploadRecordDO();
|
|
|
recordDO.setDeviceSn(deviceSn);
|
|
@ -157,7 +164,16 @@ public class DataInputService {
|
|
|
public String uploadDeviceData(String json){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
|
|
String deviceSn = jsonObject.getString("deviceSn");
|
|
|
if(StringUtils.isBlank(deviceSn)){
|
|
|
throw new ServiceException("设备编码不能为空");
|
|
|
}
|
|
|
String hospital = jsonObject.getString("hospital");
|
|
|
if(StringUtils.isBlank(hospital)){
|
|
|
throw new ServiceException("医院编码不能为空");
|
|
|
}
|
|
|
if(jsonObject.getJSONArray("data")==null){
|
|
|
throw new ServiceException("设备数据data不能为空");
|
|
|
}
|
|
|
String data = jsonObject.getJSONArray("data").toJSONString();
|
|
|
if(StringUtils.isBlank(data)){
|
|
|
throw new ServiceException("设备数据data不能为空");
|
|
@ -166,6 +182,13 @@ public class DataInputService {
|
|
|
throw new ServiceException("设备数据data超过最大允许字符");
|
|
|
}
|
|
|
String categoryCode = jsonObject.getString("categoryCode");
|
|
|
if(StringUtils.isBlank(hospital)){
|
|
|
throw new ServiceException("设备类型不能为空");
|
|
|
}
|
|
|
IotDeviceDO iotDeviceDO = iotDeviceService.findByDeviceSn(deviceSn);
|
|
|
if(iotDeviceDO==null){
|
|
|
throw new ServiceException("请先注册设备后在上传");
|
|
|
}
|
|
|
try {
|
|
|
IotDeviceUploadRecordDO recordDO = new IotDeviceUploadRecordDO();
|
|
|
recordDO.setDeviceSn(deviceSn);
|