add seller cache because batch no
Showing
14 changed files
with
144 additions
and
41 deletions
@@ -109,7 +109,8 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -109,7 +109,8 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
109 | 109 | ||
110 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 110 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
111 | CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), | 111 | CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), |
112 | - CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderInfo.getOrderCode()), | 112 | + CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods), |
113 | + CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | ||
113 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderInfo.getOrderCode()))); | 114 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderInfo.getOrderCode()))); |
114 | } | 115 | } |
115 | 116 |
@@ -93,14 +93,16 @@ public class SellerOrderPaymentService extends AbstractOrderPaymentService { | @@ -93,14 +93,16 @@ public class SellerOrderPaymentService extends AbstractOrderPaymentService { | ||
93 | String prdName = null; | 93 | String prdName = null; |
94 | int sellerUid; | 94 | int sellerUid; |
95 | SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderInfo.getOrderCode()); | 95 | SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderInfo.getOrderCode()); |
96 | + SellerOrderGoods sellerOrderGoods = null; | ||
96 | if (Objects.nonNull(sellerOrder)){ | 97 | if (Objects.nonNull(sellerOrder)){ |
97 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup()); | 98 | + sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup()); |
98 | prdName = sellerOrderGoods.getProductName(); | 99 | prdName = sellerOrderGoods.getProductName(); |
99 | } | 100 | } |
100 | inBoxFacade.sellerPaidEarnestMoney(sellerUid=orderInfo.getUid(), prdName); | 101 | inBoxFacade.sellerPaidEarnestMoney(sellerUid=orderInfo.getUid(), prdName); |
101 | 102 | ||
102 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 103 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
103 | - CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderInfo.getOrderCode()) | 104 | + CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods), |
105 | + CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), sellerOrder.getOrderCode()) | ||
104 | )); | 106 | )); |
105 | } | 107 | } |
106 | 108 |
@@ -5,6 +5,7 @@ import com.yoho.core.redis.cluster.annotation.Redis; | @@ -5,6 +5,7 @@ import com.yoho.core.redis.cluster.annotation.Redis; | ||
5 | import com.yoho.core.redis.cluster.operations.nosync.YHRedisTemplate; | 5 | import com.yoho.core.redis.cluster.operations.nosync.YHRedisTemplate; |
6 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; | 6 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; |
7 | import com.yohobuy.ufo.model.order.common.TabType; | 7 | import com.yohobuy.ufo.model.order.common.TabType; |
8 | +import com.yohoufo.dal.order.model.SellerOrderGoods; | ||
8 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
9 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
10 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
@@ -35,6 +36,12 @@ public class CacheCleaner { | @@ -35,6 +36,12 @@ public class CacheCleaner { | ||
35 | delete(keyBuilders); | 36 | delete(keyBuilders); |
36 | } | 37 | } |
37 | 38 | ||
39 | + public void cleanSellerDetail(SellerOrderGoods sog){ | ||
40 | + RedisKeyBuilder detailKB = CacheKeyBuilder.sellerOrderDetailKey(sog); | ||
41 | + List<RedisKeyBuilder> keyBuilders = Lists.newArrayList(detailKB); | ||
42 | + delete(keyBuilders); | ||
43 | + } | ||
44 | + | ||
38 | /** | 45 | /** |
39 | * 批量删除key | 46 | * 批量删除key |
40 | * @param keyBuilders | 47 | * @param keyBuilders |
1 | package com.yohoufo.order.service.cache; | 1 | package com.yohoufo.order.service.cache; |
2 | 2 | ||
3 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; | 3 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; |
4 | +import com.yohobuy.ufo.model.order.common.TabType; | ||
5 | +import com.yohoufo.dal.order.model.SellerOrderGoods; | ||
4 | import com.yohoufo.order.model.request.OrderListRequest; | 6 | import com.yohoufo.order.model.request.OrderListRequest; |
5 | import org.slf4j.helpers.MessageFormatter; | 7 | import org.slf4j.helpers.MessageFormatter; |
6 | 8 | ||
9 | +import java.math.BigDecimal; | ||
10 | +import java.util.Objects; | ||
11 | + | ||
7 | /** | 12 | /** |
8 | * Created by chenchao on 2018/10/16. | 13 | * Created by chenchao on 2018/10/16. |
9 | */ | 14 | */ |
@@ -40,8 +45,9 @@ public class CacheKeyBuilder { | @@ -40,8 +45,9 @@ public class CacheKeyBuilder { | ||
40 | 45 | ||
41 | ORDER_LIST("ufo:order:orderList:","uid:{}:tabType:{}"), | 46 | ORDER_LIST("ufo:order:orderList:","uid:{}:tabType:{}"), |
42 | 47 | ||
43 | - ORDER_DETAIL("ufo:order:orderDetail:", "uid:{}:tabType:{}:orderCode:{}"); | 48 | + ORDER_DETAIL("ufo:order:orderDetail:", "uid:{}:tabType:{}:orderCode:{}"), |
44 | 49 | ||
50 | + SELLER_ORDER_DETAIL("ufo:order:orderDetail:", "uid:{}:tabType:{}:batchNo:{}:price{}:status{}"); | ||
45 | private String fix; | 51 | private String fix; |
46 | 52 | ||
47 | private String placeHolder; | 53 | private String placeHolder; |
@@ -79,6 +85,18 @@ public class CacheKeyBuilder { | @@ -79,6 +85,18 @@ public class CacheKeyBuilder { | ||
79 | return PatternKeyTemplate.ORDER_LIST_COUNT.getKeyPattern(); | 85 | return PatternKeyTemplate.ORDER_LIST_COUNT.getKeyPattern(); |
80 | } | 86 | } |
81 | 87 | ||
88 | + public static RedisKeyBuilder sellerOrderDetailKey(SellerOrderGoods sog){ | ||
89 | + if (Objects.isNull(sog)){ | ||
90 | + return null; | ||
91 | + } | ||
92 | + String actor = TabType.SELL.getValue(); | ||
93 | + int uid = sog.getUid(); | ||
94 | + long batchNo = sog.getBatchNo(); | ||
95 | + BigDecimal price = sog.getGoodsPrice(); | ||
96 | + Integer status = sog.getStatus(); | ||
97 | + return KeyTemp.SELLER_ORDER_DETAIL.builderKey(new Object[]{uid, actor, batchNo, price, status}); | ||
98 | + } | ||
99 | + | ||
82 | public static RedisKeyBuilder orderDetailKey(int uid, String actor, long orderCode){ | 100 | public static RedisKeyBuilder orderDetailKey(int uid, String actor, long orderCode){ |
83 | 101 | ||
84 | return KeyTemp.ORDER_DETAIL.builderKey(new Object[]{uid, actor, orderCode}); | 102 | return KeyTemp.ORDER_DETAIL.builderKey(new Object[]{uid, actor, orderCode}); |
@@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.TabType; | @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.TabType; | ||
6 | import com.yohobuy.ufo.model.order.vo.OrderListVo; | 6 | import com.yohobuy.ufo.model.order.vo.OrderListVo; |
7 | import com.yohoufo.common.cache.CacheClient; | 7 | import com.yohoufo.common.cache.CacheClient; |
8 | import com.yohoufo.common.cache.SnappyZipUtils; | 8 | import com.yohoufo.common.cache.SnappyZipUtils; |
9 | +import com.yohoufo.dal.order.model.SellerOrderGoods; | ||
9 | import com.yohoufo.order.model.request.OrderListRequest; | 10 | import com.yohoufo.order.model.request.OrderListRequest; |
10 | import com.yohoufo.order.model.response.OrderDetailInfo; | 11 | import com.yohoufo.order.model.response.OrderDetailInfo; |
11 | import org.apache.commons.lang3.StringUtils; | 12 | import org.apache.commons.lang3.StringUtils; |
@@ -77,6 +78,19 @@ public class OrderCacheService { | @@ -77,6 +78,19 @@ public class OrderCacheService { | ||
77 | } | 78 | } |
78 | } | 79 | } |
79 | 80 | ||
81 | + public void cacheSellerOrderDetailInfo(SellerOrderGoods sog, OrderDetailInfo orderDetailInfo){ | ||
82 | + RedisKeyBuilder kb = CacheKeyBuilder.sellerOrderDetailKey(sog); | ||
83 | + cacheClient.set(kb.getKey(), ExpiredTime.ORDER_DETAIL , orderDetailInfo); | ||
84 | + logger.info("put seller OrderDetail cache ,info {}", sog); | ||
85 | + } | ||
86 | + | ||
87 | + public OrderDetailInfo getSellerOrderDetailInfo(SellerOrderGoods sog){ | ||
88 | + RedisKeyBuilder kb = CacheKeyBuilder.sellerOrderDetailKey(sog); | ||
89 | + logger.info("get seller OrderDetail cache ,info {}", sog); | ||
90 | + OrderDetailInfo orderDetailInfo = cacheClient.get(kb.getKey(), OrderDetailInfo.class); | ||
91 | + return orderDetailInfo; | ||
92 | + } | ||
93 | + | ||
80 | 94 | ||
81 | public void cacheOrderDetailInfo(int uid, long orderCode,TabType actor, OrderDetailInfo orderDetailInfo){ | 95 | public void cacheOrderDetailInfo(int uid, long orderCode,TabType actor, OrderDetailInfo orderDetailInfo){ |
82 | RedisKeyBuilder kb = CacheKeyBuilder.orderDetailKey(uid, actor.getValue(), orderCode); | 96 | RedisKeyBuilder kb = CacheKeyBuilder.orderDetailKey(uid, actor.getValue(), orderCode); |
@@ -162,6 +162,8 @@ public class AppraiseService { | @@ -162,6 +162,8 @@ public class AppraiseService { | ||
162 | .buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode()) | 162 | .buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode()) |
163 | .payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY) | 163 | .payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY) |
164 | .skup(skup); | 164 | .skup(skup); |
165 | + SellerOrderGoods sellerOrderGoods; | ||
166 | + sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
165 | try { | 167 | try { |
166 | payRefundService.refund(req, bleb); | 168 | payRefundService.refund(req, bleb); |
167 | //通知卖家退还保证金 | 169 | //通知卖家退还保证金 |
@@ -170,7 +172,7 @@ public class AppraiseService { | @@ -170,7 +172,7 @@ public class AppraiseService { | ||
170 | //记录物流信息 | 172 | //记录物流信息 |
171 | expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum); | 173 | expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum); |
172 | //平台已发货给买家 | 174 | //平台已发货给买家 |
173 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | 175 | + |
174 | inBoxFacade.depotDeliver2Buyer(buyerUid, orderCode,sellerOrderGoods.getProductName()); | 176 | inBoxFacade.depotDeliver2Buyer(buyerUid, orderCode,sellerOrderGoods.getProductName()); |
175 | }catch (Exception ex){ | 177 | }catch (Exception ex){ |
176 | LOGGER.warn("in appraiseSuccess,refund fail, req {}", req, ex); | 178 | LOGGER.warn("in appraiseSuccess,refund fail, req {}", req, ex); |
@@ -188,6 +190,7 @@ public class AppraiseService { | @@ -188,6 +190,7 @@ public class AppraiseService { | ||
188 | 190 | ||
189 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 191 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
190 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), | 192 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), |
193 | + CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods), | ||
191 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | 194 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), |
192 | CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode))); | 195 | CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode))); |
193 | 196 | ||
@@ -285,9 +288,10 @@ public class AppraiseService { | @@ -285,9 +288,10 @@ public class AppraiseService { | ||
285 | tso.setUpdateTime(DateUtil.getCurrentTimeSecond()); | 288 | tso.setUpdateTime(DateUtil.getCurrentTimeSecond()); |
286 | tso.setExceptStatus(expectSOStatus.getCode()); | 289 | tso.setExceptStatus(expectSOStatus.getCode()); |
287 | int soCnt = sellerOrderMapper.updateByOrderCode(tso); | 290 | int soCnt = sellerOrderMapper.updateByOrderCode(tso); |
288 | - | 291 | + SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
289 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 292 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
290 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), | 293 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), |
294 | + CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods), | ||
291 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | 295 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), |
292 | CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode))); | 296 | CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode))); |
293 | 297 | ||
@@ -324,7 +328,7 @@ public class AppraiseService { | @@ -324,7 +328,7 @@ public class AppraiseService { | ||
324 | try{ | 328 | try{ |
325 | payRefundService.refund(req, bleb); | 329 | payRefundService.refund(req, bleb); |
326 | // | 330 | // |
327 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | 331 | + |
328 | inBoxFacade.noticeSellerWhenAppraiseFail(sellerUid, sellerOrderGoods.getProductName()); | 332 | inBoxFacade.noticeSellerWhenAppraiseFail(sellerUid, sellerOrderGoods.getProductName()); |
329 | inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(), sellerOrderGoods.getProductName()); | 333 | inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(), sellerOrderGoods.getProductName()); |
330 | }catch (Exception ex){ | 334 | }catch (Exception ex){ |
@@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl; | @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl; | ||
2 | 2 | ||
3 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 3 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
4 | import com.yohobuy.ufo.model.order.common.SkupStatus; | 4 | import com.yohobuy.ufo.model.order.common.SkupStatus; |
5 | +import com.yohobuy.ufo.model.order.common.TabType; | ||
5 | import com.yohoufo.common.utils.DateUtil; | 6 | import com.yohoufo.common.utils.DateUtil; |
6 | import com.yohoufo.dal.order.BuyerOrderMapper; | 7 | import com.yohoufo.dal.order.BuyerOrderMapper; |
7 | import com.yohoufo.dal.order.OrderCouponMapper; | 8 | import com.yohoufo.dal.order.OrderCouponMapper; |
@@ -21,6 +22,8 @@ import com.yohoufo.order.model.bo.CouponBo; | @@ -21,6 +22,8 @@ import com.yohoufo.order.model.bo.CouponBo; | ||
21 | import com.yohoufo.order.model.request.PaymentRequest; | 22 | import com.yohoufo.order.model.request.PaymentRequest; |
22 | import com.yohoufo.order.model.request.TransferMoneyRequest; | 23 | import com.yohoufo.order.model.request.TransferMoneyRequest; |
23 | import com.yohoufo.order.service.IPaymentService; | 24 | import com.yohoufo.order.service.IPaymentService; |
25 | +import com.yohoufo.order.service.cache.CacheCleaner; | ||
26 | +import com.yohoufo.order.service.cache.CacheKeyBuilder; | ||
24 | import com.yohoufo.order.service.concurrent.ThreadPoolFactory; | 27 | import com.yohoufo.order.service.concurrent.ThreadPoolFactory; |
25 | import com.yohoufo.order.service.proxy.CouponProxyService; | 28 | import com.yohoufo.order.service.proxy.CouponProxyService; |
26 | import com.yohoufo.order.utils.LoggerUtils; | 29 | import com.yohoufo.order.utils.LoggerUtils; |
@@ -30,6 +33,7 @@ import org.springframework.stereotype.Service; | @@ -30,6 +33,7 @@ import org.springframework.stereotype.Service; | ||
30 | 33 | ||
31 | import javax.annotation.Resource; | 34 | import javax.annotation.Resource; |
32 | import java.math.BigDecimal; | 35 | import java.math.BigDecimal; |
36 | +import java.util.Arrays; | ||
33 | import java.util.concurrent.Callable; | 37 | import java.util.concurrent.Callable; |
34 | import java.util.concurrent.Future; | 38 | import java.util.concurrent.Future; |
35 | 39 | ||
@@ -65,18 +69,24 @@ public class BuyerOrderCancelService { | @@ -65,18 +69,24 @@ public class BuyerOrderCancelService { | ||
65 | @Autowired | 69 | @Autowired |
66 | private PayRefundService payRefundService; | 70 | private PayRefundService payRefundService; |
67 | 71 | ||
72 | + @Autowired | ||
73 | + private CacheCleaner cacheCleaner; | ||
74 | + | ||
68 | 75 | ||
69 | public void cancel(BeforeSellerDeliverEvent bsdEvent){ | 76 | public void cancel(BeforeSellerDeliverEvent bsdEvent){ |
70 | OrderDynamicConfig.BuyerCancelCompensateNode compensate = orderDynamicConfig.getBeforeSellerDeliverBCCN(); | 77 | OrderDynamicConfig.BuyerCancelCompensateNode compensate = orderDynamicConfig.getBeforeSellerDeliverBCCN(); |
71 | 78 | ||
72 | logger.info("in buyer cancel BeforeSellerDeliver, event {} compensate {}", bsdEvent, compensate); | 79 | logger.info("in buyer cancel BeforeSellerDeliver, event {} compensate {}", bsdEvent, compensate); |
73 | int buyerUid = bsdEvent.getBuyerUid(); | 80 | int buyerUid = bsdEvent.getBuyerUid(); |
81 | + int sellerUid = bsdEvent.getSellerUid(); | ||
74 | long orderCode = bsdEvent.getOrderCode(); | 82 | long orderCode = bsdEvent.getOrderCode(); |
75 | OrderStatus target = bsdEvent.getTarget(); | 83 | OrderStatus target = bsdEvent.getTarget(); |
76 | OrderStatus expected = bsdEvent.getExpected(); | 84 | OrderStatus expected = bsdEvent.getExpected(); |
77 | int currentTime = DateUtil.getCurrentTimeSecond(); | 85 | int currentTime = DateUtil.getCurrentTimeSecond(); |
78 | int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), target.getCode(), currentTime); | 86 | int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), target.getCode(), currentTime); |
79 | if (rows>0) { | 87 | if (rows>0) { |
88 | + //退还优惠券 | ||
89 | + refundCouponIfNeed(buyerUid, orderCode); | ||
80 | int skup = bsdEvent.getSkup(); | 90 | int skup = bsdEvent.getSkup(); |
81 | SellerOrderGoods targetGoods = new SellerOrderGoods(); | 91 | SellerOrderGoods targetGoods = new SellerOrderGoods(); |
82 | targetGoods.setId(skup); | 92 | targetGoods.setId(skup); |
@@ -92,7 +102,12 @@ public class BuyerOrderCancelService { | @@ -92,7 +102,12 @@ public class BuyerOrderCancelService { | ||
92 | BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup, | 102 | BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup, |
93 | compensate, transferCase); | 103 | compensate, transferCase); |
94 | Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt); | 104 | Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt); |
95 | - | 105 | + SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
106 | + cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | ||
107 | + CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), | ||
108 | + CacheKeyBuilder.sellerOrderDetailKey(psog), | ||
109 | + CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | ||
110 | + CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode))); | ||
96 | logger.info("use one thread to execute buyer cancel BeforeSellerDeliver buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}", | 111 | logger.info("use one thread to execute buyer cancel BeforeSellerDeliver buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}", |
97 | buyerUid, orderCode, skup, compensate, transferCase); | 112 | buyerUid, orderCode, skup, compensate, transferCase); |
98 | } | 113 | } |
@@ -106,10 +121,14 @@ public class BuyerOrderCancelService { | @@ -106,10 +121,14 @@ public class BuyerOrderCancelService { | ||
106 | OrderStatus target = bdrEvent.getTarget(); | 121 | OrderStatus target = bdrEvent.getTarget(); |
107 | OrderStatus expected = bdrEvent.getExpected(); | 122 | OrderStatus expected = bdrEvent.getExpected(); |
108 | int buyerUid = bdrEvent.getBuyerUid(); | 123 | int buyerUid = bdrEvent.getBuyerUid(); |
124 | + int sellerUid = bdrEvent.getSellerUid(); | ||
109 | long orderCode = bdrEvent.getOrderCode(); | 125 | long orderCode = bdrEvent.getOrderCode(); |
110 | int currentTime = DateUtil.getCurrentTimeSecond(); | 126 | int currentTime = DateUtil.getCurrentTimeSecond(); |
111 | int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), target.getCode(), currentTime); | 127 | int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), target.getCode(), currentTime); |
112 | if (rows>0) { | 128 | if (rows>0) { |
129 | + //退还优惠券 | ||
130 | + refundCouponIfNeed(buyerUid, orderCode); | ||
131 | + | ||
113 | int skup = bdrEvent.getSkup(); | 132 | int skup = bdrEvent.getSkup(); |
114 | SellerOrderGoods targetGoods = new SellerOrderGoods(); | 133 | SellerOrderGoods targetGoods = new SellerOrderGoods(); |
115 | targetGoods.setId(skup); | 134 | targetGoods.setId(skup); |
@@ -125,7 +144,12 @@ public class BuyerOrderCancelService { | @@ -125,7 +144,12 @@ public class BuyerOrderCancelService { | ||
125 | BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup, | 144 | BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup, |
126 | compensate, transferCase); | 145 | compensate, transferCase); |
127 | Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt); | 146 | Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt); |
128 | - | 147 | + SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
148 | + cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | ||
149 | + CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), | ||
150 | + CacheKeyBuilder.sellerOrderDetailKey(psog), | ||
151 | + CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | ||
152 | + CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode))); | ||
129 | logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}", | 153 | logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}", |
130 | buyerUid, orderCode, skup, compensate, transferCase); | 154 | buyerUid, orderCode, skup, compensate, transferCase); |
131 | } | 155 | } |
@@ -93,9 +93,12 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -93,9 +93,12 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
93 | expectStatus.getCode(), | 93 | expectStatus.getCode(), |
94 | OrderStatus.DONE.getCode(), | 94 | OrderStatus.DONE.getCode(), |
95 | DateUtil.getCurrentTimeSecond())) { | 95 | DateUtil.getCurrentTimeSecond())) { |
96 | + BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode); | ||
97 | + SellerOrderGoods sog = sellerOrderGoodsMapper.selectByPrimaryKey(bog.getSkup()); | ||
96 | 98 | ||
97 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 99 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
98 | CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), | 100 | CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), |
101 | + CacheKeyBuilder.sellerOrderDetailKey(sog), | ||
99 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | 102 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), |
100 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode))); | 103 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode))); |
101 | } else { | 104 | } else { |
@@ -141,8 +144,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -141,8 +144,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
141 | case WAITING_PAY: | 144 | case WAITING_PAY: |
142 | targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_PAY; | 145 | targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_PAY; |
143 | cancelBeforePaid(orderRequest, node, expectStatus, targetStatus); | 146 | cancelBeforePaid(orderRequest, node, expectStatus, targetStatus); |
144 | - //退还优惠券 | ||
145 | - buyerOrderCancelService.refundCouponIfNeed(orderRequest.getUid(),orderRequest.getOrderCode()); | ||
146 | break; | 147 | break; |
147 | case HAS_PAYED: | 148 | case HAS_PAYED: |
148 | BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(orderRequest.getUid(), | 149 | BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(orderRequest.getUid(), |
@@ -167,8 +168,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -167,8 +168,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
167 | .expected(expectStatus).target(targetStatus).skup(skup).sellerUid(buyerOrder.getSellerUid()) | 168 | .expected(expectStatus).target(targetStatus).skup(skup).sellerUid(buyerOrder.getSellerUid()) |
168 | .build(); | 169 | .build(); |
169 | buyerOrderCancelService.cancel(bdre); | 170 | buyerOrderCancelService.cancel(bdre); |
170 | - //退还优惠券 | ||
171 | - buyerOrderCancelService.refundCouponIfNeed(orderRequest.getUid(),orderRequest.getOrderCode()); | ||
172 | break; | 171 | break; |
173 | } | 172 | } |
174 | 173 | ||
@@ -200,8 +199,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -200,8 +199,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
200 | tsog.setStatus(SkupStatus.CAN_SELL.getCode()); | 199 | tsog.setStatus(SkupStatus.CAN_SELL.getCode()); |
201 | sellerOrderGoodsMapper.updateByPrimaryKeySelective(tsog); | 200 | sellerOrderGoodsMapper.updateByPrimaryKeySelective(tsog); |
202 | 201 | ||
203 | - | ||
204 | - | ||
205 | // 恢复product skup的库存 | 202 | // 恢复product skup的库存 |
206 | boolean isReturnSuccess = productProxyService.returnStorage(skup); | 203 | boolean isReturnSuccess = productProxyService.returnStorage(skup); |
207 | // | 204 | // |
@@ -212,6 +209,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -212,6 +209,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
212 | // | 209 | // |
213 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 210 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
214 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), | 211 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), |
212 | + CacheKeyBuilder.sellerOrderDetailKey(psog), | ||
215 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | 213 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), |
216 | CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode))); | 214 | CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode))); |
217 | 215 | ||
@@ -371,10 +369,12 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -371,10 +369,12 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
371 | int sellerUid = buyerOrder.getSellerUid(); | 369 | int sellerUid = buyerOrder.getSellerUid(); |
372 | buyerOrderMapper.updateStatusByOrderCode(orderCode, uid, expectStatus.getCode(), | 370 | buyerOrderMapper.updateStatusByOrderCode(orderCode, uid, expectStatus.getCode(), |
373 | targetStatus.getCode(), DateUtil.getCurrentTimeSecond()); | 371 | targetStatus.getCode(), DateUtil.getCurrentTimeSecond()); |
374 | - | 372 | + BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode); |
373 | + SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(bog.getSkup()); | ||
375 | 374 | ||
376 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 375 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
377 | CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), | 376 | CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), |
377 | + CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods), | ||
378 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | 378 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), |
379 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode))); | 379 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode))); |
380 | } | 380 | } |
@@ -117,12 +117,13 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -117,12 +117,13 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
117 | } | 117 | } |
118 | 118 | ||
119 | //根据skup ,更新鉴定中心 | 119 | //根据skup ,更新鉴定中心 |
120 | + int skup; | ||
120 | SellerOrderGoods sellerOrderGoods=new SellerOrderGoods(); | 121 | SellerOrderGoods sellerOrderGoods=new SellerOrderGoods(); |
121 | - sellerOrderGoods.setId(buyerOrderGoods.getSkup()); | 122 | + sellerOrderGoods.setId(skup=buyerOrderGoods.getSkup()); |
122 | sellerOrderGoods.setDepotNo(depotNum); | 123 | sellerOrderGoods.setDepotNo(depotNum); |
123 | sellerOrderGoodsMapper.updateByPrimaryKeySelective(sellerOrderGoods); | 124 | sellerOrderGoodsMapper.updateByPrimaryKeySelective(sellerOrderGoods); |
124 | 125 | ||
125 | - productProxyService.setDepotNum(buyerOrderGoods.getSkup(),depotNum); | 126 | + productProxyService.setDepotNum(skup,depotNum); |
126 | 127 | ||
127 | // 更新买家订单状态 | 128 | // 更新买家订单状态 |
128 | int updateBuyerCnt = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerOrder.getUid(), | 129 | int updateBuyerCnt = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerOrder.getUid(), |
@@ -139,10 +140,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -139,10 +140,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
139 | 140 | ||
140 | LOGGER.info("deliverToDepot update buyer order status result {} ",updateBuyerCnt); | 141 | LOGGER.info("deliverToDepot update buyer order status result {} ",updateBuyerCnt); |
141 | 142 | ||
142 | - | 143 | + SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
143 | // | 144 | // |
144 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 145 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
145 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), | 146 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), |
147 | + CacheKeyBuilder.sellerOrderDetailKey(psog), | ||
146 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | 148 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), |
147 | CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode))); | 149 | CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode))); |
148 | } | 150 | } |
@@ -241,7 +241,8 @@ public class SellerOrderCancelService { | @@ -241,7 +241,8 @@ public class SellerOrderCancelService { | ||
241 | } | 241 | } |
242 | 242 | ||
243 | cacheCleaner.cleanList(uid, TabType.SELL.getValue()); | 243 | cacheCleaner.cleanList(uid, TabType.SELL.getValue()); |
244 | - cacheCleaner.cleanDetail(uid, orderCode, TabType.SELL); | 244 | + SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
245 | + cacheCleaner.cleanSellerDetail(psog); | ||
245 | } | 246 | } |
246 | 247 | ||
247 | return result; | 248 | return result; |
@@ -328,8 +329,10 @@ public class SellerOrderCancelService { | @@ -328,8 +329,10 @@ public class SellerOrderCancelService { | ||
328 | tbo.setUpdateTime(DateUtil.getCurrentTimeSecond()); | 329 | tbo.setUpdateTime(DateUtil.getCurrentTimeSecond()); |
329 | result += buyerOrderMapper.updateByOrderCode(tbo); | 330 | result += buyerOrderMapper.updateByOrderCode(tbo); |
330 | if(result > 0) { | 331 | if(result > 0) { |
332 | + SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup()); | ||
331 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), | 333 | cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), |
332 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), | 334 | CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), |
335 | + CacheKeyBuilder.sellerOrderDetailKey(psog), | ||
333 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), buyerOrderCode), | 336 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), buyerOrderCode), |
334 | CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), buyerOrderCode))); | 337 | CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), buyerOrderCode))); |
335 | 338 | ||
@@ -360,7 +363,7 @@ public class SellerOrderCancelService { | @@ -360,7 +363,7 @@ public class SellerOrderCancelService { | ||
360 | .type(transferCase.getCode()).transferCase(transferCase).build(); | 363 | .type(transferCase.getCode()).transferCase(transferCase).build(); |
361 | transferService.transfer(tmReq); | 364 | transferService.transfer(tmReq); |
362 | PayRefundBo refundResp = payRefundService.refund(refundReq, bleb); | 365 | PayRefundBo refundResp = payRefundService.refund(refundReq, bleb); |
363 | - SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup()); | 366 | + |
364 | //异步 | 367 | //异步 |
365 | inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode, psog.getProductName()); | 368 | inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode, psog.getProductName()); |
366 | inBoxFacade.sellerCancelAfterBuyerPaid(sellerUid, psog.getProductName()); | 369 | inBoxFacade.sellerCancelAfterBuyerPaid(sellerUid, psog.getProductName()); |
@@ -497,7 +500,7 @@ public class SellerOrderCancelService { | @@ -497,7 +500,7 @@ public class SellerOrderCancelService { | ||
497 | sellerOrderMapper.updateByOrderCode(tso); | 500 | sellerOrderMapper.updateByOrderCode(tso); |
498 | // | 501 | // |
499 | cacheCleaner.cleanList(sellerUid, TabType.SELL.getValue()); | 502 | cacheCleaner.cleanList(sellerUid, TabType.SELL.getValue()); |
500 | - cacheCleaner.cleanDetail(sellerUid, orderCode, TabType.SELL); | 503 | + cacheCleaner.cleanSellerDetail(psog); |
501 | double earnestMoney = sellerOrder.getEarnestMoney().doubleValue(); | 504 | double earnestMoney = sellerOrder.getEarnestMoney().doubleValue(); |
502 | PaymentRequest refundReq = PaymentRequest.builder().uid(sellerOrder.getUid()) | 505 | PaymentRequest refundReq = PaymentRequest.builder().uid(sellerOrder.getUid()) |
503 | .orderCode(orderCode) | 506 | .orderCode(orderCode) |
@@ -106,24 +106,25 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | @@ -106,24 +106,25 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | ||
106 | logger.warn("getOrderDetail orderCode illegal, req {}", orderRequest); | 106 | logger.warn("getOrderDetail orderCode illegal, req {}", orderRequest); |
107 | throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); | 107 | throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); |
108 | } | 108 | } |
109 | - OrderDetailInfo orderDetailInfo = orderCacheService.getOrderDetailInfo(uid, orderCode, TabType.SELL); | ||
110 | - | ||
111 | - if (Objects.isNull(orderDetailInfo)){ | ||
112 | - if( SELLER_TYPES.contains(codeMeta.getType())){ | 109 | + OrderDetailInfo orderDetailInfo ; |
110 | + boolean fromCache = true; | ||
111 | + if( SELLER_TYPES.contains(codeMeta.getType())){ | ||
112 | + SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCodeUid(orderCode, uid); | ||
113 | + if (Objects.isNull(sellerOrder)){ | ||
114 | + logger.warn("can not find seller order, req {}", orderRequest); | ||
115 | + return null; | ||
116 | + } | ||
117 | + Integer skup = sellerOrder.getSkup(); | ||
118 | + SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
119 | + orderDetailInfo = orderCacheService.getSellerOrderDetailInfo(sellerOrderGoods); | ||
113 | 120 | ||
114 | - SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCodeUid(orderCode, uid); | ||
115 | - if (Objects.isNull(sellerOrder)){ | ||
116 | - logger.warn("can not find seller order, req {}", orderRequest); | ||
117 | - return null; | ||
118 | - } | 121 | + if (Objects.isNull(orderDetailInfo)){ |
122 | + fromCache = false; | ||
119 | boolean isEntry = userProxyService.isEntryShop(uid) | 123 | boolean isEntry = userProxyService.isEntryShop(uid) |
120 | && Objects.nonNull(sellerOrder.getPayment()) | 124 | && Objects.nonNull(sellerOrder.getPayment()) |
121 | && OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType() == sellerOrder.getPayment(); | 125 | && OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType() == sellerOrder.getPayment(); |
122 | SellerType sellerType = isEntry ? SellerType.ENTRY : SellerType.COMMON; | 126 | SellerType sellerType = isEntry ? SellerType.ENTRY : SellerType.COMMON; |
123 | - Integer skup = sellerOrder.getSkup(); | ||
124 | 127 | ||
125 | - | ||
126 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
127 | Integer skupStatusCode = sellerOrderGoods.getStatus(); | 128 | Integer skupStatusCode = sellerOrderGoods.getStatus(); |
128 | 129 | ||
129 | SellerOrderGoods sogc = new SellerOrderGoods(); | 130 | SellerOrderGoods sogc = new SellerOrderGoods(); |
@@ -136,14 +137,19 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | @@ -136,14 +137,19 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | ||
136 | SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode); | 137 | SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode); |
137 | AddressInfo addressInfo = sellerAddressService.getHiddenAddressInfo(uid, skup); | 138 | AddressInfo addressInfo = sellerAddressService.getHiddenAddressInfo(uid, skup); |
138 | orderDetailInfo = buildOrderDetail(sellerOrder, skupStatus, tsog, addressInfo, sellerType); | 139 | orderDetailInfo = buildOrderDetail(sellerOrder, skupStatus, tsog, addressInfo, sellerType); |
139 | - }else{ | ||
140 | - orderDetailInfo = super.getOrderDetail(orderRequest); | 140 | + orderCacheService.cacheSellerOrderDetailInfo(tsog, orderDetailInfo); |
141 | } | 141 | } |
142 | 142 | ||
143 | - if (Objects.nonNull(orderDetailInfo)){ | 143 | + }else { |
144 | + orderDetailInfo = orderCacheService.getOrderDetailInfo(uid, orderCode, TabType.SELL); | ||
145 | + if (Objects.isNull(orderDetailInfo)) { | ||
146 | + fromCache = false; | ||
147 | + orderDetailInfo = super.getOrderDetail(orderRequest); | ||
144 | orderCacheService.cacheOrderDetailInfo(uid, orderCode, TabType.SELL, orderDetailInfo); | 148 | orderCacheService.cacheOrderDetailInfo(uid, orderCode, TabType.SELL, orderDetailInfo); |
145 | } | 149 | } |
146 | - }else{//fetch from cache | 150 | + } |
151 | + | ||
152 | + if (fromCache){//fetch from cache | ||
147 | resetDynamicProporties(orderDetailInfo); | 153 | resetDynamicProporties(orderDetailInfo); |
148 | } | 154 | } |
149 | 155 |
@@ -43,6 +43,7 @@ import com.yohoufo.order.service.IOrderDetailService; | @@ -43,6 +43,7 @@ import com.yohoufo.order.service.IOrderDetailService; | ||
43 | import com.yohoufo.order.service.IOrderListService; | 43 | import com.yohoufo.order.service.IOrderListService; |
44 | import com.yohoufo.order.service.MerchantOrderPaymentService; | 44 | import com.yohoufo.order.service.MerchantOrderPaymentService; |
45 | import com.yohoufo.order.service.cache.CacheCleaner; | 45 | import com.yohoufo.order.service.cache.CacheCleaner; |
46 | +import com.yohoufo.order.service.cache.CacheKeyBuilder; | ||
46 | import com.yohoufo.order.service.cache.OrderCacheService; | 47 | import com.yohoufo.order.service.cache.OrderCacheService; |
47 | import com.yohoufo.order.service.concurrent.ThreadPoolFactory; | 48 | import com.yohoufo.order.service.concurrent.ThreadPoolFactory; |
48 | import com.yohoufo.order.service.handler.SellerOrderComputeHandler; | 49 | import com.yohoufo.order.service.handler.SellerOrderComputeHandler; |
@@ -232,11 +233,13 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -232,11 +233,13 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
232 | if(isEntryShop){ | 233 | if(isEntryShop){ |
233 | log.info("in publishPrd use batchPublishPrds, req {}", req); | 234 | log.info("in publishPrd use batchPublishPrds, req {}", req); |
234 | resp = batchPublishPrds(context, req); | 235 | resp = batchPublishPrds(context, req); |
236 | + | ||
235 | }else{ | 237 | }else{ |
236 | log.info("in publishPrd use publishSinglePrd, req {}", req); | 238 | log.info("in publishPrd use publishSinglePrd, req {}", req); |
237 | resp = publishSinglePrd(req, context); | 239 | resp = publishSinglePrd(req, context); |
240 | + cacheCleaner.cleanList(req.getUid(), TabType.SELL.getValue()); | ||
238 | } | 241 | } |
239 | - cacheCleaner.cleanList(req.getUid(), TabType.SELL.getValue()); | 242 | + |
240 | return resp; | 243 | return resp; |
241 | } | 244 | } |
242 | 245 | ||
@@ -351,8 +354,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -351,8 +354,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
351 | List<OrderInfo> orderList = soList.parallelStream().map(so->OrderInfo.builder() | 354 | List<OrderInfo> orderList = soList.parallelStream().map(so->OrderInfo.builder() |
352 | .orderCode(so.getOrderCode()).amount(so.getEarnestMoney()).build()).collect(Collectors.toList());; | 355 | .orderCode(so.getOrderCode()).amount(so.getEarnestMoney()).build()).collect(Collectors.toList());; |
353 | merchantOrderPaymentService.unshelveAddWalletDetail(sellerWallet, orderList); | 356 | merchantOrderPaymentService.unshelveAddWalletDetail(sellerWallet, orderList); |
357 | + SkupDto skupDto = tskupMap.values().iterator().next(); | ||
354 | //clean cache | 358 | //clean cache |
355 | - cacheCleaner.cleanList(req.getUid(), TabType.SELL.getValue()); | 359 | + cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(req.getUid(), TabType.SELL.getValue()), |
360 | + CacheKeyBuilder.sellerOrderDetailKey(skupDto.getSellerOrderGoods()) | ||
361 | + )); | ||
356 | } | 362 | } |
357 | 363 | ||
358 | result = true; | 364 | result = true; |
@@ -581,7 +587,10 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -581,7 +587,10 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
581 | merchantOrderPaymentService.changePriceAddWalletDetail(sellerWallet, orderList ); | 587 | merchantOrderPaymentService.changePriceAddWalletDetail(sellerWallet, orderList ); |
582 | 588 | ||
583 | successCnt = skupMap.size(); | 589 | successCnt = skupMap.size(); |
584 | - cacheCleaner.cleanList(req.getUid(), TabType.SELL.getValue()); | 590 | + SkupDto skupDto = skupMap.values().iterator().next(); |
591 | + cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(req.getUid(), TabType.SELL.getValue()), | ||
592 | + CacheKeyBuilder.sellerOrderDetailKey(skupDto.getSellerOrderGoods()) | ||
593 | + )); | ||
585 | }else { | 594 | }else { |
586 | //1.2 划账失败后 | 595 | //1.2 划账失败后 |
587 | failCnt = skupMap.size(); | 596 | failCnt = skupMap.size(); |
@@ -623,6 +632,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -623,6 +632,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
623 | SellerOrderSubmitHandler.ForkJoinResult fjr = null; | 632 | SellerOrderSubmitHandler.ForkJoinResult fjr = null; |
624 | try { | 633 | try { |
625 | fjr = orderSubmitHandler.submitMultiple(ctx, num); | 634 | fjr = orderSubmitHandler.submitMultiple(ctx, num); |
635 | + cacheCleaner.cleanList(uid, TabType.SELL.getValue()); | ||
626 | // (异步实现)记录保证金流水 | 636 | // (异步实现)记录保证金流水 |
627 | //(异步实现)同步数据到prd,记录支付, | 637 | //(异步实现)同步数据到prd,记录支付, |
628 | BatchPublishTailEvent bpte = BatchPublishTailEvent.builder().fjr(fjr).sellerWallet(sellerWallet).build(); | 638 | BatchPublishTailEvent bpte = BatchPublishTailEvent.builder().fjr(fjr).sellerWallet(sellerWallet).build(); |
@@ -6,6 +6,7 @@ import com.yohoufo.dal.order.SellerOrderMetaMapper; | @@ -6,6 +6,7 @@ import com.yohoufo.dal.order.SellerOrderMetaMapper; | ||
6 | import com.yohoufo.dal.order.TradeBillsMapper; | 6 | import com.yohoufo.dal.order.TradeBillsMapper; |
7 | import com.yohoufo.dal.order.model.SellerOrderMeta; | 7 | import com.yohoufo.dal.order.model.SellerOrderMeta; |
8 | import com.yohoufo.dal.order.model.TradeBills; | 8 | import com.yohoufo.dal.order.model.TradeBills; |
9 | +import com.yohoufo.order.common.Payment; | ||
9 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
10 | import org.slf4j.LoggerFactory; | 11 | import org.slf4j.LoggerFactory; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -37,6 +38,9 @@ public class TradeBillsService { | @@ -37,6 +38,9 @@ public class TradeBillsService { | ||
37 | */ | 38 | */ |
38 | public void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, | 39 | public void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, |
39 | Integer payType, Integer tradeStatus) { | 40 | Integer payType, Integer tradeStatus) { |
41 | + if(payType != null && Payment.WALLET.getCode() == payType){ | ||
42 | + return; | ||
43 | + } | ||
40 | SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, "fee"); | 44 | SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, "fee"); |
41 | if (meta == null) { | 45 | if (meta == null) { |
42 | logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup); | 46 | logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup); |
@@ -82,6 +86,11 @@ public class TradeBillsService { | @@ -82,6 +86,11 @@ public class TradeBillsService { | ||
82 | public void backPayBuyRecord(Integer uid, Integer sellerUid, Integer skup, | 86 | public void backPayBuyRecord(Integer uid, Integer sellerUid, Integer skup, |
83 | Long orderCode, Integer payType, BigDecimal amount, | 87 | Long orderCode, Integer payType, BigDecimal amount, |
84 | Integer tradeStatus) { | 88 | Integer tradeStatus) { |
89 | + | ||
90 | + if(payType != null && Payment.WALLET.getCode() == payType){ | ||
91 | + return; | ||
92 | + } | ||
93 | + | ||
85 | SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(sellerUid, skup, "fee"); | 94 | SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(sellerUid, skup, "fee"); |
86 | if (meta == null) { | 95 | if (meta == null) { |
87 | logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, selleruid = {}, skup={}", sellerUid, skup); | 96 | logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, selleruid = {}, skup={}", sellerUid, skup); |
@@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus; | @@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus; | ||
5 | import com.yohobuy.ufo.model.order.req.SellerOrderBatchCancelReq; | 5 | import com.yohobuy.ufo.model.order.req.SellerOrderBatchCancelReq; |
6 | import com.yohoufo.common.exception.UfoServiceException; | 6 | import com.yohoufo.common.exception.UfoServiceException; |
7 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; | 7 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; |
8 | +import com.yohoufo.dal.order.model.SellerOrder; | ||
8 | import com.yohoufo.dal.order.model.SellerOrderGoods; | 9 | import com.yohoufo.dal.order.model.SellerOrderGoods; |
9 | import com.yohoufo.order.model.dto.SkupDto; | 10 | import com.yohoufo.order.model.dto.SkupDto; |
10 | import lombok.Data; | 11 | import lombok.Data; |
@@ -36,6 +37,8 @@ public class SellerBatchCancelPrepareProcessor { | @@ -36,6 +37,8 @@ public class SellerBatchCancelPrepareProcessor { | ||
36 | 37 | ||
37 | @Data | 38 | @Data |
38 | public static class DataNode{ | 39 | public static class DataNode{ |
40 | + SellerOrderGoods sampleSellerOrderGoods; | ||
41 | + | ||
39 | Long batchNo; | 42 | Long batchNo; |
40 | 43 | ||
41 | List<Integer> needOffShelveSkups; | 44 | List<Integer> needOffShelveSkups; |
-
Please register or login to post a comment