Pu Zhibing
2024-10-16 c4664502dfdaffff555b532e65b51a57ac8b29c2
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java
@@ -75,6 +75,7 @@
                              @RequestParam("invoiceUrl") String invoiceUrl){
      TOrderInvoice orderInvoice = orderInvoiceService.getById(id);
      orderInvoice.setInvoiceUrl(invoiceUrl);
      orderInvoice.setStatus(3);
      orderInvoiceService.updateById(orderInvoice);
      // 发送邮箱
      // 收件人电子邮箱,TODO 换成自己的收件箱
@@ -128,7 +129,7 @@
         //组装的顺序非常重要,一定要先组装文本域,再组装文件
         MimeBodyPart htmlPart = new MimeBodyPart();
         // 组装内容
         htmlPart.setContent("This is message content", "text/html;charset=UTF-8");
         htmlPart.setContent("开票", "text/html;charset=UTF-8");
         msgMultipart.addBodyPart(htmlPart);
         // 组装附件
@@ -141,7 +142,9 @@
            byte[] imageBytes = IOUtils.toByteArray(inputStream);
            // 创建临时文件
            File tempFile = File.createTempFile("tempImage", ".png");
            // 截取imageUrl后缀名
            String fileExtension = imageUrl.substring(imageUrl.lastIndexOf("."));
            File tempFile = File.createTempFile("tempImage", fileExtension);
            try (FileOutputStream fos = new FileOutputStream(tempFile)) {
               fos.write(imageBytes);
            }