瀏覽代碼

Excel版形式发票

zhangchenm 1 周之前
父節點
當前提交
f725af6442

+ 12 - 0
trade-client/src/main/java/com/trade/client/trade/salesorder/service/SalesOrderCService.java

@@ -1,6 +1,8 @@
 package com.trade.client.trade.salesorder.service;
 
 import com.github.pagehelper.PageInfo;
+import com.trade.service.trade.salesorder.domain.SalesOrder;
+import com.trade.service.trade.salesorder.domain.SalesOrderGoods;
 import com.trade.service.trade.salesorder.dto.*;
 import com.trade.service.trade.salesorder.vo.SalesOrderDtlVO;
 import com.trade.service.trade.salesorder.vo.SalesOrderSearch;
@@ -86,4 +88,14 @@ public interface SalesOrderCService {
      * @return boolean
      */
     OrderPaymentAmountDto submitOrderListInfo(List<OrderListInfoDto> salesOrderInfo, int source);
+
+    /**
+     * 生成形式发票文件
+     * 
+     * @param salesOrder 销售订单信息
+     * @param salesOrderGoodsList 销售订单商品信息
+     * @param invoiceNo 发票号
+     * @return 发票文件ID
+     */
+    Long generateInvoiceFile(SalesOrder salesOrder, List<SalesOrderGoods> salesOrderGoodsList, String invoiceNo);
 }

+ 92 - 28
trade-client/src/main/java/com/trade/client/trade/salesorder/service/impl/SalesOrderCServiceImpl.java

@@ -1,24 +1,31 @@
 package com.trade.client.trade.salesorder.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
-import com.deepoove.poi.config.Configure;
-import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.metadata.fill.FillConfig;
 import com.github.pagehelper.PageInfo;
 import com.trade.client.security.utils.UserUtils;
 import com.trade.common.constant.HttpStatus;
 import com.trade.common.exception.ServiceException;
 import com.trade.common.utils.ConstantUtil;
 import com.trade.common.utils.StringUtils;
+import com.trade.common.utils.file.ASopUtil;
 import com.trade.common.utils.uuid.BizNoUtil;
 import com.trade.service.DictConstants;
+import com.trade.service.contract.entity.SFileTemplate;
+import com.trade.service.contract.util.SignPubUtil;
 import com.trade.service.enterprise.companyrelated.domain.ImporterEntity;
 import com.trade.service.enterprise.companyrelated.service.IImporterEntityService;
 import com.trade.service.enterprise.customer.domain.Enterprise;
 import com.trade.service.enterprise.customer.domain.EnterpriseRelatedPerson;
 import com.trade.service.enterprise.customer.service.EnterpriseBaseService;
 import com.trade.service.enterprise.customer.service.EnterpriseRelatedPersonBaseService;
+import com.trade.service.filestorage.entity.TFileStorage;
+import com.trade.service.filestorage.service.OSSFileService;
+import com.trade.service.filestorage.util.FileUtil;
 import com.trade.service.system.service.ISysDictDataService;
-import com.trade.service.trade.purchaseorder.domain.PurchaseOrderCommodity;
 import com.trade.service.trade.purchaseorder.dto.PurchaseOrderDto;
 import com.trade.service.trade.purchaseorder.service.PurchaseOrderService;
 import com.trade.service.trade.salescontract.domain.ContractTerms;
@@ -32,9 +39,6 @@ import com.trade.service.trade.salesorder.dto.*;
 import com.trade.client.trade.salesorder.service.SalesOrderCService;
 import com.trade.service.filestorage.enums.FileTypeEnum;
 import com.trade.service.TransStruct;
-import com.trade.service.contract.dto.ContractGenInputItem;
-import com.trade.service.contract.dto.ContractGenOutputItem;
-import com.trade.service.contract.service.ContractService;
 import com.trade.service.contract.service.ISFileTemplateService;
 import com.trade.service.trade.salesorder.constant.SaleOrderConstant;
 import com.trade.service.trade.salesorder.service.*;
@@ -45,10 +49,16 @@ import com.trade.service.serialNum.service.SerialNumberGenerator;
 import com.trade.service.tradingplatform.domain.TradingPlatform;
 import com.trade.service.tradingplatform.service.TradingPlatformBaseService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.*;
@@ -64,8 +74,6 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
     private final ISalesOrderLogisticsService salesOrderLogisticsService;
     private final ISalesOrderContainerService salesOrderContainerService;
     @Resource
-    private ContractService contractService;
-    @Resource
     private SerialNumberGenerator serialNumberGenerator;
     @Resource
     private TransStruct transStruct;
@@ -89,6 +97,8 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
     private SalesCommodityService salesCommodityService;
     @Resource
     private ISysDictDataService iSysDictDataService;
+    @Resource
+    private OSSFileService ossFileStorageService;
 
     public SalesOrderCServiceImpl(ISalesOrderService salesOrderService, ISalesOrderGoodsService salesOrderGoodsService,
             ISalesOrderInvoiceService salesOrderInvoiceService, ISalesOrderLogisticsService salesOrderLogisticsService,
@@ -105,7 +115,7 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
         search.setCustomerUserId(UserUtils.getCustomerUserId());
         search.setPoint(true);
         if (StringUtils.isNotEmpty(search.getStatus())
-                && SaleOrderConstant.ORDER_STATUS_DELIVERING.equals(search.getStatus())) {
+                && String.valueOf(SaleOrderConstant.ORDER_STATUS_DELIVERING).equals(search.getStatus())) {
             List<Integer> statusList = new ArrayList<>();
             statusList.add(SaleOrderConstant.ORDER_STATUS_DELIVERING);
             statusList.add(SaleOrderConstant.ORDER_STATUS_PARTIAL_COLLECTION);
@@ -187,33 +197,72 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
         log.info("提交销售订单Info:{}", salesOrderDTO.toString());
         save(salesOrderDTO, true);
         SalesOrder salesOrder = salesOrderDTO.getSalesOrder();
-        Long userId = salesOrder.getCustomerUserId();
         SalesOrderInvoice salesOrderInvoice = new SalesOrderInvoice();
         salesOrderInvoice.setOrderId(salesOrder.getId());
         salesOrderInvoice.setInvoiceNo(serialNumberGenerator.nextValue(SaleOrderConstant.ORDER_INVOICE_NO_PREFIX));
         salesOrderInvoice.setAmount(salesOrder.getAmount());
         // 生成发票文件并保存文件ID
-        ContractGenInputItem item = initContractGenInputItem(salesOrder, salesOrderDTO.getSalesOrderGoodsList(),
+        Long fileId = generateInvoiceFile(salesOrder, salesOrderDTO.getSalesOrderGoodsList(),
                 salesOrderInvoice.getInvoiceNo());
-        ContractGenOutputItem outputItem = contractService.generateSingleContract(item, userId);
-        salesOrderInvoice.setFileId(outputItem.getFileId());
+        salesOrderInvoice.setFileId(fileId);
         salesOrderInvoiceService.save(salesOrderInvoice);
     }
 
     /**
-     * 初始化合同生成参数
+     * 生成形式发票文件
      * 
      * @param salesOrder 订单信息
      * @param salesOrderGoodsList 订单商品列表
      * @param invoiceNo 发票号
+     * @return 文件ID
+     */
+    public Long generateInvoiceFile(SalesOrder salesOrder, List<SalesOrderGoods> salesOrderGoodsList,
+            String invoiceNo) {
+        String transientFileName = FileUtil.getAbsoluteDir() + "/" + UUID.randomUUID() + ".xlsx";
+        String excelFileName = FileUtil.getAbsoluteDir() + "/" + invoiceNo + ".xlsx";
+        String pdfFilePath = FileUtil.getAbsoluteDir() + "/" + invoiceNo + ".pdf";
+        SFileTemplate fileTemplate = fileTemplateService.selectByFileType(FileTypeEnum.PROFORMA_INVOICE.getCode());
+        try {
+            Map<String, Object> titleData = initTemplateParams(salesOrder, invoiceNo);
+            List<GoodsInfo4TL> goodsList = transStruct.transOrder2GoodsInfo4TLList(salesOrderGoodsList);
+            // 写入Excel文件
+            try (ExcelWriter excelWriter = EasyExcel.write(transientFileName).withTemplate(fileTemplate.getSrcPath())
+                    .build()) {
+                WriteSheet writeSheet = EasyExcel.writerSheet().build();
+                FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
+                excelWriter.fill(goodsList, fillConfig, writeSheet);
+                excelWriter.fill(titleData, writeSheet);
+            }
+            // 此处需要用新的文件接收,否则转pdf会报错: java.util.zip.ZipException: invalid entry size
+            try (Workbook workbook = new XSSFWorkbook(new FileInputStream(transientFileName));
+                    FileOutputStream fos = new FileOutputStream(excelFileName)) {
+                workbook.write(fos);
+            }
+            // 转换Excel为PDF
+            ASopUtil.excel2pdf(excelFileName, pdfFilePath);
+        } catch (IOException e) {
+            throw new ServiceException("生成形式发票文件失败: " + e.getMessage(), HttpStatus.ERROR);
+        } finally {
+            // 清理生成的文件
+            SignPubUtil.deleteFileWithPath(transientFileName, excelFileName);
+        }
+        // 上传文件并返回ID
+        TFileStorage fileStorage = ossFileStorageService.uploadAndSaveDBRecord(new File(pdfFilePath),
+                fileTemplate.getDestDir());
+        SignPubUtil.deleteFileWithPath(pdfFilePath);
+        return fileStorage.getId();
+    }
+
+    /**
+     * 初始化模板参数
+     * 
+     * @param salesOrder 订单信息
+     * @param invoiceNo 发票号
      * @return 合同生成参数
      */
-    private ContractGenInputItem initContractGenInputItem(SalesOrder salesOrder,
-            List<SalesOrderGoods> salesOrderGoodsList, String invoiceNo) {
-        ContractGenInputItem item = new ContractGenInputItem();
-        String templateCode = fileTemplateService.selectByFileType(FileTypeEnum.PROFORMA_INVOICE.getCode())
-                .getTemplateCode();
+    private Map<String, Object> initTemplateParams(SalesOrder salesOrder, String invoiceNo) {
         SalesContractDto salesContract = salesContractService.getSalesContractById(salesOrder.getSaleContractId());
+        SalesOrderLogistics orderLogistics = salesOrderLogisticsService.getByOrderId(salesOrder.getId());
         ContractTerms contractTerms = contractTermsService.getByContractIdAndType(salesContract.getId(),
                 ConstantUtil.SALES_CONTRACT_NO_PREFIX);
         ImporterEntity importer = importerEntityService.getByEntityId(salesOrder.getImporterId());
@@ -224,24 +273,29 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
         String customerAddress = StringUtils.isEmpty(enterprise.getBusinessAddress()) ? enterprise.getRegisterAddress()
                 : enterprise.getBusinessAddress();
         String contractTel = contact.getMobile();
+        String email = contact.getEmail();
+        String contactName = contact.getName();
         if (DictConstants.EXPORT_TYPE_PROXY.equals(enterprise.getExportType())) {
             TradingPlatform tradingPlatform = tradingPlatformBaseService.lambdaQuery()
                     .eq(TradingPlatform::getCertNo, salesContract.getAgencyCertNo()).one();
             customerName = tradingPlatform.getPlatformName();
             customerAddress = tradingPlatform.getBusinessAddress();
             contractTel = tradingPlatform.getContactMobile();
+            email = tradingPlatform.getContactEmail();
+            contactName = tradingPlatform.getContactName();
         }
         // 支付方式 页面选其他,后台取不到值,默认"" PS: The final interpretation rights belong to the product manager who will never make
         // a mistake
         String paymentWay = Optional
                 .ofNullable(iSysDictDataService.selectDictLabel("payment_way_en", contractTerms.getPaymentWay()))
                 .orElse("");
-        item.setTemplateCode(templateCode);
         Map<String, Object> params = new HashMap<>();
         params.put("customerName", customerName);
         params.put("customerAddress", customerAddress);
-        params.put("date", LocalDate.now());
+        params.put("contactName", contactName);
+        params.put("date", LocalDate.now().toString());
         params.put("tel", contractTel);
+        params.put("email", email);
         params.put("invoiceNo", invoiceNo);
         params.put("from", salesContract.getPortDeparture());
         params.put("to", salesContract.getPortDestination());
@@ -249,17 +303,27 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
         params.put("payWay", paymentWay);
         params.put("importerName", importer.getEntityName());
         params.put("importerAddress", importer.getBusinessAddress());
+        params.put("importerContactName", importer.getContactName());
+        params.put("importerContactEmail", importer.getContactEmail());
+        params.put("importerContactPhone", importer.getContactMobile());
         params.put("currency", contractTerms.getPaymentCurrency());
         params.put("cardNo", contractTerms.getAccountNumber());
         params.put("openBank", contractTerms.getOpeningBank());
+        params.put("accountName", contractTerms.getAccountName());
         params.put("swiftCode", contractTerms.getSwiftCode());
-        params.put("total", salesOrder.getAmount());
-        List<GoodsInfo4TL> goodsList = transStruct.transOrder2GoodsInfo4TLList(salesOrderGoodsList);
-        params.put(SaleOrderConstant.ORDER_INVOICE_GOODS_LIST_KEY, goodsList);
-        item.setParams(params);
-        LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
-        item.setConfig(Configure.builder().bind(SaleOrderConstant.ORDER_INVOICE_GOODS_LIST_KEY, policy).build());
-        return item;
+        params.put("orderTotal", salesOrder.getAmount());
+        params.put("shippingMethod", orderLogistics.getShippingMethod());
+        BigDecimal total = salesOrder.getAmount();
+        if (orderLogistics.getShippingFee() != null) {
+            total = total.add(orderLogistics.getShippingFee());
+            params.put("shippingFee", orderLogistics.getShippingFee());
+        }
+        if (orderLogistics.getInsuranceFee() != null) {
+            total = total.add(orderLogistics.getInsuranceFee());
+            params.put("insuranceFee", orderLogistics.getInsuranceFee());
+        }
+        params.put("total", total);
+        return params;
     }
 
     @Override

+ 19 - 2
trade-client/src/test/java/com/trade/client/salesorder/service/impl/SalesOrderCServiceTest.java

@@ -6,6 +6,7 @@ import com.trade.service.contract.service.ISFileTemplateService;
 import com.trade.service.trade.salesorder.domain.SalesOrder;
 import com.trade.service.trade.salesorder.domain.SalesOrderGoods;
 import com.trade.service.trade.salesorder.dto.SalesOrderDTO;
+import com.trade.service.trade.salesorder.service.ISalesOrderGoodsService;
 import com.trade.service.trade.salesorder.vo.SalesOrderSearch;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -18,11 +19,13 @@ import java.util.List;
 
 @SpringBootTest
 class SalesOrderCServiceTest {
+
     @Resource
     private SalesOrderCService salesOrderCService;
-
     @Resource
     private ISFileTemplateService fileTemplateService;
+    @Resource
+    private ISalesOrderGoodsService salesOrderGoodsService;
 
     @Test
     void printProformaInvoiceFTLFileType() {
@@ -38,7 +41,7 @@ class SalesOrderCServiceTest {
     @Test
     void salesOrderSaveTest() {
         SalesOrder salesOrder = new SalesOrder();
-        //salesOrder.setId(2L);
+        // salesOrder.setId(2L);
         salesOrder.setAmount(new BigDecimal(1000001));
         salesOrder.setCustomerUserId(1L);
         salesOrder.setImporterId(1L);
@@ -67,4 +70,18 @@ class SalesOrderCServiceTest {
         System.out.println(salesOrderCService.queryListBySearch(salesOrderSearch));
     }
 
+    @Test
+    void invoiceTest() {
+        SalesOrder salesOrder = new SalesOrder();
+        salesOrder.setId(1854043001450524673L);
+        salesOrder.setAmount(new BigDecimal(1000001));
+        salesOrder.setCustomerUserId(1853996402259128322L);
+        salesOrder.setImporterId(1854006691536957442L);
+        salesOrder.setSaleContractId(1854040902331396098L);
+        SalesOrderDTO salesOrderDTO = new SalesOrderDTO();
+        salesOrderDTO.setSalesOrder(salesOrder);
+        salesOrderCService.generateInvoiceFile(salesOrder,
+                salesOrderGoodsService.lambdaQuery().eq(SalesOrderGoods::getSaleOrderId, salesOrder.getId()).list(),
+                "123456789012345678");
+    }
 }

二進制
trade-common/lib/aspose-cells-8.5.2.jar


+ 21 - 0
trade-common/pom.xml

@@ -149,6 +149,27 @@
             <version>2.5.1</version>
             <optional>true</optional>
         </dependency>
+        <!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>itextpdf</artifactId>
+            <version>5.5.13.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.aspose</groupId>
+            <artifactId>aspose-cells</artifactId>
+            <version>8.5.2</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/lib/aspose-cells-8.5.2.jar</systemPath>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.3.4</version>
+        </dependency>
     </dependencies>
 
 

+ 113 - 11
trade-common/src/main/java/com/trade/common/utils/file/ASopUtil.java

@@ -6,16 +6,29 @@ import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 
+import com.aspose.cells.PdfSaveOptions;
+import com.aspose.cells.Workbook;
 import com.aspose.words.Document;
 import com.aspose.words.License;
 import com.aspose.words.SaveFormat;
 
-
 /**
- * Aspose Word OP工具类
+ * Aspose OP工具类
+ * </p>
+ * <新增了excel转pdf的功能 20241109>
+ * </p>
  */
 public class ASopUtil {
 
+    private static final String licenseStr = "<License>\n" + "  <Data>\n" + "    <Products>\n"
+            + "      <Product>Aspose.Total for Java</Product>\n" + "      <Product>Aspose.Words for Java</Product>\n"
+            + "    </Products>\n" + "    <EditionType>Enterprise</EditionType>\n"
+            + "    <SubscriptionExpiry>20991231</SubscriptionExpiry>\n"
+            + "    <LicenseExpiry>20991231</LicenseExpiry>\n"
+            + "    <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>\n" + "  </Data>\n"
+            + "  <Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>\n"
+            + "</License>";
+
     public static File docTransfer(InputStream inputStream, String outPath, int saveFormat) {
         if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
             // return;
@@ -57,19 +70,96 @@ public class ASopUtil {
         return file;
     }
 
+    /**
+     * excel 转 pdf
+     *
+     * @param excelFilePath excel文件路径
+     */
+    public static void excel2pdf(String excelFilePath) {
+        excel2pdf(excelFilePath, null, null);
+    }
+
+    /**
+     * excel 转 pdf
+     *
+     * @param excelFilePath excel文件路径
+     * @param convertSheets 需要转换的sheet
+     */
+    public static void excel2pdf(String excelFilePath, int[] convertSheets) {
+        excel2pdf(excelFilePath, null, convertSheets);
+    }
+
+    /**
+     * excel 转 pdf
+     *
+     * @param excelFilePath excel文件路径
+     * @param pdfFilePath pdf文件路径
+     */
+    public static void excel2pdf(String excelFilePath, String pdfFilePath) {
+        excel2pdf(excelFilePath, pdfFilePath, null);
+    }
+
+    /**
+     * excel 转 pdf
+     *
+     * @param excelFilePath excel文件路径
+     * @param pdfFilePath pdf文件路径
+     * @param convertSheets 需要转换的sheet
+     */
+    public static void excel2pdf(String excelFilePath, String pdfFilePath, int[] convertSheets) {
+        try {
+            getCellsLicense();
+            pdfFilePath = pdfFilePath == null ? getPdfFilePath(excelFilePath) : pdfFilePath;
+            Workbook wb = new Workbook(excelFilePath);
+            FileOutputStream fileOS = new FileOutputStream(pdfFilePath);
+            PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
+            pdfSaveOptions.setOnePagePerSheet(true);
+            if (null != convertSheets) {
+                printSheetPage(wb, convertSheets);
+            }
+            wb.save(fileOS, pdfSaveOptions);
+            fileOS.flush();
+            fileOS.close();
+            System.out.println("convert success");
+        } catch (Exception e) {
+            System.out.println("convert failed");
+            e.printStackTrace();
+            throw new RuntimeException("文件转换失败");
+        }
+    }
+
+    /**
+     * 获取 生成的 pdf 文件路径,默认与源文件同一目录
+     *
+     * @param excelFilePath excel文件
+     * @return 生成的 pdf 文件
+     */
+    private static String getPdfFilePath(String excelFilePath) {
+        return excelFilePath.split("\\.")[0] + ".pdf";
+    }
+
+    /**
+     * 隐藏workbook中不需要的sheet页。
+     *
+     * @param sheets 显示页的sheet数组
+     */
+    private static void printSheetPage(Workbook wb, int[] sheets) {
+        for (int i = 1; i < wb.getWorksheets().getCount(); i++) {
+            wb.getWorksheets().get(i).setVisible(false);
+        }
+        if (null == sheets || sheets.length == 0) {
+            wb.getWorksheets().get(0).setVisible(true);
+        } else {
+            for (int i = 0; i < sheets.length; i++) {
+                wb.getWorksheets().get(i).setVisible(true);
+            }
+        }
+    }
+
     private static boolean getLicense() {
         boolean result = false;
         try {
             // 凭证
-            String licenseStr = "<License>\n" + "  <Data>\n" + "    <Products>\n"
-                    + "      <Product>Aspose.Total for Java</Product>\n"
-                    + "      <Product>Aspose.Words for Java</Product>\n" + "    </Products>\n"
-                    + "    <EditionType>Enterprise</EditionType>\n"
-                    + "    <SubscriptionExpiry>20991231</SubscriptionExpiry>\n"
-                    + "    <LicenseExpiry>20991231</LicenseExpiry>\n"
-                    + "    <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>\n" + "  </Data>\n"
-                    + "  <Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>\n"
-                    + "</License>";
             InputStream license = new ByteArrayInputStream(licenseStr.getBytes(StandardCharsets.UTF_8));
             License asposeLic = new License();
             asposeLic.setLicense(license);
@@ -79,4 +169,16 @@ public class ASopUtil {
         }
         return result;
     }
+
+    private static void getCellsLicense() {
+        InputStream license = new ByteArrayInputStream(licenseStr.getBytes(StandardCharsets.UTF_8));
+        com.aspose.cells.License asposeLic = new com.aspose.cells.License();
+        asposeLic.setLicense(license);
+    }
+
+    public static void main(String[] args) {
+        String inPath = "C:\\Users\\dawn7\\Desktop\\123456789012345678.xlsx";
+        String outPath = "C:\\Users\\dawn7\\Desktop\\123456789012345678.pdf";
+        excel2pdf(inPath, outPath);
+    }
 }

+ 15 - 1
trade-service/src/main/java/com/trade/service/contract/util/SignPubUtil.java

@@ -57,7 +57,7 @@ public class SignPubUtil {
     }
 
     /**
-     * 删除pdf(若采用本地存储方式则无需此步操作)
+     * 删除文件
      *
      * @param file file
      */
@@ -68,4 +68,18 @@ public class SignPubUtil {
             e.printStackTrace();
         }
     }
+
+    /**
+     * 删除文件
+     * 
+     * @param filePaths 文件路径
+     */
+    public static void deleteFileWithPath(String... filePaths) {
+        for (String filePath : filePaths) {
+            File file = new File(filePath);
+            if (file.exists()) {
+                SignPubUtil.deleteFile(file);
+            }
+        }
+    }
 }

+ 19 - 0
trade-service/src/main/java/com/trade/service/trade/salesorder/domain/SalesOrderLogistics.java

@@ -3,6 +3,8 @@ package com.trade.service.trade.salesorder.domain;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.trade.common.core.domain.BizBaseEntity;
+
+import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import lombok.Getter;
@@ -84,4 +86,21 @@ public class SalesOrderLogistics extends BizBaseEntity {
      * 发货备注
      */
     private String deliverRemark;
+    /**
+     * 运输方式
+     */
+    @NotBlank(message = "运输方式不能为空")
+    private String shippingMethod;
+    /**
+     * 运费金额
+     */
+    private BigDecimal shippingFee;
+    /**
+     * 保费金额
+     */
+    private BigDecimal insuranceFee;
+    /**
+     * 杂费金额
+     */
+    private BigDecimal otherFee;
 }

+ 2 - 2
trade-service/src/main/java/com/trade/service/trade/salesorder/dto/GoodsInfo4TL.java

@@ -11,7 +11,7 @@ public class GoodsInfo4TL {
     private String count;
     private String unit;
     private String unitPrice;
-    private String uPC = "USD";//单价币种
+    private String tag1 = "$";//单价币种
     private String amount;
-    private String aC = "USD";// 金额币种
+    private String tag2 = "$";// 金额币种
 }

+ 17 - 0
trade-service/src/main/java/com/trade/service/trade/salesorder/vo/SalesOrderLogisticsDtlVO.java

@@ -1,5 +1,6 @@
 package com.trade.service.trade.salesorder.vo;
 
+import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
@@ -44,4 +45,20 @@ public class SalesOrderLogisticsDtlVO {
     List<SalesOrderContainerVO> salesOrderContainerList;
     @ApiModelProperty(name = "ladingBillFile", value = "提单文件")
     private FileAbstractDto ladingBillFile;
+    /**
+     * 运输方式
+     */
+    private String shippingMethod;
+    /**
+     * 运费金额
+     */
+    private BigDecimal shippingFee;
+    /**
+     * 保费金额
+     */
+    private BigDecimal insuranceFee;
+    /**
+     * 杂费金额
+     */
+    private BigDecimal otherFee;
 }

+ 12 - 2
trade-service/src/main/resources/mapper/trade/salesorder/SalesOrderLogisticsMapper.xml

@@ -13,6 +13,10 @@
         <result column="dest_port" property="destPort" />
         <result column="lading_type" property="ladingType" />
         <result column="lading_date" property="ladingDate" />
+        <result column="shipping_method" property="shippingMethod" />
+        <result column="shipping_fee" property="shippingFee" />
+        <result column="insurance_fee" property="insuranceFee" />
+        <result column="other_fee" property="otherFee" />
         <result column="lading_bill_no" property="ladingBillNo" />
         <result column="lading_bill_file_id" property="ladingBillFileId" />
         <result column="estimated_arrival_time" property="estimatedArrivalTime" />
@@ -25,9 +29,11 @@
     <sql id="Base_Column_List">
         id,
         deleted,
-        order_id, logistics_company, deliver_time, from_port, dest_port, lading_type, lading_date,
-lading_bill_no, lading_bill_file_id, estimated_arrival_time, deliver_remark, gmt_create, gmt_modified
+        order_id, logistics_company, deliver_time, from_port, dest_port, lading_type, lading_date, shipping_method,
+        shipping_fee, insurance_fee, other_fee, lading_bill_no, lading_bill_file_id, estimated_arrival_time, deliver_remark,
+        gmt_create, gmt_modified
     </sql>
+
     <select id="queryListBySearch" resultType="com.trade.service.trade.salesorder.vo.SalesOrderLogisticsVO">
         SELECT
         a.logistics_company,
@@ -98,6 +104,10 @@ lading_bill_no, lading_bill_file_id, estimated_arrival_time, deliver_remark, gmt
             a.lading_bill_no,
             a.lading_bill_file_id,
             a.deliver_remark,
+            a.shipping_method,
+            a.shipping_fee,
+            a.insurance_fee,
+            a.other_fee,
             b.order_no,
             d.contract_no as sales_contract_no,
             e.platform_name as agency_enterprise_name