Authored by qinchao

更新地址后,清订单详情的缓存

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 import com.yoho.error.ServiceError; 5 import com.yoho.error.ServiceError;
6 import com.yoho.error.exception.ServiceException; 6 import com.yoho.error.exception.ServiceException;
  7 +import com.yohobuy.ufo.model.order.common.TabType;
7 import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; 8 import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq;
8 import com.yohoufo.common.utils.UserInfoHiddenHelper; 9 import com.yohoufo.common.utils.UserInfoHiddenHelper;
9 import com.yohoufo.dal.order.BuyerOrderMetaMapper; 10 import com.yohoufo.dal.order.BuyerOrderMetaMapper;
@@ -11,12 +12,16 @@ import com.yohoufo.dal.order.model.BuyerOrderMeta; @@ -11,12 +12,16 @@ import com.yohoufo.dal.order.model.BuyerOrderMeta;
11 import com.yohoufo.order.constants.MetaKey; 12 import com.yohoufo.order.constants.MetaKey;
12 import com.yohoufo.order.model.AddressInfo; 13 import com.yohoufo.order.model.AddressInfo;
13 import com.yohoufo.order.service.IBuyerOrderMetaService; 14 import com.yohoufo.order.service.IBuyerOrderMetaService;
  15 +import com.yohoufo.order.service.cache.CacheCleaner;
  16 +import com.yohoufo.order.service.cache.CacheKeyBuilder;
14 import org.apache.commons.lang3.StringUtils; 17 import org.apache.commons.lang3.StringUtils;
15 import org.slf4j.Logger; 18 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory; 19 import org.slf4j.LoggerFactory;
17 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service; 21 import org.springframework.stereotype.Service;
19 22
  23 +import java.util.Arrays;
  24 +
20 @Service 25 @Service
21 public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService { 26 public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService {
22 27
@@ -25,6 +30,9 @@ public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService { @@ -25,6 +30,9 @@ public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService {
25 @Autowired 30 @Autowired
26 private BuyerOrderMetaMapper buyerOrderMetaMapper; 31 private BuyerOrderMetaMapper buyerOrderMetaMapper;
27 32
  33 + @Autowired
  34 + private CacheCleaner cacheCleaner;
  35 +
28 @Override 36 @Override
29 public String updateDeliveryAddress(BuyerOrderMetaUpdateReq req){ 37 public String updateDeliveryAddress(BuyerOrderMetaUpdateReq req){
30 logger.info("BuyerOrderMetaServiceImpl updateDeliveryAddress parse address {} ",req.getAddress()); 38 logger.info("BuyerOrderMetaServiceImpl updateDeliveryAddress parse address {} ",req.getAddress());
@@ -74,6 +82,10 @@ public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService { @@ -74,6 +82,10 @@ public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService {
74 updateRowNum = buyerOrderMetaMapper.updateMetaValueByUidAndOrderCodeAndMetaKey(meta); 82 updateRowNum = buyerOrderMetaMapper.updateMetaValueByUidAndOrderCodeAndMetaKey(meta);
75 logger.info("BuyerOrderMetaServiceImpl updateDeliveryAddress meta param {} end, updateRowNum {} ",meta,updateRowNum); 83 logger.info("BuyerOrderMetaServiceImpl updateDeliveryAddress meta param {} end, updateRowNum {} ",meta,updateRowNum);
76 rtn += (" address update:"+updateRowNum); 84 rtn += (" address update:"+updateRowNum);
  85 +
  86 + //清地址缓存
  87 + cacheCleaner.delete(Arrays.asList(
  88 + CacheKeyBuilder.orderDetailKey(req.getUid(), TabType.BUY.getValue(), req.getOrderCode())));
77 return rtn; 89 return rtn;
78 } 90 }
79 91