Commit 4c09a559c4a1c40309b34d7a3ea7910306ebc601

Authored by YunaiV
1 parent 639ce7bb

【功能修复】商城:物流信息、微信通知的缓存,因为 @Cacheable 错误使用 condition 导致无法缓存的问题

yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java
... ... @@ -23,10 +23,10 @@ import cn.iocoder.yudao.module.trade.framework.delivery.core.client.ExpressClien
23 23 import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackQueryReqDTO;
24 24 import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO;
25 25 import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
  26 +import jakarta.annotation.Resource;
26 27 import org.springframework.cache.annotation.Cacheable;
27 28 import org.springframework.stereotype.Service;
28 29  
29   -import jakarta.annotation.Resource;
30 30 import java.util.*;
31 31  
32 32 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
... ... @@ -215,7 +215,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
215 215 * @return 物流轨迹
216 216 */
217 217 @Cacheable(cacheNames = RedisKeyConstants.EXPRESS_TRACK, key = "#code + '-' + #logisticsNo + '-' + #receiverMobile",
218   - condition = "#result != null && #result.length() > 0")
  218 + unless = "#result == null")
219 219 public List<ExpressTrackRespDTO> getExpressTrackList(String code, String logisticsNo, String receiverMobile) {
220 220 return expressClientFactory.getDefaultExpressClient().getExpressTrackList(new ExpressTrackQueryReqDTO()
221 221 .setExpressCode(code).setLogisticsNo(logisticsNo).setPhone(receiverMobile));
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
... ... @@ -280,7 +280,8 @@ public class SocialClientServiceImpl implements SocialClientService {
280 280 }
281 281  
282 282 @Override
283   - @Cacheable(cacheNames = RedisKeyConstants.WXA_SUBSCRIBE_TEMPLATE, key = "#userType", condition = "#result != null")
  283 + @Cacheable(cacheNames = RedisKeyConstants.WXA_SUBSCRIBE_TEMPLATE, key = "#userType",
  284 + unless = "#result == null")
284 285 public List<TemplateInfo> getSubscribeTemplateList(Integer userType) {
285 286 WxMaService service = getWxMaService(userType);
286 287 try {
... ...