瀏覽代碼

增加日志

xueyiming 2 月之前
父節點
當前提交
52cf90cd67

+ 7 - 4
api-module/src/main/java/com/tzld/piaoquan/api/controller/TencentWeComController.java

@@ -240,14 +240,17 @@ public class TencentWeComController {
         if (multipartFile.isEmpty()) {
             log.error("multipartFile is empty");
         }
-        File file = new File(filePath);
+
+        File targetFile = new File(System.getProperty("java.io.tmpdir"), filePath);
+        // 将MultipartFile的内容传输到File中
+        multipartFile.transferTo(targetFile);
         // 将MultipartFile的内容传输到File中
-        multipartFile.transferTo(file);
-        log.info("sendPostFile file size={}", file.length());
+        multipartFile.transferTo(targetFile);
+        log.info("sendPostFile file size={}", targetFile.length());
         byte[] decodedBytes = Base64.getDecoder().decode(url);
         String originalString = new String(decodedBytes);
         log.info("sendPostFile url={}", originalString);
-        String post = httpPoolClient.post(url, file);
+        String post = httpPoolClient.post(url, targetFile);
         log.info("sendPostFile post={}", post);
         Files.delete(Paths.get(filePath));
         return post;