| @@ -202,6 +202,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Autowired | |||
| WxCouponCarMapper wxCouponCarMapper; | |||
| @Autowired | |||
| WxMallMapper wxMallMapper; | |||
| private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| @@ -907,7 +910,20 @@ 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(); | |||
| wxMallq.setParentTenantId(couponOrderTenantEntity.getTenantId()); | |||
| 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(); | |||
| @@ -924,19 +940,15 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| bUserIdList.add(bUserId); | |||
| } | |||
| mallBUserIdList.put(bo.getBTenantId(), bUserIdList); | |||
| 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); | |||
| } | |||
| mallMerchantIdList.put(bo.getBTenantId(), merchantIdList); | |||
| 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))) { | |||
| @@ -964,26 +976,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 ) { | |||
| @@ -999,20 +991,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) { | |||