|
@ -97,12 +97,12 @@ public class DataInputService {
|
|
if(StringUtils.isBlank(categoryName)){
|
|
if(StringUtils.isBlank(categoryName)){
|
|
throw new ServiceException("设备类型名称不能为空");
|
|
throw new ServiceException("设备类型名称不能为空");
|
|
}
|
|
}
|
|
|
|
int count = iotDeviceService.countByDeviceSn(deviceSn);
|
|
|
|
if(count > 0){
|
|
|
|
throw new ServiceException("设备唯一码已存在,请检查是否已经上传过,或者换一个编码");
|
|
|
|
}
|
|
String result = "";
|
|
String result = "";
|
|
try {
|
|
try {
|
|
int count = iotDeviceService.countByDeviceSn(deviceSn);
|
|
|
|
if(count > 0){
|
|
|
|
throw new ServiceException("设备唯一码已存在,请检查是否已经上传过,或者换一个编码");
|
|
|
|
}
|
|
|
|
IotDeviceDO iotDeviceDO = new IotDeviceDO();
|
|
IotDeviceDO iotDeviceDO = new IotDeviceDO();
|
|
iotDeviceDO.setDeviceSn(deviceSn);
|
|
iotDeviceDO.setDeviceSn(deviceSn);
|
|
iotDeviceDO.setCategoryCode(categoryCode);
|
|
iotDeviceDO.setCategoryCode(categoryCode);
|
|
@ -127,12 +127,19 @@ public class DataInputService {
|
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
|
String deviceSn = jsonObject.getString("deviceSn");
|
|
String deviceSn = jsonObject.getString("deviceSn");
|
|
String hospital = jsonObject.getString("hospital");
|
|
String hospital = jsonObject.getString("hospital");
|
|
|
|
String data = jsonObject.getJSONArray("data").toJSONString();
|
|
|
|
if(StringUtils.isBlank(data)){
|
|
|
|
throw new ServiceException("设备数据data不能为空");
|
|
|
|
}
|
|
|
|
if(data.length()>60000){
|
|
|
|
throw new ServiceException("设备数据data超过最大允许字符");
|
|
|
|
}
|
|
String categoryCode = jsonObject.getString("categoryCode");
|
|
String categoryCode = jsonObject.getString("categoryCode");
|
|
try {
|
|
try {
|
|
IotDeviceUploadRecordDO recordDO = new IotDeviceUploadRecordDO();
|
|
IotDeviceUploadRecordDO recordDO = new IotDeviceUploadRecordDO();
|
|
recordDO.setDeviceSn(deviceSn);
|
|
recordDO.setDeviceSn(deviceSn);
|
|
recordDO.setHospital(hospital);
|
|
recordDO.setHospital(hospital);
|
|
recordDO.setJsonData(jsonObject.getJSONArray("data").toJSONString());
|
|
|
|
|
|
recordDO.setJsonData(data);
|
|
recordDO.setCategoryCode(categoryCode);
|
|
recordDO.setCategoryCode(categoryCode);
|
|
recordDO.setStatus(0);
|
|
recordDO.setStatus(0);
|
|
recordDO.setCreateTime(new Date());
|
|
recordDO.setCreateTime(new Date());
|