|
@@ -370,6 +370,55 @@ public class UserSceneServiceImpl implements IUserSceneService {
|
|
|
return ResultData.ok(JSON.parseObject(processStr, DownLoadProgressBean.class));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResultData checkDownload(Long userId, SceneDownloadParamVO param) throws Exception {
|
|
|
+
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getSceneNum());
|
|
|
+ if(scenePlus == null){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
+ if(sceneEditInfo == null){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+
|
|
|
+ //downloadStatus,1打包资源下载,2已下载过,3下载过,并且没有修改过,无需打包直接返回下载地址,-1没下载次数不足
|
|
|
+ //下载中
|
|
|
+ SceneDownloadLog sceneDownloadLog = sceneDownloadLogService.findLastOneByNum(param.getSceneNum());
|
|
|
+
|
|
|
+ //未下载过
|
|
|
+ if(Objects.isNull(sceneDownloadLog)){
|
|
|
+ result.put("downloadStatus", 0);
|
|
|
+ return ResultData.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(sceneDownloadLog.getDownloadStatus() == DownloadStatus.DOWNLOADING.code()){
|
|
|
+ result.put("downloadStatus", 1);
|
|
|
+ return ResultData.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //下载过,并且没有修改过
|
|
|
+ if(sceneDownloadLog.getSceneVersion() == sceneEditInfo.getVersion()
|
|
|
+ && sceneDownloadLog.getDownloadStatus() == DownloadStatus.SUCCESS.code()){
|
|
|
+
|
|
|
+ result.put("downloadStatus", 3);
|
|
|
+ result.put("downloadUrl", sceneDownloadLog.getDownloadUrl());
|
|
|
+ return ResultData.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ //下载过,且修改过
|
|
|
+ result.put("downloadStatus", 2);
|
|
|
+ // 清除旧的下载信息
|
|
|
+ redisUtil.del(String.format(RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4, param.getSceneNum()));
|
|
|
+
|
|
|
+ return ResultData.ok(result);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public Map<String, Object> getNewScenesPagerByUserId(Long userId, SceneParamVO param) throws Exception {
|
|
|
|
|
|
List<SceneProPO> sceneList = new ArrayList<>();
|