Jelajahi Sumber

Merge branch 'feature-stg需求-增加导出数据库表记录和缓存记录' into test

dengsixing 1 tahun lalu
induk
melakukan
2a7a5b2436

+ 57 - 5
src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -531,16 +531,68 @@ public class SceneDownloadHandlerServiceImpl {
                 FileUtil.writeUtf8String(JSON.toJSONString(hoticons), cachePath + "hoticons.json");
             }
 
-//            Set<String> hoticons = redisUtil.sGet(String.format(RedisKey.SCENE_HOT_ICONS, num));
-//            FileUtil.writeUtf8String(JSON.toJSONString(hoticons), cachePath + "hoticons.json");
+            Map<String, String> LinkPanStr = redisUtil.hmget(String.format(RedisKey.SCENE_LINKPAN_DATA, num));
+            if(CollUtil.isNotEmpty(LinkPanStr)){
+                Map<String, JSONObject> linkPan = LinkPanStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
+                FileUtil.writeUtf8String(JSON.toJSONString(linkPan), cachePath + "linkPan.json");
+            }
+
+            Map<String, String> LinkPanStylesStr = redisUtil.hmget(String.format(RedisKey.SCENE_LINKPAN_STYLES, num));
+            if(CollUtil.isNotEmpty(LinkPanStylesStr)){
+                Map<String, JSONObject> LinkPanStyles = LinkPanStylesStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
+                FileUtil.writeUtf8String(JSON.toJSONString(LinkPanStyles), cachePath + "LinkPanStyles.json");
+            }
+
+            Map<String, String> billboardsStr = redisUtil.hmget(String.format(RedisKey.SCENE_BILLBOARDS, num));
+            if(CollUtil.isNotEmpty(billboardsStr)){
+                Map<String, JSONObject> billboards = billboardsStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
+                FileUtil.writeUtf8String(JSON.toJSONString(billboards), cachePath + "billboards.json");
+            }
+
+            Map<String, String> billboardsStylesStr = redisUtil.hmget(String.format(RedisKey.SCENE_BILLBOARDS_STYLES, num));
+            if(CollUtil.isNotEmpty(billboardsStylesStr)){
+                Map<String, JSONObject> billboardsStyles = billboardsStylesStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
+                FileUtil.writeUtf8String(JSON.toJSONString(billboardsStyles), cachePath + "billboardsStyles.json");
+            }
+
+            Map<String, String> cutModelStr = redisUtil.hmget(String.format(RedisKey.SCENE_CUT_MODEL, num));
+            if(CollUtil.isNotEmpty(cutModelStr)){
+                Map<String, JSONObject> cutModel = cutModelStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
+                FileUtil.writeUtf8String(JSON.toJSONString(cutModel), cachePath + "cutModel.json");
+            }
 
+            Map<String, String> mosaicStr = redisUtil.hmget(String.format(RedisKey.SCENE_MOSAIC_DATA, num));
+            if(CollUtil.isNotEmpty(mosaicStr)){
+                Map<String, JSONObject> mosaic = mosaicStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
+                FileUtil.writeUtf8String(JSON.toJSONString(mosaic), cachePath + "mosaic.json");
+            }
+
+            List<String> filterStr = redisUtil.lGet(String.format(RedisKey.SCENE_filter_DATA, num), 0, -1);
+            if(CollUtil.isNotEmpty(filterStr)){
+                List<JSONObject> filter = filterStr.stream().map(v -> JSONUtil.parseObj(v)).collect(Collectors.toList());
+                FileUtil.writeUtf8String(JSON.toJSONString(filter), cachePath + "filter.json");
+            }
+
+            Map<String, String> drawStr = redisUtil.hmget(String.format(RedisKey.SCENE_DRAW, num));
+            if(CollUtil.isNotEmpty(drawStr)){
+                Map<String, JSONObject> draw = drawStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
+                FileUtil.writeUtf8String(JSON.toJSONString(draw), cachePath + "draw.json");
+            }
 
-//            FileUtil.writeUtf8String(batContent, String.format(this.sourceLocal, num, exeName));
+            //下载计算资源
+            if(fYunFileService.fileExist(String.format(UploadFilePath.scene_result_data_path, num) + "data.json")){
+                fYunFileService.downloadFile(String.format(UploadFilePath.scene_result_data_path, num) + "data.json", cachePath + "data.json");
+            }else{
+                FileUtil.writeUtf8String("", cachePath + "data.json");
+            }
+            if(fYunFileService.fileExist(String.format(UploadFilePath.scene_result_data_path, num) + "project.json")){
+                fYunFileService.downloadFile(String.format(UploadFilePath.scene_result_data_path, num) + "project.json", cachePath + "project.json");
+            }else{
+                FileUtil.writeUtf8String("", cachePath + "project.json");
+            }
         }catch (Exception e){
             log.error("下载缓存数据出错,", e);
         }
-
-
     }
 
     private void zipBat(String num, String version) throws Exception{