Browse Source

创建sketch场景分享二维码的logo

dengsixing 2 years ago
parent
commit
d21e70e404
1 changed files with 36 additions and 36 deletions
  1. 36 36
      src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

+ 36 - 36
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -3300,42 +3300,42 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         //调用objToTxt算法
         CreateObjUtil.objToTxt(imagesBuffer.toString(), "");
 
-//        String uploadJsonPath = imagesBuffer.toString() + File.separator + "results" +File.separator+"upload.json";
-//        boolean exist = ComputerUtil.checkComputeCompleted(uploadJsonPath, maxCheckTimes, waitTime);
-//        if(!exist){
-//            log.error("upload.json数据出错");
-//            throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
-//        }
-//        String uploadData = FileUtils.readFile(uploadJsonPath);
-//        JSONObject uploadJson = null;
-//        JSONArray array = null;
-//        if(uploadData!=null) {
-//            uploadJson = JSONObject.parseObject(uploadData);
-//            array = uploadJson.getJSONArray("upload");
-//        }
-//        if(array == null){
-//            log.error("upload.json数据出错");
-//            throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
-//        }
-//
-//        Map<String,String> map = new HashMap<String,String>();
-//        JSONObject fileJson = null;
-//        String fileName = "";
-//        for(int i = 0, len = array.size(); i < len; i++) {
-//            fileJson = array.getJSONObject(i);
-//            fileName = fileJson.getString("file");
-//            //文件不存在抛出异常
-//            if (!new File(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName).exists()) {
-//                throw new Exception(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName + "文件不存在");
-//            }
-//
-//            //tex文件夹
-//            if (fileJson.getIntValue("clazz") == 15) {
-//                map.put(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName, "images/images" +
-//                    param.getNum() + "/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
-//                continue;
-//            }
-//        }
+        String uploadJsonPath = imagesBuffer.toString() + File.separator + "results" +File.separator+"upload.json";
+        boolean exist = ComputerUtil.checkComputeCompleted(uploadJsonPath, maxCheckTimes, waitTime);
+        if(!exist){
+            log.error("upload.json数据出错");
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
+        }
+        String uploadData = FileUtils.readFile(uploadJsonPath);
+        JSONObject uploadJson = null;
+        JSONArray array = null;
+        if(uploadData!=null) {
+            uploadJson = JSONObject.parseObject(uploadData);
+            array = uploadJson.getJSONArray("upload");
+        }
+        if(array == null){
+            log.error("upload.json数据出错");
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
+        }
+
+        Map<String,String> map = new HashMap<String,String>();
+        JSONObject fileJson = null;
+        String fileName = "";
+        for(int i = 0, len = array.size(); i < len; i++) {
+            fileJson = array.getJSONObject(i);
+            fileName = fileJson.getString("file");
+            //文件不存在抛出异常
+            if (!new File(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName).exists()) {
+                throw new Exception(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName + "文件不存在");
+            }
+
+            //tex文件夹
+            if (fileJson.getIntValue("clazz") == 15) {
+                map.put(imagesBuffer.toString() + File.separator + "results" + File.separator + fileName, "images/images" +
+                    param.getNum() + "/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
+                continue;
+            }
+        }
 //
 //        CreateObjUtil.convertTxtToDam(imagesBuffer.toString() + File.separator + "results" +File.separator+"modeldata.txt", imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
 //        CreateObjUtil.convertDamToLzma(imagesBuffer.toString() + File.separator + "results" +File.separator+ "dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");