lyhzzz 5 mesi fa
parent
commit
5065fe9698

+ 1 - 1
src/main/java/com/fdkankan/ucenter/service/ISceneDownloadLogService.java

@@ -13,5 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneDownloadLogService extends IService<SceneDownloadLog> {
 
-    SceneDownloadLog getByStatusAndNum(String sceneNum, int status, Integer isUpgrade);
+    SceneDownloadLog getByStatusAndNum(String sceneNum, Integer status, Integer isUpgrade,Integer sceneVersion);
 }

+ 6 - 14
src/main/java/com/fdkankan/ucenter/service/impl/DownService.java

@@ -76,29 +76,19 @@ public class DownService implements IDownService {
         }
         Integer sceneVersion = getSceneVersion(scenePro, plus);
 
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp);
+        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp,sceneVersion);
         DownVo downVo = new DownVo();
         if(sceneDownloadLog != null){
             downVo.setDownloadStatus(1);
             return downVo;
         }
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1,isUp);
+        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1,isUp,sceneVersion);
         //3下载过,并且没有修改过
-        if(sceneDownloadLog != null && sceneDownloadLog.getSceneVersion().intValue() == sceneVersion){
+        if(sceneDownloadLog != null ){
             downVo.setDownloadStatus(3);
             downVo.setDownloadUrl(sceneDownloadLog.getDownloadUrl());
             return downVo;
         }
-        //下载过,有更改
-        if(sceneDownloadLog != null){
-            String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS;
-            if(isUp == 1){
-                redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4;
-            }
-            downVo.setDownloadStatus(2);
-            redisUtil.del(String.format(redisKey,sceneNum));  // 清除旧的下载信息
-            return downVo;
-        }
         return downVo;
     }
 
@@ -225,7 +215,9 @@ public class DownService implements IDownService {
         if(scenePro == null){
             isUp = 1;
         }
-        SceneDownloadLog sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp);
+        Integer sceneVersion = getSceneVersion(scenePro, plus);
+
+        SceneDownloadLog sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp,sceneVersion);
 
         DownloadProcessVo downloadProcessVo = JSONObject.parseObject(result, DownloadProcessVo.class);
         if(sceneDownloadLog != null){

+ 2 - 1
src/main/java/com/fdkankan/ucenter/service/impl/SceneDownloadLogServiceImpl.java

@@ -21,7 +21,7 @@ import java.util.List;
 public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMapper, SceneDownloadLog> implements ISceneDownloadLogService {
 
     @Override
-    public SceneDownloadLog getByStatusAndNum(String sceneNum, int status, Integer isUpgrade) {
+    public SceneDownloadLog getByStatusAndNum(String sceneNum, Integer status, Integer isUpgrade,Integer sceneVersion) {
         LambdaQueryWrapper<SceneDownloadLog> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SceneDownloadLog::getSceneNum,sceneNum);
         wrapper.eq(SceneDownloadLog::getStatus,status);
@@ -30,6 +30,7 @@ public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMa
             sysVersion = "v4";
         }
         wrapper.eq(SceneDownloadLog::getSysVersion,sysVersion);
+        wrapper.eq(SceneDownloadLog::getSceneVersion,sceneVersion);
         wrapper.orderByDesc(SceneDownloadLog::getCreateTime);
         List<SceneDownloadLog> list = this.list(wrapper);
         if(list != null && list.size() >0){