From 071055a74bab5062581f58d2ed54a191c1d4636e Mon Sep 17 00:00:00 2001 From: Shaun Chyxion Date: Thu, 19 Nov 2020 22:32:32 +0800 Subject: [PATCH] export customer ID 2 --- .../crm/service/support/CustomerServiceSupport.java | 2 +- .../support/CustomerYearToDateSaleServiceSupport.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java b/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java index 779fec8..f351b10 100644 --- a/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java +++ b/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java @@ -488,7 +488,7 @@ public class CustomerServiceSupport try { log.info("Export Customer [{}].", c); - printer.printRecord(c.getId(), + printer.printRecord(c.getId2(), c.getName(), c.getSumYtdSales(), joinYtdSales(c.getYears(), c.getYtdSales()), diff --git a/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerYearToDateSaleServiceSupport.java b/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerYearToDateSaleServiceSupport.java index 69c8fc1..aa47dd6 100644 --- a/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerYearToDateSaleServiceSupport.java +++ b/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerYearToDateSaleServiceSupport.java @@ -90,6 +90,12 @@ public class CustomerYearToDateSaleServiceSupport */ @Override public void read(final CSVRecord record) { + val customerId2 = StringUtils.trim(record.get(0)); + if (StringUtils.isBlank(customerId2)) { + log.info("Blank customer id found, ignore."); + return; + } + val customerName = StringUtils.trim(record.get(1)); if (StringUtils.isBlank(customerName)) { log.warn("Record [{}] blank customer name found, ignore.", record); @@ -97,7 +103,9 @@ public class CustomerYearToDateSaleServiceSupport } val customer = customerMapper.find( - new Search(Customer.NAME, customerName)); + new Search(Customer.ID2, customerId2) + .eq(Customer.NAME, customerName)); + if (customer == null) { log.warn("No customer [{}] found, ignore.", customerName); return;