Showing
14 changed files
with
87 additions
and
40 deletions
@@ -29,15 +29,23 @@ public interface BuyerOrderMapper { | @@ -29,15 +29,23 @@ public interface BuyerOrderMapper { | ||
29 | 29 | ||
30 | int updateByOrderCode(BuyerOrder record); | 30 | int updateByOrderCode(BuyerOrder record); |
31 | 31 | ||
32 | - int selectCntByUidStatus(@Param("uid") int uid, @Param("status") List<Integer> status); | 32 | + int selectCntByUidStatus(@Param("uid") int uid, @Param("status") List<Integer> status,@Param("orderTypes") List<Integer> orderTypes); |
33 | 33 | ||
34 | - List<BuyerOrder> selectListByUidStatus(@Param("uid") int uid, @Param("orderCode") Long orderCode, @Param("status") List<Integer> status, | ||
35 | - @Param("offset")Integer offset, @Param("limit")Integer limit); | 34 | + List<BuyerOrder> selectListByUidStatus(@Param("uid") int uid, |
35 | + @Param("orderCode") Long orderCode, | ||
36 | + @Param("status") List<Integer> status, | ||
37 | + @Param("orderTypes") List<Integer> orderTypes, | ||
38 | + @Param("offset")Integer offset, | ||
39 | + @Param("limit")Integer limit); | ||
36 | 40 | ||
37 | - int selectCntBySellerUidStatus(@Param("sellerUid") int suid, @Param("status") List<Integer> status); | 41 | + int selectCntBySellerUidStatus(@Param("sellerUid") int suid, |
42 | + @Param("status") List<Integer> status, | ||
43 | + @Param("orderTypes") List<Integer> orderTypes); | ||
38 | 44 | ||
39 | - List<BuyerOrder> selectListBySellerUidStatus(@Param("sellerUid") int suid, @Param("orderCode") Long orderCode, | 45 | + List<BuyerOrder> selectListBySellerUidStatus(@Param("sellerUid") int suid, |
46 | + @Param("orderCode") Long orderCode, | ||
40 | @Param("status") List<Integer> status, | 47 | @Param("status") List<Integer> status, |
48 | + @Param("orderTypes") List<Integer> orderTypes, | ||
41 | @Param("offset")Integer offset, @Param("limit")Integer limit); | 49 | @Param("offset")Integer offset, @Param("limit")Integer limit); |
42 | 50 | ||
43 | int updateByPrimaryKey(BuyerOrder record); | 51 | int updateByPrimaryKey(BuyerOrder record); |
@@ -48,7 +48,11 @@ | @@ -48,7 +48,11 @@ | ||
48 | 48 | ||
49 | <select id="selectCntByUidStatus" resultType="java.lang.Integer"> | 49 | <select id="selectCntByUidStatus" resultType="java.lang.Integer"> |
50 | select count(*) from buyer_order | 50 | select count(*) from buyer_order |
51 | - where uid = #{uid,jdbcType=INTEGER} | 51 | + where <include refid="where_sql_buyer_order_list_by_UidStatus" /> |
52 | + </select> | ||
53 | + | ||
54 | + <sql id="where_sql_buyer_order_list_by_UidStatus"> | ||
55 | + uid = #{uid,jdbcType=INTEGER} | ||
52 | and buyer_order_status = 1 | 56 | and buyer_order_status = 1 |
53 | <if test="status != null"> | 57 | <if test="status != null"> |
54 | and status in | 58 | and status in |
@@ -56,21 +60,22 @@ | @@ -56,21 +60,22 @@ | ||
56 | #{item} | 60 | #{item} |
57 | </foreach> | 61 | </foreach> |
58 | </if> | 62 | </if> |
59 | - </select> | 63 | + |
64 | + <if test="orderTypes != null"> | ||
65 | + and attributes in | ||
66 | + <foreach collection="orderTypes" item="attributes" open="(" close=")" separator=","> | ||
67 | + #{attributes} | ||
68 | + </foreach> | ||
69 | + </if> | ||
70 | + </sql> | ||
60 | 71 | ||
61 | 72 | ||
62 | <select id="selectListByUidStatus" resultMap="BaseResultMap"> | 73 | <select id="selectListByUidStatus" resultMap="BaseResultMap"> |
63 | select <include refid="Base_Column_List" /> from buyer_order | 74 | select <include refid="Base_Column_List" /> from buyer_order |
64 | - where uid = #{uid,jdbcType=INTEGER} and buyer_order_status = 1 | 75 | + where <include refid="where_sql_buyer_order_list_by_UidStatus" /> |
65 | <if test="orderCode != null"> | 76 | <if test="orderCode != null"> |
66 | and order_code = #{orderCode,jdbcType=BIGINT} | 77 | and order_code = #{orderCode,jdbcType=BIGINT} |
67 | </if> | 78 | </if> |
68 | - <if test="status != null"> | ||
69 | - and status in | ||
70 | - <foreach item="item" index="index" collection="status" open="(" separator="," close=")"> | ||
71 | - #{item} | ||
72 | - </foreach> | ||
73 | - </if> | ||
74 | order by create_time desc, update_time desc | 79 | order by create_time desc, update_time desc |
75 | limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER} | 80 | limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER} |
76 | </select> | 81 | </select> |
@@ -389,6 +394,12 @@ | @@ -389,6 +394,12 @@ | ||
389 | #{item} | 394 | #{item} |
390 | </foreach> | 395 | </foreach> |
391 | </if> | 396 | </if> |
397 | + <if test="orderTypes != null"> | ||
398 | + and attributes in | ||
399 | + <foreach collection="orderTypes" item="attributes" open="(" close=")" separator=","> | ||
400 | + #{attributes} | ||
401 | + </foreach> | ||
402 | + </if> | ||
392 | </sql> | 403 | </sql> |
393 | 404 | ||
394 | <select id="selectCntBySellerUidStatus" resultType="java.lang.Integer"> | 405 | <select id="selectCntBySellerUidStatus" resultType="java.lang.Integer"> |
@@ -99,7 +99,7 @@ public class PromotionService { | @@ -99,7 +99,7 @@ public class PromotionService { | ||
99 | uid, skup, salePrice, promotionId); | 99 | uid, skup, salePrice, promotionId); |
100 | //fetch promotions | 100 | //fetch promotions |
101 | Map<Integer,Pair<PromotionActivityRspBo,PromotionCalculator>> promotion2CalculatorMap | 101 | Map<Integer,Pair<PromotionActivityRspBo,PromotionCalculator>> promotion2CalculatorMap |
102 | - = buildPromotion2CalculatorMap(uid, skup, context.getChargeParam().getBusinessClient()); | 102 | + = buildPromotion2CalculatorMap(uid, skup, chargeParam.getBusinessClient()); |
103 | 103 | ||
104 | if (MapUtils.isEmpty(promotion2CalculatorMap)){ | 104 | if (MapUtils.isEmpty(promotion2CalculatorMap)){ |
105 | logger.warn("caculatePromotions.calculateByPromotionId promotion2CalculatorMap empty, uid {} skup {} salePrice {} ", | 105 | logger.warn("caculatePromotions.calculateByPromotionId promotion2CalculatorMap empty, uid {} skup {} salePrice {} ", |
@@ -67,6 +67,7 @@ public class BuyerOrderController { | @@ -67,6 +67,7 @@ public class BuyerOrderController { | ||
67 | public ApiResponse getOrderList(@RequestParam("type") int type, | 67 | public ApiResponse getOrderList(@RequestParam("type") int type, |
68 | @RequestParam("uid") int uid, | 68 | @RequestParam("uid") int uid, |
69 | @RequestParam("tabType") String tabType, | 69 | @RequestParam("tabType") String tabType, |
70 | + @RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient, | ||
70 | @RequestParam(value = "page", required = false, defaultValue = "1") int page, | 71 | @RequestParam(value = "page", required = false, defaultValue = "1") int page, |
71 | @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) { | 72 | @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) { |
72 | TabType actor = TabType.getTabType(tabType); | 73 | TabType actor = TabType.getTabType(tabType); |
@@ -80,6 +81,7 @@ public class BuyerOrderController { | @@ -80,6 +81,7 @@ public class BuyerOrderController { | ||
80 | .limit(limit) | 81 | .limit(limit) |
81 | .tabType(tabType) | 82 | .tabType(tabType) |
82 | .actor(actor) | 83 | .actor(actor) |
84 | + .businessClient(businessClient) | ||
83 | .build(); | 85 | .build(); |
84 | LOG.info("in ufo.order.list, req {}", orderListRequest); | 86 | LOG.info("in ufo.order.list, req {}", orderListRequest); |
85 | PageResp<OrderListInfo> orderListInfoRsp; | 87 | PageResp<OrderListInfo> orderListInfoRsp; |
@@ -272,6 +274,7 @@ public class BuyerOrderController { | @@ -272,6 +274,7 @@ public class BuyerOrderController { | ||
272 | @RequestMapping(params = "method=ufo.order.getAllCnt") | 274 | @RequestMapping(params = "method=ufo.order.getAllCnt") |
273 | public ApiResponse getOrderCnt(@RequestParam(name = "uid") int uid, | 275 | public ApiResponse getOrderCnt(@RequestParam(name = "uid") int uid, |
274 | @RequestParam("tabType") String tabType, | 276 | @RequestParam("tabType") String tabType, |
277 | + @RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient, | ||
275 | @RequestParam(name = "client_type", required = false) String clientType){ | 278 | @RequestParam(name = "client_type", required = false) String clientType){ |
276 | LOG.info("in ufo.order.getAllCnt, uid {}, clientType is {}", uid, clientType); | 279 | LOG.info("in ufo.order.getAllCnt, uid {}, clientType is {}", uid, clientType); |
277 | TabType actor = TabType.getTabType(tabType); | 280 | TabType actor = TabType.getTabType(tabType); |
@@ -282,6 +285,7 @@ public class BuyerOrderController { | @@ -282,6 +285,7 @@ public class BuyerOrderController { | ||
282 | .uid(uid) | 285 | .uid(uid) |
283 | .tabType(tabType) | 286 | .tabType(tabType) |
284 | .actor(actor) | 287 | .actor(actor) |
288 | + .businessClient(businessClient) | ||
285 | .build(); | 289 | .build(); |
286 | OrderCntResp orderCntResp; | 290 | OrderCntResp orderCntResp; |
287 | switch (actor){ | 291 | switch (actor){ |
@@ -311,7 +315,8 @@ public class BuyerOrderController { | @@ -311,7 +315,8 @@ public class BuyerOrderController { | ||
311 | public ApiResponse getMyBuyedGoods( | 315 | public ApiResponse getMyBuyedGoods( |
312 | @RequestParam("uid") int uid, | 316 | @RequestParam("uid") int uid, |
313 | @RequestParam(value = "page", required = false, defaultValue = "1") int page, | 317 | @RequestParam(value = "page", required = false, defaultValue = "1") int page, |
314 | - @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) { | 318 | + @RequestParam(value = "limit", required = false, defaultValue = "10") int limit, |
319 | + @RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient) { | ||
315 | TabType actor = TabType.BUY; | 320 | TabType actor = TabType.BUY; |
316 | OrderListRequest orderListRequest = OrderListRequest.builder() | 321 | OrderListRequest orderListRequest = OrderListRequest.builder() |
317 | .uid(uid) | 322 | .uid(uid) |
@@ -320,6 +325,7 @@ public class BuyerOrderController { | @@ -320,6 +325,7 @@ public class BuyerOrderController { | ||
320 | .limit(limit) | 325 | .limit(limit) |
321 | .tabType(actor.getValue()) | 326 | .tabType(actor.getValue()) |
322 | .actor(actor) | 327 | .actor(actor) |
328 | + .businessClient(businessClient) | ||
323 | .build(); | 329 | .build(); |
324 | LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest); | 330 | LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest); |
325 | //TODO remove below codes 2 service level | 331 | //TODO remove below codes 2 service level |
@@ -33,6 +33,7 @@ public class OrderStatisticController { | @@ -33,6 +33,7 @@ public class OrderStatisticController { | ||
33 | @Deprecated | 33 | @Deprecated |
34 | @RequestMapping(value = "/shopping", params = "method=ufo.order.summary") | 34 | @RequestMapping(value = "/shopping", params = "method=ufo.order.summary") |
35 | public ApiResponse summary(@RequestParam(name = "uid") int uid, | 35 | public ApiResponse summary(@RequestParam(name = "uid") int uid, |
36 | + @RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient, | ||
36 | @RequestParam(name = "client_type", required = false) String clientType){ | 37 | @RequestParam(name = "client_type", required = false) String clientType){ |
37 | 38 | ||
38 | logger.info("in ufo.order.summary, uid {}, clientType is {}", uid, clientType); | 39 | logger.info("in ufo.order.summary, uid {}, clientType is {}", uid, clientType); |
@@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo; | @@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo; | ||
5 | import com.yohobuy.ufo.model.order.bo.GoodsInfo; | 5 | import com.yohobuy.ufo.model.order.bo.GoodsInfo; |
6 | import com.yohobuy.ufo.model.order.bo.TimeoutBo; | 6 | import com.yohobuy.ufo.model.order.bo.TimeoutBo; |
7 | import com.yohobuy.ufo.model.order.common.*; | 7 | import com.yohobuy.ufo.model.order.common.*; |
8 | +import com.yohobuy.ufo.model.order.constants.BusinessClientEnum; | ||
8 | import com.yohobuy.ufo.model.order.constants.SkupType; | 9 | import com.yohobuy.ufo.model.order.constants.SkupType; |
9 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; | 10 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; |
10 | import com.yohobuy.ufo.model.order.resp.PageResp; | 11 | import com.yohobuy.ufo.model.order.resp.PageResp; |
@@ -45,9 +46,9 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements | @@ -45,9 +46,9 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements | ||
45 | 46 | ||
46 | abstract List<Integer> initOrderListRequest(OrderListRequest request); | 47 | abstract List<Integer> initOrderListRequest(OrderListRequest request); |
47 | 48 | ||
48 | - abstract int getTotal(int uid, List<Integer> statusQuery); | 49 | + abstract int getTotal(int uid, List<Integer> statusQuery, List<Integer> orderTypes); |
49 | 50 | ||
50 | - abstract List<BuyerOrder> getOrderList(int uid, Long orderCode, List<Integer> statusQuery, int offset, int limit); | 51 | + abstract List<BuyerOrder> getOrderList(int uid, Long orderCode, List<Integer> statusQuery, List<Integer> orderTypes, int offset, int limit); |
51 | 52 | ||
52 | abstract List<BuyerOrderGoods> getOrderGoodsList(int uid, List<Long> orderCodeList); | 53 | abstract List<BuyerOrderGoods> getOrderGoodsList(int uid, List<Long> orderCodeList); |
53 | 54 | ||
@@ -163,7 +164,9 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements | @@ -163,7 +164,9 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements | ||
163 | // check and init请求参数 | 164 | // check and init请求参数 |
164 | List<Integer> statusQuery = initOrderListRequest(request); | 165 | List<Integer> statusQuery = initOrderListRequest(request); |
165 | TabType actor = request.getActor(); | 166 | TabType actor = request.getActor(); |
166 | - int total = getTotal(request.getUid(), statusQuery); | 167 | + BusinessClientEnum businessClientEnum = OrderAssist.findBusinessClient(request.getBusinessClient()); |
168 | + List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient(businessClientEnum); | ||
169 | + int total = getTotal(request.getUid(), statusQuery, orderTypes); | ||
167 | int limit = request.getLimit(); | 170 | int limit = request.getLimit(); |
168 | if (total == 0){ | 171 | if (total == 0){ |
169 | return lpNode; | 172 | return lpNode; |
@@ -171,7 +174,7 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements | @@ -171,7 +174,7 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements | ||
171 | 174 | ||
172 | int offset = (request.getPage() - 1) * limit; | 175 | int offset = (request.getPage() - 1) * limit; |
173 | 176 | ||
174 | - List<BuyerOrder> buyerOrderList = getOrderList(request.getUid(), request.getOrderCode(), statusQuery, offset, limit); | 177 | + List<BuyerOrder> buyerOrderList = getOrderList(request.getUid(), request.getOrderCode(), statusQuery, orderTypes, offset, limit); |
175 | 178 | ||
176 | List<Long> orderCodeList = buyerOrderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList()); | 179 | List<Long> orderCodeList = buyerOrderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList()); |
177 | //TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络I | 180 | //TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络I |
@@ -106,13 +106,13 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO | @@ -106,13 +106,13 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO | ||
106 | } | 106 | } |
107 | 107 | ||
108 | @Override | 108 | @Override |
109 | - int getTotal(int uid, List<Integer> statusQuery){ | ||
110 | - return buyerOrderMapper.selectCntByUidStatus(uid, statusQuery); | 109 | + int getTotal(int uid, List<Integer> statusQuery, List<Integer> orderTypes){ |
110 | + return buyerOrderMapper.selectCntByUidStatus(uid, statusQuery, orderTypes); | ||
111 | } | 111 | } |
112 | 112 | ||
113 | @Override | 113 | @Override |
114 | - List<BuyerOrder> getOrderList(int uid, Long orderCode, List<Integer> statusQuery, int offset, int limit){ | ||
115 | - List<BuyerOrder> buyerOrderList = buyerOrderMapper.selectListByUidStatus(uid, orderCode, statusQuery, offset, limit); | 114 | + List<BuyerOrder> getOrderList(int uid, Long orderCode, List<Integer> statusQuery,List<Integer> orderTypes, int offset, int limit){ |
115 | + List<BuyerOrder> buyerOrderList = buyerOrderMapper.selectListByUidStatus(uid, orderCode, statusQuery,orderTypes, offset, limit); | ||
116 | return buyerOrderList; | 116 | return buyerOrderList; |
117 | } | 117 | } |
118 | 118 |
@@ -781,7 +781,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -781,7 +781,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
781 | public OrderSummaryResp selectBidingOrderNumByUid(int uid, String statKey) { | 781 | public OrderSummaryResp selectBidingOrderNumByUid(int uid, String statKey) { |
782 | Integer num = orderCacheService.getStatOrderSummary(uid, TabType.BUY, statKey); | 782 | Integer num = orderCacheService.getStatOrderSummary(uid, TabType.BUY, statKey); |
783 | if (num == null) { | 783 | if (num == null) { |
784 | - num = buyerOrderMapper.selectCntByUidStatus(uid, Lists.newArrayList(OrderStatus.BIDING.getCode())); | 784 | + num = buyerOrderMapper.selectCntByUidStatus(uid, Lists.newArrayList(OrderStatus.BIDING.getCode()), null); |
785 | } | 785 | } |
786 | if (num != null) { | 786 | if (num != null) { |
787 | orderCacheService.cacheStatOrderSummary(uid, TabType.BUY, statKey, num); | 787 | orderCacheService.cacheStatOrderSummary(uid, TabType.BUY, statKey, num); |
@@ -344,13 +344,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -344,13 +344,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
344 | } | 344 | } |
345 | 345 | ||
346 | @Override | 346 | @Override |
347 | - int getTotal(int uid, List<Integer> statusQuery) { | ||
348 | - return buyerOrderMapper.selectCntBySellerUidStatus(uid, statusQuery); | 347 | + int getTotal(int uid, List<Integer> statusQuery, List<Integer> orderTypes) { |
348 | + return buyerOrderMapper.selectCntBySellerUidStatus(uid, statusQuery, orderTypes); | ||
349 | } | 349 | } |
350 | 350 | ||
351 | @Override | 351 | @Override |
352 | - List<BuyerOrder> getOrderList(int uid, Long orderCode, List<Integer> statusQuery, int offset, int limit){ | ||
353 | - List<BuyerOrder> buyerOrderList = buyerOrderMapper.selectListBySellerUidStatus(uid, orderCode, statusQuery, offset, limit); | 352 | + List<BuyerOrder> getOrderList(int uid, Long orderCode, List<Integer> statusQuery, List<Integer> orderTypes, int offset, int limit){ |
353 | + List<BuyerOrder> buyerOrderList = buyerOrderMapper.selectListBySellerUidStatus(uid, orderCode, statusQuery, orderTypes, offset, limit); | ||
354 | return buyerOrderList; | 354 | return buyerOrderList; |
355 | } | 355 | } |
356 | 356 |
@@ -95,7 +95,7 @@ public class SellerOrderViewService { | @@ -95,7 +95,7 @@ public class SellerOrderViewService { | ||
95 | public int getUnfinishedOrderBySellerUid(Integer uid){ | 95 | public int getUnfinishedOrderBySellerUid(Integer uid){ |
96 | logger.info("in seller order getUnfinishedOrderBySellerUid count uid {} ", uid); | 96 | logger.info("in seller order getUnfinishedOrderBySellerUid count uid {} ", uid); |
97 | List<Integer> statusList = ActionStatusHold.getUnfinishedOrderStatusCode(); | 97 | List<Integer> statusList = ActionStatusHold.getUnfinishedOrderStatusCode(); |
98 | - Integer total = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList); | 98 | + Integer total = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList, null); |
99 | logger.info("in seller order getUnfinishedOrderBySellerUid count uid {}, total {} ", uid, total); | 99 | logger.info("in seller order getUnfinishedOrderBySellerUid count uid {}, total {} ", uid, total); |
100 | return total; | 100 | return total; |
101 | } | 101 | } |
@@ -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.yoho.core.dal.datasource.annotation.Database; | 3 | import com.yoho.core.dal.datasource.annotation.Database; |
4 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 4 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
5 | +import com.yohobuy.ufo.model.order.constants.BusinessClientEnum; | ||
5 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 6 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
6 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | 7 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
7 | import com.yohoufo.common.alarm.EventBusPublisher; | 8 | import com.yohoufo.common.alarm.EventBusPublisher; |
@@ -15,6 +16,7 @@ import com.yohoufo.order.convert.builder.AlarmEventBuilder; | @@ -15,6 +16,7 @@ import com.yohoufo.order.convert.builder.AlarmEventBuilder; | ||
15 | import com.yohoufo.order.service.handler.transfer.TransferChancelSelector; | 16 | import com.yohoufo.order.service.handler.transfer.TransferChancelSelector; |
16 | import com.yohoufo.order.service.proxy.UserProxyService; | 17 | import com.yohoufo.order.service.proxy.UserProxyService; |
17 | import com.yohoufo.order.utils.LoggerUtils; | 18 | import com.yohoufo.order.utils.LoggerUtils; |
19 | +import com.yohoufo.order.utils.OrderAssist; | ||
18 | import com.yohoufo.order.utils.SellerGoodsHelper; | 20 | import com.yohoufo.order.utils.SellerGoodsHelper; |
19 | import org.apache.commons.lang3.StringUtils; | 21 | import org.apache.commons.lang3.StringUtils; |
20 | import org.slf4j.Logger; | 22 | import org.slf4j.Logger; |
@@ -47,12 +49,12 @@ public class ShoppingRiskWatchDog { | @@ -47,12 +49,12 @@ public class ShoppingRiskWatchDog { | ||
47 | @Autowired | 49 | @Autowired |
48 | TransferChancelSelector transferChancelSelector; | 50 | TransferChancelSelector transferChancelSelector; |
49 | 51 | ||
50 | - public void checkWaitingPayCnt(int uid){ | 52 | + public void checkWaitingPayCnt(int uid, BusinessClientEnum businessClientEnum){ |
51 | logger.info("in ShoppingRiskWatchDog.checkWaitingPayCnt uid {}", uid); | 53 | logger.info("in ShoppingRiskWatchDog.checkWaitingPayCnt uid {}", uid); |
52 | List<Integer> statusList = new ArrayList<>(1); | 54 | List<Integer> statusList = new ArrayList<>(1); |
53 | statusList.add(OrderStatus.WAITING_PAY.getCode()); | 55 | statusList.add(OrderStatus.WAITING_PAY.getCode()); |
54 | - | ||
55 | - int cnt = buyerOrderMapper.selectCntByUidStatus(uid, statusList); | 56 | + List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient(businessClientEnum); |
57 | + int cnt = buyerOrderMapper.selectCntByUidStatus(uid, statusList, orderTypes); | ||
56 | if (cnt >= waitingPayCnt){ | 58 | if (cnt >= waitingPayCnt){ |
57 | logger.warn("in ShoppingRiskWatchDog.checkWaitingPayCnt try monopolizing skup another time,uid {} waiting pay cnt {}", | 59 | logger.warn("in ShoppingRiskWatchDog.checkWaitingPayCnt try monopolizing skup another time,uid {} waiting pay cnt {}", |
58 | uid, cnt); | 60 | uid, cnt); |
@@ -7,10 +7,7 @@ import com.yoho.core.rest.client.ServiceCaller; | @@ -7,10 +7,7 @@ import com.yoho.core.rest.client.ServiceCaller; | ||
7 | import com.yoho.error.ServiceError; | 7 | import com.yoho.error.ServiceError; |
8 | import com.yoho.error.exception.ServiceException; | 8 | import com.yoho.error.exception.ServiceException; |
9 | import com.yohobuy.ufo.model.order.common.*; | 9 | import com.yohobuy.ufo.model.order.common.*; |
10 | -import com.yohobuy.ufo.model.order.constants.ChangePriceStatus; | ||
11 | -import com.yohobuy.ufo.model.order.constants.OrderConstant; | ||
12 | -import com.yohobuy.ufo.model.order.constants.OrderDetailDesc; | ||
13 | -import com.yohobuy.ufo.model.order.constants.SkupType; | 10 | +import com.yohobuy.ufo.model.order.constants.*; |
14 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 11 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
15 | import com.yohoufo.common.alarm.EventBusPublisher; | 12 | import com.yohoufo.common.alarm.EventBusPublisher; |
16 | import com.yohoufo.common.exception.UfoServiceException; | 13 | import com.yohoufo.common.exception.UfoServiceException; |
@@ -150,7 +147,9 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -150,7 +147,9 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
150 | logger.warn("payment uid or skup is null"); | 147 | logger.warn("payment uid or skup is null"); |
151 | throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); | 148 | throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); |
152 | } | 149 | } |
153 | - shoppingRiskWatchDog.checkWaitingPayCnt(uid); | 150 | + BusinessClientEnum businessClientEnum; |
151 | + businessClientEnum=OrderAssist.findBusinessClient(request.getBusinessClient()); | ||
152 | + shoppingRiskWatchDog.checkWaitingPayCnt(uid, businessClientEnum); | ||
154 | // 检查 商品sku是否可售 | 153 | // 检查 商品sku是否可售 |
155 | SellerOrderGoods skupGood = checkSkupSellOrNot(uid, request.getSkup()); | 154 | SellerOrderGoods skupGood = checkSkupSellOrNot(uid, request.getSkup()); |
156 | GoodsPrepareData goodsPrepareData = checkSkupExtraWithlock(uid, skupGood, false); | 155 | GoodsPrepareData goodsPrepareData = checkSkupExtraWithlock(uid, skupGood, false); |
@@ -423,8 +422,8 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -423,8 +422,8 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
423 | logger.warn("submit param is null"); | 422 | logger.warn("submit param is null"); |
424 | throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); | 423 | throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); |
425 | } | 424 | } |
426 | - | ||
427 | - shoppingRiskWatchDog.checkWaitingPayCnt(uid); | 425 | + BusinessClientEnum businessClientEnum = OrderAssist.findBusinessClient(shoppingRequest.getBusinessClient()); |
426 | + shoppingRiskWatchDog.checkWaitingPayCnt(uid, businessClientEnum); | ||
428 | // 检查skup是否可售 | 427 | // 检查skup是否可售 |
429 | SellerOrderGoods psog = checkSkupSellOrNot(uid, shoppingRequest.getSkup()); | 428 | SellerOrderGoods psog = checkSkupSellOrNot(uid, shoppingRequest.getSkup()); |
430 | GoodsPrepareData goodsPrepareData = checkSkupExtraWithlock(uid, psog, true); | 429 | GoodsPrepareData goodsPrepareData = checkSkupExtraWithlock(uid, psog, true); |
@@ -13,6 +13,8 @@ import com.yohoufo.order.model.dto.ServiceFeeRate; | @@ -13,6 +13,8 @@ import com.yohoufo.order.model.dto.ServiceFeeRate; | ||
13 | import org.apache.commons.lang3.StringUtils; | 13 | import org.apache.commons.lang3.StringUtils; |
14 | 14 | ||
15 | import java.math.BigDecimal; | 15 | import java.math.BigDecimal; |
16 | +import java.util.ArrayList; | ||
17 | +import java.util.List; | ||
16 | import java.util.Objects; | 18 | import java.util.Objects; |
17 | 19 | ||
18 | /** | 20 | /** |
@@ -126,4 +128,17 @@ public class OrderAssist { | @@ -126,4 +128,17 @@ public class OrderAssist { | ||
126 | } | 128 | } |
127 | return businessClientCode; | 129 | return businessClientCode; |
128 | } | 130 | } |
131 | + private static final List<Integer> FLEAMARKET_CLIENT_ORDERTYPES = new ArrayList<Integer>(){ | ||
132 | + { | ||
133 | + add(OrderAttributes.COMMON_IN_STOCK.getCode()); | ||
134 | + } | ||
135 | + }; | ||
136 | + | ||
137 | + public static List<Integer> matchOrderTypesByBusinessClient(BusinessClientEnum businessClientEnum){ | ||
138 | + if (Objects.nonNull(businessClientEnum) | ||
139 | + && BusinessClientEnum.TAOBAO_FLEAMARKET_CLIENT.equals(businessClientEnum)){ | ||
140 | + return FLEAMARKET_CLIENT_ORDERTYPES; | ||
141 | + } | ||
142 | + return null; | ||
143 | + } | ||
129 | } | 144 | } |
-
Please register or login to post a comment