Sfoglia il codice sorgente

判断相机是否存在

gao.qiang 11 mesi fa
parent
commit
020e67dfaf

+ 5 - 0
hazard-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -285,6 +285,11 @@ public class GeoHazardMonitorTokenController {
             BaseUser admin = baseUserService.getUserName("admin");
             lw.eq(BaseDeviceDynamicManagement::getCameraCode, reqDeviceVo.getCameraCode());
             BaseDeviceDynamicManagement baseDynamicManagement = baseDeviceDynamicManagementService.getOne(lw);
+            if (ObjectUtils.isEmpty(baseDynamicManagement)) {
+                jsonObject.put("resultCode", 0);
+                jsonObject.put("message", "相机编码不存在!");
+                return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
+            }
             baseDynamicManagement.setElectricity(reqDeviceVo.getElectricity());
             if (reqDeviceVo.getTime().toString().length() == 10) {
                 reqDeviceVo.setTime(reqDeviceVo.getTime() * 1000);