From de254b87864ac8fabae3a4a7556e332e6a649fb3 Mon Sep 17 00:00:00 2001 From: Burce Date: Mon, 28 Oct 2019 15:11:40 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=8B=9B=E5=95=86][=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../invest/impl/InvestBizServiceImpl.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index ef2c6ee58..68e507816 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -38,7 +38,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.*; -import java.time.temporal.TemporalAmount; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Function; @@ -1118,10 +1117,14 @@ public class InvestBizServiceImpl implements InvestBizService { Map bussinessMap = getMap(businessService.getByIds(getIds(customers, InvestCustomerEntity::getBusinessId)), WxBusiness::getId); List resultList = new ArrayList<>(); for (InvestCustomerEntity costomerItem : customers) { - Optional demandItem = Optional.ofNullable(demindsMap.get(costomerItem.getId())); - WxShop shop = shopsMap.get(demandItem.orElse(null)); - WxBrand brand = brandMap.get(costomerItem.getBrandId()); - resultList.add(buildCustomerItem(demandItem.orElse(null), costomerItem, brand, shop, bussinessMap.get(costomerItem.getBusinessId()))); + InvestDemandEntity demandItem = demindsMap.get(costomerItem.getId()); + WxShop shop = null; + WxBrand brand = null ; + if (Objects.nonNull(demandItem)) { + shop = shopsMap.get(demandItem.getTargetId()); + brand = brandMap.get(costomerItem.getBrandId()); + } + resultList.add(buildCustomerItem(demandItem, costomerItem, brand, shop, bussinessMap.get(costomerItem.getBusinessId()))); } return resultList; } @@ -1140,10 +1143,14 @@ public class InvestBizServiceImpl implements InvestBizService { List resultList = new ArrayList<>(); for (InvestCustomerEntity costomerItem : customers) { - Optional demandItem = Optional.ofNullable(demindsMap.get(costomerItem.getId())); - WxShop shop = shopsMap.get(demandItem.orElse(null)); - WxBrand brand = brandMap.get(costomerItem.getBrandId()); - resultList.add(buildDemindItem(demandItem.orElse(null), costomerItem, brand, shop, usersMap)); + InvestDemandEntity demandItem = demindsMap.get(costomerItem.getId()); + WxShop shop = null; + WxBrand brand = null ; + if (Objects.nonNull(demandItem)) { + shop = shopsMap.get(demandItem.getTargetId()); + brand = brandMap.get(costomerItem.getBrandId()); + } + resultList.add(buildDemindItem(demandItem, costomerItem, brand, shop, usersMap)); } return resultList; }