diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index 16097f9e9..d57ec0a9b 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -1,15 +1,18 @@ package com.iformall.controller; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMiniappThemeValue; import com.iformall.enums.EnumCouponType; +import com.iformall.enums.EnumMerchantStatus; import com.iformall.utils.RedisCacheUtils; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.lang3.StringUtils; @@ -23,6 +26,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.alibaba.fastjson.JSON; import com.iformall.common.ErrorCode; import com.iformall.common.ResultData; import com.iformall.domain.po.WxCoupon; @@ -34,7 +38,9 @@ import com.iformall.enums.EnumCouponChannelType; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponService; import com.iformall.service.WxMerchantService; +import com.iformall.service.util.CouponCacheUtils; import com.iformall.utils.Constant; +import com.iformall.utils.RedisCacheUtils; import com.iformall.utils.RedisLock; import io.swagger.annotations.Api; @@ -58,6 +64,170 @@ public class WxCouponController extends BaseController { @Autowired @Qualifier("couponDetailRedisTemplate") RedisTemplate cdRedisTemplate; + + @Autowired + @Qualifier("objectCommonRedisTemplate") + RedisTemplate redisTemplate; + + + + @ApiOperation("根据id(couponChannel)查询详情接口") + @GetMapping("/couponDetail") + @ApiImplicitParams({ + @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) + public ResultData couponDetail(String couponChannelId) { + if ((StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) + ) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); + } + Long couponChannelIdL = 0L; + + try { + if (StringUtils.isNotBlank(couponChannelId) && !couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) { + couponChannelIdL = Long.valueOf(couponChannelId); + } + } catch (NumberFormatException e) { + logger.error("id转换失败" + couponChannelId); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); + } + + if(couponChannelIdL <= 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); + } + + WxCouponChannel couponChannel = CouponCacheUtils.getCouponChannelCache(redisTemplate, couponChannelIdL); + if (null == couponChannel) { + couponChannel = wxCouponChannelService.getById(couponChannelIdL,this.getTenantInfo().getTenantId()); + if (null == couponChannel) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId无效" + couponChannelId); + } + CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); + } + + WxCoupon coupon = CouponCacheUtils.getCouponCache(redisTemplate, couponChannel.getCouponId()); + if (null == coupon) { + coupon = couponService.getById(couponChannel.getCouponId(),couponChannel.getTenantId()); + if (null == coupon) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannel找不到coupon" + couponChannelId); + } + if(EnumCouponType.COUPON_GIFT.getCode().equals(coupon.getType())){ + WxCoupon couponQ = new WxCoupon(); + couponQ.updateTenantInfo(coupon); + List longs = JSON.parseArray(coupon.getGiftList(), Long.class); + if(longs != null && longs.size() > 0){ + couponQ.setIds(longs); + coupon.setGiftCouponList(couponService.list(couponQ)); + } + } + coupon.setCouponId(coupon.getId()); + coupon.setCouponChannelId(couponChannel.getId()); + CouponCacheUtils.setCouponCache(redisTemplate, couponChannel.getCouponId(), coupon); + } + updateActivityStatus(coupon,couponChannel); + coupon.setCouponChannel(couponChannel); + return new ResultData(coupon); + } + + @ApiOperation("根据id(couponChannel)查询库存价格接口") + @GetMapping("/couponPriceAndStock") + @ApiImplicitParams({ + @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) + public ResultData couponPriceAndStock(String couponChannelId) { + if ((StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) + ) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); + } + Long couponChannelIdL = 0L; + + try { + if (StringUtils.isNotBlank(couponChannelId) && !couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) { + couponChannelIdL = Long.valueOf(couponChannelId); + } + } catch (NumberFormatException e) { + logger.error("id转换失败" + couponChannelId); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); + } + + if(couponChannelIdL <= 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); + } + + WxCouponChannel channelPriceAndStock = wxCouponChannelService.getPriceAndStock(this.getTenantInfo(), couponChannelIdL); + if (null == channelPriceAndStock) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId非法"); + } + + WxCoupon coupon = couponService.getPriceAndStock(channelPriceAndStock.getCouponId(),this.getTenantInfo().getTenantId()); + if (null == coupon) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId查询不到coupon"); + } + StringBuffer sb = new StringBuffer("{\"salePrice\":"); + if (null != channelPriceAndStock.getChannelPrice()) { + sb.append(channelPriceAndStock.getChannelPrice()); + }else { + sb.append(coupon.getSalePrice()); + } + sb.append(",\"remainInventory\":"); + if (null != channelPriceAndStock.getChannelStock()) { + sb.append(channelPriceAndStock.getChannelStock()); + }else { + sb.append(coupon.getRemainInventory()); + } + sb.append(",\"inventory\":").append(coupon.getInventory()).append(",\"price\":").append(coupon.getPrice()).append(",\"creditPrice\":").append(coupon.getCreditPrice()).append("}"); + return new ResultData(sb.toString()); + } + + @ApiOperation("根据id(couponChannel)查询商品商户接口") + @GetMapping("/couponMerchant") + @ApiImplicitParams({ + @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) + public ResultData couponMerchant(String couponChannelId) { + if ((StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) + ) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); + } + Long couponChannelIdL = 0L; + + try { + if (StringUtils.isNotBlank(couponChannelId) && !couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) { + couponChannelIdL = Long.valueOf(couponChannelId); + } + } catch (NumberFormatException e) { + logger.error("id转换失败" + couponChannelId); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); + } + + if(couponChannelIdL <= 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); + } + + WxCouponChannel couponChannel = CouponCacheUtils.getCouponChannelCache(redisTemplate, couponChannelIdL); + if (null == couponChannel) { + couponChannel = wxCouponChannelService.getById(couponChannelIdL,this.getTenantInfo().getTenantId()); + if (null == couponChannel) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId无效" + couponChannelId); + } + CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); + } + + List volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getId()); + if (null == volist) { + List couponIdList = new ArrayList(); + couponIdList.add(couponChannel.getCouponId()); + Map> couponMerchantVoMap = merchantService.findCouponMerchantVoList(couponIdList, couponChannel,true); + volist = couponMerchantVoMap.get(couponChannel.getCouponId()); + if (volist != null) { + volist = volist.stream().filter( + m->m.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())) + .collect(Collectors.toList()); + } + if (null != volist && volist.size() > 0 ) { + CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponChannel.getCouponId(), volist); + } + } + return new ResultData(volist); + + } @Autowired @Qualifier("objectCommonRedisTemplate") @@ -339,5 +509,21 @@ public class WxCouponController extends BaseController { } } } + + private void updateActivityStatus(WxCoupon coupon,WxCouponChannel couponChannel) { + if (coupon.getType().equals(EnumCouponType.COUPON_PREORDER.getCode()) || + (couponChannel.getTargetAd() != null && couponChannel.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) + ) { + Date now = new Date(); + + if (couponChannel.getBeginTime().getTime() > now.getTime()) { + coupon.setActStatus(EnumCouponChannelActivityStatus.PREPARED.getCode()); + } else if (couponChannel.getEndTime().getTime() < now.getTime()) { + coupon.setActStatus(EnumCouponChannelActivityStatus.ENDED.getCode()); + } else { + coupon.setActStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); + } + } + } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index 0f55fc14f..f43e6d8ec 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -215,6 +215,8 @@ public class WxCoupon extends TenantEntity { @TableField(exist = false) @io.swagger.annotations.ApiModelProperty(value="投放渠道id",name="couponChannelId") private Long couponChannelId; + @TableField(exist = false) + private WxCouponChannel couponChannel; //营销分析 @TableField(exist = false) @@ -239,6 +241,10 @@ public class WxCoupon extends TenantEntity { @TableField(exist = false) private List giftCouponList; + + @TableField(exist = false) + @io.swagger.annotations.ApiModelProperty(value = "现时抢购状态", name = "actStatus") + private Integer actStatus; @TableField(exist = false) @SortColumn(column = "press_count") diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java index f4d6e19a7..24603537c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java @@ -174,17 +174,8 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { */ public void setWxCoupon(WxCoupon c){ if(c != null){ - if(this.getChannelStock() == null){ - this.setRemainInventory(c.getRemainInventory()); - }else{ - this.setRemainInventory(this.getChannelStock()); - } - if(this.getChannelPrice() == null){ - this.setSalePrice(c.getSalePrice()); - }else{ - this.setSalePrice(this.getChannelPrice()); - } - + this.setRemainInventory(c.getRemainInventory()); + this.setSalePrice(c.getSalePrice()); this.setInventory(c.getInventory()); this.setCoverImg(c.getCoverImg()); this.setSubTitle(c.getSubTitle()); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java index aca14c27d..23821a48a 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java @@ -3,6 +3,7 @@ package com.iformall.mapper; import java.util.*; import com.iformall.common.CommonMapper; import com.iformall.domain.po.WxTopic; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.WxCouponChannel; import org.apache.ibatis.annotations.Param; @@ -65,5 +66,7 @@ public interface WxCouponChannelMapper extends CommonMapper { List findSendCouponIds(@Param("expired")Integer expired,@Param("tenantId")String tenantId); WxCoupon selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + WxCoupon getPriceAndStock(@Param("id")Long id,@Param("tenantId")String tenantId); WxCouponCVo findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId); WxCouponCVo findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId); diff --git a/mallinkService/src/main/java/com/iformall/pay/WxProfitSharing.java b/mallinkService/src/main/java/com/iformall/pay/WxProfitSharing.java index 5bb82f764..b49405b91 100644 --- a/mallinkService/src/main/java/com/iformall/pay/WxProfitSharing.java +++ b/mallinkService/src/main/java/com/iformall/pay/WxProfitSharing.java @@ -21,6 +21,8 @@ public class WxProfitSharing { private static final String RPOFIT_SHARING_ADD_RECEIVER_URL = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver"; // 删除分账账户 private static final String RPOFIT_SHARING_REMOVE_RECEIVER_URL = "https://api.mch.weixin.qq.com/pay/profitsharingremovereceiver"; + //查询订单待分账金额 + private static final String RPOFIT_SHARING_ORDER_SHAREMENT_URL = "https://api.mch.weixin.qq.com/pay/profitsharingorderamountquery"; private WxProfitSharing() { @@ -69,6 +71,16 @@ public class WxProfitSharing { * @return */ public static String addReceiver(Map params) {return doPost(RPOFIT_SHARING_ADD_RECEIVER_URL, params); } + + + /** + * 查询订单待分账金额 + * @param params + * @return + */ + public static String queryOrderShareAmount(Map params) { + return doPost(RPOFIT_SHARING_ORDER_SHAREMENT_URL, params); + } /** * 分账接收方删除 diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java index e347da8db..41580e73c 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java @@ -67,6 +67,7 @@ public interface WxCouponChannelService { void setChannelStock(WxCouponChannel record,Integer number); void releaseChannelStock(WxCouponChannel record); void setChannelPrice(WxCouponChannel record); + WxCouponChannel getPriceAndStock(TenantEntity tenantEntity,Long couponChannelId); ResultData getCouponChannelPoi(TenantEntity tenantInfo, Long id); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index 50d54cfb1..79614e9bd 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -17,6 +17,8 @@ public interface WxCouponService { ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize); + + List list(WxCoupon wxCoupon); /** * 根据实体查询分页列表 @@ -67,6 +69,8 @@ public interface WxCouponService { * @return */ WxCoupon getById(Long id,String tenantId); + + WxCoupon getPriceAndStock(Long id,String tenantId); WxCoupon getHtmlById(Long id,String tenantId); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index e6f7a4d9c..ce872cb3a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -740,5 +740,10 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { return new ResultData(ErrorCode.SYS_NULLPOINTER_ERROR.getCode(),"未找到可用的数据"); } + @Override + public WxCouponChannel getPriceAndStock(TenantEntity tenantEntity, Long couponChannelId) { + return wxCouponChannelMapper.getPriceAndStock(couponChannelId, tenantEntity.getTenantId()); + } + } 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 036e7376a..b2cb3871d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -189,6 +189,11 @@ public class WxCouponServiceImpl implements WxCouponService { } return new ResultData(page); } + + @Override + public List list(WxCoupon wxCoupon){ + return wxCouponMapper.findList(wxCoupon); + } @Override public PageInfo listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize) { @@ -230,6 +235,11 @@ public class WxCouponServiceImpl implements WxCouponService { public WxCoupon getById(Long id,String tenantId) { return wxCouponMapper.selectById(id,tenantId); } + + @Override + public WxCoupon getPriceAndStock(Long id,String tenantId) { + return wxCouponMapper.getPriceAndStock(id,tenantId); + } @Override public WxCoupon getHtmlById(Long id,String tenantId) { diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/WxPayShareService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/WxPayShareService.java index f257d481a..3f1937f17 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/WxPayShareService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/WxPayShareService.java @@ -429,5 +429,50 @@ public class WxPayShareService extends PayShareBaseAdapterService{ return new ShareAccountResult(true, null, "success", returnMap); } - + private static String queryOrderShareAmount(String mchId,String transcationId,String apiKey) { + WxProfitSharingP psCmd = new WxProfitSharingP(); + psCmd.setMch_id(mchId);//服务商商户id + psCmd.setNonce_str(Utility.generate32UUID()); + psCmd.setTransaction_id(transcationId); + psCmd.setSign_type("HMAC-SHA256"); + + try { + psCmd.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(psCmd), apiKey)); + return WxProfitSharing.queryOrderShareAmount(BeanUtils.toStringMap(psCmd)); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + +// public static void main(String[] args) { +// System.out.println(queryOrderShareAmount("1511925291","4200001516202205010431149938","XHZfpVA0NzoXgLEjsujctUTcyj8Zur2C")); +// //System.out.println(test("1511925291", "1604439800", "wxed2f44705544b892", "4200001455202205127949391954", "XHZfpVA0NzoXgLEjsujctUTcyj8Zur2C", "684670745960046592", "D:\\apiclient_cert.p12")); +// } +// +// private static String test(String mchId,String subMchId,String parentAppId,String transcationId,String apiKey,String orderNo,String certPaht) { +// WxProfitSharingFinishP psFCmd = new WxProfitSharingFinishP(); +// psFCmd.setMch_id(mchId); +// psFCmd.setSub_mch_id(subMchId); +// psFCmd.setAppid(parentAppId); +// psFCmd.setNonce_str(Utility.generate32UUID()); +// psFCmd.setTransaction_id(transcationId); +// psFCmd.setOut_order_no(orderNo); +// //psFCmd.setAmount(amount); +// psFCmd.setDescription("分账已完结"); +// psFCmd.setSign_type("HMAC-SHA256"); +// +// String response; +// try { +// psFCmd.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(psFCmd), apiKey)); +// log.info("request:" + psFCmd.toString()); +// response = WxProfitSharing.finishOrder(BeanUtils.toStringMap(psFCmd), certPaht, mchId); +// return response; +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return null; +// +// } + } diff --git a/mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java b/mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java new file mode 100644 index 000000000..18290a6d2 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java @@ -0,0 +1,60 @@ +package com.iformall.service.util; + +import java.util.List; + +import org.springframework.data.redis.core.RedisTemplate; + +import com.iformall.domain.po.WxCoupon; +import com.iformall.domain.po.WxCouponChannel; +import com.iformall.domain.vo.WxMerchantVo; +import com.iformall.utils.RedisCacheUtils; + +public class CouponCacheUtils { + + public static void removeCouponChannelCache(RedisTemplate template,Long couponChannelId) { + String key = "couponChannelDetail:"+couponChannelId; + RedisCacheUtils.removeCache(template, key); + } + + public static void setCouponChannelCache(RedisTemplate template,Long couponChannelId,WxCouponChannel couponChannel) { + String key = "couponChannelDetail:"+couponChannelId; + RedisCacheUtils.cache(template, key, couponChannel, 24*3600); + } + + public static WxCouponChannel getCouponChannelCache(RedisTemplate template,Long couponChannelId) { + String key = "couponChannelDetail:"+couponChannelId; + return RedisCacheUtils.getCacheObject(template, key,WxCouponChannel.class); + } + + + public static void removeCouponCache(RedisTemplate template,Long couponId) { + String key = "couponDetail:"+couponId; + RedisCacheUtils.removeCache(template, key); + } + + public static void setCouponCache(RedisTemplate template,Long couponId,WxCoupon coupon) { + String key = "couponDetail:"+couponId; + RedisCacheUtils.cache(template, key, coupon, 24*3600); + } + + public static WxCoupon getCouponCache(RedisTemplate template,Long couponId) { + String key = "couponDetail:"+couponId; + return RedisCacheUtils.getCacheObject(template, key,WxCoupon.class); + } + + public static void removeCouponMerchantCache(RedisTemplate template,Long couponId) { + String key = "couponMerchant:"+couponId; + RedisCacheUtils.removeCache(template, key); + } + + public static void setCouponMerchantCache(RedisTemplate template,Long couponId,List merchantList) { + String key = "couponMerchant:"+couponId; + RedisCacheUtils.cache(template, key, merchantList, 24*3600); + } + + public static List getCouponMerchantCache(RedisTemplate template,Long couponId) { + String key = "couponMerchant:"+couponId; + return RedisCacheUtils.getCacheListObject(template, key,WxMerchantVo.class); + } + +} diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 984f51d52..d5eaaaf3f 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -356,5 +356,9 @@ update wx_coupon_channel SET channel_price = #{price} where id = #{id} and tenant_id =#{tenantId} + + diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 0d9ad1597..e85ee551e 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -325,6 +325,10 @@ select ,c.html from wx_coupon c where id = #{id} and tenant_id = #{tenantId} + +