export customer ID 2

This commit is contained in:
Shaun Chyxion 2020-11-19 22:32:32 +08:00
parent 5c843c837c
commit 071055a74b
2 changed files with 10 additions and 2 deletions

View File

@ -488,7 +488,7 @@ public class CustomerServiceSupport
try { try {
log.info("Export Customer [{}].", c); log.info("Export Customer [{}].", c);
printer.printRecord(c.getId(), printer.printRecord(c.getId2(),
c.getName(), c.getName(),
c.getSumYtdSales(), c.getSumYtdSales(),
joinYtdSales(c.getYears(), c.getYtdSales()), joinYtdSales(c.getYears(), c.getYtdSales()),

View File

@ -90,6 +90,12 @@ public class CustomerYearToDateSaleServiceSupport
*/ */
@Override @Override
public void read(final CSVRecord record) { 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)); val customerName = StringUtils.trim(record.get(1));
if (StringUtils.isBlank(customerName)) { if (StringUtils.isBlank(customerName)) {
log.warn("Record [{}] blank customer name found, ignore.", record); log.warn("Record [{}] blank customer name found, ignore.", record);
@ -97,7 +103,9 @@ public class CustomerYearToDateSaleServiceSupport
} }
val customer = customerMapper.find( val customer = customerMapper.find(
new Search(Customer.NAME, customerName)); new Search(Customer.ID2, customerId2)
.eq(Customer.NAME, customerName));
if (customer == null) { if (customer == null) {
log.warn("No customer [{}] found, ignore.", customerName); log.warn("No customer [{}] found, ignore.", customerName);
return; return;