Bläddra i källkod

更新sn码,更新相机类型

lyhzzz 2 år sedan
förälder
incheckning
1fdb2c22b7

+ 1 - 1
src/main/java/com/fdkankan/manage/service/IAuthorizeCameraDetailService.java

@@ -17,5 +17,5 @@ public interface IAuthorizeCameraDetailService extends IService<AuthorizeCameraD
 
     List<AuthorizeCameraDetail> getByCameraId(Integer id);
 
-    void updateSnCode(Integer id, String snCode);
+    void updateSnCode(Integer id, Long cameraId,Integer cameraType,String snCode);
 }

+ 3 - 1
src/main/java/com/fdkankan/manage/service/impl/AuthorizeCameraDetailServiceImpl.java

@@ -29,10 +29,12 @@ public class AuthorizeCameraDetailServiceImpl extends ServiceImpl<IAuthorizeCame
     }
 
     @Override
-    public void updateSnCode(Integer id, String snCode) {
+    public void updateSnCode(Integer id, Long cameraId,Integer cameraType,String snCode) {
         LambdaUpdateWrapper<AuthorizeCameraDetail> wrapper = new LambdaUpdateWrapper<>();
         wrapper.eq(AuthorizeCameraDetail::getId,id);
         wrapper.set(AuthorizeCameraDetail::getSnCode,snCode);
+        wrapper.set(AuthorizeCameraDetail::getCameraType,cameraType);
+        wrapper.set(AuthorizeCameraDetail::getCameraId,cameraId);
         this.update(wrapper);
     }
 }

+ 5 - 2
src/main/java/com/fdkankan/manage/service/impl/AuthorizeCameraServiceImpl.java

@@ -169,7 +169,10 @@ public class AuthorizeCameraServiceImpl extends ServiceImpl<IAuthorizeCameraMapp
         if(bySnCode == null){
             throw new BusinessException(ResultCode.UPDATE_CAMERA_NO_IN);
         }
-
+        CameraDetail byCameraId = cameraDetailService.getByCameraId(bySnCode.getId());
+        if(byCameraId == null){
+            throw new BusinessException(ResultCode.UPDATE_CAMERA_NO_IN);
+        }
         try {
             CamRegSDto dtos = new CamRegSDto();
             dtos.setMachineCode(authorizeCamera.getMachineCode());
@@ -185,7 +188,7 @@ public class AuthorizeCameraServiceImpl extends ServiceImpl<IAuthorizeCameraMapp
                 throw new BusinessException(ResultCode.GET_MACHINE_CODE_ERROR);
             }
             AuthorizeCameraLog authorizeCameraLog = authorizeCameraLogService.saveLog(cameraDetail, snCode, authorizeKey);
-            authorizeCameraDetailService.updateSnCode(cameraDetail.getId(),snCode);
+            authorizeCameraDetailService.updateSnCode(cameraDetail.getId(),bySnCode.getId(),CameraUtils.getCameraType(byCameraId.getType()),snCode);
             return authorizeCameraLog;
         }catch (Exception e){
             throw new BusinessException(ResultCode.GET_MACHINE_CODE_ERROR);