Parcourir la source

微调整码包生成逻辑

tanzhongran il y a 3 ans
Parent
commit
8495200c7b

+ 11 - 3
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/infrastructure/mq/GenerateCodeConsumer.java

@@ -1,5 +1,6 @@
 package com.abi.qms.platform.infrastructure.mq;
 
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.file.FileWriter;
 import com.abi.base.foundation.util.RedisClient;
 import com.abi.qms.platform.dao.entity.*;
@@ -114,7 +115,8 @@ public class GenerateCodeConsumer {
 	final List<QrData> qrDataList = new LinkedList<>();
 
 	//生成码包路径
-	private File file = new File(this.getClass().getResource("/").getPath()+"/code");
+//	private File file = new File(this.getClass().getResource("/").getPath()+"/code");
+	private File file = new File("classpath:META-INF/code");
 
 	//批量添加文件
 	private ArrayList<File> fileList = new ArrayList<>();
@@ -131,6 +133,12 @@ public class GenerateCodeConsumer {
 	//该包下共有多少码数量
 	public Long sum = 0L;
 
+
+//	public static void main(String[] args) {
+//		File file = new File("classpath*:/code");
+//		System.out.println(file.getPath());
+//	}
+
 	@SneakyThrows
 	@RabbitHandler
 	@RabbitListener(queues = GenerateCodeConsumer.GENERATE_CODE_BY_REPERTORY_QUEUE)
@@ -279,8 +287,8 @@ public class GenerateCodeConsumer {
 			}
 			//放入oss地址和密码
 			qrPackage.setZipPassword(pas);
-			//删除生成文件 TODO
-			//FileUtil.del(file);
+			//删除生成文件
+			FileUtil.del(file);
 		}catch (Exception e){
 			throw new BusinessException("上传OSS失败");
 		}