Browse Source

旧版相机入库数据兼容

dengsixing 3 months ago
parent
commit
4fd539fa15

+ 19 - 2
src/main/java/com/fdkankan/contro/controller/TestController.java

@@ -1,5 +1,10 @@
 package com.fdkankan.contro.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.entity.Camera;
+import com.fdkankan.contro.service.ICameraService;
 import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.IScene3dNumService;
 import com.fdkankan.web.response.ResultData;
@@ -9,6 +14,8 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Objects;
+
 /**
  * <p>
  * TODO
@@ -27,10 +34,20 @@ public class TestController {
     private ICommonService commonService;
     @Value("${4dkk.laserService.bucket}")
     private String bucket;
+    @Autowired
+    private ICameraService cameraService;
 
     @GetMapping("/test")
-    public ResultData test(String num) throws Exception {
-        return ResultData.ok(bucket);
+    public ResultData test(String mac) throws Exception {
+        Camera camera = cameraService.getBySnCode(mac);
+        if(Objects.isNull(camera)){
+            camera = cameraService.getOne(new LambdaQueryWrapper<Camera>()
+                    .like(Camera::getChildName, mac)
+                    .or().like(Camera::getSnCode, mac)
+                    .or().like(Camera::getWifiName, mac));
+            throw new BusinessException(ErrorCode.FAILURE_CODE_7010);
+        }
+        return ResultData.ok(camera);
     }
 
 }

+ 4 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -254,6 +254,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
         Camera camera = cameraService.getBySnCode(mac);
         if(Objects.isNull(camera)){
+            cameraService.getOne(new LambdaQueryWrapper<Camera>()
+                    .like(Camera::getChildName, mac)
+                    .or().like(Camera::getSnCode, mac)
+                    .or().like(Camera::getWifiName, mac));
             throw new BusinessException(ErrorCode.FAILURE_CODE_7010);
         }
         CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());