Showing
8 changed files
with
82 additions
and
10 deletions
@@ -83,6 +83,11 @@ public class OrderDetailInfo { | @@ -83,6 +83,11 @@ public class OrderDetailInfo { | ||
83 | */ | 83 | */ |
84 | private Integer isPaid; | 84 | private Integer isPaid; |
85 | 85 | ||
86 | + /** | ||
87 | + * 发货剩余时间 | ||
88 | + */ | ||
89 | + private Long deliverLeftTime; | ||
90 | + | ||
86 | @Builder | 91 | @Builder |
87 | @Data | 92 | @Data |
88 | @AllArgsConstructor | 93 | @AllArgsConstructor |
@@ -6,10 +6,8 @@ import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; | @@ -6,10 +6,8 @@ import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; | ||
6 | import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; | 6 | import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; |
7 | import com.yohoufo.common.helper.ImageUrlAssist; | 7 | import com.yohoufo.common.helper.ImageUrlAssist; |
8 | import com.yohoufo.common.utils.DateUtil; | 8 | import com.yohoufo.common.utils.DateUtil; |
9 | -import com.yohoufo.dal.order.model.BuyerOrder; | ||
10 | -import com.yohoufo.dal.order.model.BuyerOrderGoods; | ||
11 | -import com.yohoufo.dal.order.model.BuyerOrderMeta; | ||
12 | -import com.yohoufo.dal.order.model.SellerOrderGoods; | 9 | +import com.yohoufo.dal.order.OrdersPayMapper; |
10 | +import com.yohoufo.dal.order.model.*; | ||
13 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 11 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
14 | import com.yohoufo.order.common.Payment; | 12 | import com.yohoufo.order.common.Payment; |
15 | import com.yohobuy.ufo.model.order.common.TabType; | 13 | import com.yohobuy.ufo.model.order.common.TabType; |
@@ -19,6 +17,7 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; | @@ -19,6 +17,7 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; | ||
19 | import com.yohoufo.order.model.request.OrderRequest; | 17 | import com.yohoufo.order.model.request.OrderRequest; |
20 | import com.yohoufo.order.model.response.GoodsInfo; | 18 | import com.yohoufo.order.model.response.GoodsInfo; |
21 | import com.yohoufo.order.model.response.OrderDetailInfo; | 19 | import com.yohoufo.order.model.response.OrderDetailInfo; |
20 | +import com.yohoufo.order.mq.DelayTime; | ||
22 | import com.yohoufo.order.service.IExpressInfoService; | 21 | import com.yohoufo.order.service.IExpressInfoService; |
23 | import com.yohoufo.order.service.IOrderDetailService; | 22 | import com.yohoufo.order.service.IOrderDetailService; |
24 | import lombok.experimental.Builder; | 23 | import lombok.experimental.Builder; |
@@ -34,6 +33,9 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | @@ -34,6 +33,9 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | ||
34 | private final Logger logger = LoggerFactory.getLogger(getClass()); | 33 | private final Logger logger = LoggerFactory.getLogger(getClass()); |
35 | 34 | ||
36 | @Autowired | 35 | @Autowired |
36 | + private OrdersPayService ordersPayService; | ||
37 | + | ||
38 | + @Autowired | ||
37 | protected IExpressInfoService expressInfoService; | 39 | protected IExpressInfoService expressInfoService; |
38 | 40 | ||
39 | abstract BuyerOrder getBuyerOrder(int uid, long orderCode); | 41 | abstract BuyerOrder getBuyerOrder(int uid, long orderCode); |
@@ -51,6 +53,13 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | @@ -51,6 +53,13 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | ||
51 | 53 | ||
52 | abstract AddressInfo getHiddenAddressInfo(int uid, long orderCode, int skup); | 54 | abstract AddressInfo getHiddenAddressInfo(int uid, long orderCode, int skup); |
53 | 55 | ||
56 | + Long getDeliverLeftTime(int buyerUid, long orderCode, Integer orderStatus){ | ||
57 | + if (OrderStatus.HAS_PAYED.getCode() == orderStatus){ | ||
58 | + return ordersPayService.getDeliverLeftTime(buyerUid, orderCode); | ||
59 | + }else{ | ||
60 | + return null; | ||
61 | + } | ||
62 | + } | ||
54 | /** | 63 | /** |
55 | * 获取订单详情 | 64 | * 获取订单详情 |
56 | * @param orderRequest | 65 | * @param orderRequest |
@@ -133,10 +142,12 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | @@ -133,10 +142,12 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | ||
133 | BuyerOrderGoods buyerOrderGoods = buildNode.buyerOrderGoods; | 142 | BuyerOrderGoods buyerOrderGoods = buildNode.buyerOrderGoods; |
134 | SellerOrderGoods sellerOrderGoods = buildNode.sellerOrderGoods; | 143 | SellerOrderGoods sellerOrderGoods = buildNode.sellerOrderGoods; |
135 | AddressInfo userAddress = buildNode.userAddress; | 144 | AddressInfo userAddress = buildNode.userAddress; |
145 | + Integer buyerUid; | ||
146 | + Long orderCode; | ||
136 | //ready 2 set | 147 | //ready 2 set |
137 | OrderDetailInfo orderDetailInfo = new OrderDetailInfo(); | 148 | OrderDetailInfo orderDetailInfo = new OrderDetailInfo(); |
138 | - orderDetailInfo.setUid(buyerOrder.getUid()); | ||
139 | - orderDetailInfo.setOrderCode(buyerOrder.getOrderCode()); | 149 | + orderDetailInfo.setUid(buyerUid = buyerOrder.getUid()); |
150 | + orderDetailInfo.setOrderCode(orderCode = buyerOrder.getOrderCode()); | ||
140 | orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); | 151 | orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); |
141 | orderDetailInfo.setButtons(orderStatus.getDetailButtons(tabType)); | 152 | orderDetailInfo.setButtons(orderStatus.getDetailButtons(tabType)); |
142 | OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType); | 153 | OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType); |
@@ -170,6 +181,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | @@ -170,6 +181,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ | ||
170 | //只有卖家在查看买家的订单时才有 | 181 | //只有卖家在查看买家的订单时才有 |
171 | assembleSoldPrdCompute(orderDetailInfo, buyerOrder.getSellerUid(), buyerOrderGoods.getSkup()); | 182 | assembleSoldPrdCompute(orderDetailInfo, buyerOrder.getSellerUid(), buyerOrderGoods.getSkup()); |
172 | 183 | ||
184 | + orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(buyerUid, orderCode, buyerOrder.getStatus())); | ||
173 | return orderDetailInfo; | 185 | return orderDetailInfo; |
174 | } | 186 | } |
175 | 187 |
@@ -16,6 +16,7 @@ import com.yohoufo.order.model.request.OrderListRequest; | @@ -16,6 +16,7 @@ import com.yohoufo.order.model.request.OrderListRequest; | ||
16 | import com.yohoufo.order.service.IOrderListService; | 16 | import com.yohoufo.order.service.IOrderListService; |
17 | import org.slf4j.Logger; | 17 | import org.slf4j.Logger; |
18 | import org.slf4j.LoggerFactory; | 18 | import org.slf4j.LoggerFactory; |
19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
19 | 20 | ||
20 | import java.util.List; | 21 | import java.util.List; |
21 | import java.util.Map; | 22 | import java.util.Map; |
@@ -29,6 +30,8 @@ public abstract class AbsOrderListService implements IOrderListService{ | @@ -29,6 +30,8 @@ public abstract class AbsOrderListService implements IOrderListService{ | ||
29 | 30 | ||
30 | private final Logger logger = LoggerFactory.getLogger(getClass()); | 31 | private final Logger logger = LoggerFactory.getLogger(getClass()); |
31 | 32 | ||
33 | + @Autowired | ||
34 | + private OrdersPayService ordersPayService; | ||
32 | 35 | ||
33 | abstract List<Integer> initOrderListRequest(OrderListRequest request); | 36 | abstract List<Integer> initOrderListRequest(OrderListRequest request); |
34 | 37 | ||
@@ -40,6 +43,13 @@ public abstract class AbsOrderListService implements IOrderListService{ | @@ -40,6 +43,13 @@ public abstract class AbsOrderListService implements IOrderListService{ | ||
40 | 43 | ||
41 | abstract List<SellerOrderGoods> getBaseOrderGoodsList(List<Integer> skups); | 44 | abstract List<SellerOrderGoods> getBaseOrderGoodsList(List<Integer> skups); |
42 | 45 | ||
46 | + Long getDeliverLeftTime(int buyerUid, long orderCode, Integer orderStatus){ | ||
47 | + if (OrderStatus.HAS_PAYED.getCode() == orderStatus){ | ||
48 | + return ordersPayService.getDeliverLeftTime(buyerUid, orderCode); | ||
49 | + }else{ | ||
50 | + return null; | ||
51 | + } | ||
52 | + } | ||
43 | /** | 53 | /** |
44 | * 订单列表 | 54 | * 订单列表 |
45 | * @param request | 55 | * @param request |
@@ -163,6 +173,9 @@ public abstract class AbsOrderListService implements IOrderListService{ | @@ -163,6 +173,9 @@ public abstract class AbsOrderListService implements IOrderListService{ | ||
163 | orderListInfo.setGoodsInfo(goodsInfo); | 173 | orderListInfo.setGoodsInfo(goodsInfo); |
164 | orderListInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime()); | 174 | orderListInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime()); |
165 | orderListInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); | 175 | orderListInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); |
176 | + // | ||
177 | + orderListInfo.setDeliverLeftTime(getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode(), | ||
178 | + buyerOrder.getStatus())); | ||
166 | return orderListInfo; | 179 | return orderListInfo; |
167 | } | 180 | } |
168 | 181 |
@@ -150,6 +150,8 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO | @@ -150,6 +150,8 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO | ||
150 | if (orderDetailInfo.getStatusDetail().getStatus() == OrderStatus.WAITING_PAY.getCode()){ | 150 | if (orderDetailInfo.getStatusDetail().getStatus() == OrderStatus.WAITING_PAY.getCode()){ |
151 | int leftTime = calLeftTime(orderDetailInfo.getSecendLevelCreateTime()); | 151 | int leftTime = calLeftTime(orderDetailInfo.getSecendLevelCreateTime()); |
152 | orderDetailInfo.getStatusDetail().setLeftTime(leftTime); | 152 | orderDetailInfo.getStatusDetail().setLeftTime(leftTime); |
153 | + orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(orderDetailInfo.getUid(), | ||
154 | + orderDetailInfo.getOrderCode(), orderDetailInfo.getStatusDetail().getStatus())); | ||
153 | } | 155 | } |
154 | } | 156 | } |
155 | 157 |
@@ -96,6 +96,7 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO | @@ -96,6 +96,7 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO | ||
96 | if (oli.getStatus() == OrderStatus.WAITING_PAY.getCode()){ | 96 | if (oli.getStatus() == OrderStatus.WAITING_PAY.getCode()){ |
97 | oli.setLeftTime(calLeftTime(oli.getSecendLevelCreateTime())); | 97 | oli.setLeftTime(calLeftTime(oli.getSecendLevelCreateTime())); |
98 | } | 98 | } |
99 | + oli.setDeliverLeftTime(getDeliverLeftTime(oli.getUid(), oli.getOrderCode(), oli.getStatus())); | ||
99 | }); | 100 | }); |
100 | } | 101 | } |
101 | } | 102 | } |
1 | +package com.yohoufo.order.service.impl; | ||
2 | + | ||
3 | +import com.yohoufo.common.utils.DateUtil; | ||
4 | +import com.yohoufo.dal.order.OrdersPayMapper; | ||
5 | +import com.yohoufo.dal.order.model.OrdersPay; | ||
6 | +import com.yohoufo.order.mq.DelayTime; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.stereotype.Service; | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by chao.chen on 2018/11/23. | ||
12 | + */ | ||
13 | +@Service | ||
14 | +public class OrdersPayService { | ||
15 | + | ||
16 | + @Autowired | ||
17 | + private OrdersPayMapper ordersPayMapper; | ||
18 | + | ||
19 | + public Long getDeliverLeftTime(int buyerUid, long orderCode){ | ||
20 | + OrdersPay ordersPay = ordersPayMapper.selectOrdersPay(orderCode, buyerUid); | ||
21 | + if (ordersPay == null){ | ||
22 | + return null; | ||
23 | + } | ||
24 | + return (long)DelayTime.MINUTES_36_HOURS * 60 - (DateUtil.getCurrentTimeSecond()-ordersPay.getCreateTime()); | ||
25 | + } | ||
26 | +} |
@@ -30,6 +30,7 @@ import com.yohoufo.order.service.proxy.UserProxyService; | @@ -30,6 +30,7 @@ import com.yohoufo.order.service.proxy.UserProxyService; | ||
30 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; | 30 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
31 | import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; | 31 | import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; |
32 | 32 | ||
33 | +import org.apache.commons.collections.CollectionUtils; | ||
33 | import org.apache.commons.lang3.StringUtils; | 34 | import org.apache.commons.lang3.StringUtils; |
34 | import org.slf4j.Logger; | 35 | import org.slf4j.Logger; |
35 | import org.slf4j.LoggerFactory; | 36 | import org.slf4j.LoggerFactory; |
@@ -387,5 +388,12 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | @@ -387,5 +388,12 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | ||
387 | int leftTime = calLeftTime(orderDetailInfo.getSecendLevelCreateTime()); | 388 | int leftTime = calLeftTime(orderDetailInfo.getSecendLevelCreateTime()); |
388 | orderDetailInfo.getStatusDetail().setLeftTime(leftTime); | 389 | orderDetailInfo.getStatusDetail().setLeftTime(leftTime); |
389 | } | 390 | } |
391 | + List<BuyerOrderGoods> bogList = buyerOrderGoodsMapper.selectBySkups(Arrays.asList(orderDetailInfo.getGoodsInfo().getSkup())); | ||
392 | + if (CollectionUtils.isNotEmpty(bogList)){ | ||
393 | + //存在时说明已经有买家下单 当前状态来自于买家订单 | ||
394 | + BuyerOrderGoods bog = bogList.get(0); | ||
395 | + int status = orderDetailInfo.getStatusDetail().getStatus(); | ||
396 | + orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(bog.getUid(), bog.getOrderCode(), status)); | ||
397 | + } | ||
390 | } | 398 | } |
391 | } | 399 | } |
@@ -31,10 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -31,10 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
31 | import org.springframework.stereotype.Service; | 31 | import org.springframework.stereotype.Service; |
32 | 32 | ||
33 | import java.math.BigDecimal; | 33 | import java.math.BigDecimal; |
34 | -import java.util.HashMap; | ||
35 | -import java.util.List; | ||
36 | -import java.util.Map; | ||
37 | -import java.util.Objects; | 34 | +import java.util.*; |
38 | import java.util.stream.Collectors; | 35 | import java.util.stream.Collectors; |
39 | 36 | ||
40 | /** | 37 | /** |
@@ -140,6 +137,14 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -140,6 +137,14 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
140 | if (oli.getStatus() == SkupStatus.CAN_NOT_SELL.getCode()){ | 137 | if (oli.getStatus() == SkupStatus.CAN_NOT_SELL.getCode()){ |
141 | oli.setLeftTime(calLeftTime(oli.getSecendLevelCreateTime())); | 138 | oli.setLeftTime(calLeftTime(oli.getSecendLevelCreateTime())); |
142 | } | 139 | } |
140 | + List<BuyerOrderGoods> bogList = buyerOrderGoodsMapper.selectBySkups(Arrays.asList(oli.getGoodsInfo().getSkup())); | ||
141 | + if (CollectionUtils.isNotEmpty(bogList)){ | ||
142 | + //存在时说明已经有买家下单 当前状态来自于买家订单 | ||
143 | + BuyerOrderGoods bog = bogList.get(0); | ||
144 | + int status = oli.getStatus(); | ||
145 | + oli.setDeliverLeftTime(getDeliverLeftTime(bog.getUid(), bog.getOrderCode(), status)); | ||
146 | + } | ||
147 | + | ||
143 | }); | 148 | }); |
144 | } | 149 | } |
145 | } | 150 | } |
-
Please register or login to post a comment