feat: 海运有价卡按三段费用带小计展示

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-20 17:50:46 +08:00
co-authored by Cursor
parent 79caddef0e
commit 698ac43878
4 changed files with 135 additions and 2 deletions
@@ -557,6 +557,10 @@ public class InquiryTmsQueryService {
appendFeeLineFromRow(buckets.get(bucket), (Map<?, ?>) one, headerCurrency);
}
}
String bucketTotal = firstText(row.get("totalCostPrice"), row.get("total_cost_price"));
if (StringUtils.isNotBlank(bucketTotal)) {
quote.put("fee_total_" + bucket, bucketTotal);
}
}
}
for (Map.Entry<String, List<Map<String, String>>> e : buckets.entrySet()) {
@@ -182,4 +182,42 @@ public class TmsQuoteCurrencyTest {
assertTrue(quote.get("fee_lines").contains("运输费"));
assertTrue(quote.get("fee_lines").contains("2800"));
}
@Test
public void toAgentQuoteKeepsSeaBucketTotals() {
Map<String, Object> pol = new HashMap<>();
pol.put("feeName", "操作费");
pol.put("amount", 1020);
pol.put("currency", "CNY");
Map<String, Object> polWrap = new java.util.LinkedHashMap<>();
polWrap.put("polCostItems", Collections.singletonList(pol));
polWrap.put("totalCostPrice", 1070);
Map<String, Object> ocean = new HashMap<>();
ocean.put("feeName", "海运费");
ocean.put("amount", 575);
ocean.put("currency", "USD");
Map<String, Object> oceanWrap = new java.util.LinkedHashMap<>();
oceanWrap.put("oceanCostItems", Collections.singletonList(ocean));
oceanWrap.put("totalCostPrice", 4038);
Map<String, Object> pod = new HashMap<>();
pod.put("feeName", "文件费");
pod.put("amount", 450);
pod.put("currency", "CNY");
Map<String, Object> podWrap = new java.util.LinkedHashMap<>();
podWrap.put("podCostItems", Collections.singletonList(pod));
podWrap.put("totalCostPrice", 470);
Map<String, Object> data = new HashMap<>();
data.put("quoteFound", true);
data.put("totalCostPrice", 6952.77);
data.put("currency", "CNY");
data.put("feeItems", java.util.Arrays.asList(polWrap, oceanWrap, podWrap));
Map<String, Object> tms = new HashMap<>();
tms.put("code", 1);
tms.put("tmsData", data);
Map<String, String> quote = InquiryTmsQueryService.toAgentQuote(tms);
assertEquals("1070", quote.get("fee_total_polCostItems"));
assertEquals("4038", quote.get("fee_total_oceanCostItems"));
assertEquals("470", quote.get("fee_total_podCostItems"));
assertTrue(quote.get("fee_rows_oceanCostItems").contains("575"));
}
}