Browse Source

场景下载新接口

dsx 1 year ago
parent
commit
bcd62eb6b2

+ 2 - 0
src/main/java/com/fdkankan/scene/service/ISceneDownloadLogService.java

@@ -21,4 +21,6 @@ public interface ISceneDownloadLogService extends IService<SceneDownloadLog> {
 
     ResultData downloadUpDateStatus(String num);
 
+    ResultData downOfflineSceneCheck(String num);
+
 }

+ 25 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneDownloadLogServiceImpl.java

@@ -173,4 +173,29 @@ public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMa
         redisUtil.del(String.format(RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4,num));
         return ResultData.ok();
     }
+
+    @Override
+    public ResultData downOfflineSceneCheck(String num) {
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        if(Objects.isNull(scenePlus)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+        Scene scene = sceneService.getBySceneCode(num);
+        String mapping = scene.getMapping();
+        Map<String, Object> result = new HashMap<>();
+        SceneDownloadLog sceneDownloadLog = this.getOne(
+                new LambdaQueryWrapper<SceneDownloadLog>()
+                        .eq(SceneDownloadLog::getSceneNum, num)
+                        .orderByDesc(SceneDownloadLog::getId)
+                        .last("limit 1"));
+        if(Objects.nonNull(sceneDownloadLog) && sceneDownloadLog.getStatus() == 1){
+            String url=this.publicUrl+":"+fdkkLaserConfig.getLaserPort()+"/" + mapping +sceneDownloadLog.getDownloadUrl();
+            result.put("status", 2);
+            result.put("url",url);
+        }else{
+            result.put("status", 1);
+        }
+        return ResultData.ok(result);
+    }
 }