Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.8
Showing
14 changed files
with
297 additions
and
167 deletions
@@ -247,29 +247,20 @@ public class ChargeService { | @@ -247,29 +247,20 @@ public class ChargeService { | ||
247 | break; | 247 | break; |
248 | case SF: | 248 | case SF: |
249 | default: | 249 | default: |
250 | + if(chargeContext.getUserAddressPair() != null) { | ||
251 | + String areaCode = chargeContext.getUserAddressPair().getLeft().getAreaCode(); | ||
252 | + deliveryWayCost = deliveryWayCostSupport.getCostOfSfByAreaCode(areaCode); | ||
253 | + }else { | ||
254 | + //默认 没有选地址的场景 | ||
250 | deliveryWayCost = deliveryWayCostSupport.getCostOfSf(); | 255 | deliveryWayCost = deliveryWayCostSupport.getCostOfSf(); |
256 | + } | ||
251 | finalDeliverAmount = deliveryWayCost; | 257 | finalDeliverAmount = deliveryWayCost; |
252 | break; | 258 | break; |
253 | } | 259 | } |
254 | } | 260 | } |
255 | } | 261 | } |
256 | 262 | ||
257 | - /* | ||
258 | - if (shoppingSupport.isDeliveryWayByStore()){ | ||
259 | - deliveryWayCost = 0D; | ||
260 | - }else/* if(chargeContext.getUserAddressPair() != null){ | ||
261 | - String areaCode = chargeContext.getUserAddressPair().getLeft().getAreaCode(); | ||
262 | - deliveryWayCost = deliveryWayCostSupport.getCostOfSfByAreaCode(areaCode); | ||
263 | - }else{ | ||
264 | - //运费的最终保证 | ||
265 | - if (chargeContext.isShipFeeRequird()){ | ||
266 | - deliveryWayCost = deliveryWayCostSupport.getCostOfSf(); | ||
267 | - } | ||
268 | - }*/ | ||
269 | - /*{ | ||
270 | - deliveryWayCost = deliveryWayCostSupport.getCostOfSf(); | ||
271 | - } | ||
272 | - */ | 263 | + |
273 | //运费 | 264 | //运费 |
274 | chargeContext.getChargeResult().setDeliveryWay(chargeContext.getChargeParam().getDeliveryWay()); | 265 | chargeContext.getChargeResult().setDeliveryWay(chargeContext.getChargeParam().getDeliveryWay()); |
275 | chargeContext.getChargeResult().setShippingAmount(deliveryWayCost); | 266 | chargeContext.getChargeResult().setShippingAmount(deliveryWayCost); |
@@ -14,6 +14,7 @@ import com.yohoufo.order.model.request.OrderRequest; | @@ -14,6 +14,7 @@ import com.yohoufo.order.model.request.OrderRequest; | ||
14 | import com.yohoufo.order.model.response.OrderDetailInfo; | 14 | import com.yohoufo.order.model.response.OrderDetailInfo; |
15 | import com.yohoufo.order.service.IBuyerOrderService; | 15 | import com.yohoufo.order.service.IBuyerOrderService; |
16 | import com.yohoufo.order.service.impl.AppraiseService; | 16 | import com.yohoufo.order.service.impl.AppraiseService; |
17 | +import com.yohoufo.order.service.impl.BuyerOrderViewService; | ||
17 | import com.yohoufo.order.service.seller.orderMeta.SellerFeeService; | 18 | import com.yohoufo.order.service.seller.orderMeta.SellerFeeService; |
18 | import com.yohoufo.order.service.impl.SellerOrderService; | 19 | import com.yohoufo.order.service.impl.SellerOrderService; |
19 | import com.yohoufo.order.service.impl.SellerOrderViewService; | 20 | import com.yohoufo.order.service.impl.SellerOrderViewService; |
@@ -49,6 +50,9 @@ public class BuyerOrderController { | @@ -49,6 +50,9 @@ public class BuyerOrderController { | ||
49 | @Autowired | 50 | @Autowired |
50 | private AppraiseService appraiseService; | 51 | private AppraiseService appraiseService; |
51 | 52 | ||
53 | + @Autowired | ||
54 | + private BuyerOrderViewService buyerOrderViewService; | ||
55 | + | ||
52 | /** | 56 | /** |
53 | * [购买]订单列表 | 57 | * [购买]订单列表 |
54 | * 1: 全部 | 58 | * 1: 全部 |
@@ -80,7 +84,7 @@ public class BuyerOrderController { | @@ -80,7 +84,7 @@ public class BuyerOrderController { | ||
80 | PageResp<OrderListInfo> orderListInfoRsp; | 84 | PageResp<OrderListInfo> orderListInfoRsp; |
81 | switch (actor){ | 85 | switch (actor){ |
82 | case BUY: | 86 | case BUY: |
83 | - orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest, false); | 87 | + orderListInfoRsp = buyerOrderViewService.getOrderList(orderListRequest, false); |
84 | break; | 88 | break; |
85 | case SELL: | 89 | case SELL: |
86 | orderListInfoRsp = sellerOrderService.getOrderList(orderListRequest, false); | 90 | orderListInfoRsp = sellerOrderService.getOrderList(orderListRequest, false); |
@@ -121,7 +125,7 @@ public class BuyerOrderController { | @@ -121,7 +125,7 @@ public class BuyerOrderController { | ||
121 | OrderDetailInfo orderDetailInfo; | 125 | OrderDetailInfo orderDetailInfo; |
122 | switch (actor){ | 126 | switch (actor){ |
123 | case BUY: | 127 | case BUY: |
124 | - orderDetailInfo = buyerOrderService.getOrderDetail(orderRequest); | 128 | + orderDetailInfo = buyerOrderViewService.getOrderDetail(orderRequest); |
125 | break; | 129 | break; |
126 | case SELL: | 130 | case SELL: |
127 | orderDetailInfo = sellerOrderService.getOrderDetail(orderRequest); | 131 | orderDetailInfo = sellerOrderService.getOrderDetail(orderRequest); |
@@ -318,7 +322,7 @@ public class BuyerOrderController { | @@ -318,7 +322,7 @@ public class BuyerOrderController { | ||
318 | .build(); | 322 | .build(); |
319 | LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest); | 323 | LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest); |
320 | //TODO remove below codes 2 service level | 324 | //TODO remove below codes 2 service level |
321 | - PageResp<OrderListInfo> orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest, false); | 325 | + PageResp<OrderListInfo> orderListInfoRsp = buyerOrderViewService.getOrderList(orderListRequest, false); |
322 | List<JSONObject> goods = Lists.newArrayList(); | 326 | List<JSONObject> goods = Lists.newArrayList(); |
323 | List<Integer> goodsId = Lists.newArrayList(); | 327 | List<Integer> goodsId = Lists.newArrayList(); |
324 | if(null != orderListInfoRsp.getData() ){ | 328 | if(null != orderListInfoRsp.getData() ){ |
@@ -357,7 +361,7 @@ public class BuyerOrderController { | @@ -357,7 +361,7 @@ public class BuyerOrderController { | ||
357 | .uid(uid) | 361 | .uid(uid) |
358 | .orderCode(orderCode) | 362 | .orderCode(orderCode) |
359 | .build(); | 363 | .build(); |
360 | - OrderCancelComputeResult occr = buyerOrderService.cancelCompute(orderRequest); | 364 | + OrderCancelComputeResult occr = buyerOrderViewService.cancelCompute(orderRequest); |
361 | LOG.info("method ufo.buyer.cancelCompute out, orderCode is {}, uid is {}", orderCode, uid); | 365 | LOG.info("method ufo.buyer.cancelCompute out, orderCode is {}, uid is {}", orderCode, uid); |
362 | return new ApiResponse.ApiResponseBuilder().data(occr).code(200).message("成功").build(); | 366 | return new ApiResponse.ApiResponseBuilder().data(occr).code(200).message("成功").build(); |
363 | } | 367 | } |
@@ -19,6 +19,7 @@ import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; | @@ -19,6 +19,7 @@ import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; | ||
19 | import com.yohoufo.order.service.IBuyerOrderService; | 19 | import com.yohoufo.order.service.IBuyerOrderService; |
20 | import com.yohoufo.order.service.IPaymentService; | 20 | import com.yohoufo.order.service.IPaymentService; |
21 | import com.yohoufo.order.service.impl.BuyerOrderCancelService; | 21 | import com.yohoufo.order.service.impl.BuyerOrderCancelService; |
22 | +import com.yohoufo.order.service.impl.BuyerOrderViewService; | ||
22 | import com.yohoufo.order.service.impl.SellerOrderService; | 23 | import com.yohoufo.order.service.impl.SellerOrderService; |
23 | import com.yohoufo.order.utils.LoggerUtils; | 24 | import com.yohoufo.order.utils.LoggerUtils; |
24 | import org.slf4j.Logger; | 25 | import org.slf4j.Logger; |
@@ -46,6 +47,9 @@ public class ErpGWOrderController { | @@ -46,6 +47,9 @@ public class ErpGWOrderController { | ||
46 | @Autowired | 47 | @Autowired |
47 | BuyerOrderCancelService buyerOrderCancelService; | 48 | BuyerOrderCancelService buyerOrderCancelService; |
48 | 49 | ||
50 | + @Autowired | ||
51 | + private BuyerOrderViewService buyerOrderViewService; | ||
52 | + | ||
49 | @RequestMapping(params = "method=ufo.buyer.orderNums") | 53 | @RequestMapping(params = "method=ufo.buyer.orderNums") |
50 | @IgnoreSession | 54 | @IgnoreSession |
51 | public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){ | 55 | public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){ |
@@ -83,7 +87,7 @@ public class ErpGWOrderController { | @@ -83,7 +87,7 @@ public class ErpGWOrderController { | ||
83 | case BUY: | 87 | case BUY: |
84 | orderListRequest.setType(OrderListType.ALL.getType()); // 默认全部 | 88 | orderListRequest.setType(OrderListType.ALL.getType()); // 默认全部 |
85 | //TODO 换成独立的service 继承共同的抽象服务类, 除了必要的复用,尽量从service 到 dao 独立隔离; | 89 | //TODO 换成独立的service 继承共同的抽象服务类, 除了必要的复用,尽量从service 到 dao 独立隔离; |
86 | - orderListInfoRsp = buyerOrderService.getOrderListForErpGW(orderListRequest); | 90 | + orderListInfoRsp = buyerOrderViewService.getOrderListForErpGW(orderListRequest); |
87 | break; | 91 | break; |
88 | case SELL: | 92 | case SELL: |
89 | orderListRequest.setType(SellerOrderListType.ALL.getType()); // 默认全部 | 93 | orderListRequest.setType(SellerOrderListType.ALL.getType()); // 默认全部 |
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.annotation.JSONField; | @@ -4,6 +4,8 @@ import com.alibaba.fastjson.annotation.JSONField; | ||
4 | import lombok.Getter; | 4 | import lombok.Getter; |
5 | import lombok.Setter; | 5 | import lombok.Setter; |
6 | 6 | ||
7 | +import java.math.BigDecimal; | ||
8 | + | ||
7 | /** | 9 | /** |
8 | * Created by li.ma on 2018/9/27. | 10 | * Created by li.ma on 2018/9/27. |
9 | */ | 11 | */ |
@@ -21,6 +23,9 @@ public class AppraiseAddressResp { | @@ -21,6 +23,9 @@ public class AppraiseAddressResp { | ||
21 | 23 | ||
22 | @JSONField(name="id") | 24 | @JSONField(name="id") |
23 | private Integer type; | 25 | private Integer type; |
26 | + | ||
27 | + @Getter@Setter | ||
28 | + private BigDecimal shipFee; | ||
24 | /** | 29 | /** |
25 | * 是否变更 | 30 | * 是否变更 |
26 | */ | 31 | */ |
@@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes; | @@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes; | ||
9 | import com.yohobuy.ufo.model.order.common.OrderCodeType; | 9 | import com.yohobuy.ufo.model.order.common.OrderCodeType; |
10 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 10 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
11 | import com.yohobuy.ufo.model.order.common.TabType; | 11 | import com.yohobuy.ufo.model.order.common.TabType; |
12 | +import com.yohobuy.ufo.model.order.constants.SkupType; | ||
12 | import com.yohoufo.common.alarm.EventBusPublisher; | 13 | import com.yohoufo.common.alarm.EventBusPublisher; |
13 | import com.yohoufo.common.utils.DateUtil; | 14 | import com.yohoufo.common.utils.DateUtil; |
14 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | 15 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; |
@@ -17,8 +18,6 @@ import com.yohoufo.dal.order.BuyerOrderMetaMapper; | @@ -17,8 +18,6 @@ import com.yohoufo.dal.order.BuyerOrderMetaMapper; | ||
17 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; | 18 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; |
18 | import com.yohoufo.dal.order.model.*; | 19 | import com.yohoufo.dal.order.model.*; |
19 | import com.yohoufo.order.constants.MetaKey; | 20 | import com.yohoufo.order.constants.MetaKey; |
20 | -import com.yohoufo.order.service.impl.TradeBillsService; | ||
21 | -import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; | ||
22 | import com.yohoufo.order.event.DeliverNoticeEvent; | 21 | import com.yohoufo.order.event.DeliverNoticeEvent; |
23 | import com.yohoufo.order.event.ErpBuyerOrderEvent; | 22 | import com.yohoufo.order.event.ErpBuyerOrderEvent; |
24 | import com.yohoufo.order.event.SellerCancelDeliverEvent; | 23 | import com.yohoufo.order.event.SellerCancelDeliverEvent; |
@@ -30,6 +29,8 @@ import com.yohoufo.order.service.cache.CacheCleaner; | @@ -30,6 +29,8 @@ import com.yohoufo.order.service.cache.CacheCleaner; | ||
30 | import com.yohoufo.order.service.cache.CacheKeyBuilder; | 29 | import com.yohoufo.order.service.cache.CacheKeyBuilder; |
31 | import com.yohoufo.order.service.impl.MetaConfigService; | 30 | import com.yohoufo.order.service.impl.MetaConfigService; |
32 | import com.yohoufo.order.service.impl.OrderOverTimeService; | 31 | import com.yohoufo.order.service.impl.OrderOverTimeService; |
32 | +import com.yohoufo.order.service.impl.TradeBillsService; | ||
33 | +import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; | ||
33 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; | 34 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; |
34 | import com.yohoufo.order.service.proxy.DeliveryMinutesService; | 35 | import com.yohoufo.order.service.proxy.DeliveryMinutesService; |
35 | import com.yohoufo.order.service.proxy.InBoxFacade; | 36 | import com.yohoufo.order.service.proxy.InBoxFacade; |
@@ -42,7 +43,6 @@ import org.slf4j.LoggerFactory; | @@ -42,7 +43,6 @@ import org.slf4j.LoggerFactory; | ||
42 | import org.springframework.beans.factory.annotation.Autowired; | 43 | import org.springframework.beans.factory.annotation.Autowired; |
43 | import org.springframework.stereotype.Service; | 44 | import org.springframework.stereotype.Service; |
44 | 45 | ||
45 | -import java.math.BigDecimal; | ||
46 | import java.util.Arrays; | 46 | import java.util.Arrays; |
47 | import java.util.List; | 47 | import java.util.List; |
48 | import java.util.concurrent.TimeUnit; | 48 | import java.util.concurrent.TimeUnit; |
@@ -90,6 +90,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -90,6 +90,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
90 | @Autowired | 90 | @Autowired |
91 | private TradeBillsService tradeBillsService; | 91 | private TradeBillsService tradeBillsService; |
92 | 92 | ||
93 | + @Autowired | ||
94 | + private DepositService depositService; | ||
95 | + | ||
93 | /** | 96 | /** |
94 | * 更新订单状态 | 97 | * 更新订单状态 |
95 | * @param orderInfo | 98 | * @param orderInfo |
@@ -124,8 +127,27 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -124,8 +127,27 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
124 | return result; | 127 | return result; |
125 | } | 128 | } |
126 | 129 | ||
127 | - private void processInStockOrder(OrderInfo orderInfo,BuyerOrderGoods buyerOrderGoods, | ||
128 | - SellerOrderGoods sellerOrderGoods){ | 130 | + private void processDepositOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){ |
131 | + //寄存订单 & 闪购商品 | ||
132 | + if (SkupType.QUICK_DELIVER.getCode() == sellerOrderGoods.getAttributes()){ | ||
133 | + Integer sellerUid = null; | ||
134 | + Integer buyerUid = null; | ||
135 | + Long orderCode = null; | ||
136 | + Integer skup = null; | ||
137 | + try { | ||
138 | + depositService.changeOwner(sellerUid = buyerOrder.getSellerUid(), skup = sellerOrderGoods.getId(), | ||
139 | + orderCode = buyerOrder.getOrderCode(), buyerUid = buyerOrder.getUid()); | ||
140 | + }catch (Exception ex){ | ||
141 | + logger.warn("pay successful, processDepositOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}", | ||
142 | + sellerUid, buyerUid, orderCode, skup); | ||
143 | + } | ||
144 | + | ||
145 | + } | ||
146 | + processInStockOrder(buyerOrder, sellerOrderGoods); | ||
147 | + | ||
148 | + } | ||
149 | + | ||
150 | + private void processInStockOrder(BuyerOrder orderInfo, SellerOrderGoods sellerOrderGoods){ | ||
129 | Integer uid = orderInfo.getUid(); | 151 | Integer uid = orderInfo.getUid(); |
130 | Integer sellerUid = orderInfo.getSellerUid(); | 152 | Integer sellerUid = orderInfo.getSellerUid(); |
131 | long orderCode = orderInfo.getOrderCode(); | 153 | long orderCode = orderInfo.getOrderCode(); |
@@ -154,7 +176,7 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -154,7 +176,7 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
154 | /** | 176 | /** |
155 | * 预售 | 177 | * 预售 |
156 | */ | 178 | */ |
157 | - private void processPreSaleOrder(OrderInfo orderInfo,SellerOrderGoods sellerOrderGoods){ | 179 | + private void processPreSaleOrder(BuyerOrder orderInfo,SellerOrderGoods sellerOrderGoods){ |
158 | // 立即消息通知 | 180 | // 立即消息通知 |
159 | Integer uid = orderInfo.getUid(); | 181 | Integer uid = orderInfo.getUid(); |
160 | long orderCode = orderInfo.getOrderCode(); | 182 | long orderCode = orderInfo.getOrderCode(); |
@@ -174,6 +196,11 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -174,6 +196,11 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
174 | orderOverTimeService.insertDeliveryTime(new OrderOverTime(orderCode, ts + secondsOfLimit, minutes)); | 196 | orderOverTimeService.insertDeliveryTime(new OrderOverTime(orderCode, ts + secondsOfLimit, minutes)); |
175 | } | 197 | } |
176 | 198 | ||
199 | + private void processQuickDeliverOrder(BuyerOrder orderInfo, SellerOrderGoods sellerOrderGoods){ | ||
200 | + | ||
201 | + | ||
202 | + } | ||
203 | + | ||
177 | @Override | 204 | @Override |
178 | public void processAfterPay(OrderInfo orderInfo) { | 205 | public void processAfterPay(OrderInfo orderInfo) { |
179 | Integer uid = orderInfo.getUid(); | 206 | Integer uid = orderInfo.getUid(); |
@@ -206,16 +233,20 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -206,16 +233,20 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
206 | case COMMON_IN_STOCK: | 233 | case COMMON_IN_STOCK: |
207 | case FLAW: | 234 | case FLAW: |
208 | case SECOND_HAND: | 235 | case SECOND_HAND: |
209 | - processInStockOrder(orderInfo, buyerOrderGoods, sellerOrderGoods); | 236 | + default: |
237 | + processInStockOrder(buyerOrder, sellerOrderGoods); | ||
210 | break; | 238 | break; |
211 | case ADVANCE_SALE: | 239 | case ADVANCE_SALE: |
212 | - processPreSaleOrder(orderInfo, sellerOrderGoods); | 240 | + processPreSaleOrder(buyerOrder, sellerOrderGoods); |
213 | break; | 241 | break; |
214 | case OFFLINE: | 242 | case OFFLINE: |
215 | //门店ufo订单这里啥都不干 | 243 | //门店ufo订单这里啥都不干 |
216 | break; | 244 | break; |
217 | - default: | ||
218 | - processInStockOrder(orderInfo, buyerOrderGoods, sellerOrderGoods); | 245 | + case QUICK_DELIVER: |
246 | + processQuickDeliverOrder(buyerOrder, sellerOrderGoods); | ||
247 | + break; | ||
248 | + case DEPOSITE: | ||
249 | + processDepositOrder(buyerOrder, sellerOrderGoods); | ||
219 | break; | 250 | break; |
220 | } | 251 | } |
221 | 252 |
@@ -33,7 +33,7 @@ public interface DepositService { | @@ -33,7 +33,7 @@ public interface DepositService { | ||
33 | 33 | ||
34 | 34 | ||
35 | // 转卖 | 35 | // 转卖 |
36 | - boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid); | 36 | + boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid, boolean isDeposit); |
37 | // 可上架数量 | 37 | // 可上架数量 |
38 | int getDepositOffShelvesCount(Integer uid, Integer storageId); | 38 | int getDepositOffShelvesCount(Integer uid, Integer storageId); |
39 | // 可上架数量 | 39 | // 可上架数量 |
@@ -4,14 +4,12 @@ import com.yohobuy.ufo.model.order.common.OrderListType; | @@ -4,14 +4,12 @@ import com.yohobuy.ufo.model.order.common.OrderListType; | ||
4 | import com.yohobuy.ufo.model.order.resp.BuyerOrderNums; | 4 | import com.yohobuy.ufo.model.order.resp.BuyerOrderNums; |
5 | import com.yohobuy.ufo.model.order.resp.OrderCancelComputeResult; | 5 | import com.yohobuy.ufo.model.order.resp.OrderCancelComputeResult; |
6 | import com.yohobuy.ufo.model.order.resp.OrderCntResp; | 6 | import com.yohobuy.ufo.model.order.resp.OrderCntResp; |
7 | -import com.yohobuy.ufo.model.order.resp.PageResp; | ||
8 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 7 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
9 | -import com.yohoufo.order.model.request.OrderListRequest; | ||
10 | import com.yohoufo.order.model.request.OrderRequest; | 8 | import com.yohoufo.order.model.request.OrderRequest; |
11 | import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; | 9 | import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; |
12 | import com.yohoufo.order.model.response.OrderSummaryResp; | 10 | import com.yohoufo.order.model.response.OrderSummaryResp; |
13 | 11 | ||
14 | -public interface IBuyerOrderService extends IOrderListService, IOrderDetailService{ | 12 | +public interface IBuyerOrderService { |
15 | 13 | ||
16 | 14 | ||
17 | /** | 15 | /** |
@@ -66,6 +64,5 @@ public interface IBuyerOrderService extends IOrderListService, IOrderDetailServi | @@ -66,6 +64,5 @@ public interface IBuyerOrderService extends IOrderListService, IOrderDetailServi | ||
66 | 64 | ||
67 | OrderCntResp getOrderCnt(OrderRequest req, OrderListType listType); | 65 | OrderCntResp getOrderCnt(OrderRequest req, OrderListType listType); |
68 | 66 | ||
69 | - OrderCancelComputeResult cancelCompute(OrderRequest orderRequest); | ||
70 | 67 | ||
71 | } | 68 | } |
@@ -81,19 +81,11 @@ public interface IExpressInfoService { | @@ -81,19 +81,11 @@ public interface IExpressInfoService { | ||
81 | AppraiseAddressResp noticeAppraiseAddressChanged(Integer uid, Long orderCode); | 81 | AppraiseAddressResp noticeAppraiseAddressChanged(Integer uid, Long orderCode); |
82 | 82 | ||
83 | 83 | ||
84 | - /** | ||
85 | - * 根据订单号获取快递类型 | ||
86 | - * 1:卖家到鉴定中心 | ||
87 | - * 2:鉴定中心到买家 | ||
88 | - * 3:鉴定中心退回到卖家 | ||
89 | - * | ||
90 | - * @param orderCode | ||
91 | - * @return | ||
92 | - */ | ||
93 | - //Integer getExpressType(Long orderCode); | 84 | + |
85 | + AppraiseAddressResp queryByUserAddress(int uid,String addressId); | ||
86 | + | ||
94 | 87 | ||
95 | 88 | ||
96 | - //ExpressInfoRespBo queryLastExpressDetailInfo(Long orderCode,int type); | ||
97 | 89 | ||
98 | ExpressInfoDetail getLastExpressInfoDetail(TabType actor,int status, Long orderCode); | 90 | ExpressInfoDetail getLastExpressInfoDetail(TabType actor,int status, Long orderCode); |
99 | 91 |
@@ -20,6 +20,7 @@ import java.security.SecureRandom; | @@ -20,6 +20,7 @@ import java.security.SecureRandom; | ||
20 | import java.util.*; | 20 | import java.util.*; |
21 | import java.util.concurrent.TimeUnit; | 21 | import java.util.concurrent.TimeUnit; |
22 | import java.util.function.Function; | 22 | import java.util.function.Function; |
23 | +import java.util.function.Supplier; | ||
23 | import java.util.stream.Collectors; | 24 | import java.util.stream.Collectors; |
24 | 25 | ||
25 | /** | 26 | /** |
@@ -95,12 +96,16 @@ public class AppraiseAddressService { | @@ -95,12 +96,16 @@ public class AppraiseAddressService { | ||
95 | List<AppraiseAddressResp> appraiseAddressResps = queryAddressInfoList(); | 96 | List<AppraiseAddressResp> appraiseAddressResps = queryAddressInfoList(); |
96 | 97 | ||
97 | if (CollectionUtils.isEmpty(appraiseAddressResps)) { | 98 | if (CollectionUtils.isEmpty(appraiseAddressResps)) { |
99 | + return buildDefaultNanJingDepot(); | ||
100 | + } | ||
101 | + return appraiseAddressResps.get(0); | ||
102 | + } | ||
103 | + | ||
104 | + private AppraiseAddressResp buildDefaultNanJingDepot(){ | ||
98 | return new AppraiseAddressResp.builder().setMobile(DEFAULT_MOBILE).setType(0) | 105 | return new AppraiseAddressResp.builder().setMobile(DEFAULT_MOBILE).setType(0) |
99 | .setAddressName(addressName) | 106 | .setAddressName(addressName) |
100 | .setAddress(address).build(); | 107 | .setAddress(address).build(); |
101 | } | 108 | } |
102 | - return appraiseAddressResps.get(0); | ||
103 | - } | ||
104 | 109 | ||
105 | 110 | ||
106 | // 根据默认鉴定中心地址 | 111 | // 根据默认鉴定中心地址 |
@@ -129,6 +134,18 @@ public class AppraiseAddressService { | @@ -129,6 +134,18 @@ public class AppraiseAddressService { | ||
129 | return value; | 134 | return value; |
130 | } | 135 | } |
131 | 136 | ||
137 | + public AppraiseAddressResp findByDepotType(int type){ | ||
138 | + List<AppraiseAddressResp> aas = queryAddressInfoList(); | ||
139 | + Supplier<AppraiseAddressResp> aarSupplier ; | ||
140 | + if (type == DepotType.NJ.getCode()){ | ||
141 | + aarSupplier = this::buildDefaultNanJingDepot; | ||
142 | + }else{ | ||
143 | + aarSupplier = this::queryInitAddress; | ||
144 | + } | ||
145 | + return aas.stream().filter(aar-> aar.getType() == type).findAny().orElseGet(aarSupplier); | ||
146 | + } | ||
147 | + | ||
148 | + | ||
132 | public Map<Integer, AppraiseAddress> buildCodeAppraiseAddressMap(){ | 149 | public Map<Integer, AppraiseAddress> buildCodeAppraiseAddressMap(){ |
133 | Map<Integer, AppraiseAddress> result = new CacheDataConvert<Map<Integer, AppraiseAddress>>() | 150 | Map<Integer, AppraiseAddress> result = new CacheDataConvert<Map<Integer, AppraiseAddress>>() |
134 | .convert(CACHE_KEY, MAP_CACHE_KEY); | 151 | .convert(CACHE_KEY, MAP_CACHE_KEY); |
@@ -6,9 +6,9 @@ import com.yoho.error.ServiceError; | @@ -6,9 +6,9 @@ import com.yoho.error.ServiceError; | ||
6 | import com.yoho.error.exception.ServiceException; | 6 | import com.yoho.error.exception.ServiceException; |
7 | import com.yohobuy.ufo.model.order.common.*; | 7 | import com.yohobuy.ufo.model.order.common.*; |
8 | import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; | 8 | import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; |
9 | -import com.yohobuy.ufo.model.order.resp.*; | 9 | +import com.yohobuy.ufo.model.order.resp.BuyerOrderNums; |
10 | +import com.yohobuy.ufo.model.order.resp.OrderCntResp; | ||
10 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 11 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
11 | -import com.yohobuy.ufo.model.order.vo.OrderListVo; | ||
12 | import com.yohoufo.common.alarm.EventBusPublisher; | 12 | import com.yohoufo.common.alarm.EventBusPublisher; |
13 | import com.yohoufo.common.exception.UfoServiceException; | 13 | import com.yohoufo.common.exception.UfoServiceException; |
14 | import com.yohoufo.common.utils.DateUtil; | 14 | import com.yohoufo.common.utils.DateUtil; |
@@ -22,14 +22,10 @@ import com.yohoufo.dal.product.ProductMapper; | @@ -22,14 +22,10 @@ import com.yohoufo.dal.product.ProductMapper; | ||
22 | import com.yohoufo.dal.product.model.Product; | 22 | import com.yohoufo.dal.product.model.Product; |
23 | import com.yohoufo.order.common.ActionStatusHold; | 23 | import com.yohoufo.order.common.ActionStatusHold; |
24 | import com.yohoufo.order.common.DelStatus; | 24 | import com.yohoufo.order.common.DelStatus; |
25 | -import com.yohobuy.ufo.model.order.common.Payment; | ||
26 | import com.yohoufo.order.event.*; | 25 | import com.yohoufo.order.event.*; |
27 | import com.yohoufo.order.model.PayQueryBo; | 26 | import com.yohoufo.order.model.PayQueryBo; |
28 | -import com.yohoufo.order.model.dto.BuyerPenaltyCalResult; | ||
29 | -import com.yohoufo.order.model.request.OrderListRequest; | ||
30 | import com.yohoufo.order.model.request.OrderRequest; | 27 | import com.yohoufo.order.model.request.OrderRequest; |
31 | import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; | 28 | import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; |
32 | -import com.yohoufo.order.model.response.OrderDetailInfo; | ||
33 | import com.yohoufo.order.model.response.OrderSummaryResp; | 29 | import com.yohoufo.order.model.response.OrderSummaryResp; |
34 | import com.yohoufo.order.service.IBuyerOrderMetaService; | 30 | import com.yohoufo.order.service.IBuyerOrderMetaService; |
35 | import com.yohoufo.order.service.IBuyerOrderService; | 31 | import com.yohoufo.order.service.IBuyerOrderService; |
@@ -38,7 +34,6 @@ import com.yohoufo.order.service.IPaymentService; | @@ -38,7 +34,6 @@ import com.yohoufo.order.service.IPaymentService; | ||
38 | import com.yohoufo.order.service.cache.CacheCleaner; | 34 | import com.yohoufo.order.service.cache.CacheCleaner; |
39 | import com.yohoufo.order.service.cache.CacheKeyBuilder; | 35 | import com.yohoufo.order.service.cache.CacheKeyBuilder; |
40 | import com.yohoufo.order.service.cache.OrderCacheService; | 36 | import com.yohoufo.order.service.cache.OrderCacheService; |
41 | -import com.yohoufo.order.service.handler.BuyerCancelCompensateComputeHandler; | ||
42 | import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; | 37 | import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; |
43 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; | 38 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; |
44 | import com.yohoufo.order.service.pay.AbstractPayService; | 39 | import com.yohoufo.order.service.pay.AbstractPayService; |
@@ -53,7 +48,6 @@ import org.slf4j.Logger; | @@ -53,7 +48,6 @@ import org.slf4j.Logger; | ||
53 | import org.springframework.beans.factory.annotation.Autowired; | 48 | import org.springframework.beans.factory.annotation.Autowired; |
54 | import org.springframework.stereotype.Service; | 49 | import org.springframework.stereotype.Service; |
55 | 50 | ||
56 | -import java.math.BigDecimal; | ||
57 | import java.util.*; | 51 | import java.util.*; |
58 | import java.util.stream.Collectors; | 52 | import java.util.stream.Collectors; |
59 | 53 | ||
@@ -72,12 +66,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -72,12 +66,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
72 | SellerOrderGoodsMapper sellerOrderGoodsMapper; | 66 | SellerOrderGoodsMapper sellerOrderGoodsMapper; |
73 | 67 | ||
74 | @Autowired | 68 | @Autowired |
75 | - private BuyerOrderListServiceImpl buyerOrderListService; | ||
76 | - | ||
77 | - @Autowired | ||
78 | - private BuyerOrderDetailService buyerOrderDetailService; | ||
79 | - | ||
80 | - @Autowired | ||
81 | private ProductProxyService productProxyService; | 69 | private ProductProxyService productProxyService; |
82 | 70 | ||
83 | @Autowired | 71 | @Autowired |
@@ -107,8 +95,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -107,8 +95,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
107 | @Autowired | 95 | @Autowired |
108 | private QualityCheckMapper qualityCheckMapper; | 96 | private QualityCheckMapper qualityCheckMapper; |
109 | 97 | ||
110 | - @Autowired | ||
111 | - private BuyerCancelCompensateComputeHandler buyerCancelCompensateComputeHandler; | ||
112 | 98 | ||
113 | @Autowired | 99 | @Autowired |
114 | private ProductMapper productMapper; | 100 | private ProductMapper productMapper; |
@@ -493,11 +479,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -493,11 +479,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
493 | } | 479 | } |
494 | 480 | ||
495 | 481 | ||
496 | - private class DataNode{ | 482 | + class DataNode{ |
497 | BuyerOrder buyerOrderInDB; | 483 | BuyerOrder buyerOrderInDB; |
498 | } | 484 | } |
499 | 485 | ||
500 | - private DataNode checkBase(OrderRequest orderRequest){ | 486 | + DataNode checkBase(OrderRequest orderRequest){ |
501 | // 参数检查 | 487 | // 参数检查 |
502 | if (orderRequest.getUid() < 0 | 488 | if (orderRequest.getUid() < 0 |
503 | || orderRequest.getOrderCode() < 0){ | 489 | || orderRequest.getOrderCode() < 0){ |
@@ -554,10 +540,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -554,10 +540,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
554 | } | 540 | } |
555 | 541 | ||
556 | 542 | ||
557 | - @Override | ||
558 | - public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) { | ||
559 | - return buyerOrderDetailService.getOrderDetail(orderRequest); | ||
560 | - } | 543 | + |
561 | 544 | ||
562 | 545 | ||
563 | /** | 546 | /** |
@@ -614,40 +597,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -614,40 +597,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
614 | return sum; | 597 | return sum; |
615 | } | 598 | } |
616 | 599 | ||
617 | - @Override | ||
618 | - public PageResp getOrderListForErpGW(OrderListRequest request) { | ||
619 | - return buyerOrderListService.getOrderListForErpGW(request); | ||
620 | - } | ||
621 | 600 | ||
622 | - @Override | ||
623 | - public PageResp getOrderList(OrderListRequest request, boolean isPlatform) { | ||
624 | - | ||
625 | - OrderListVo orderListVo = orderCacheService.getOrderListInfos(request); | ||
626 | - PageResp.PageRespBuilder respBuilder; | ||
627 | - if (Objects.nonNull(orderListVo)){ | ||
628 | - respBuilder = PageResp.builder() | ||
629 | - .page(request.getPage()) | ||
630 | - .pageSize(orderListVo.getPageSize()) | ||
631 | - .total(orderListVo.getTotal()) | ||
632 | - .pagetotal(orderListVo.getPagetotal()); | ||
633 | - List<OrderListInfo> oliList = orderListVo.getOrderList(); | ||
634 | - buyerOrderListService.resetDynamicProporties(oliList, request.getType()); | ||
635 | - return respBuilder.data(oliList).build(); | ||
636 | - } | ||
637 | - PageResp orderListInfoRsp = buyerOrderListService.getOrderList(request, isPlatform); | ||
638 | - | ||
639 | - if (orderListInfoRsp != null){ | ||
640 | - | ||
641 | - | ||
642 | - orderListVo = OrderListVo.builder().page(orderListInfoRsp.getPage()) | ||
643 | - .pageSize(orderListInfoRsp.getPageSize()) | ||
644 | - .orderList(orderListInfoRsp.getData()) | ||
645 | - .total(orderListInfoRsp.getTotal()) | ||
646 | - .pagetotal(orderListInfoRsp.getPagetotal()).build(); | ||
647 | - orderCacheService.cacheOrderList(request, orderListVo); | ||
648 | - } | ||
649 | - return orderListInfoRsp; | ||
650 | - } | ||
651 | 601 | ||
652 | 602 | ||
653 | /** | 603 | /** |
@@ -861,62 +811,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -861,62 +811,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
861 | return resp; | 811 | return resp; |
862 | } | 812 | } |
863 | 813 | ||
864 | - @Override | ||
865 | - public OrderCancelComputeResult cancelCompute(OrderRequest orderRequest) { | ||
866 | - DataNode node = checkBase(orderRequest); | ||
867 | - BuyerOrder buyerOrder = node.buyerOrderInDB; | ||
868 | - Integer orderStatus = buyerOrder.getStatus(); | ||
869 | - OrderStatus expectStatus = null ; | ||
870 | - if (orderStatus == null || (expectStatus = OrderStatus.getOrderStatus(orderStatus))== null){ | ||
871 | - logger.warn("in buyer cancelCompute check orderStatus fail, orderStatus {} expectStatus {}", orderStatus,expectStatus ); | ||
872 | - throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); | ||
873 | - } | ||
874 | - logger.info("in buyer cancelCompute, req {} expectStatus {}", orderRequest, expectStatus); | ||
875 | - //case 1 :支付前 | ||
876 | - //case 2 :支付后,卖家发货前 | ||
877 | - //case 3 :卖家发货后,鉴定中心接受前 | ||
878 | - OrderStatus targetStatus = null; | ||
879 | - BuyerPenaltyCalResult bpcr = null; | ||
880 | - OrderCancelComputeResult occr = null; | ||
881 | - switch (expectStatus){ | ||
882 | - case WAITING_PAY: | ||
883 | - targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_PAY; | ||
884 | - occr = OrderCancelComputeResult.builder() | ||
885 | - .confirmDesc("确定取消订单?").build(); | ||
886 | - break; | ||
887 | - case HAS_PAYED: | ||
888 | - targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER; | ||
889 | - bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, | ||
890 | - buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(),buyerOrder.getOrderCode()), | ||
891 | - targetStatus); | ||
892 | - occr = bpcr2occr(bpcr); | ||
893 | - occr.setNeedPenalty(true); | ||
894 | - break; | ||
895 | - case SELLER_SEND_OUT: | ||
896 | - targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE; | ||
897 | - bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, | ||
898 | - buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(),buyerOrder.getOrderCode()), | ||
899 | - targetStatus); | ||
900 | - occr = bpcr2occr(bpcr); | ||
901 | - occr.setNeedPenalty(true); | ||
902 | - break; | ||
903 | - } | ||
904 | - return occr; | ||
905 | - } | ||
906 | - | ||
907 | - private OrderCancelComputeResult bpcr2occr(BuyerPenaltyCalResult bpcr){ | ||
908 | - String currencyUnit = "元"; | ||
909 | - String orderPrice = bpcr.getOrderActualAmount().toPlainString() + currencyUnit; | ||
910 | - String penaltyRate = bpcr.getPenaltyRate().multiply(new BigDecimal(100)).toPlainString() + "%"; | ||
911 | - String penaltyAmount = "-"+bpcr.getPenaltyAmount().toPlainString() + currencyUnit; | ||
912 | - String refundAmount = bpcr.getLeftAmount().toPlainString() + currencyUnit; | ||
913 | - OrderCancelComputeResult occr = OrderCancelComputeResult.builder() | ||
914 | - .orderPrice(orderPrice) | ||
915 | - .penaltyRate(penaltyRate) | ||
916 | - .penaltyAmount(penaltyAmount) | ||
917 | - .refundAmount(refundAmount) | ||
918 | - .showPrice(true) | ||
919 | - .build(); | ||
920 | - return occr; | ||
921 | - } | 814 | + |
815 | + | ||
816 | + | ||
922 | } | 817 | } |
1 | +package com.yohoufo.order.service.impl; | ||
2 | + | ||
3 | +import com.yoho.error.ServiceError; | ||
4 | +import com.yoho.error.exception.ServiceException; | ||
5 | +import com.yohobuy.ufo.model.order.common.OrderStatus; | ||
6 | +import com.yohobuy.ufo.model.order.resp.OrderCancelComputeResult; | ||
7 | +import com.yohobuy.ufo.model.order.resp.OrderListInfo; | ||
8 | +import com.yohobuy.ufo.model.order.resp.PageResp; | ||
9 | +import com.yohobuy.ufo.model.order.vo.OrderListVo; | ||
10 | +import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | ||
11 | +import com.yohoufo.dal.order.model.BuyerOrder; | ||
12 | +import com.yohoufo.order.model.dto.BuyerPenaltyCalResult; | ||
13 | +import com.yohoufo.order.model.request.OrderListRequest; | ||
14 | +import com.yohoufo.order.model.request.OrderRequest; | ||
15 | +import com.yohoufo.order.model.response.OrderDetailInfo; | ||
16 | +import com.yohoufo.order.service.IOrderDetailService; | ||
17 | +import com.yohoufo.order.service.IOrderListService; | ||
18 | +import com.yohoufo.order.service.cache.OrderCacheService; | ||
19 | +import com.yohoufo.order.service.handler.BuyerCancelCompensateComputeHandler; | ||
20 | +import com.yohoufo.order.utils.LoggerUtils; | ||
21 | +import org.slf4j.Logger; | ||
22 | +import org.springframework.beans.factory.annotation.Autowired; | ||
23 | +import org.springframework.stereotype.Service; | ||
24 | + | ||
25 | +import java.math.BigDecimal; | ||
26 | +import java.util.List; | ||
27 | +import java.util.Objects; | ||
28 | + | ||
29 | +@Service | ||
30 | +public class BuyerOrderViewService implements IOrderListService, IOrderDetailService { | ||
31 | + | ||
32 | + private final Logger logger = LoggerUtils.getBuyerOrderLogger(); | ||
33 | + | ||
34 | + @Autowired | ||
35 | + private BuyerOrderListServiceImpl buyerOrderListService; | ||
36 | + | ||
37 | + @Autowired | ||
38 | + private BuyerOrderDetailService buyerOrderDetailService; | ||
39 | + | ||
40 | + | ||
41 | + @Autowired | ||
42 | + private OrderCacheService orderCacheService; | ||
43 | + | ||
44 | + @Autowired | ||
45 | + private BuyerOrderServiceImpl buyerOrderService; | ||
46 | + | ||
47 | + @Autowired | ||
48 | + private BuyerCancelCompensateComputeHandler buyerCancelCompensateComputeHandler; | ||
49 | + | ||
50 | + @Autowired | ||
51 | + BuyerOrderGoodsMapper buyerOrderGoodsMapper; | ||
52 | + | ||
53 | + | ||
54 | + @Override | ||
55 | + public PageResp getOrderListForErpGW(OrderListRequest request) { | ||
56 | + return buyerOrderListService.getOrderListForErpGW(request); | ||
57 | + } | ||
58 | + | ||
59 | + @Override | ||
60 | + public PageResp getOrderList(OrderListRequest request, boolean isPlatform) { | ||
61 | + | ||
62 | + OrderListVo orderListVo = orderCacheService.getOrderListInfos(request); | ||
63 | + PageResp.PageRespBuilder respBuilder; | ||
64 | + if (Objects.nonNull(orderListVo)){ | ||
65 | + respBuilder = PageResp.builder() | ||
66 | + .page(request.getPage()) | ||
67 | + .pageSize(orderListVo.getPageSize()) | ||
68 | + .total(orderListVo.getTotal()) | ||
69 | + .pagetotal(orderListVo.getPagetotal()); | ||
70 | + List<OrderListInfo> oliList = orderListVo.getOrderList(); | ||
71 | + buyerOrderListService.resetDynamicProporties(oliList, request.getType()); | ||
72 | + return respBuilder.data(oliList).build(); | ||
73 | + } | ||
74 | + PageResp orderListInfoRsp = buyerOrderListService.getOrderList(request, isPlatform); | ||
75 | + | ||
76 | + if (orderListInfoRsp != null){ | ||
77 | + | ||
78 | + | ||
79 | + orderListVo = OrderListVo.builder().page(orderListInfoRsp.getPage()) | ||
80 | + .pageSize(orderListInfoRsp.getPageSize()) | ||
81 | + .orderList(orderListInfoRsp.getData()) | ||
82 | + .total(orderListInfoRsp.getTotal()) | ||
83 | + .pagetotal(orderListInfoRsp.getPagetotal()).build(); | ||
84 | + orderCacheService.cacheOrderList(request, orderListVo); | ||
85 | + } | ||
86 | + return orderListInfoRsp; | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) { | ||
91 | + return buyerOrderDetailService.getOrderDetail(orderRequest); | ||
92 | + } | ||
93 | + | ||
94 | + public OrderCancelComputeResult cancelCompute(OrderRequest orderRequest) { | ||
95 | + BuyerOrderServiceImpl.DataNode node = buyerOrderService.checkBase(orderRequest); | ||
96 | + BuyerOrder buyerOrder = node.buyerOrderInDB; | ||
97 | + Integer orderStatus = buyerOrder.getStatus(); | ||
98 | + OrderStatus expectStatus = null ; | ||
99 | + if (orderStatus == null || (expectStatus = OrderStatus.getOrderStatus(orderStatus))== null){ | ||
100 | + logger.warn("in buyer cancelCompute check orderStatus fail, orderStatus {} expectStatus {}", orderStatus,expectStatus ); | ||
101 | + throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); | ||
102 | + } | ||
103 | + logger.info("in buyer cancelCompute, req {} expectStatus {}", orderRequest, expectStatus); | ||
104 | + //case 1 :支付前 | ||
105 | + //case 2 :支付后,卖家发货前 | ||
106 | + //case 3 :卖家发货后,鉴定中心接受前 | ||
107 | + OrderStatus targetStatus = null; | ||
108 | + BuyerPenaltyCalResult bpcr = null; | ||
109 | + OrderCancelComputeResult occr = null; | ||
110 | + switch (expectStatus){ | ||
111 | + case WAITING_PAY: | ||
112 | + targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_PAY; | ||
113 | + occr = OrderCancelComputeResult.builder() | ||
114 | + .confirmDesc("确定取消订单?").build(); | ||
115 | + break; | ||
116 | + case HAS_PAYED: | ||
117 | + targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER; | ||
118 | + bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, | ||
119 | + buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(),buyerOrder.getOrderCode()), | ||
120 | + targetStatus); | ||
121 | + occr = bpcr2occr(bpcr); | ||
122 | + occr.setNeedPenalty(true); | ||
123 | + break; | ||
124 | + case SELLER_SEND_OUT: | ||
125 | + targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE; | ||
126 | + bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, | ||
127 | + buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(),buyerOrder.getOrderCode()), | ||
128 | + targetStatus); | ||
129 | + occr = bpcr2occr(bpcr); | ||
130 | + occr.setNeedPenalty(true); | ||
131 | + break; | ||
132 | + } | ||
133 | + return occr; | ||
134 | + } | ||
135 | + | ||
136 | + private OrderCancelComputeResult bpcr2occr(BuyerPenaltyCalResult bpcr){ | ||
137 | + String currencyUnit = "元"; | ||
138 | + String orderPrice = bpcr.getOrderActualAmount().toPlainString() + currencyUnit; | ||
139 | + String penaltyRate = bpcr.getPenaltyRate().multiply(new BigDecimal(100)).toPlainString() + "%"; | ||
140 | + String penaltyAmount = "-"+bpcr.getPenaltyAmount().toPlainString() + currencyUnit; | ||
141 | + String refundAmount = bpcr.getLeftAmount().toPlainString() + currencyUnit; | ||
142 | + OrderCancelComputeResult occr = OrderCancelComputeResult.builder() | ||
143 | + .orderPrice(orderPrice) | ||
144 | + .penaltyRate(penaltyRate) | ||
145 | + .penaltyAmount(penaltyAmount) | ||
146 | + .refundAmount(refundAmount) | ||
147 | + .showPrice(true) | ||
148 | + .build(); | ||
149 | + return occr; | ||
150 | + } | ||
151 | +} |
@@ -233,8 +233,8 @@ public class DepositServiceImpl implements DepositService { | @@ -233,8 +233,8 @@ public class DepositServiceImpl implements DepositService { | ||
233 | 233 | ||
234 | // 转卖 | 234 | // 转卖 |
235 | @Override | 235 | @Override |
236 | - public boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid) { | ||
237 | - LOGGER.info("changeOwner success! uid {}, skup is {}, buyOrderCode is {}, newUid is {}", uid, skup, buyOrderCode, newUid); | 236 | + public boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid, boolean isDeposit) { |
237 | + LOGGER.info("changeOwner success! uid {}, skup is {}, buyOrderCode is {}, newUid is {}, isDeposit is {}", uid, skup, buyOrderCode, newUid, isDeposit); | ||
238 | StorageDeposit sd = storageDepositMapper.queryByOwnerSkup(uid, skup); | 238 | StorageDeposit sd = storageDepositMapper.queryByOwnerSkup(uid, skup); |
239 | if (sd == null) { | 239 | if (sd == null) { |
240 | return false; | 240 | return false; |
@@ -247,7 +247,8 @@ public class DepositServiceImpl implements DepositService { | @@ -247,7 +247,8 @@ public class DepositServiceImpl implements DepositService { | ||
247 | sd.setOwnerUid(newUid); | 247 | sd.setOwnerUid(newUid); |
248 | sd.setOrderCode(buyOrderCode); | 248 | sd.setOrderCode(buyOrderCode); |
249 | sd.setSkup(sd.getNewSkup()); | 249 | sd.setSkup(sd.getNewSkup()); |
250 | - sd.setStatus(1); | 250 | + sd.setStatus(isDeposit ? 1 : 2); |
251 | + sd.setOutType(isDeposit ? 0 : 2); | ||
251 | sd.setOrderStatus(0); | 252 | sd.setOrderStatus(0); |
252 | sd.setUpdateTime(0); | 253 | sd.setUpdateTime(0); |
253 | int now = (int) (System.currentTimeMillis() / 1000); | 254 | int now = (int) (System.currentTimeMillis() / 1000); |
@@ -20,6 +20,7 @@ import com.yohoufo.common.alarm.EventBusPublisher; | @@ -20,6 +20,7 @@ import com.yohoufo.common.alarm.EventBusPublisher; | ||
20 | import com.yohoufo.common.caller.UfoServiceCaller; | 20 | import com.yohoufo.common.caller.UfoServiceCaller; |
21 | import com.yohoufo.common.constant.ExpressInfoConstant; | 21 | import com.yohoufo.common.constant.ExpressInfoConstant; |
22 | import com.yohoufo.common.exception.UfoServiceException; | 22 | import com.yohoufo.common.exception.UfoServiceException; |
23 | +import com.yohoufo.common.utils.AddressUtil; | ||
23 | import com.yohoufo.common.utils.DateUtil; | 24 | import com.yohoufo.common.utils.DateUtil; |
24 | import com.yohoufo.common.utils.UserInfoHiddenHelper; | 25 | import com.yohoufo.common.utils.UserInfoHiddenHelper; |
25 | import com.yohoufo.dal.order.*; | 26 | import com.yohoufo.dal.order.*; |
@@ -37,6 +38,7 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder; | @@ -37,6 +38,7 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder; | ||
37 | import com.yohoufo.order.service.proxy.InBoxFacade; | 38 | import com.yohoufo.order.service.proxy.InBoxFacade; |
38 | import com.yohoufo.order.service.proxy.OrderStatusFlowService; | 39 | import com.yohoufo.order.service.proxy.OrderStatusFlowService; |
39 | import com.yohoufo.order.service.proxy.ProductProxyService; | 40 | import com.yohoufo.order.service.proxy.ProductProxyService; |
41 | +import com.yohoufo.order.service.proxy.UserProxyService; | ||
40 | import com.yohoufo.order.service.seller.setting.SellerService; | 42 | import com.yohoufo.order.service.seller.setting.SellerService; |
41 | import com.yohoufo.order.service.seller.setting.SellerWrapper; | 43 | import com.yohoufo.order.service.seller.setting.SellerWrapper; |
42 | import org.apache.commons.collections.CollectionUtils; | 44 | import org.apache.commons.collections.CollectionUtils; |
@@ -111,6 +113,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -111,6 +113,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
111 | @Autowired | 113 | @Autowired |
112 | private IBuyerOrderMetaService buyerOrderMetaService; | 114 | private IBuyerOrderMetaService buyerOrderMetaService; |
113 | 115 | ||
116 | + @Autowired | ||
117 | + private UserProxyService userProxyService; | ||
118 | + | ||
114 | private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data"; | 119 | private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data"; |
115 | 120 | ||
116 | //物流文案设置 | 121 | //物流文案设置 |
@@ -1050,6 +1055,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -1050,6 +1055,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
1050 | return appraiseAddressService.queryHKAppraiseAddress(); | 1055 | return appraiseAddressService.queryHKAppraiseAddress(); |
1051 | } | 1056 | } |
1052 | 1057 | ||
1058 | + | ||
1053 | boolean skupIsNull = (null == skup); | 1059 | boolean skupIsNull = (null == skup); |
1054 | boolean orderCodeIsNull = (null == orderCode); | 1060 | boolean orderCodeIsNull = (null == orderCode); |
1055 | if (skupIsNull && orderCodeIsNull) { | 1061 | if (skupIsNull && orderCodeIsNull) { |
@@ -1057,6 +1063,14 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -1057,6 +1063,14 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
1057 | return appraiseAddressService.queryInitAddress(); | 1063 | return appraiseAddressService.queryInitAddress(); |
1058 | } | 1064 | } |
1059 | 1065 | ||
1066 | + //寄存订单 | ||
1067 | + BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | ||
1068 | + //防止较早版本出错 | ||
1069 | + if (Objects.nonNull(buyerOrder)){ | ||
1070 | + if (OrderAttributes.DEPOSITE.getCode() == buyerOrder.getAttributes()){ | ||
1071 | + return appraiseAddressService.findByDepotType(DepotType.NJ.getCode()); | ||
1072 | + } | ||
1073 | + } | ||
1060 | 1074 | ||
1061 | AddressInfo buyerAddress = findSellerAddressInfo(uid, skup); | 1075 | AddressInfo buyerAddress = findSellerAddressInfo(uid, skup); |
1062 | 1076 | ||
@@ -1111,5 +1125,33 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -1111,5 +1125,33 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
1111 | return resp; | 1125 | return resp; |
1112 | } | 1126 | } |
1113 | 1127 | ||
1128 | + @Override | ||
1129 | + public AppraiseAddressResp queryByUserAddress(int uid, String addressIdStr) { | ||
1130 | + int addressId = AddressUtil.getDecryptStr(addressIdStr); | ||
1131 | + if (addressId < 0){ | ||
1132 | + LOGGER.warn("queryByUserAddess addressId invalidate, uid {}, addressId is {}", | ||
1133 | + uid, addressIdStr); | ||
1134 | + throw new ServiceException(ServiceError.ORDER_ADDRESSID_INVALIDATE); | ||
1135 | + } | ||
1136 | + | ||
1137 | + //query the address | ||
1138 | + AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); | ||
1139 | + // 根据用户id查询默认地址的省份 | ||
1140 | + AppraiseAddressResp resp = null; | ||
1141 | + if (null != hiddenBackAddress ) { | ||
1142 | + // 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址 | ||
1143 | + AppraiseAddress address = appraiseAddressService.queryAppraiseAddressByAreaCode(hiddenBackAddress.getAreaCode()); | ||
1144 | + | ||
1145 | + resp = new AppraiseAddressResp.builder().setAreaCode(address.getAreaCode()).build(); | ||
1146 | + resp.setShipFee(address.getShipFee()); | ||
1147 | + LOGGER.info("In queryByUserAddess hiddenBackAddress success, uid {} addressIdStr {}, AppraiseAddressResp", | ||
1148 | + uid, addressIdStr, resp); | ||
1149 | + }else { | ||
1150 | + LOGGER.warn("In queryByUserAddess hiddenBackAddress is null, uid {} addressIdStr {}", uid, addressIdStr); | ||
1151 | + } | ||
1152 | + | ||
1153 | + return resp; | ||
1154 | + } | ||
1155 | + | ||
1114 | 1156 | ||
1115 | } | 1157 | } |
@@ -375,10 +375,10 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -375,10 +375,10 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
375 | ActivityPrice activityPrice = checkAndGetActivityPrice(request, skupGood); | 375 | ActivityPrice activityPrice = checkAndGetActivityPrice(request, skupGood); |
376 | //构建算费 | 376 | //构建算费 |
377 | ChargeContext chargeContext = buildChargeContext(request, skupGood, activityPrice, ChargeParam.COMPUTE); | 377 | ChargeContext chargeContext = buildChargeContext(request, skupGood, activityPrice, ChargeParam.COMPUTE); |
378 | - /*if (StringUtils.isNoneBlank(request.getAddressId())){ | 378 | + if (StringUtils.isNoneBlank(request.getAddressId())){ |
379 | Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request); | 379 | Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request); |
380 | chargeContext.setUserAddressPair(addressInfoPair); | 380 | chargeContext.setUserAddressPair(addressInfoPair); |
381 | - }*/ | 381 | + } |
382 | //算费 | 382 | //算费 |
383 | chargeService.charge(chargeContext); | 383 | chargeService.charge(chargeContext); |
384 | //算费结果 | 384 | //算费结果 |
-
Please register or login to post a comment