瀏覽代碼

复制场景不支持重算,提示语

lyhzzz 2 年之前
父節點
當前提交
3c88c7ef6e

+ 1 - 0
src/main/java/com/fdkankan/manage/common/ResultCode.java

@@ -71,6 +71,7 @@ public enum ResultCode  {
     SCENE_IS_BUILDING(50054, "场景计算中,不能复制!"),
     MOVE_ERROR(50055, "原始资源不存在,不能迁移!"),
     MOVE_ERROR_COPY(50055, "复制场景,不能迁移!"),
+    COPY_NUM_NOTREBUILD(50055, "复制的场景不支持重算!"),
 
     ;
 

+ 10 - 4
src/main/java/com/fdkankan/manage/controller/SceneController.java

@@ -4,16 +4,14 @@ package com.fdkankan.manage.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.entity.SceneCopyLog;
 import com.fdkankan.manage.entity.ScenePlusExt;
 import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.manage.entity.ScenePlus;
 import com.fdkankan.manage.entity.ScenePro;
 import com.fdkankan.manage.httpClient.client.FdKKClient;
-import com.fdkankan.manage.service.IDownService;
-import com.fdkankan.manage.service.IScenePlusExtService;
-import com.fdkankan.manage.service.IScenePlusService;
-import com.fdkankan.manage.service.ISceneProService;
+import com.fdkankan.manage.service.*;
 import com.fdkankan.manage.vo.request.SceneParam;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -21,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
 import java.util.HashMap;
 
 
@@ -44,6 +43,8 @@ public class SceneController {
     FdKKClient fdKKClient;
    @Autowired
     FYunFileServiceInterface fYunFileServiceInterface;
+   @Autowired
+    ISceneCopyLogService sceneCopyLogService;
 
     @PostMapping("/list")
     public ResultData list(@RequestBody SceneParam param){
@@ -147,6 +148,11 @@ public class SceneController {
         if(StringUtils.isBlank(dataSource)){
             throw new BusinessException(ResultCode.SCENE_REBUILD_ERROR);
         }
+        Long countByNewNum = sceneCopyLogService.getCountByNewNum(num);
+        if(countByNewNum >0){
+            throw new BusinessException(ResultCode.COPY_NUM_NOTREBUILD);
+        }
+
         if(!fYunFileServiceInterface.fileExist(dataSource.replace("/mnt/data","home")+"/data.fdage")){
             throw new BusinessException(ResultCode.SCENE_REBUILD_ERROR);
         }

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

@@ -16,7 +16,8 @@ import java.util.List;
  */
 public interface ISceneCopyLogService extends IService<SceneCopyLog> {
 
-    Long getCountBySceneNum(String num);
+    Long getCountByOldNum(String num);
+    Long getCountByNewNum(String num);
 
     void saveByNum(String oldNum, String newNum, Long userId);
 

+ 7 - 1
src/main/java/com/fdkankan/manage/service/impl/SceneCopyLogServiceImpl.java

@@ -22,12 +22,18 @@ import java.util.List;
 public class SceneCopyLogServiceImpl extends ServiceImpl<ISceneCopyLogMapper, SceneCopyLog> implements ISceneCopyLogService {
 
     @Override
-    public Long getCountBySceneNum(String num) {
+    public Long getCountByOldNum(String num) {
         LambdaQueryWrapper<SceneCopyLog> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SceneCopyLog::getOldNum,num);
         return this.count(wrapper);
     }
 
+    public Long getCountByNewNum(String num) {
+        LambdaQueryWrapper<SceneCopyLog> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SceneCopyLog::getNewNum,num);
+        return this.count(wrapper);
+    }
+
     @Override
     public void saveByNum(String oldNum, String newNum, Long userId) {
         SceneCopyLog sceneCopyLog = new SceneCopyLog();