| @@ -98,7 +98,6 @@ public class WxCouponChannelController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @RedisCache | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("douyinLiveList") | @GetMapping("douyinLiveList") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -124,7 +123,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| if (null == page ) { | if (null == page ) { | ||||
| page = wxCouponChannelService.liveHomePage(wxCouponChannel, pageNum, pageSize); | page = wxCouponChannelService.liveHomePage(wxCouponChannel, pageNum, pageSize); | ||||
| if(page.getList() != null && page.getList().size() > 0){ | if(page.getList() != null && page.getList().size() > 0){ | ||||
| RedisCacheUtils.cache(redisTemplate, key, page, 100); | |||||
| RedisCacheUtils.cache(redisTemplate, key, page, 60*60); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -192,6 +192,8 @@ public class WxCoupon extends TenantEntity { | |||||
| private String merchantParams; | private String merchantParams; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Long merchantId; | private Long merchantId; | ||||
| @TableField(exist = false) | |||||
| private String merchantName; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="targetAd") | @io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="targetAd") | ||||
| @@ -268,4 +268,5 @@ 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); | List<WxMerchantVo> getCouponMerchantList(TenantEntity tenantInfo, Long couponId); | ||||
| } | } | ||||
| @@ -160,6 +160,7 @@ public interface WxMerchantService { | |||||
| List<WxMerchantVo> findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop); | List<WxMerchantVo> findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop); | ||||
| Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop); | Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop); | ||||
| Map<Long,String> getLiveCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity); | |||||
| List<WxMerchant> getMerchantList(WxMerchant wxMerchant); | List<WxMerchant> getMerchantList(WxMerchant wxMerchant); | ||||
| @@ -512,6 +512,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| } | } | ||||
| List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | ||||
| Map<Long,WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds,tenantEntity); | Map<Long,WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds,tenantEntity); | ||||
| Map<Long,String> merchantNameMap = wxMerchantService.getLiveCouponMerchantMap(couponIds,tenantEntity); | |||||
| List<WxCoupon> retList = new ArrayList<>(); | List<WxCoupon> retList = new ArrayList<>(); | ||||
| for (WxCouponChannel cc:list) { | for (WxCouponChannel cc:list) { | ||||
| WxCoupon cm = couponMap.get(cc.getCouponId()); | WxCoupon cm = couponMap.get(cc.getCouponId()); | ||||
| @@ -525,6 +526,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| vo.setInventory(cm.getInventory()); | vo.setInventory(cm.getInventory()); | ||||
| vo.setSalePrice(cm.getSalePrice()); | vo.setSalePrice(cm.getSalePrice()); | ||||
| vo.setPrice(cm.getPrice()); | vo.setPrice(cm.getPrice()); | ||||
| vo.setMerchantName(merchantNameMap.get(cc.getCouponId())); | |||||
| retList.add(vo); | retList.add(vo); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1230,6 +1230,73 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| return wxCouponOrderService.userTradeDetailList(record,record.getStarttime(),record.getEndtime(),pageIndex,pageSize); | 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 | @Override | ||||
| public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop) { | public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop) { | ||||
| Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>(); | Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>(); | ||||
| @@ -354,10 +354,6 @@ | |||||
| and cc.`status` = #{status} | and cc.`status` = #{status} | ||||
| </if> | </if> | ||||
| <if test=" null != couponStatus "> | |||||
| and cc.`coupon_status` = #{couponStatus} | |||||
| </if> | |||||
| <if test=" null != subTargetId "> | <if test=" null != subTargetId "> | ||||
| and cc.`sub_target_id` = #{subTargetId} | and cc.`sub_target_id` = #{subTargetId} | ||||
| </if> | </if> | ||||
| @@ -1260,7 +1260,7 @@ | |||||
| </update> | </update> | ||||
| <select id="newfindCList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="newfindCList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select id,remain_inventory,inventory,cover_img,sub_title,item_group,sale_price,use_price,price,tail_price, | |||||
| select id,remain_inventory,inventory,cover_img,title,sub_title,item_group,sale_price,use_price,price,tail_price, | |||||
| orig_price,unit,use_limit_rule,use_limit_quantity,send_type,support_transfer,press_limit_num,auto_refund, | orig_price,unit,use_limit_rule,use_limit_quantity,send_type,support_transfer,press_limit_num,auto_refund, | ||||
| conditions,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date,valid_days,credit_price, | conditions,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date,valid_days,credit_price, | ||||
| content_type,source_type | content_type,source_type | ||||