Browse Source

删除场景校验场景计算状态

lyhzzz 1 year ago
parent
commit
f28283b544
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/main/java/com/fdkankan/manage/controller/RtkInfoController.java

+ 14 - 0
src/main/java/com/fdkankan/manage/controller/RtkInfoController.java

@@ -2,13 +2,18 @@ package com.fdkankan.manage.controller;
 
 
 import cn.dev33.satoken.stp.StpUtil;
+import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.manage.entity.AgentAudit;
+import com.fdkankan.manage.entity.Camera;
 import com.fdkankan.manage.entity.RtkInfo;
+import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.manage.service.IAgentAuditService;
+import com.fdkankan.manage.service.ICameraService;
 import com.fdkankan.manage.service.IRtkInfoService;
 import com.fdkankan.manage.vo.request.AgentAuditListParam;
 import com.fdkankan.manage.vo.request.RtkInfoParam;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -26,6 +31,8 @@ public class RtkInfoController {
 
     @Autowired
     IRtkInfoService rtkInfoService;
+    @Autowired
+    ICameraService cameraService;
 
     @PostMapping("/list")
     public ResultData list(@RequestBody RtkInfoParam param){
@@ -39,6 +46,13 @@ public class RtkInfoController {
         }else {
             rtkInfo.setUpdateUserId(Long.valueOf((String)StpUtil.getLoginId()));
         }
+        if(StringUtils.isBlank(rtkInfo.getCameraSnCode())){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        Camera camera = cameraService.getBySnCode(rtkInfo.getCameraSnCode());
+        if(camera == null){
+            throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
+        }
         rtkInfoService.saveOrEdit(rtkInfo);
         return ResultData.ok();
     }