dengsixing 2 vuotta sitten
vanhempi
commit
1184d2d5af

+ 40 - 15
4dkankan-utils-model/src/main/java/com/fdkankan/model/utils/CreateObjUtil.java

@@ -257,22 +257,47 @@ public class CreateObjUtil {
 	}
 	
 	public static void convertTxtToDam(String srcpath,String despath)throws Exception{
-		BigSceneProto.binary_mesh.Builder builder = BigSceneProto.binary_mesh.newBuilder();
-		InputStream inputStream = new FileInputStream(srcpath);
-		InputStreamReader reader = new InputStreamReader(inputStream, "ASCII");
-		TextFormat.merge(reader, builder);
-		byte[] buf = builder.build().toByteArray();
-
-		//把序列化后的数据写入本地磁盘
-		ByteArrayInputStream stream = new ByteArrayInputStream(buf);
-		BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
-		BufferedInputStream bis = new BufferedInputStream(stream);
-		int b = -1;
-		while ((b = bis.read()) != -1) {
-			bos.write(b);
+		InputStream inputStream = null;
+		InputStreamReader reader = null;
+		ByteArrayInputStream stream = null;
+		BufferedOutputStream bos = null;
+		BufferedInputStream bis = null;
+		try{
+			BigSceneProto.binary_mesh.Builder builder = BigSceneProto.binary_mesh.newBuilder();
+			inputStream = new FileInputStream(srcpath);
+			reader = new InputStreamReader(inputStream, "ASCII");
+			TextFormat.merge(reader, builder);
+			byte[] buf = builder.build().toByteArray();
+
+			//把序列化后的数据写入本地磁盘
+			stream = new ByteArrayInputStream(buf);
+			bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+			bis = new BufferedInputStream(stream);
+			int b = -1;
+			while ((b = bis.read()) != -1) {
+				bos.write(b);
+			}
+		}catch (Exception e){
+			log.error("txt转dam出错,srcpath:{}, despath:{}",srcpath, despath);
+			throw e;
+		}finally {
+			if(inputStream != null){
+				inputStream.close();
+			}
+			if(reader != null){
+				reader.close();
+			}
+			if(stream != null){
+				stream.close();
+			}
+			if(bos != null){
+				bos.close();
+			}
+			if(bis != null){
+				bis.close();
+			}
 		}
-		bis.close();
-		bos.close();
+
 	}
 	
 	public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception

+ 11 - 0
4dkankan-utils-redis/src/main/java/com/fdkankan/redis/constant/RedisLockKey.java

@@ -1,8 +1,10 @@
 package com.fdkankan.redis.constant;
 
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.json.JSON;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
+import java.io.File;
 
 /**
  * <p>
@@ -147,6 +149,15 @@ public class RedisLockKey {
      */
     public static final String LOCK_SCENE_CLEAN = "lock:scene:clean";
 
+    /**
+     * 思维打包下载锁
+     */
+    public static final String LOCK_DOWNLOAD_SIWEI_HTML = "lock:download:siwei:html";
+
+    public static void main(String[] args) {
+        FileUtil.copyContent(new File("F:\\test\\test"), new File("F:\\test\\test2"), true);
+    }
+
 
 
 }