|
@@ -121,14 +121,21 @@ public class DownService implements IDownService {
|
|
Map<String,String> params = new HashMap<>(2);
|
|
Map<String,String> params = new HashMap<>(2);
|
|
params.put("type","local");
|
|
params.put("type","local");
|
|
params.put("sceneNum",sceneNum);
|
|
params.put("sceneNum",sceneNum);
|
|
- String redisKey = RedisKey.DOWNLOAD_TASK;
|
|
|
|
|
|
+ String progressKey = String.format(RedisKey.PREFIX_DOWNLOAD_PROGRESS, sceneNum);
|
|
|
|
+ String downloadTaskKey = RedisKey.DOWNLOAD_TASK;
|
|
String sysVersion = "v3";
|
|
String sysVersion = "v3";
|
|
if(scenePro == null){
|
|
if(scenePro == null){
|
|
params.put("num",sceneNum);
|
|
params.put("num",sceneNum);
|
|
- redisKey = RedisKey.SCENE_DOWNLOADS_TASK_V4;
|
|
|
|
|
|
+ progressKey = String.format(RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4, sceneNum);
|
|
|
|
+ downloadTaskKey = RedisKey.SCENE_DOWNLOADS_TASK_V4;
|
|
sysVersion = "v4";
|
|
sysVersion = "v4";
|
|
}
|
|
}
|
|
- redisUtil.lRightPush(redisKey, JSONObject.toJSONString(params));
|
|
|
|
|
|
+ //先删除之前的下载进度
|
|
|
|
+ redisUtil.del(progressKey);
|
|
|
|
+ //入队
|
|
|
|
+ redisUtil.lRightPush(downloadTaskKey, JSONObject.toJSONString(params));
|
|
|
|
+
|
|
|
|
+ //修改用户的下载次数
|
|
user.setDownloadNum(user.getDownloadNum() + 1);
|
|
user.setDownloadNum(user.getDownloadNum() + 1);
|
|
userService.updateById(user);
|
|
userService.updateById(user);
|
|
|
|
|
|
@@ -145,7 +152,7 @@ public class DownService implements IDownService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public DownloadProcessVo downloadProcess(String sceneNum) {
|
|
|
|
|
|
+ public DownloadProcessVo downloadProcess(Long userId, String sceneNum) {
|
|
if (StringUtils.isEmpty(sceneNum)) {
|
|
if (StringUtils.isEmpty(sceneNum)) {
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
@@ -180,6 +187,7 @@ public class DownService implements IDownService {
|
|
}
|
|
}
|
|
case DownloadStatusEnum.DOWNLOAD_FAILED_CODE:
|
|
case DownloadStatusEnum.DOWNLOAD_FAILED_CODE:
|
|
sceneDownloadLog.setStatus(-1);
|
|
sceneDownloadLog.setStatus(-1);
|
|
|
|
+ userService.updateDownloadNum(userId, -1);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
sceneDownloadLogService.updateById(sceneDownloadLog);
|
|
sceneDownloadLogService.updateById(sceneDownloadLog);
|