|
|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
|
|
|
import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.JSONUtils;
|
|
|
+import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.uuid.IdUtils;
|
|
|
import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
|
|
|
import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
|
|
|
@@ -600,13 +601,25 @@ public class TestController {
|
|
|
|
|
|
@PostMapping("/warn")
|
|
|
public AjaxResult warnQxzTest(@RequestBody WarnTestReq req) throws Exception {
|
|
|
- String devBid = req.getDevBid();
|
|
|
+ String devCode = req.getDevCode();
|
|
|
JSONObject data = req.getData();
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(devCode)) {
|
|
|
+ throw new IotBizException(IotErrorCode.FAILURE.getCode(), "设备编码为空");
|
|
|
+ }
|
|
|
+
|
|
|
if(data == null) {
|
|
|
throw new IotBizException(IotErrorCode.FAILURE.getCode(), "数据为空");
|
|
|
}
|
|
|
|
|
|
- IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
+ List<IotDevice> iotDeviceList = iotDeviceService.selectIotDeviceByDevCode(devCode);
|
|
|
+ if (iotDeviceList == null || iotDeviceList.isEmpty()) {
|
|
|
+ throw new IotBizException(IotErrorCode.FAILURE.getCode(), "设备不存在");
|
|
|
+ }
|
|
|
+ if(iotDeviceList.size() > 1) {
|
|
|
+ throw new IotBizException(IotErrorCode.FAILURE.getCode(), "设备不唯一");
|
|
|
+ }
|
|
|
+ IotDevice iotDevice = iotDeviceList.get(0);
|
|
|
if (iotDevice == null) {
|
|
|
throw new IotBizException(IotErrorCode.FAILURE.getCode(), "设备不存在");
|
|
|
}
|