| @@ -28,10 +28,12 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.iformall.annotation.TenantIgnore; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxMerchantVo; | import com.iformall.domain.vo.WxMerchantVo; | ||||
| import com.iformall.enums.EnumCouponChannelActivityStatus; | import com.iformall.enums.EnumCouponChannelActivityStatus; | ||||
| @@ -281,6 +283,7 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(sb.toString()); | return new ResultData(sb.toString()); | ||||
| } | } | ||||
| @TenantIgnore | |||||
| @ApiOperation("根据id(couponChannel)查询商品商户接口") | @ApiOperation("根据id(couponChannel)查询商品商户接口") | ||||
| @GetMapping("/couponMerchant") | @GetMapping("/couponMerchant") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -314,7 +317,7 @@ public class WxCouponController extends BaseController { | |||||
| CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); | CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); | ||||
| } | } | ||||
| List<WxMerchantVo> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getId()); | |||||
| Map<WxMall,List<WxMerchantVo>> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getId()); | |||||
| if (null == volist) { | if (null == volist) { | ||||
| volist = couponService.getCouponMerchantList(getTenantInfo(), couponChannel.getCouponId()); | volist = couponService.getCouponMerchantList(getTenantInfo(), couponChannel.getCouponId()); | ||||
| if (null != volist && volist.size() > 0 ) { | if (null != volist && volist.size() > 0 ) { | ||||
| @@ -10,6 +10,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.TtCouponChannelPoi; | import com.iformall.domain.po.TtCouponChannelPoi; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.TtCouponVo; | import com.iformall.domain.vo.TtCouponVo; | ||||
| @@ -278,7 +279,7 @@ public interface WxCouponService { | |||||
| Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); | Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); | ||||
| List<WxMerchantVo> getCouponMerchantList(TenantEntity tenantInfo, Long couponId); | |||||
| Map<WxMall,List<WxMerchantVo>> getCouponMerchantList(TenantEntity tenantInfo, Long couponId); | |||||
| /** | /** | ||||
| * 作废卷 | * 作废卷 | ||||
| @@ -150,6 +150,9 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponMallMapper wxCouponMallMapper; | WxCouponMallMapper wxCouponMallMapper; | ||||
| @Autowired | |||||
| WxMallMapper wxMallMapper; | |||||
| @Override | @Override | ||||
| public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | ||||
| @@ -1507,10 +1510,36 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxMerchantVo> getCouponMerchantList(TenantEntity tenantInfo, Long couponId) { | |||||
| List<Long> couponIdList = new ArrayList<Long>(); | |||||
| public Map<WxMall,List<WxMerchantVo>> getCouponMerchantList(TenantEntity tenantInfo, Long couponId) { | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(couponId,tenantInfo.getTenantId()); | |||||
| if (EnumCouponType.isParentCoupon(wxCoupon.getType())){ | |||||
| WxCouponMall couponMall = new WxCouponMall(); | |||||
| couponMall.updateTenantInfo(tenantInfo); | |||||
| couponMall.setProductId(couponId); | |||||
| couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()); | |||||
| List<WxCouponMall> couponMallList = wxCouponMallMapper.findList(couponMall); | |||||
| if (null != couponMallList && couponMallList.size()> 0 ) { | |||||
| Map<WxMall,List<WxMerchantVo>> mallMerchantMap = new HashMap<WxMall,List<WxMerchantVo>>(); | |||||
| for (int i = 0 ; i < couponMallList.size();i++) { | |||||
| WxCouponMall cm = couponMallList.get(i); | |||||
| WxMall mall = wxMallMapper.getByTenantId(cm.getMallTenantId()); | |||||
| mallMerchantMap.put(mall, getCouponMerchantList(couponId,mall)); | |||||
| } | |||||
| return mallMerchantMap; | |||||
| } | |||||
| return null; | |||||
| }else { | |||||
| Map<WxMall,List<WxMerchantVo>> mallMerchantMap = new HashMap<WxMall,List<WxMerchantVo>>(); | |||||
| WxMall mall = wxMallMapper.getByTenantId(tenantInfo.getTenantId()); | |||||
| mallMerchantMap.put(mall, getCouponMerchantList(couponId,mall)); | |||||
| return mallMerchantMap; | |||||
| } | |||||
| } | |||||
| private List<WxMerchantVo> getCouponMerchantList(Long couponId,TenantEntity mallTenantEntity) { | |||||
| List<Long> couponIdList = new ArrayList<Long>(); | |||||
| couponIdList.add(couponId); | couponIdList.add(couponId); | ||||
| Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIdList, tenantInfo,true); | |||||
| Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIdList, mallTenantEntity,true); | |||||
| List<WxMerchantVo> merchantList = couponMerchantVoMap.get(couponId); | List<WxMerchantVo> merchantList = couponMerchantVoMap.get(couponId); | ||||
| if (merchantList != null) { | if (merchantList != null) { | ||||
| @@ -1411,15 +1411,15 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop) { | |||||
| public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity mallTenantEntity,boolean hasShop) { | |||||
| Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>(); | Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>(); | ||||
| if (null == couponIds || couponIds.size() <= 0) { | if (null == couponIds || couponIds.size() <= 0) { | ||||
| return retMap; | return retMap; | ||||
| } | } | ||||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantEntity.getTenantId(), couponIds); | |||||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(mallTenantEntity.getTenantId(), couponIds); | |||||
| if(null != merchantIds && merchantIds.size() > 0 ) { | if(null != merchantIds && merchantIds.size() > 0 ) { | ||||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | TtMerchantPoi poiQ = new TtMerchantPoi(); | ||||
| poiQ.updateTenantInfo(tenantEntity); | |||||
| poiQ.updateTenantInfo(mallTenantEntity); | |||||
| poiQ.setIds(merchantIds); | poiQ.setIds(merchantIds); | ||||
| List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(poiQ); | List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(poiQ); | ||||
| Map<Long,TtMerchantPoi> poiMap = new HashMap<Long,TtMerchantPoi>(); | Map<Long,TtMerchantPoi> poiMap = new HashMap<Long,TtMerchantPoi>(); | ||||
| @@ -1433,7 +1433,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| WxMerchant merchantQ = new WxMerchant(); | WxMerchant merchantQ = new WxMerchant(); | ||||
| merchantQ.updateTenantInfo(tenantEntity); | |||||
| merchantQ.updateTenantInfo(mallTenantEntity); | |||||
| merchantQ.setIds(merchantIds); | merchantQ.setIds(merchantIds); | ||||
| List<WxMerchant> merchantList = wxMerchantMapper.findList(merchantQ); | List<WxMerchant> merchantList = wxMerchantMapper.findList(merchantQ); | ||||
| Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>(); | Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>(); | ||||
| @@ -1455,7 +1455,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); | WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); | ||||
| couponMerchantQ.updateTenantInfo(tenantEntity); | |||||
| couponMerchantQ.updateTenantInfo(mallTenantEntity); | |||||
| couponMerchantQ.setStatus(0); | couponMerchantQ.setStatus(0); | ||||
| couponMerchantQ.setProductIds(couponIds); | couponMerchantQ.setProductIds(couponIds); | ||||
| List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(couponMerchantQ); | List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(couponMerchantQ); | ||||
| @@ -1465,7 +1465,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| Map<Long,List<WxShopVo>> merchantShopVoList = null; | Map<Long,List<WxShopVo>> merchantShopVoList = null; | ||||
| if (hasShop) { | if (hasShop) { | ||||
| merchantShopVoList = wxShopService.findMerchantShopVoListMap(tenantEntity,merchantIds); | |||||
| merchantShopVoList = wxShopService.findMerchantShopVoListMap(mallTenantEntity,merchantIds); | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.service.util; | package com.iformall.service.util; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.data.redis.core.RedisTemplate; | import org.springframework.data.redis.core.RedisTemplate; | ||||
| @@ -8,6 +9,7 @@ import org.springframework.data.redis.core.RedisTemplate; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.vo.WxMerchantVo; | import com.iformall.domain.vo.WxMerchantVo; | ||||
| import com.iformall.enums.EnumCacheKey; | import com.iformall.enums.EnumCacheKey; | ||||
| import com.iformall.utils.RedisCacheUtils; | import com.iformall.utils.RedisCacheUtils; | ||||
| @@ -50,14 +52,14 @@ public class CouponCacheUtils { | |||||
| RedisCacheUtils.removeCache(template, key); | RedisCacheUtils.removeCache(template, key); | ||||
| } | } | ||||
| public static void setCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,List<WxMerchantVo> merchantList) { | |||||
| public static void setCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,Map<WxMall,List<WxMerchantVo>> merchantList) { | |||||
| String key = "couponMerchant:"+couponId; | String key = "couponMerchant:"+couponId; | ||||
| RedisCacheUtils.cache(template, key, merchantList, 24*3600); | RedisCacheUtils.cache(template, key, merchantList, 24*3600); | ||||
| } | } | ||||
| public static List<WxMerchantVo> getCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| public static Map<WxMall,List<WxMerchantVo>> getCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| String key = "couponMerchant:"+couponId; | String key = "couponMerchant:"+couponId; | ||||
| return RedisCacheUtils.getCacheListObject(template, key,WxMerchantVo.class); | |||||
| return (Map<WxMall, List<WxMerchantVo>>) RedisCacheUtils.getCacheListObject(template, key,Map.class); | |||||
| } | } | ||||
| public static void removeDouyinLivePageCache(RedisTemplate<String, Object> template,String tenantId,Integer targetAd,Integer bussiness) { | public static void removeDouyinLivePageCache(RedisTemplate<String, Object> template,String tenantId,Integer targetAd,Integer bussiness) { | ||||