Merge branch 'dev' of http://git.yoho.cn/ufo/yohoufo-fore into dev
Showing
13 changed files
with
76 additions
and
95 deletions
@@ -309,9 +309,7 @@ | @@ -309,9 +309,7 @@ | ||
309 | 309 | ||
310 | 310 | ||
311 | <select id="selectListBySellerUidStatus" resultMap="BaseResultMap"> | 311 | <select id="selectListBySellerUidStatus" resultMap="BaseResultMap"> |
312 | - select | ||
313 | - count(1) | ||
314 | - from buyer_order | 312 | + select <include refid="Base_Column_List" /> from buyer_order |
315 | where <include refid="sql_where_4_select_SellerUidStatus"/> | 313 | where <include refid="sql_where_4_select_SellerUidStatus"/> |
316 | limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER} | 314 | limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER} |
317 | </select> | 315 | </select> |
1 | package com.yohoufo.order.controller; | 1 | package com.yohoufo.order.controller; |
2 | 2 | ||
3 | +import com.yohobuy.ufo.model.order.resp.PageResp; | ||
3 | import com.yohoufo.common.ApiResponse; | 4 | import com.yohoufo.common.ApiResponse; |
4 | import com.yohoufo.order.common.TabType; | 5 | import com.yohoufo.order.common.TabType; |
5 | import com.yohoufo.order.model.request.OrderListRequest; | 6 | import com.yohoufo.order.model.request.OrderListRequest; |
6 | import com.yohoufo.order.model.request.OrderRequest; | 7 | import com.yohoufo.order.model.request.OrderRequest; |
7 | import com.yohoufo.order.model.response.OrderDetailInfo; | 8 | import com.yohoufo.order.model.response.OrderDetailInfo; |
8 | -import com.yohoufo.order.model.response.OrderListInfoRsp; | 9 | +import com.yohoufo.order.model.response.OrderListInfo; |
9 | import com.yohoufo.order.service.IBuyerOrderService; | 10 | import com.yohoufo.order.service.IBuyerOrderService; |
10 | import com.yohoufo.order.service.impl.SellerOrderService; | 11 | import com.yohoufo.order.service.impl.SellerOrderService; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -57,7 +58,7 @@ public class BuyerOrderController { | @@ -57,7 +58,7 @@ public class BuyerOrderController { | ||
57 | .tabType(tabType) | 58 | .tabType(tabType) |
58 | .actor(actor) | 59 | .actor(actor) |
59 | .build(); | 60 | .build(); |
60 | - OrderListInfoRsp orderListInfoRsp; | 61 | + PageResp<OrderListInfo> orderListInfoRsp; |
61 | switch (actor){ | 62 | switch (actor){ |
62 | case BUY: | 63 | case BUY: |
63 | orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest); | 64 | orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest); |
1 | -package com.yohoufo.order.model.response; | ||
2 | - | ||
3 | -import lombok.AllArgsConstructor; | ||
4 | -import lombok.Data; | ||
5 | -import lombok.NoArgsConstructor; | ||
6 | -import lombok.experimental.Builder; | ||
7 | - | ||
8 | -import java.util.List; | ||
9 | - | ||
10 | -@Data | ||
11 | -@Builder | ||
12 | -@NoArgsConstructor | ||
13 | -@AllArgsConstructor | ||
14 | -public class OrderListInfoRsp { | ||
15 | - | ||
16 | - List<OrderListInfo> data; | ||
17 | - | ||
18 | - // 页码 | ||
19 | - private int currPage; | ||
20 | - // 每页记录数 | ||
21 | - private int limit; | ||
22 | - | ||
23 | - // 总记录数 | ||
24 | - private int total; | ||
25 | - // 当前页记录数 | ||
26 | - private int currTotal; | ||
27 | - // 页数 | ||
28 | - private int pageSize; | ||
29 | - | ||
30 | -} |
1 | package com.yohoufo.order.service; | 1 | package com.yohoufo.order.service; |
2 | 2 | ||
3 | +import com.yohobuy.ufo.model.order.resp.PageResp; | ||
3 | import com.yohoufo.order.model.request.OrderListRequest; | 4 | import com.yohoufo.order.model.request.OrderListRequest; |
4 | -import com.yohoufo.order.model.response.OrderListInfoRsp; | 5 | +import com.yohoufo.order.model.response.OrderListInfo; |
5 | 6 | ||
6 | /** | 7 | /** |
7 | * Created by chenchao on 2018/9/19. | 8 | * Created by chenchao on 2018/9/19. |
@@ -13,5 +14,5 @@ public interface IOrderListService { | @@ -13,5 +14,5 @@ public interface IOrderListService { | ||
13 | * @param request | 14 | * @param request |
14 | * @return | 15 | * @return |
15 | */ | 16 | */ |
16 | - OrderListInfoRsp getOrderList(OrderListRequest request); | 17 | + PageResp<OrderListInfo> getOrderList(OrderListRequest request); |
17 | } | 18 | } |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | +import com.yohobuy.ufo.model.order.resp.PageResp; | ||
4 | import com.yohoufo.common.utils.DateUtil; | 5 | import com.yohoufo.common.utils.DateUtil; |
5 | import com.yohoufo.dal.order.model.BuyerOrder; | 6 | import com.yohoufo.dal.order.model.BuyerOrder; |
6 | import com.yohoufo.dal.order.model.BuyerOrderGoods; | 7 | import com.yohoufo.dal.order.model.BuyerOrderGoods; |
@@ -10,7 +11,6 @@ import com.yohoufo.order.common.TabType; | @@ -10,7 +11,6 @@ import com.yohoufo.order.common.TabType; | ||
10 | import com.yohoufo.order.model.request.OrderListRequest; | 11 | import com.yohoufo.order.model.request.OrderListRequest; |
11 | import com.yohoufo.order.model.response.GoodsInfo; | 12 | import com.yohoufo.order.model.response.GoodsInfo; |
12 | import com.yohoufo.order.model.response.OrderListInfo; | 13 | import com.yohoufo.order.model.response.OrderListInfo; |
13 | -import com.yohoufo.order.model.response.OrderListInfoRsp; | ||
14 | import com.yohoufo.order.service.IOrderListService; | 14 | import com.yohoufo.order.service.IOrderListService; |
15 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
16 | import org.slf4j.LoggerFactory; | 16 | import org.slf4j.LoggerFactory; |
@@ -44,20 +44,18 @@ public abstract class AbsOrderListService implements IOrderListService{ | @@ -44,20 +44,18 @@ public abstract class AbsOrderListService implements IOrderListService{ | ||
44 | * @return | 44 | * @return |
45 | */ | 45 | */ |
46 | @Override | 46 | @Override |
47 | - public OrderListInfoRsp getOrderList(OrderListRequest request){ | 47 | + public PageResp<OrderListInfo> getOrderList(OrderListRequest request){ |
48 | 48 | ||
49 | // check and init请求参数 | 49 | // check and init请求参数 |
50 | List<Integer> statusQuery = initOrderListRequest(request); | 50 | List<Integer> statusQuery = initOrderListRequest(request); |
51 | TabType actor = request.getActor(); | 51 | TabType actor = request.getActor(); |
52 | int total = getTotal(request.getUid(), statusQuery); | 52 | int total = getTotal(request.getUid(), statusQuery); |
53 | int limit = request.getLimit(); | 53 | int limit = request.getLimit(); |
54 | - int currentTotal = 0; | ||
55 | - OrderListInfoRsp.OrderListInfoRspBuilder respBuilder = OrderListInfoRsp.builder() | ||
56 | - .currPage(request.getPage()) | ||
57 | - .limit(limit) | 54 | + PageResp.PageRespBuilder respBuilder = PageResp.builder() |
55 | + .page(request.getPage()) | ||
56 | + .pageSize(limit) | ||
58 | .total(total) | 57 | .total(total) |
59 | - .currTotal(currentTotal) | ||
60 | - .pageSize((total % limit == 0) ? (total / limit) : (total / limit + 1)); | 58 | + .pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1)); |
61 | if (total == 0){ | 59 | if (total == 0){ |
62 | return respBuilder.build(); | 60 | return respBuilder.build(); |
63 | } | 61 | } |
@@ -86,7 +84,7 @@ public abstract class AbsOrderListService implements IOrderListService{ | @@ -86,7 +84,7 @@ public abstract class AbsOrderListService implements IOrderListService{ | ||
86 | data.add(orderListInfo); | 84 | data.add(orderListInfo); |
87 | }); | 85 | }); |
88 | 86 | ||
89 | - OrderListInfoRsp orderListInfoRsp = respBuilder.data(data).currTotal(data.size()).build(); | 87 | + PageResp orderListInfoRsp = respBuilder.data(data).build(); |
90 | 88 | ||
91 | return orderListInfoRsp; | 89 | return orderListInfoRsp; |
92 | 90 |
@@ -2,34 +2,22 @@ package com.yohoufo.order.service.impl; | @@ -2,34 +2,22 @@ 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.yohoufo.common.utils.DateUtil; | 5 | +import com.yohobuy.ufo.model.order.resp.PageResp; |
6 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | 6 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; |
7 | import com.yohoufo.dal.order.BuyerOrderMapper; | 7 | import com.yohoufo.dal.order.BuyerOrderMapper; |
8 | import com.yohoufo.dal.order.BuyerOrderMetaMapper; | 8 | import com.yohoufo.dal.order.BuyerOrderMetaMapper; |
9 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; | 9 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; |
10 | import com.yohoufo.dal.order.model.BuyerOrder; | 10 | import com.yohoufo.dal.order.model.BuyerOrder; |
11 | -import com.yohoufo.dal.order.model.BuyerOrderGoods; | ||
12 | -import com.yohoufo.dal.order.model.BuyerOrderMeta; | ||
13 | -import com.yohoufo.dal.order.model.SellerOrderGoods; | ||
14 | -import com.yohoufo.order.common.OrderListType; | ||
15 | import com.yohoufo.order.common.OrderStatus; | 11 | import com.yohoufo.order.common.OrderStatus; |
16 | -import com.yohoufo.order.common.Payment; | ||
17 | -import com.yohoufo.order.common.TabType; | ||
18 | -import com.yohoufo.order.constants.MetaKey; | ||
19 | -import com.yohoufo.order.constants.OrderConstant; | ||
20 | import com.yohoufo.order.model.request.OrderListRequest; | 12 | import com.yohoufo.order.model.request.OrderListRequest; |
21 | import com.yohoufo.order.model.request.OrderRequest; | 13 | import com.yohoufo.order.model.request.OrderRequest; |
22 | -import com.yohoufo.order.model.response.GoodsInfo; | ||
23 | import com.yohoufo.order.model.response.OrderDetailInfo; | 14 | import com.yohoufo.order.model.response.OrderDetailInfo; |
24 | -import com.yohoufo.order.model.response.OrderListInfoRsp; | ||
25 | import com.yohoufo.order.service.IBuyerOrderService; | 15 | import com.yohoufo.order.service.IBuyerOrderService; |
26 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
27 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
28 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
29 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
30 | 20 | ||
31 | -import java.util.List; | ||
32 | - | ||
33 | @Service | 21 | @Service |
34 | public class BuyerOrderServiceImpl implements IBuyerOrderService { | 22 | public class BuyerOrderServiceImpl implements IBuyerOrderService { |
35 | 23 | ||
@@ -115,20 +103,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -115,20 +103,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
115 | } | 103 | } |
116 | 104 | ||
117 | 105 | ||
118 | - | ||
119 | - | ||
120 | - | ||
121 | - | ||
122 | - | ||
123 | - | ||
124 | - | ||
125 | @Override | 106 | @Override |
126 | public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) { | 107 | public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) { |
127 | return buyerOrderDetailService.getOrderDetail(orderRequest); | 108 | return buyerOrderDetailService.getOrderDetail(orderRequest); |
128 | } | 109 | } |
129 | 110 | ||
130 | @Override | 111 | @Override |
131 | - public OrderListInfoRsp getOrderList(OrderListRequest request) { | 112 | + public PageResp getOrderList(OrderListRequest request) { |
132 | return buyerOrderListService.getOrderList(request); | 113 | return buyerOrderListService.getOrderList(request); |
133 | } | 114 | } |
134 | } | 115 | } |
@@ -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.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.resp.PageResp; | ||
5 | import com.yohoufo.common.utils.DateUtil; | 6 | import com.yohoufo.common.utils.DateUtil; |
6 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | 7 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; |
7 | import com.yohoufo.dal.order.BuyerOrderMapper; | 8 | import com.yohoufo.dal.order.BuyerOrderMapper; |
@@ -16,7 +17,6 @@ import com.yohoufo.order.common.SellerOrderStatus; | @@ -16,7 +17,6 @@ import com.yohoufo.order.common.SellerOrderStatus; | ||
16 | import com.yohoufo.order.common.SkupStatus; | 17 | import com.yohoufo.order.common.SkupStatus; |
17 | import com.yohoufo.order.model.request.OrderListRequest; | 18 | import com.yohoufo.order.model.request.OrderListRequest; |
18 | import com.yohoufo.order.model.response.OrderListInfo; | 19 | import com.yohoufo.order.model.response.OrderListInfo; |
19 | -import com.yohoufo.order.model.response.OrderListInfoRsp; | ||
20 | import com.yohoufo.order.service.IOrderListService; | 20 | import com.yohoufo.order.service.IOrderListService; |
21 | import lombok.extern.slf4j.Slf4j; | 21 | import lombok.extern.slf4j.Slf4j; |
22 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -46,20 +46,18 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -46,20 +46,18 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
46 | private SellerOrderGoodsMapper sellerOrderGoodsMapper; | 46 | private SellerOrderGoodsMapper sellerOrderGoodsMapper; |
47 | 47 | ||
48 | @Override | 48 | @Override |
49 | - public OrderListInfoRsp getOrderList(OrderListRequest request){ | 49 | + public PageResp<OrderListInfo> getOrderList(OrderListRequest request){ |
50 | int type; | 50 | int type; |
51 | if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()){ | 51 | if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()){ |
52 | List<Integer> statusList = initOrderListRequest(request); | 52 | List<Integer> statusList = initOrderListRequest(request); |
53 | 53 | ||
54 | int total = sellerOrderGoodsMapper.selectCntByUidStatusList(request.getUid(), statusList); | 54 | int total = sellerOrderGoodsMapper.selectCntByUidStatusList(request.getUid(), statusList); |
55 | int limit = request.getLimit(); | 55 | int limit = request.getLimit(); |
56 | - int currentTotal = 0; | ||
57 | - OrderListInfoRsp.OrderListInfoRspBuilder respBuilder = OrderListInfoRsp.builder() | ||
58 | - .currPage(request.getPage()) | ||
59 | - .limit(limit) | 56 | + PageResp.PageRespBuilder respBuilder = PageResp.builder() |
57 | + .page(request.getPage()) | ||
58 | + .pageSize(limit) | ||
60 | .total(total) | 59 | .total(total) |
61 | - .currTotal(currentTotal) | ||
62 | - .pageSize((total % limit == 0) ? (total / limit) : (total / limit + 1)); | 60 | + .pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1)); |
63 | if (total == 0){ | 61 | if (total == 0){ |
64 | return respBuilder.build(); | 62 | return respBuilder.build(); |
65 | } | 63 | } |
@@ -74,7 +72,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -74,7 +72,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
74 | .map(sellerOrder -> buildOrderListInfo(skupSellerOrderGoodsMap.get(sellerOrder.getSkup()), sellerOrder)) | 72 | .map(sellerOrder -> buildOrderListInfo(skupSellerOrderGoodsMap.get(sellerOrder.getSkup()), sellerOrder)) |
75 | .collect(Collectors.toList()); | 73 | .collect(Collectors.toList()); |
76 | 74 | ||
77 | - OrderListInfoRsp orderListInfoRsp = respBuilder.data(data).currTotal(data.size()).build(); | 75 | + PageResp orderListInfoRsp = respBuilder.data(data).build(); |
78 | return orderListInfoRsp; | 76 | return orderListInfoRsp; |
79 | }else{ | 77 | }else{ |
80 | return super.getOrderList(request); | 78 | return super.getOrderList(request); |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | import com.yoho.service.model.response.UserAddressRspBO; | 3 | import com.yoho.service.model.response.UserAddressRspBO; |
4 | -import com.yohobuy.ufo.model.order.bo.PlatformFee; | ||
5 | import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; | 4 | import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; |
6 | import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq; | 5 | import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq; |
7 | import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq; | 6 | import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq; |
7 | +import com.yohobuy.ufo.model.order.resp.PageResp; | ||
8 | import com.yohoufo.common.caller.UfoServiceCaller; | 8 | import com.yohoufo.common.caller.UfoServiceCaller; |
9 | import com.yohoufo.common.exception.GatewayException; | 9 | import com.yohoufo.common.exception.GatewayException; |
10 | -import com.yohoufo.common.utils.BigDecimalHelper; | ||
11 | -import com.yohoufo.common.utils.PriceFormater; | ||
12 | -import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | ||
13 | -import com.yohoufo.dal.order.BuyerOrderMapper; | ||
14 | -import com.yohoufo.dal.order.SellerOrderGoodsMapper; | ||
15 | import com.yohoufo.dal.order.SellerOrderMapper; | 10 | import com.yohoufo.dal.order.SellerOrderMapper; |
16 | import com.yohoufo.order.common.OrderCodeType; | 11 | import com.yohoufo.order.common.OrderCodeType; |
17 | import com.yohoufo.order.convert.SellerOrderConvertor; | 12 | import com.yohoufo.order.convert.SellerOrderConvertor; |
18 | import com.yohoufo.order.model.AddressInfo; | 13 | import com.yohoufo.order.model.AddressInfo; |
19 | import com.yohoufo.order.model.GoodsInfo; | 14 | import com.yohoufo.order.model.GoodsInfo; |
20 | import com.yohoufo.order.model.SellerOrderContext; | 15 | import com.yohoufo.order.model.SellerOrderContext; |
21 | -import com.yohoufo.order.model.dto.PlatformFeeDto; | ||
22 | import com.yohoufo.order.model.dto.SellerOrderComputeResult; | 16 | import com.yohoufo.order.model.dto.SellerOrderComputeResult; |
23 | import com.yohoufo.order.model.request.OrderListRequest; | 17 | import com.yohoufo.order.model.request.OrderListRequest; |
24 | import com.yohoufo.order.model.request.OrderRequest; | 18 | import com.yohoufo.order.model.request.OrderRequest; |
25 | import com.yohoufo.order.model.response.OrderDetailInfo; | 19 | import com.yohoufo.order.model.response.OrderDetailInfo; |
26 | -import com.yohoufo.order.model.response.OrderListInfoRsp; | 20 | +import com.yohoufo.order.model.response.OrderListInfo; |
27 | import com.yohoufo.order.service.IOrderDetailService; | 21 | import com.yohoufo.order.service.IOrderDetailService; |
28 | import com.yohoufo.order.service.IOrderListService; | 22 | import com.yohoufo.order.service.IOrderListService; |
29 | import com.yohoufo.order.service.handler.SellerOrderComputeHandler; | 23 | import com.yohoufo.order.service.handler.SellerOrderComputeHandler; |
@@ -280,7 +274,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -280,7 +274,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
280 | 274 | ||
281 | 275 | ||
282 | @Override | 276 | @Override |
283 | - public OrderListInfoRsp getOrderList(OrderListRequest request){ | 277 | + public PageResp<OrderListInfo> getOrderList(OrderListRequest request){ |
284 | 278 | ||
285 | return sellerOrderListService.getOrderList(request); | 279 | return sellerOrderListService.getOrderList(request); |
286 | } | 280 | } |
@@ -44,13 +44,12 @@ public class ProductController { | @@ -44,13 +44,12 @@ public class ProductController { | ||
44 | @Cachable(expire = 300) | 44 | @Cachable(expire = 300) |
45 | public ApiResponse queryProductDetailById( | 45 | public ApiResponse queryProductDetailById( |
46 | @RequestParam(value = "product_id") Integer productId) { | 46 | @RequestParam(value = "product_id") Integer productId) { |
47 | - | ||
48 | if (null == productId) { | 47 | if (null == productId) { |
48 | + LOG.info("in method=ufo.product.data product_id Is Null"); | ||
49 | return new ApiResponse(400, "product_id Is Null", null); | 49 | return new ApiResponse(400, "product_id Is Null", null); |
50 | } | 50 | } |
51 | - | 51 | + LOG.info("in method=ufo.product.data product_id={}", productId); |
52 | ProductDetailResp resp = productService.queryProductDetailById(productId); | 52 | ProductDetailResp resp = productService.queryProductDetailById(productId); |
53 | - | ||
54 | return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); | 53 | return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); |
55 | } | 54 | } |
56 | 55 | ||
@@ -63,8 +62,10 @@ public class ProductController { | @@ -63,8 +62,10 @@ public class ProductController { | ||
63 | @RequestParam(value = "product_ids") String productIds) { | 62 | @RequestParam(value = "product_ids") String productIds) { |
64 | 63 | ||
65 | if (StringUtils.isBlank(productIds)) { | 64 | if (StringUtils.isBlank(productIds)) { |
65 | + LOG.info("in method=ufo.product.series.template product_ids Is Null or empty"); | ||
66 | return new ApiResponse(400, "productIds Is Null", null); | 66 | return new ApiResponse(400, "productIds Is Null", null); |
67 | } | 67 | } |
68 | + LOG.info("in method=ufo.product.series.template product_ids={}", productIds); | ||
68 | ProductSeriesTemplateResp resp = productService.querySeriesTemplateData(productIds); | 69 | ProductSeriesTemplateResp resp = productService.querySeriesTemplateData(productIds); |
69 | return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); | 70 | return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); |
70 | } | 71 | } |
@@ -78,8 +79,10 @@ public class ProductController { | @@ -78,8 +79,10 @@ public class ProductController { | ||
78 | @RequestParam(value = "product_ids") String productIds) { | 79 | @RequestParam(value = "product_ids") String productIds) { |
79 | 80 | ||
80 | if (StringUtils.isBlank(productIds)) { | 81 | if (StringUtils.isBlank(productIds)) { |
82 | + LOG.info("in method=ufo.product.sort.template product_ids Is Null or empty"); | ||
81 | return new ApiResponse(400, "productIds Is Null", null); | 83 | return new ApiResponse(400, "productIds Is Null", null); |
82 | } | 84 | } |
85 | + LOG.info("in method=ufo.product.sort.template product_ids={}", productIds); | ||
83 | ProductSortTemplateResp resp = productService.querySortTemplateData(productIds); | 86 | ProductSortTemplateResp resp = productService.querySortTemplateData(productIds); |
84 | return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); | 87 | return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); |
85 | } | 88 | } |
@@ -88,11 +91,13 @@ public class ProductController { | @@ -88,11 +91,13 @@ public class ProductController { | ||
88 | @RequestMapping(params = "method=ufo.product.storage.leastprice") | 91 | @RequestMapping(params = "method=ufo.product.storage.leastprice") |
89 | @Cachable(expire = 300) | 92 | @Cachable(expire = 300) |
90 | public StorageLeastPriceResp queryStorageLeastprice( | 93 | public StorageLeastPriceResp queryStorageLeastprice( |
91 | - @RequestParam(value = "storage_id", required = true) Integer storageId) { | 94 | + @RequestParam(value = "storage_id") Integer storageId) { |
92 | 95 | ||
93 | if (storageId == null) { | 96 | if (storageId == null) { |
97 | + LOG.info("in method=ufo.product.storage.leastprice storage_id Is Null"); | ||
94 | return null; | 98 | return null; |
95 | } | 99 | } |
100 | + LOG.info("in method=ufo.product.storage.leastprice storage_id={}", storageId); | ||
96 | return productService.queryStorageLeastPrice(storageId); | 101 | return productService.queryStorageLeastPrice(storageId); |
97 | } | 102 | } |
98 | 103 | ||
@@ -101,11 +106,13 @@ public class ProductController { | @@ -101,11 +106,13 @@ public class ProductController { | ||
101 | @RequestMapping(params = "method=ufo.product.storage.data") | 106 | @RequestMapping(params = "method=ufo.product.storage.data") |
102 | @Cachable(expire = 300) | 107 | @Cachable(expire = 300) |
103 | public StorageDataResp queryStorageInfo( | 108 | public StorageDataResp queryStorageInfo( |
104 | - @RequestParam(value = "storage_id", required = true) Integer storageId) { | 109 | + @RequestParam(value = "storage_id") Integer storageId) { |
105 | 110 | ||
106 | if (storageId == null) { | 111 | if (storageId == null) { |
112 | + LOG.info("in method=ufo.product.storage.data storage_id Is Null"); | ||
107 | return null; | 113 | return null; |
108 | } | 114 | } |
115 | + LOG.info("in method=ufo.product.storage.data storage_id={}", storageId); | ||
109 | return productService.queryStorageInfo(storageId); | 116 | return productService.queryStorageInfo(storageId); |
110 | } | 117 | } |
111 | 118 |
@@ -53,6 +53,8 @@ public class ProductSearchController { | @@ -53,6 +53,8 @@ public class ProductSearchController { | ||
53 | ProductSearchReq req = new ProductSearchReq().setOrder(order).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId()) | 53 | ProductSearchReq req = new ProductSearchReq().setOrder(order).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId()) |
54 | .setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page); | 54 | .setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page); |
55 | searchHelpService.setQuery(query, req); | 55 | searchHelpService.setQuery(query, req); |
56 | + LOG.info("in method=ufo.product.search.list req={}", req.toString()); | ||
57 | + | ||
56 | JSONObject resp = productSearchService.searchProductList(req); | 58 | JSONObject resp = productSearchService.searchProductList(req); |
57 | return new ApiResponse.ApiResponseBuilder().code(200).message("Product List.").data(resp).build(); | 59 | return new ApiResponse.ApiResponseBuilder().code(200).message("Product List.").data(resp).build(); |
58 | } | 60 | } |
@@ -65,8 +67,10 @@ public class ProductSearchController { | @@ -65,8 +67,10 @@ public class ProductSearchController { | ||
65 | public ApiResponse searchProductRecommendById(@RequestParam(value = "product_id") Integer productId) { | 67 | public ApiResponse searchProductRecommendById(@RequestParam(value = "product_id") Integer productId) { |
66 | 68 | ||
67 | if (null == productId) { | 69 | if (null == productId) { |
70 | + LOG.info("in method=ufo.product.data.search.recommend product_id is null"); | ||
68 | return new ApiResponse(400, "product_id Is Null", null); | 71 | return new ApiResponse(400, "product_id Is Null", null); |
69 | } | 72 | } |
73 | + LOG.info("in method=ufo.product.data.search.recommend product_id={}", productId); | ||
70 | SearchProductRecommendResp resp = productSearchService.searchProductRecommendById(productId); | 74 | SearchProductRecommendResp resp = productSearchService.searchProductRecommendById(productId); |
71 | return new ApiResponse.ApiResponseBuilder().code(200).message("product.data.search.recommend").data(resp).build(); | 75 | return new ApiResponse.ApiResponseBuilder().code(200).message("product.data.search.recommend").data(resp).build(); |
72 | } | 76 | } |
@@ -92,9 +96,9 @@ public class ProductSearchController { | @@ -92,9 +96,9 @@ public class ProductSearchController { | ||
92 | ProductSearchReq req = new ProductSearchReq().setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId()) | 96 | ProductSearchReq req = new ProductSearchReq().setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId()) |
93 | .setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale); | 97 | .setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale); |
94 | searchHelpService.setQuery(query, req); | 98 | searchHelpService.setQuery(query, req); |
99 | + LOG.info("in method=ufo.product.search.list req={}", req.toString()); | ||
95 | 100 | ||
96 | SearchProductListFilterResp resp = productSearchService.searchProductListFilter(req); | 101 | SearchProductListFilterResp resp = productSearchService.searchProductListFilter(req); |
97 | - | ||
98 | return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.list.filter").data(resp).build(); | 102 | return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.list.filter").data(resp).build(); |
99 | } | 103 | } |
100 | 104 |
1 | package com.yohoufo.product.request; | 1 | package com.yohoufo.product.request; |
2 | 2 | ||
3 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
4 | + | ||
3 | public class ProductSearchReq { | 5 | public class ProductSearchReq { |
4 | 6 | ||
5 | private Integer id; | 7 | private Integer id; |
@@ -18,6 +20,26 @@ public class ProductSearchReq { | @@ -18,6 +20,26 @@ public class ProductSearchReq { | ||
18 | private String not_id; | 20 | private String not_id; |
19 | 21 | ||
20 | 22 | ||
23 | + @Override | ||
24 | + public String toString() { | ||
25 | + return new ToStringBuilder(this) | ||
26 | + .append("page", page) | ||
27 | + .append("order", order) | ||
28 | + .append("gender", gender) | ||
29 | + .append("viewNum", viewNum) | ||
30 | + .append("brand", brand) | ||
31 | + .append("size", size) | ||
32 | + .append("query", query) | ||
33 | + .append("maxSort", maxSort) | ||
34 | + .append("midSort", midSort) | ||
35 | + .append("series", series) | ||
36 | + .append("pool", pool) | ||
37 | + .append("isSoonSale", isSoonSale) | ||
38 | + .append("not_id", not_id) | ||
39 | + .toString(); | ||
40 | + } | ||
41 | + | ||
42 | + | ||
21 | public Integer getId() { | 43 | public Integer getId() { |
22 | return id; | 44 | return id; |
23 | } | 45 | } |
@@ -144,4 +166,5 @@ public class ProductSearchReq { | @@ -144,4 +166,5 @@ public class ProductSearchReq { | ||
144 | this.not_id = not_id; | 166 | this.not_id = not_id; |
145 | return this; | 167 | return this; |
146 | } | 168 | } |
169 | + | ||
147 | } | 170 | } |
@@ -67,14 +67,19 @@ public class ProductServiceImpl implements ProductService{ | @@ -67,14 +67,19 @@ public class ProductServiceImpl implements ProductService{ | ||
67 | productInfo.setLeastPrice(new BigDecimal(0)); | 67 | productInfo.setLeastPrice(new BigDecimal(0)); |
68 | setBrand(productInfo, product.getBrandId()); | 68 | setBrand(productInfo, product.getBrandId()); |
69 | setSeries(productInfo, product.getSeriesId()); | 69 | setSeries(productInfo, product.getSeriesId()); |
70 | + productInfo.setLeastPrice(null); | ||
71 | + | ||
70 | 72 | ||
71 | List<GoodsBO> goodsBOList = getGoodsList(product.getId()); | 73 | List<GoodsBO> goodsBOList = getGoodsList(product.getId()); |
72 | if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) { | 74 | if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) { |
73 | GoodsBO goodsBO = goodsBOList.get(0); | 75 | GoodsBO goodsBO = goodsBOList.get(0); |
74 | List<GoodsSize> goodsSizes = goodsBO.getSizeList(); | 76 | List<GoodsSize> goodsSizes = goodsBO.getSizeList(); |
75 | if (!CollectionUtils.isEmpty(goodsSizes)) { | 77 | if (!CollectionUtils.isEmpty(goodsSizes)) { |
76 | - BigDecimal leastPrice = goodsSizes.stream().map(GoodsSize::getLeastPrice).filter(Objects::nonNull).min((p1, p2) -> (p1.compareTo(p2))).get(); | ||
77 | - productInfo.setLeastPrice(leastPrice); | 78 | + List<BigDecimal> leastPriceList = goodsSizes.stream().map(GoodsSize::getLeastPrice).filter(Objects::nonNull).collect(Collectors.toList()); |
79 | + if (!CollectionUtils.isEmpty(leastPriceList)) { | ||
80 | + BigDecimal leastPrice = leastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get(); | ||
81 | + productInfo.setLeastPrice(leastPrice); | ||
82 | + } | ||
78 | goodsSizes.sort(Comparator.comparing(GoodsSize::getOrderBy)); | 83 | goodsSizes.sort(Comparator.comparing(GoodsSize::getOrderBy)); |
79 | } | 84 | } |
80 | } | 85 | } |
@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory; | @@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory; | ||
5 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
6 | import org.springframework.stereotype.Service; | 6 | import org.springframework.stereotype.Service; |
7 | 7 | ||
8 | +import com.alibaba.fastjson.JSON; | ||
8 | import com.alibaba.fastjson.JSONArray; | 9 | import com.alibaba.fastjson.JSONArray; |
9 | import com.alibaba.fastjson.JSONObject; | 10 | import com.alibaba.fastjson.JSONObject; |
10 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; | 11 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; |
@@ -38,7 +39,7 @@ public class ProductQueryServiceImpl implements IProductQueryService { | @@ -38,7 +39,7 @@ public class ProductQueryServiceImpl implements IProductQueryService { | ||
38 | logger.info("begin invoke ufo.product.series.template, param is:{}", params); | 39 | logger.info("begin invoke ufo.product.series.template, param is:{}", params); |
39 | ApiResponse apiResponse = ufoServiceCaller.call(SERIES_METHOD, ApiResponse.class, params); | 40 | ApiResponse apiResponse = ufoServiceCaller.call(SERIES_METHOD, ApiResponse.class, params); |
40 | if (null != apiResponse && apiResponse.getCode() == 200) { | 41 | if (null != apiResponse && apiResponse.getCode() == 200) { |
41 | - JSONObject productSeriesJSON = (JSONObject) apiResponse.getData(); | 42 | + JSONObject productSeriesJSON = (JSONObject) JSON.toJSON(apiResponse.getData()); |
42 | if (null != productSeriesJSON && null != productSeriesJSON.get("list")) { | 43 | if (null != productSeriesJSON && null != productSeriesJSON.get("list")) { |
43 | data = productSeriesJSON.getJSONArray("list"); | 44 | data = productSeriesJSON.getJSONArray("list"); |
44 | } | 45 | } |
@@ -83,7 +84,7 @@ public class ProductQueryServiceImpl implements IProductQueryService { | @@ -83,7 +84,7 @@ public class ProductQueryServiceImpl implements IProductQueryService { | ||
83 | logger.info("begin invoke ufo.product.sort.template, param is:{}", params); | 84 | logger.info("begin invoke ufo.product.sort.template, param is:{}", params); |
84 | ApiResponse apiResponse = ufoServiceCaller.call(CATEGORY_METHOD, ApiResponse.class, params); | 85 | ApiResponse apiResponse = ufoServiceCaller.call(CATEGORY_METHOD, ApiResponse.class, params); |
85 | if (null != apiResponse && apiResponse.getCode() == 200) { | 86 | if (null != apiResponse && apiResponse.getCode() == 200) { |
86 | - JSONObject productCategoryJSON = (JSONObject) apiResponse.getData(); | 87 | + JSONObject productCategoryJSON = (JSONObject) JSON.toJSON(apiResponse.getData()); |
87 | if (null != productCategoryJSON) { | 88 | if (null != productCategoryJSON) { |
88 | data = productCategoryJSON; | 89 | data = productCategoryJSON; |
89 | } | 90 | } |
-
Please register or login to post a comment