|
|
|
@@ -203,6 +203,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponCarMapper wxCouponCarMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxMallMapper wxMallMapper; |
|
|
|
|
|
|
|
private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
@@ -390,6 +393,21 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
List<Long> cUserIdList = new ArrayList<Long>(); |
|
|
|
List<Long> couponIdList = new ArrayList<Long>(); |
|
|
|
List<String> mallTenantIdList = new ArrayList<String>(); |
|
|
|
mallTenantIdList.add(couponOrderTenantEntity.getTenantId()); |
|
|
|
//查询子广场 |
|
|
|
WxMall wxMallq = new WxMall(); |
|
|
|
List<String> partlist = new ArrayList<String>(); |
|
|
|
partlist.add(couponOrderTenantEntity.getTenantId()); |
|
|
|
if (null != couponOrderTenantEntity.getParentTenantId()) { |
|
|
|
partlist.add(couponOrderTenantEntity.getParentTenantId()); |
|
|
|
} |
|
|
|
wxMallq.setParentTenantIdList(partlist); |
|
|
|
List<WxMall> mallList = wxMallMapper.findList(wxMallq); |
|
|
|
if ( null != mallList && mallList.size() > 0 ) { |
|
|
|
for (WxMall mall : mallList) { |
|
|
|
mallTenantIdList.add(mall.getTenantId()); |
|
|
|
} |
|
|
|
} |
|
|
|
for (int j = 0 ; j < couponOrderList.size(); j ++) { |
|
|
|
WxCouponOrder co = couponOrderList.get(j); |
|
|
|
Long bUserId = co.getBUserId(); |
|
|
|
@@ -400,12 +418,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
if (null == bUserIdList) { |
|
|
|
bUserIdList = new ArrayList<Long>(); |
|
|
|
} |
|
|
|
if (bUserIdList.contains(bUserId)) { |
|
|
|
if (!bUserIdList.contains(bUserId)) { |
|
|
|
bUserIdList.add(bUserId); |
|
|
|
} |
|
|
|
if (!mallTenantIdList.contains(mallTenantId)) { |
|
|
|
mallTenantIdList.add(mallTenantId); |
|
|
|
} |
|
|
|
mallBUserIdList.put(mallTenantId, bUserIdList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -445,6 +461,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
merchantIdList.add(b.getMerchantId()); |
|
|
|
} |
|
|
|
} |
|
|
|
mallMerchantIdList.put(mallTenantId, merchantIdList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -524,6 +541,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
couponMerchantVoMap = mallCouponMerchantVoMap.get(couponOrder.getBTenantId()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null == couponMerchantVoMap) { |
|
|
|
couponMerchantVoMap = new HashMap<Long, List<WxMerchantVo>>(); |
|
|
|
} |
|
|
|
WxCouponOrderBVo bvo = couponOrdertoBVo(couponOrder,bUserMap,merchantSimpleMap,cUserSimpleMap,couponMap,hasMerchant,couponMerchantVoMap); |
|
|
|
if (null != bvo ) { |
|
|
|
retList.add(bvo); |
|
|
|
@@ -904,7 +924,25 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
Map<String,List<Long>> mallBUserIdList = new HashMap<String,List<Long>>(); |
|
|
|
Map<String,List<Long>> mallMerchantIdList = new HashMap<String,List<Long>>(); |
|
|
|
List<Long> couponIdList = new ArrayList<Long>(); |
|
|
|
|
|
|
|
List<String> mallTenantIdList = new ArrayList<String>(); |
|
|
|
mallTenantIdList.add(couponOrderTenantEntity.getTenantId()); |
|
|
|
//查询子广场 |
|
|
|
WxMall wxMallq = new WxMall(); |
|
|
|
List<String> partlist = new ArrayList<String>(); |
|
|
|
partlist.add(couponOrderTenantEntity.getTenantId()); |
|
|
|
if (null != couponOrderTenantEntity.getParentTenantId()) { |
|
|
|
partlist.add(couponOrderTenantEntity.getParentTenantId()); |
|
|
|
} |
|
|
|
wxMallq.setParentTenantIdList(partlist); |
|
|
|
List<WxMall> mallList = wxMallMapper.findList(wxMallq); |
|
|
|
if ( null != mallList && mallList.size() > 0 ) { |
|
|
|
for (WxMall mall : mallList) { |
|
|
|
mallTenantIdList.add(mall.getTenantId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0 ; i < list.size() ; i ++ ) { |
|
|
|
WxCouponOrder bo = list.get(i); |
|
|
|
Long cusrid = bo.getcUserId(); |
|
|
|
@@ -920,20 +958,16 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
if(null != bUserId && (!bUserIdList.contains(bUserId))){ |
|
|
|
bUserIdList.add(bUserId); |
|
|
|
} |
|
|
|
|
|
|
|
List<Long> merchantIdList = mallMerchantIdList.get(bo.getBTenantId()); |
|
|
|
if (null == merchantIdList) { |
|
|
|
merchantIdList = new ArrayList<Long>(); |
|
|
|
} |
|
|
|
Long bmerchantId = bo.getBMerchantId(); |
|
|
|
if (null != bmerchantId && (!merchantIdList.contains(bmerchantId))) { |
|
|
|
merchantIdList.add(bmerchantId); |
|
|
|
} |
|
|
|
mallBUserIdList.put(bo.getBTenantId(), bUserIdList); |
|
|
|
|
|
|
|
if (!mallTenantIdList.contains(bo.getBTenantId())) { |
|
|
|
mallTenantIdList.add(bo.getBTenantId()); |
|
|
|
List<Long> merchantIds = mallMerchantIdList.get(bo.getBTenantId()); |
|
|
|
if (null == merchantIds) { |
|
|
|
merchantIds = new ArrayList<Long>(); |
|
|
|
} |
|
|
|
|
|
|
|
if(null != bo.getMerchantId() && (!merchantIds.contains(bo.getMerchantId()))){ |
|
|
|
merchantIds.add(bo.getMerchantId()); |
|
|
|
} |
|
|
|
mallMerchantIdList.put(bo.getBTenantId(), merchantIds); |
|
|
|
} |
|
|
|
Long couponId = bo.getCouponId(); |
|
|
|
if (null != couponId && (!couponIdList.contains(couponId))) { |
|
|
|
@@ -961,26 +995,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<Long,String> merchantNameMap = new HashMap<Long,String>(); |
|
|
|
if (null != mallMerchantIdList && mallMerchantIdList.size() > 0 ) { |
|
|
|
for (Iterator<String> it = mallMerchantIdList.keySet().iterator();it.hasNext();) { |
|
|
|
String mallTenantIt = it.next(); |
|
|
|
List<Long> merchantIdList = mallMerchantIdList.get(mallTenantIt); |
|
|
|
if (null != merchantIdList && merchantIdList.size() > 0 ) { |
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
merchantQ.setTenantId(mallTenantIt); |
|
|
|
merchantQ.setIds(merchantIdList); |
|
|
|
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ); |
|
|
|
if (null != merchantList) { |
|
|
|
for (int i = 0 ; i < merchantList.size() ; i ++) { |
|
|
|
WxMerchant m = merchantList.get(i); |
|
|
|
merchantNameMap.put(m.getId(), m.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); |
|
|
|
Map<Long,Long> merchantProductIdMap = new HashMap<Long,Long>(); |
|
|
|
if (null != couponIdList && couponIdList.size() > 0 ) { |
|
|
|
@@ -996,20 +1010,49 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0 ; i < mallTenantIdList.size(); i++) { |
|
|
|
List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(mallTenantIdList.get(i), couponIdList); |
|
|
|
String mallTenantId = mallTenantIdList.get(i); |
|
|
|
List<Long> merchantIds = mallMerchantIdList.get(mallTenantId); |
|
|
|
List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(mallTenantId, couponIdList); |
|
|
|
if (null != merchantProductVos) { |
|
|
|
if (null == merchantIds) { |
|
|
|
merchantIds = new ArrayList<Long>(); |
|
|
|
} |
|
|
|
for (int j = 0 ; j < merchantProductVos.size(); j ++) { |
|
|
|
WxMerchantProductVo mp = merchantProductVos.get(j); |
|
|
|
if (mp.getMc() > 1) { |
|
|
|
merchantProductIdMap.put(mp.getProductId(), -999L); |
|
|
|
}else { |
|
|
|
merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId()); |
|
|
|
if (!merchantIds.contains(mp.getMerchantId())) { |
|
|
|
merchantIds.add(mp.getMerchantId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
mallMerchantIdList.put(mallTenantId, merchantIds); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<Long,String> merchantNameMap = new HashMap<Long,String>(); |
|
|
|
if (null != mallMerchantIdList && mallMerchantIdList.size() > 0 ) { |
|
|
|
for (Iterator<String> it = mallMerchantIdList.keySet().iterator();it.hasNext();) { |
|
|
|
String mallTenantIt = it.next(); |
|
|
|
List<Long> merchantIdList = mallMerchantIdList.get(mallTenantIt); |
|
|
|
if (null != merchantIdList && merchantIdList.size() > 0 ) { |
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
merchantQ.setTenantId(mallTenantIt); |
|
|
|
merchantQ.setIds(merchantIdList); |
|
|
|
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ); |
|
|
|
if (null != merchantList) { |
|
|
|
for (int i = 0 ; i < merchantList.size() ; i ++) { |
|
|
|
WxMerchant m = merchantList.get(i); |
|
|
|
merchantNameMap.put(m.getId(), m.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); |
|
|
|
if (cUserIdList.size() > 0) { |
|
|
|
|