dengsixing пре 5 месеци
родитељ
комит
130ba193b3
1 измењених фајлова са 20 додато и 1 уклоњено
  1. 20 1
      src/main/java/com/fdkankan/scene/service/impl/HaixinServiceImpl.java

+ 20 - 1
src/main/java/com/fdkankan/scene/service/impl/HaixinServiceImpl.java

@@ -2,6 +2,8 @@ package com.fdkankan.scene.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.util.CmdUtils;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
@@ -21,6 +23,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class HaixinServiceImpl implements IHaixinService {
@@ -45,7 +48,7 @@ public class HaixinServiceImpl implements IHaixinService {
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
 
         String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
-        List<String> cadImgKeys = fileServiceInterface.listRemoteFiles(userViewPath + "cad-style-");
+        List<String> cadImgKeys = fileServiceInterface.listRemoteFiles(userViewPath + "cad-style-3-");
         if(CollUtil.isEmpty(cadImgKeys)){
             return;
         }
@@ -54,6 +57,22 @@ public class HaixinServiceImpl implements IHaixinService {
         cadImgKeys.stream().forEach(key->{
             fileServiceInterface.downloadFile(key, tmpPath + FileUtil.getName(key));
         });
+
+        String floorPlanPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "floorplan.json";
+        String floorPlanStr = fileServiceInterface.getFileContent(floorPlanPath);
+        JSONObject floorPlanJson = JSON.parseObject(floorPlanStr);
+        JSONArray floors = floorPlanJson.getJSONArray("floors");
+        List<Map<String, String>> readme = floors.stream().map(f -> {
+            JSONObject item = (JSONObject) f;
+            Integer subgroup = item.getInteger("subgroup");
+            String floor_name = item.getString("name");
+            Map<String, String> map = new HashMap<>();
+            map.put("floor_name", floor_name);
+            map.put("img_name", "cad-style-3-" + subgroup + "jpg");
+            return map;
+        }).collect(Collectors.toList());
+        FileUtil.writeUtf8String(JSON.toJSONString(readme), tmpPath + "readme.json");
+
         String zipPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + currentTimeMillis + ".zip";
 
         //打压缩包