lyhzzz hai 2 meses
pai
achega
ed7c90f724

+ 9 - 3
src/main/java/com/fdkankan/fusion/down/CaseDownService.java

@@ -125,6 +125,7 @@ public class CaseDownService {
     @Autowired
     RedisUtil redisUtil;
     public static String downProcessKey = "fusion:down:offline:process:caseId:%s";
+    public static String downProcessKey2 = "fusion:down:process:caseId:%s";
     public static String buildSceneKey = "fusion:build:scene:";
 
     public DownVo checkDown(Integer caseId) {
@@ -176,6 +177,11 @@ public class CaseDownService {
 
     public void setRedisProcess(Integer caseId,Integer num){
         setRedisProcess(caseId,num,null,1000);
+        if(num ==0){
+            String redisKey2 = String.format(downProcessKey2, caseId);
+            redisUtil.set(redisKey2,"1",60);
+        }
+
     }
 
     public void setRedisProcess(Integer caseId,Integer num,String url){
@@ -196,14 +202,14 @@ public class CaseDownService {
     public DownloadProcessVo process(Integer caseId) {
         DownloadProcessVo downVo = new DownloadProcessVo();
         String redisKey = String.format(downProcessKey, caseId);
-        String redisKey2 = "fusion:down:process:caseId:"+ caseId;
+        String redisKey2 = String.format(downProcessKey2, caseId);
 
         if(redisUtil.hasKey(redisKey)){
             DownloadProcessVo downloadProcessVo = JSONObject.parseObject(redisUtil.get(redisKey), DownloadProcessVo.class);
             if(redisUtil.hasKey(redisKey2)){
-                redisUtil.set(redisKey2,String.valueOf(Integer.parseInt(redisUtil.get(redisKey2)) + 1),60*60);
+                redisUtil.set(redisKey2,String.valueOf(Integer.parseInt(redisUtil.get(redisKey2)) + 1),60);
             }else {
-                redisUtil.set(redisKey2,"1",60*60);
+                redisUtil.set(redisKey2,"1",60);
             }
             if(downloadProcessVo.getPercent() == 100){
                 downloadProcessVo.setPercent(100);