Showing
8 changed files
with
81 additions
and
8 deletions
@@ -50,7 +50,7 @@ public interface BuyerOrderMapper { | @@ -50,7 +50,7 @@ public interface BuyerOrderMapper { | ||
50 | 50 | ||
51 | BuyerOrder selectAllByOrderCode(@Param("orderCode") Long orderCode); | 51 | BuyerOrder selectAllByOrderCode(@Param("orderCode") Long orderCode); |
52 | 52 | ||
53 | - | 53 | + int selectCntByUid(@Param("uid")int uid); |
54 | 54 | ||
55 | int selectCntBySellerUid(@Param("sellerUid")int sellerUid, @Param("statusList")Collection<Integer> statusList); | 55 | int selectCntBySellerUid(@Param("sellerUid")int sellerUid, @Param("statusList")Collection<Integer> statusList); |
56 | } | 56 | } |
@@ -29,6 +29,7 @@ public interface SellerOrderGoodsMapper { | @@ -29,6 +29,7 @@ public interface SellerOrderGoodsMapper { | ||
29 | @Param("offset")Integer offset, | 29 | @Param("offset")Integer offset, |
30 | @Param("limit")Integer limit); | 30 | @Param("limit")Integer limit); |
31 | 31 | ||
32 | + int selectCntByUid(@Param("uid")int uid); | ||
32 | 33 | ||
33 | int updateStatusBySkpu(SellerOrderGoods record); | 34 | int updateStatusBySkpu(SellerOrderGoods record); |
34 | 35 |
@@ -32,7 +32,9 @@ | @@ -32,7 +32,9 @@ | ||
32 | where id = #{id,jdbcType=INTEGER} | 32 | where id = #{id,jdbcType=INTEGER} |
33 | </select> | 33 | </select> |
34 | 34 | ||
35 | - | 35 | + <select id="selectCntByUid" resultType="java.lang.Integer"> |
36 | + select count(*) from buyer_order where uid = #{uid,jdbcType=INTEGER} | ||
37 | + </select> | ||
36 | 38 | ||
37 | <select id="selectCntByUidStatus" resultType="java.lang.Integer"> | 39 | <select id="selectCntByUidStatus" resultType="java.lang.Integer"> |
38 | select count(*) from buyer_order | 40 | select count(*) from buyer_order |
@@ -70,6 +70,11 @@ | @@ -70,6 +70,11 @@ | ||
70 | select count(*) from seller_order_goods where <include refid="sql_where_4_select_UidStatusList"/> | 70 | select count(*) from seller_order_goods where <include refid="sql_where_4_select_UidStatusList"/> |
71 | </select> | 71 | </select> |
72 | 72 | ||
73 | + | ||
74 | + <select id="selectCntByUid" resultType="java.lang.Integer"> | ||
75 | + select count(*) from seller_order_goods where uid = #{uid,jdbcType=INTEGER} | ||
76 | + </select> | ||
77 | + | ||
73 | <select id="selectByUidStatusList" resultMap="BaseResultMap"> | 78 | <select id="selectByUidStatusList" resultMap="BaseResultMap"> |
74 | select <include refid="Base_Column_List" /> from seller_order_goods | 79 | select <include refid="Base_Column_List" /> from seller_order_goods |
75 | where <include refid="sql_where_4_select_UidStatusList"/> | 80 | where <include refid="sql_where_4_select_UidStatusList"/> |
1 | package com.yohoufo.order.controller; | 1 | package com.yohoufo.order.controller; |
2 | 2 | ||
3 | +import com.google.common.collect.Lists; | ||
4 | +import com.yohobuy.ufo.model.order.common.OrderListType; | ||
5 | +import com.yohobuy.ufo.model.order.common.SellerOrderListType; | ||
6 | +import com.yohobuy.ufo.model.order.resp.OrderCntResp; | ||
3 | import com.yohobuy.ufo.model.order.resp.PageResp; | 7 | import com.yohobuy.ufo.model.order.resp.PageResp; |
4 | import com.yohoufo.common.ApiResponse; | 8 | import com.yohoufo.common.ApiResponse; |
5 | import com.yohoufo.common.annotation.IgnoreSession; | 9 | import com.yohoufo.common.annotation.IgnoreSession; |
@@ -9,6 +13,7 @@ import com.yohoufo.order.model.request.OrderListRequest; | @@ -9,6 +13,7 @@ import com.yohoufo.order.model.request.OrderListRequest; | ||
9 | import com.yohoufo.order.model.request.OrderRequest; | 13 | import com.yohoufo.order.model.request.OrderRequest; |
10 | import com.yohoufo.order.model.response.OrderDetailInfo; | 14 | import com.yohoufo.order.model.response.OrderDetailInfo; |
11 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; | 15 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; |
16 | +import com.yohoufo.order.model.response.OrderSummaryResp; | ||
12 | import com.yohoufo.order.service.IBuyerOrderService; | 17 | import com.yohoufo.order.service.IBuyerOrderService; |
13 | import com.yohoufo.order.service.impl.SellerFeeService; | 18 | import com.yohoufo.order.service.impl.SellerFeeService; |
14 | import com.yohoufo.order.service.impl.SellerOrderService; | 19 | import com.yohoufo.order.service.impl.SellerOrderService; |
@@ -205,4 +210,33 @@ public class BuyerOrderController { | @@ -205,4 +210,33 @@ public class BuyerOrderController { | ||
205 | return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("成功").build(); | 210 | return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("成功").build(); |
206 | } | 211 | } |
207 | 212 | ||
213 | + | ||
214 | + @RequestMapping(params = "method=ufo.order.getAllCnt") | ||
215 | + public ApiResponse submit(@RequestParam(name = "uid") int uid, | ||
216 | + @RequestParam("tabType") String tabType, | ||
217 | + @RequestParam(name = "client_type", required = false) String clientType){ | ||
218 | + LOG.info("in ufo.order.getAllCnt, uid {}, clientType is {}", uid, clientType); | ||
219 | + TabType actor = TabType.getTabType(tabType); | ||
220 | + if (Objects.isNull(actor)){ | ||
221 | + return new ApiResponse.ApiResponseBuilder().code(400).message("非法的tab").build(); | ||
222 | + } | ||
223 | + OrderRequest orderRequest = OrderRequest.builder() | ||
224 | + .uid(uid) | ||
225 | + .tabType(tabType) | ||
226 | + .actor(actor) | ||
227 | + .build(); | ||
228 | + OrderCntResp orderCntResp; | ||
229 | + switch (actor){ | ||
230 | + case BUY: | ||
231 | + orderCntResp = buyerOrderService.getOrderCnt(orderRequest, OrderListType.ALL); | ||
232 | + break; | ||
233 | + case SELL: | ||
234 | + orderCntResp = sellerOrderService.getOrderCnt(orderRequest, SellerOrderListType.ALL); | ||
235 | + break; | ||
236 | + default: | ||
237 | + orderCntResp = OrderCntResp.builder().uid(uid).cnt(0L).actor(tabType).build(); | ||
238 | + } | ||
239 | + return new ApiResponse.ApiResponseBuilder().code(200).data(orderCntResp).message("查询订单数量").build(); | ||
240 | + } | ||
241 | + | ||
208 | } | 242 | } |
1 | package com.yohoufo.order.service; | 1 | package com.yohoufo.order.service; |
2 | 2 | ||
3 | +import com.yohobuy.ufo.model.order.common.OrderListType; | ||
4 | +import com.yohobuy.ufo.model.order.resp.OrderCntResp; | ||
3 | import com.yohoufo.order.model.request.OrderRequest; | 5 | import com.yohoufo.order.model.request.OrderRequest; |
4 | import com.yohoufo.order.model.response.OrderSummaryResp; | 6 | import com.yohoufo.order.model.response.OrderSummaryResp; |
5 | 7 | ||
@@ -35,4 +37,6 @@ public interface IBuyerOrderService extends IOrderListService, IOrderDetailServi | @@ -35,4 +37,6 @@ public interface IBuyerOrderService extends IOrderListService, IOrderDetailServi | ||
35 | 37 | ||
36 | 38 | ||
37 | void confirmReceive(long orderCode); | 39 | void confirmReceive(long orderCode); |
40 | + | ||
41 | + OrderCntResp getOrderCnt(OrderRequest req, OrderListType listType); | ||
38 | } | 42 | } |
@@ -2,16 +2,17 @@ package com.yohoufo.order.service.impl; | @@ -2,16 +2,17 @@ package com.yohoufo.order.service.impl; | ||
2 | 2 | ||
3 | import com.yoho.error.ServiceError; | 3 | import com.yoho.error.ServiceError; |
4 | import com.yoho.error.exception.ServiceException; | 4 | import com.yoho.error.exception.ServiceException; |
5 | +import com.yohobuy.ufo.model.order.common.OrderListType; | ||
5 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 6 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
6 | import com.yohobuy.ufo.model.order.common.SkupStatus; | 7 | import com.yohobuy.ufo.model.order.common.SkupStatus; |
7 | import com.yohobuy.ufo.model.order.common.TabType; | 8 | import com.yohobuy.ufo.model.order.common.TabType; |
9 | +import com.yohobuy.ufo.model.order.resp.OrderCntResp; | ||
8 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; | 10 | import com.yohobuy.ufo.model.order.resp.OrderListInfo; |
9 | import com.yohobuy.ufo.model.order.resp.PageResp; | 11 | import com.yohobuy.ufo.model.order.resp.PageResp; |
10 | import com.yohobuy.ufo.model.order.vo.OrderListVo; | 12 | import com.yohobuy.ufo.model.order.vo.OrderListVo; |
11 | import com.yohoufo.common.utils.DateUtil; | 13 | import com.yohoufo.common.utils.DateUtil; |
12 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | 14 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; |
13 | import com.yohoufo.dal.order.BuyerOrderMapper; | 15 | import com.yohoufo.dal.order.BuyerOrderMapper; |
14 | -import com.yohoufo.dal.order.BuyerOrderMetaMapper; | ||
15 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; | 16 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; |
16 | import com.yohoufo.dal.order.model.BuyerOrder; | 17 | import com.yohoufo.dal.order.model.BuyerOrder; |
17 | import com.yohoufo.dal.order.model.BuyerOrderGoods; | 18 | import com.yohoufo.dal.order.model.BuyerOrderGoods; |
@@ -45,7 +46,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -45,7 +46,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
45 | @Autowired | 46 | @Autowired |
46 | BuyerOrderMapper buyerOrderMapper; | 47 | BuyerOrderMapper buyerOrderMapper; |
47 | 48 | ||
48 | - | ||
49 | @Autowired | 49 | @Autowired |
50 | BuyerOrderGoodsMapper buyerOrderGoodsMapper; | 50 | BuyerOrderGoodsMapper buyerOrderGoodsMapper; |
51 | 51 | ||
@@ -53,9 +53,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -53,9 +53,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
53 | SellerOrderGoodsMapper sellerOrderGoodsMapper; | 53 | SellerOrderGoodsMapper sellerOrderGoodsMapper; |
54 | 54 | ||
55 | @Autowired | 55 | @Autowired |
56 | - BuyerOrderMetaMapper buyerOrderMetaMapper; | ||
57 | - | ||
58 | - @Autowired | ||
59 | private BuyerOrderListServiceImpl buyerOrderListService; | 56 | private BuyerOrderListServiceImpl buyerOrderListService; |
60 | 57 | ||
61 | @Autowired | 58 | @Autowired |
@@ -321,7 +318,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -321,7 +318,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
321 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), | 318 | CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode), |
322 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode))); | 319 | CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode))); |
323 | } | 320 | } |
321 | + } | ||
324 | 322 | ||
325 | - | 323 | + @Override |
324 | + public OrderCntResp getOrderCnt(OrderRequest req, OrderListType listType) { | ||
325 | + logger.info("in buyer getOrderCnt req {} listType {}", req, listType); | ||
326 | + OrderCntResp resp; | ||
327 | + int cnt ; | ||
328 | + switch (listType){ | ||
329 | + case ALL: | ||
330 | + cnt = buyerOrderMapper.selectCntByUid(req.getUid()); | ||
331 | + break; | ||
332 | + default: | ||
333 | + cnt = 0; | ||
334 | + break; | ||
335 | + } | ||
336 | + resp = OrderCntResp.builder().uid(req.getUid()).cnt(cnt).actor(req.getTabType()).build(); | ||
337 | + return resp; | ||
326 | } | 338 | } |
327 | } | 339 | } |
@@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.*; | @@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.*; | ||
7 | import com.yohobuy.ufo.model.order.req.SellerOrderCancelReq; | 7 | import com.yohobuy.ufo.model.order.req.SellerOrderCancelReq; |
8 | import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq; | 8 | import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq; |
9 | import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq; | 9 | import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq; |
10 | +import com.yohobuy.ufo.model.order.resp.OrderCntResp; | ||
10 | import com.yohobuy.ufo.model.order.resp.PageResp; | 11 | import com.yohobuy.ufo.model.order.resp.PageResp; |
11 | import com.yohoufo.common.alarm.EventBusPublisher; | 12 | import com.yohoufo.common.alarm.EventBusPublisher; |
12 | import com.yohoufo.common.alarm.SmsAlarmEvent; | 13 | import com.yohoufo.common.alarm.SmsAlarmEvent; |
@@ -531,5 +532,19 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -531,5 +532,19 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
531 | return new OrderSummaryResp("sell", cnt); | 532 | return new OrderSummaryResp("sell", cnt); |
532 | } | 533 | } |
533 | 534 | ||
535 | + public OrderCntResp getOrderCnt(OrderRequest orderRequest, SellerOrderListType listType){ | ||
536 | + log.info("in seller getOrderCnt req {} listType {}", orderRequest, listType); | ||
537 | + int cnt ; | ||
538 | + switch (listType){ | ||
539 | + case ALL: | ||
540 | + cnt = sellerOrderGoodsMapper.selectCntByUid(orderRequest.getUid()); | ||
541 | + break; | ||
542 | + default: | ||
543 | + cnt = 0; | ||
544 | + break; | ||
545 | + } | ||
546 | + return OrderCntResp.builder().cnt(cnt).uid(orderRequest.getUid()) | ||
547 | + .actor(orderRequest.getTabType()).build(); | ||
548 | + } | ||
534 | 549 | ||
535 | } | 550 | } |
-
Please register or login to post a comment