|
|
|
@@ -1230,6 +1230,73 @@ public class WxMerchantServiceImpl implements WxMerchantService { |
|
|
|
return wxCouponOrderService.userTradeDetailList(record,record.getStarttime(),record.getEndtime(),pageIndex,pageSize); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<Long,String> getLiveCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity) { |
|
|
|
Map<Long,String> retMap = new HashMap<Long,String>(); |
|
|
|
if (null == couponIds || couponIds.size() <= 0) { |
|
|
|
return retMap; |
|
|
|
} |
|
|
|
WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); |
|
|
|
couponMerchantQ.updateTenantInfo(tenantEntity); |
|
|
|
couponMerchantQ.setStatus(0); |
|
|
|
couponMerchantQ.setProductIds(couponIds); |
|
|
|
List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(couponMerchantQ); |
|
|
|
if (null == couponMerchantList) { |
|
|
|
return retMap; |
|
|
|
} |
|
|
|
Map<Long,List<Long>> couponMerchantIdMap = new HashMap<Long,List<Long>>(); |
|
|
|
List<Long> merchantIdList = new ArrayList<Long>(); |
|
|
|
for (int i = 0 ; i < couponMerchantList.size() ; i ++) { |
|
|
|
WxCouponMerchant cm = couponMerchantList.get(i); |
|
|
|
Long couponId = cm.getProductId(); |
|
|
|
Long merchantId = cm.getMerchantId(); |
|
|
|
if (null != couponId && null != merchantId) { |
|
|
|
List<Long> mIdList = couponMerchantIdMap.get(couponId); |
|
|
|
if (null == mIdList) { |
|
|
|
mIdList = new ArrayList<Long>(); |
|
|
|
couponMerchantIdMap.put(couponId, mIdList); |
|
|
|
} |
|
|
|
mIdList.add(merchantId); |
|
|
|
merchantIdList.add(merchantId); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>(); |
|
|
|
if (merchantIdList.size() > 0 ) { |
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
merchantQ.updateTenantInfo(tenantEntity); |
|
|
|
merchantQ.setIds(merchantIdList); |
|
|
|
List<WxMerchant> merchantList = wxMerchantMapper.findList(merchantQ); |
|
|
|
if (null != merchantList) { |
|
|
|
for (int i = 0 ; i < merchantList.size() ; i++) { |
|
|
|
WxMerchant m = merchantList.get(i); |
|
|
|
if (null != m) { |
|
|
|
merchantMap.put(m.getId(), m); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (Iterator<Long> it = couponMerchantIdMap.keySet().iterator();it.hasNext();) { |
|
|
|
Long couponId = it.next(); |
|
|
|
List<Long> mids = couponMerchantIdMap.get(couponId); |
|
|
|
if (null != mids) { |
|
|
|
if (mids.size() == 1) { |
|
|
|
WxMerchant merchant = merchantMap.get(mids.get(0)); |
|
|
|
if (null != merchant) { |
|
|
|
retMap.put(couponId, merchant.getName()); |
|
|
|
}else { |
|
|
|
retMap.put(couponId, "暂无商户可用"); |
|
|
|
} |
|
|
|
}else if(mids.size() > 1){ |
|
|
|
retMap.put(couponId, mids.size()+"家商户通用"); |
|
|
|
}else { |
|
|
|
retMap.put(couponId, "暂无商户可用"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return retMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop) { |
|
|
|
Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>(); |
|
|
|
|