diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index f0b787c25..c7aab5137 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -150,7 +150,13 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { } return userMap; } - + + /** + * 获取店铺 名称 + * @param tenantEntity + * @param merchantIdList + * @return + */ private Map getMerchantNameMap(TenantEntity tenantEntity,List merchantIdList) { Map merchantNameMap = new HashMap(); if (merchantIdList !=null && merchantIdList.size() > 0) { @@ -167,6 +173,69 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { } return merchantNameMap; } + + /** + * 获取店铺消耗积分 + * @param recordQ + * @param merchantIdList + * @return + */ + private Map getMerchantCreditLesMap(WxCreditHistory recordQ,List merchantIdList) { + Map merchantCreditLes = new HashMap(); + if (merchantIdList !=null && merchantIdList.size() > 0) { + recordQ.setMerchantIds(merchantIdList); + List merchantCreditRankingVos = wxCreditHistoryMapper.merchantCreditLes(recordQ); + if (null != merchantCreditRankingVos) { + for (int i = 0 ; i < merchantCreditRankingVos.size() ; i ++) { + MerchantCreditRankingVo mcrv = merchantCreditRankingVos.get(i); + merchantCreditLes.put(mcrv.getMerchantId(), mcrv.getSumLesCredit()); + } + } + } + return merchantCreditLes; + } + + /** + * 获取店铺增加积分人数 + * @param recordQ + * @param merchantIdList + * @return + */ + private Map getMerchantCreditAddUserCountMap(WxCreditHistory recordQ,List merchantIdList) { + Map merchantCreditAddUserCount = new HashMap(); + if (merchantIdList !=null && merchantIdList.size() > 0) { + recordQ.setMerchantIds(merchantIdList); + List merchantCreditRankingVos = wxCreditHistoryMapper.merchantCreditAddUserCount(recordQ); + if (null != merchantCreditRankingVos) { + for (int i = 0 ; i < merchantCreditRankingVos.size() ; i ++) { + MerchantCreditRankingVo mcrv = merchantCreditRankingVos.get(i); + merchantCreditAddUserCount.put(mcrv.getMerchantId(), mcrv.getCountAddCreditUser()); + } + } + } + return merchantCreditAddUserCount; + } + + /** + * 获取店铺消耗积分人数 + * @param recordQ + * @param merchantIdList + * @return + */ + private Map getMerchantCreditLesUserCountMap(WxCreditHistory recordQ,List merchantIdList) { + Map merchantCreditLesUserCount = new HashMap(); + if (merchantIdList !=null && merchantIdList.size() > 0) { + recordQ.setMerchantIds(merchantIdList); + List merchantCreditRankingVos = wxCreditHistoryMapper.merchantCreditLesUserCount(recordQ); + if (null != merchantCreditRankingVos) { + for (int i = 0 ; i < merchantCreditRankingVos.size() ; i ++) { + MerchantCreditRankingVo mcrv = merchantCreditRankingVos.get(i); + merchantCreditLesUserCount.put(mcrv.getMerchantId(), mcrv.getCountLesCreditUser()); + } + } + } + return merchantCreditLesUserCount; + } private Map getMallUserInfoOperatorMap(TenantEntity tenantEntity,List mallUserInfoOperatorIdList) { Map mallUserInfoOperatorMap = new HashMap(); @@ -386,9 +455,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { if(pageInfo.getList() != null && pageInfo.getList().size() > 0){ List merchantIds = pageInfo.getList().stream().map(mcr -> mcr.getMerchantId()).collect(Collectors.toList()); Map merchantNameMap = getMerchantNameMap(tenantEntity, merchantIds); - - - + Map merchantCreditLesMap = getMerchantCreditLesMap(record, merchantIds); + Map merchantCreditAddUserCountMap = getMerchantCreditAddUserCountMap(record, merchantIds); + Map merchantCreditLesUserCountMap = getMerchantCreditLesUserCountMap(record, merchantIds); + + for (MerchantCreditRankingVo mcrv:pageInfo.getList()) { + mcrv.setMerchantName(merchantNameMap.get(mcrv.getMerchantId())); + mcrv.setSumLesCredit(merchantCreditLesMap.get(mcrv.getMerchantId())==null?0:merchantCreditLesMap.get(mcrv.getMerchantId())); + mcrv.setCountAddCreditUser(merchantCreditAddUserCountMap.get(mcrv.getMerchantId())==null?0:merchantCreditAddUserCountMap.get(mcrv.getMerchantId())); + mcrv.setCountLesCreditUser(merchantCreditLesUserCountMap.get(mcrv.getMerchantId())==null?0:merchantCreditLesUserCountMap.get(mcrv.getMerchantId())); + } } return pageInfo;