From f9431377bf6d9c41601659d843127e8d6f57eb08 Mon Sep 17 00:00:00 2001 From: zhengfangyuan Date: Tue, 13 Dec 2022 15:14:19 +0800 Subject: [PATCH 1/3] fix bug --- .../controller/WxCouponController.java | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index bb0eda22a..74bb1403f 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -317,7 +317,7 @@ public class WxCouponController extends BaseController { CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); } - Map> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getId()); + Map> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getCouponId()); if (null == volist) { volist = couponService.getCouponMerchantList(getTenantInfo(), couponChannel.getCouponId()); if (null != volist && volist.size() > 0 ) { @@ -327,6 +327,42 @@ public class WxCouponController extends BaseController { return new ResultData(volist); } + + @TenantIgnore + @ApiOperation("根据couponId查询商品商户接口") + @GetMapping("/couponMerchantByCouponId") + @ApiImplicitParams({ + @ApiImplicitParam(name = "couponId", value = "couponId", dataType = "String", paramType = "query", required = true)}) + public ResultData couponMerchantByCouponId(String couponId) { + if ((StringUtils.isBlank(couponId) || couponId.equalsIgnoreCase(Constant.UNDEFINED)) + ) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponId为空"); + } + Long couponIdL = 0L; + + try { + if (StringUtils.isNotBlank(couponId) && !couponId.equalsIgnoreCase(Constant.UNDEFINED)) { + couponIdL = Long.valueOf(couponId); + } + } catch (NumberFormatException e) { + logger.error("id转换失败" + couponId); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponId转换失败" + couponId); + } + + if(couponIdL <= 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponId为空"); + } + + Map> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponIdL); + if (null == volist) { + volist = couponService.getCouponMerchantList(getTenantInfo(), couponIdL); + if (null != volist && volist.size() > 0 ) { + CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponIdL, volist); + } + } + return new ResultData(volist); + + } @Deprecated @ApiOperation("根据id(couponChannel)查询接口") From 7c6a8ef28b163e3e8f004d744df3fff342fef0fd Mon Sep 17 00:00:00 2001 From: zhengfangyuan Date: Tue, 13 Dec 2022 15:37:56 +0800 Subject: [PATCH 2/3] fix bug --- .../main/java/com/iformall/service/util/CouponCacheUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java b/mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java index 010d4e76c..8a93da213 100644 --- a/mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java +++ b/mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java @@ -59,7 +59,7 @@ public class CouponCacheUtils { public static Map> getCouponMerchantCache(RedisTemplate template,Long couponId) { String key = "couponMerchantNew:"+couponId; - return (Map>) RedisCacheUtils.getCacheListObject(template, key,Map.class); + return (Map>) RedisCacheUtils.getCacheMap(template, key); } public static void removeDouyinLivePageCache(RedisTemplate template,String tenantId,Integer targetAd,Integer bussiness) { From 029e571b1f73e29eb4de348a33705b57440d7559 Mon Sep 17 00:00:00 2001 From: zhengfangyuan Date: Tue, 13 Dec 2022 17:32:19 +0800 Subject: [PATCH 3/3] fix bug --- .../java/com/iformall/service/impl/WxCouponServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) 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 360d58cfd..559b78287 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -1850,6 +1850,9 @@ public class WxCouponServiceImpl implements WxCouponService { for (Long mid:wxCoupon.getMerchantIds()) { //开通了支付宝就可以 WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, mid, null, payMchType.getCode()); + if (null == receiver) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"商户"+mid+"未设置收款账户"); + } if (MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())) { merchantAutoShareMap.put(mid, true); }else {