From b3b3cf290399e801f2ae5fc2d214d3f318abd0d9 Mon Sep 17 00:00:00 2001 From: jillion <439912596@qq.com> Date: Sun, 20 Sep 2026 17:56:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=B7=E8=BF=90=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E5=8D=95=E8=AF=A2=E4=BB=B7=E6=A0=8F=E5=86=99=E5=85=A5=E8=B4=B8?= =?UTF-8?q?=E6=98=93=E6=9D=A1=E6=AC=BE=E5=92=8C=E8=BF=90=E8=BE=93=E5=88=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- .../impl/InquiryQuoteTemplateServiceImpl.java | 3 +- .../template/QuoteTemplateExcelSupport.java | 2 +- .../template/QuoteTemplateFillTest.java | 43 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/inquiry-api/jeecg-module-inquiry/src/main/java/org/jeecg/modules/inquiry/service/impl/InquiryQuoteTemplateServiceImpl.java b/inquiry-api/jeecg-module-inquiry/src/main/java/org/jeecg/modules/inquiry/service/impl/InquiryQuoteTemplateServiceImpl.java index 4391624..990241e 100644 --- a/inquiry-api/jeecg-module-inquiry/src/main/java/org/jeecg/modules/inquiry/service/impl/InquiryQuoteTemplateServiceImpl.java +++ b/inquiry-api/jeecg-module-inquiry/src/main/java/org/jeecg/modules/inquiry/service/impl/InquiryQuoteTemplateServiceImpl.java @@ -797,7 +797,7 @@ public class InquiryQuoteTemplateServiceImpl extends ServiceImpl quote = new HashMap<>(); quote.put("total", "2287.65"); @@ -306,9 +308,50 @@ public class QuoteTemplateFillTest { assertEquals("15件", out.getString("quantity")); assertEquals("整柜", out.getString("fcl_or_lcl")); assertEquals("20GP*1", out.getString("container_type_qty")); + assertEquals("FOB", out.getString("trade_terms")); + assertEquals("Port to Port", out.getString("运输分类")); assertEquals("2287.65", out.getString("total_amount")); } + /** + * 海运询价栏:贸易条款、运输分类按标签右侧原文写入。 + * 标签格子本身不能被港口/分类值盖掉。 + */ + @Test + public void seaInquiryWritesTradeTermsAndClassByLabel() throws Exception { + Path src = Files.createTempFile("quote-sea-class-src", ".xlsx"); + Path out = Files.createTempFile("quote-sea-class-out", ".xlsx"); + try (Workbook wb = new XSSFWorkbook()) { + Sheet sheet = wb.createSheet("海运询价单"); + row(sheet, 8).createCell(0).setCellValue("贸易条款"); + row(sheet, 9).createCell(0).setCellValue("运输分类"); + try (java.io.OutputStream os = Files.newOutputStream(src)) { + wb.write(os); + } + } + Map ticket = new HashMap<>(); + ticket.put("贸易条款", "FOB"); + ticket.put("运输分类", "Port to Port"); + ticket.put("起运港", "DONGGUAN"); + JSONObject facts = org.jeecg.modules.inquiry.service.impl.InquiryQuoteTemplateServiceImpl + .buildFillFacts("WO202609200010", ticket, new HashMap<>(), "WuJiLin"); + assertEquals("FOB", facts.getString("trade_terms")); + assertEquals("Port to Port", facts.getString("运输分类")); + JSONObject mapping = new JSONObject(); + mapping.put("fields", new JSONObject()); + QuoteTemplateExcelSupport.fillWorkbook(src, out, mapping, facts); + try (Workbook filled = new XSSFWorkbook(Files.newInputStream(out))) { + Sheet sheet = filled.getSheetAt(0); + assertEquals("贸易条款", read(sheet, 8, 0)); + assertEquals("FOB", read(sheet, 8, 1)); + assertEquals("运输分类", read(sheet, 9, 0)); + assertEquals("Port to Port", read(sheet, 9, 1)); + } finally { + Files.deleteIfExists(src); + Files.deleteIfExists(out); + } + } + @Test public void buildFillFactsProjectsCollabFields() { Map facts = new HashMap<>();