From a52ed85b01630aa02e7ed37bddb35bff312cc13f Mon Sep 17 00:00:00 2001 From: xhxu Date: Sat, 3 Dec 2022 14:45:19 +0800 Subject: [PATCH] //coupon --- .../service/impl/WxCouponServiceImpl.java | 33 +++++++++++-------- .../mapper/WxCouponMerchantMapper.xml | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 87565d4f3..9ed43faea 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -366,7 +366,7 @@ public class WxCouponServiceImpl implements WxCouponService { return null; } - List merchantList = getMerchantVoList(wxCouponCVo, wxCouponCVo.getId(), wxCouponCVo.getType()); + List merchantList = getMerchantVoList(wxCouponCVo, mallTenantEntity, wxCouponCVo.getId(), wxCouponCVo.getType()); wxCouponCVo.setMerchantVoList(merchantList); if(EnumCouponType.COUPON_GIFT.getCode().equals(wxCouponCVo.getType())){ @@ -382,21 +382,26 @@ public class WxCouponServiceImpl implements WxCouponService { return wxCouponCVo; } - private List getMerchantVoList(TenantEntity couponTenant,Long couponId,Integer couponType){ - if (EnumCouponType.isParentCoupon(couponType)){ - WxCouponMall couponMall = new WxCouponMall(); - couponMall.updateTenantInfo(couponTenant); - couponMall.setProductId(couponId); - couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()); - List couponMallList = wxCouponMallMapper.findList(couponMall); - List merchantVoList = new ArrayList<>(); - if (null != couponMallList && couponMallList.size()> 0 ) { - for (WxCouponMall cm:couponMallList) { - WxMall mall = wxMallMapper.getByTenantId(cm.getMallTenantId()); - merchantVoList.addAll(getCouponMerchantList(couponId, mall)); + private List getMerchantVoList(TenantEntity couponTenant,TenantEntity mallTenant,Long couponId,Integer couponType){ + if (EnumCouponType.isParentCoupon(couponType) && couponTenant.getTenantId().equals(mallTenant)){ + //集团查券 查询所有门店 + if(couponTenant.getTenantId().equals(mallTenant.getTenantId())){ + WxCouponMall couponMall = new WxCouponMall(); + couponMall.updateTenantInfo(couponTenant); + couponMall.setProductId(couponId); + List couponMallList = wxCouponMallMapper.findList(couponMall); + List merchantVoList = new ArrayList<>(); + if (null != couponMallList && couponMallList.size()> 0 ) { + for (WxCouponMall cm:couponMallList) { + WxMall mall = wxMallMapper.getByTenantId(cm.getMallTenantId()); + merchantVoList.addAll(getCouponMerchantList(couponId, mall)); + } } + return merchantVoList; + //子广场查券 只查询自己广场的门店 + }else{ + return getCouponMerchantList(couponId,mallTenant); } - return merchantVoList; }else{ return getCouponMerchantList(couponId,couponTenant); } diff --git a/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml index c271f8436..1aebd5e3a 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml @@ -14,7 +14,7 @@ - `id`,`product_id`,`merchant_id`,`parameter`,`create_date`,`update_date`,`status` + `id`,`tenant_id`,`parent_tenant_id`,`product_id`,`merchant_id`,`parameter`,`create_date`,`update_date`,`status`