| @@ -86,7 +86,9 @@ public class ImportTemplateTask { | |||||
| //此处判断商户是否存在 | //此处判断商户是否存在 | ||||
| //1 过滤重复商户名 | //1 过滤重复商户名 | ||||
| Set<String> merchantSet = successList.parallelStream().map(s -> StringUtils.trim(s.getMerchantName())).collect(Collectors.toSet()); | |||||
| Set<String> merchantSet = successList.parallelStream().filter(s -> StringUtils.isNotEmpty(s.getMerchantName())) | |||||
| .map(s -> StringUtils.trim(s.getMerchantName())) | |||||
| .collect(Collectors.toSet()); | |||||
| //2 查询商户名是否存在 | //2 查询商户名是否存在 | ||||
| Map<String, WxMerchant> merchantMap = new HashMap<>(); | Map<String, WxMerchant> merchantMap = new HashMap<>(); | ||||
| merchantSet.parallelStream().forEach(merchantName -> { | merchantSet.parallelStream().forEach(merchantName -> { | ||||
| @@ -101,7 +103,7 @@ public class ImportTemplateTask { | |||||
| }); | }); | ||||
| //3 计失败条数 | //3 计失败条数 | ||||
| List<WxBillExcelTemplateOther> billSuccessList = new ArrayList<>(); | List<WxBillExcelTemplateOther> billSuccessList = new ArrayList<>(); | ||||
| successList.parallelStream().forEach(s -> { | |||||
| successList.parallelStream().filter(s -> StringUtils.isNotEmpty(s.getMerchantName())).forEach(s -> { | |||||
| WxMerchant wxMerchant = merchantMap.get(s.getMerchantName()); | WxMerchant wxMerchant = merchantMap.get(s.getMerchantName()); | ||||
| Long merchantId = wxMerchant.getId(); | Long merchantId = wxMerchant.getId(); | ||||
| if (merchantId != null) { | if (merchantId != null) { | ||||
| @@ -125,9 +127,9 @@ public class ImportTemplateTask { | |||||
| //添加到redis里 | //添加到redis里 | ||||
| set_redis_value(importKey, "" + total, "" + all_success, "0", "" + all_fail, total == all_fail); | set_redis_value(importKey, "" + total, "" + all_success, "0", "" + all_fail, total == all_fail); | ||||
| if (successSize > 0) { | |||||
| if (billSuccessSize > 0) { | |||||
| try { | try { | ||||
| successList.parallelStream().forEach(bill -> { | |||||
| billSuccessList.parallelStream().forEach(bill -> { | |||||
| try { | try { | ||||
| wxBillAllService.importBill(tenantId, importKey, bill, user); | wxBillAllService.importBill(tenantId, importKey, bill, user); | ||||
| } catch (UnknownSessionException ue) { | } catch (UnknownSessionException ue) { | ||||