lyhzzz 2 bulan lalu
induk
melakukan
5e79de21c5

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/ISceneDownLogService.java

@@ -16,5 +16,5 @@ public interface ISceneDownLogService extends IService<SceneDownLog> {
 
     Object pageList(SceneDownLogParam param);
 
-    SceneDownLog getByStatusAndNum(String sceneNum, Integer status,Integer version);
+    SceneDownLog getByStatusAndNum(String sceneNum, Integer status);
 }

+ 15 - 11
src/main/java/com/fdkankan/fusion/service/impl/DownService.java

@@ -81,24 +81,28 @@ public class DownService implements IDownService {
         SceneDownLog sceneDownloadLog;
         Integer sceneVersion = getSceneVersion(plus);
 
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,sceneVersion);
         DownVo downVo = new DownVo();
-        if(sceneDownloadLog != null){
-            downVo.setDownloadStatus(1);
+        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1);
+        //3下载过,并且没有修改过
+        if(sceneDownloadLog != null && sceneDownloadLog.getVersion().intValue() == sceneVersion){
+            downVo.setDownloadStatus(3);
+            downVo.setDownloadUrl(sceneDownloadLog.getDownUrl());
             return downVo;
         }
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1,sceneVersion);
+
         //下载过,有更改
-        if(sceneDownloadLog == null){
-            String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS;
+        if(sceneDownloadLog != null){
+            String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4;
             downVo.setDownloadStatus(2);
             redisUtil.del(String.format(redisKey,sceneNum));  // 清除旧的下载信息
             return downVo;
+        }else {
+            sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0);
+            if(sceneDownloadLog != null){
+                downVo.setDownloadStatus(1);
+                return downVo;
+            }
         }
-        saveLog(plus,sceneVersion,type);
-        //3下载过,并且没有修改过
-        downVo.setDownloadStatus(3);
-        downVo.setDownloadUrl(sceneDownloadLog.getDownUrl());
         return downVo;
 
     }
@@ -184,7 +188,7 @@ public class DownService implements IDownService {
         if(StringUtils.isEmpty(result)){
             return new DownloadProcessVo();
         }
-        SceneDownLog sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,getSceneVersion(scenePlus));
+        SceneDownLog sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0);
 
         DownloadProcessVo downloadProcessVo = JSONObject.parseObject(result, DownloadProcessVo.class);
         if(sceneDownloadLog != null){

+ 1 - 2
src/main/java/com/fdkankan/fusion/service/impl/SceneDownLogServiceImpl.java

@@ -71,11 +71,10 @@ public class SceneDownLogServiceImpl extends ServiceImpl<ISceneDownLogMapper, Sc
     }
 
     @Override
-    public SceneDownLog getByStatusAndNum(String sceneNum, Integer status,Integer sceneVersion) {
+    public SceneDownLog getByStatusAndNum(String sceneNum, Integer status) {
         LambdaQueryWrapper<SceneDownLog> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SceneDownLog::getSceneNum,sceneNum);
         wrapper.eq(SceneDownLog::getStatus,status);
-        wrapper.eq(SceneDownLog::getVersion,sceneVersion);
         wrapper.orderByDesc(SceneDownLog::getId);
         List<SceneDownLog> list = this.list(wrapper);
         if(list != null && !list.isEmpty()){