Showing
13 changed files
with
142 additions
and
20 deletions
@@ -11,6 +11,9 @@ import java.util.Objects; | @@ -11,6 +11,9 @@ import java.util.Objects; | ||
11 | public class AddressInfoConvertor { | 11 | public class AddressInfoConvertor { |
12 | 12 | ||
13 | /** | 13 | /** |
14 | + * is_update = N 四级地址 | ||
15 | + is_update = Y 三级地址 | ||
16 | + | ||
14 | * { | 17 | * { |
15 | "area": "内蒙古自治区 呼和浩特市 回民区 新华西路办事处", | 18 | "area": "内蒙古自治区 呼和浩特市 回民区 新华西路办事处", |
16 | "address": "ghjkkl", | 19 | "address": "ghjkkl", |
@@ -16,5 +16,7 @@ import lombok.experimental.Builder; | @@ -16,5 +16,7 @@ import lombok.experimental.Builder; | ||
16 | public class DeliverNoticeEvent extends Event{ | 16 | public class DeliverNoticeEvent extends Event{ |
17 | private int uid; | 17 | private int uid; |
18 | 18 | ||
19 | + private int skup; | ||
20 | + | ||
19 | private String prdName; | 21 | private String prdName; |
20 | } | 22 | } |
@@ -3,9 +3,12 @@ package com.yohoufo.order.mq.consumer; | @@ -3,9 +3,12 @@ package com.yohoufo.order.mq.consumer; | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | import com.yoho.core.rabbitmq.YhConsumer; | 4 | import com.yoho.core.rabbitmq.YhConsumer; |
5 | import com.yohoufo.order.event.DeliverNoticeEvent; | 5 | import com.yohoufo.order.event.DeliverNoticeEvent; |
6 | +import com.yohoufo.order.model.AddressInfo; | ||
6 | import com.yohoufo.order.mq.TopicConstants; | 7 | import com.yohoufo.order.mq.TopicConstants; |
8 | +import com.yohoufo.order.service.impl.SellerAddressService; | ||
7 | import com.yohoufo.order.service.proxy.InBoxFacade; | 9 | import com.yohoufo.order.service.proxy.InBoxFacade; |
8 | import com.yohoufo.order.utils.LoggerUtils; | 10 | import com.yohoufo.order.utils.LoggerUtils; |
11 | +import com.yohoufo.order.utils.SmsHelper; | ||
9 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.stereotype.Component; | 14 | import org.springframework.stereotype.Component; |
@@ -24,6 +27,9 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer { | @@ -24,6 +27,9 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer { | ||
24 | @Autowired | 27 | @Autowired |
25 | private InBoxFacade inBoxFacade; | 28 | private InBoxFacade inBoxFacade; |
26 | 29 | ||
30 | + @Autowired | ||
31 | + private SellerAddressService sellerAddressService; | ||
32 | + | ||
27 | 33 | ||
28 | @Override | 34 | @Override |
29 | public void handleMessage(Object o) throws Exception { | 35 | public void handleMessage(Object o) throws Exception { |
@@ -34,7 +40,8 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer { | @@ -34,7 +40,8 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer { | ||
34 | 40 | ||
35 | DeliverNoticeEvent msg = JSONObject.parseObject(o.toString(), DeliverNoticeEvent.class); | 41 | DeliverNoticeEvent msg = JSONObject.parseObject(o.toString(), DeliverNoticeEvent.class); |
36 | 42 | ||
37 | - inBoxFacade.sellerDeliverNotice(msg.getUid(), msg.getPrdName(), 2,null); | 43 | + AddressInfo addressInfo = sellerAddressService.getAddressInfo(msg.getUid(), msg.getSkup()); |
44 | + inBoxFacade.sellerDeliverNotice(msg.getUid(), msg.getPrdName(), 2, SmsHelper.getPhones(addressInfo)); | ||
38 | 45 | ||
39 | 46 | ||
40 | } | 47 | } |
@@ -13,13 +13,16 @@ import com.yohoufo.order.common.TransferCase; | @@ -13,13 +13,16 @@ import com.yohoufo.order.common.TransferCase; | ||
13 | import com.yohoufo.order.constants.AlarmConfig; | 13 | import com.yohoufo.order.constants.AlarmConfig; |
14 | import com.yohoufo.order.event.BillLogEvent; | 14 | import com.yohoufo.order.event.BillLogEvent; |
15 | import com.yohoufo.order.event.SellerCancelDeliverEvent; | 15 | import com.yohoufo.order.event.SellerCancelDeliverEvent; |
16 | +import com.yohoufo.order.model.AddressInfo; | ||
16 | import com.yohoufo.order.model.request.PaymentRequest; | 17 | import com.yohoufo.order.model.request.PaymentRequest; |
17 | import com.yohoufo.order.model.request.TransferMoneyRequest; | 18 | import com.yohoufo.order.model.request.TransferMoneyRequest; |
18 | import com.yohoufo.order.mq.TopicConstants; | 19 | import com.yohoufo.order.mq.TopicConstants; |
19 | import com.yohoufo.order.service.IPaymentService; | 20 | import com.yohoufo.order.service.IPaymentService; |
21 | +import com.yohoufo.order.service.impl.SellerAddressService; | ||
20 | import com.yohoufo.order.service.impl.TransferService; | 22 | import com.yohoufo.order.service.impl.TransferService; |
21 | import com.yohoufo.order.service.proxy.InBoxFacade; | 23 | import com.yohoufo.order.service.proxy.InBoxFacade; |
22 | import com.yohoufo.order.utils.LoggerUtils; | 24 | import com.yohoufo.order.utils.LoggerUtils; |
25 | +import com.yohoufo.order.utils.SmsHelper; | ||
23 | import org.slf4j.Logger; | 26 | import org.slf4j.Logger; |
24 | import org.springframework.beans.factory.annotation.Autowired; | 27 | import org.springframework.beans.factory.annotation.Autowired; |
25 | import org.springframework.stereotype.Component; | 28 | import org.springframework.stereotype.Component; |
@@ -47,6 +50,9 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer { | @@ -47,6 +50,9 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer { | ||
47 | @Autowired | 50 | @Autowired |
48 | private TransferService transferService; | 51 | private TransferService transferService; |
49 | 52 | ||
53 | + @Autowired | ||
54 | + private SellerAddressService sellerAddressService; | ||
55 | + | ||
50 | 56 | ||
51 | public String getMessageTopic() { | 57 | public String getMessageTopic() { |
52 | 58 | ||
@@ -90,7 +96,8 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer { | @@ -90,7 +96,8 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer { | ||
90 | .build(); | 96 | .build(); |
91 | EventBusPublisher.publishEvent(buyererBillLogEvent); | 97 | EventBusPublisher.publishEvent(buyererBillLogEvent); |
92 | // | 98 | // |
93 | - inBoxFacade.sellerDeliverNotice(event.getSellerUid(), event.getProductName(), 3,null); | 99 | + AddressInfo addressInfo = sellerAddressService.getAddressInfo(sellerUid, skup); |
100 | + inBoxFacade.sellerDeliverNotice(event.getSellerUid(), event.getProductName(), 3, SmsHelper.getPhones(addressInfo)); | ||
94 | }catch (Exception ex){ | 101 | }catch (Exception ex){ |
95 | logger.warn("in topic {} , refund fail,req {}", getMessageTopic(), req, ex); | 102 | logger.warn("in topic {} , refund fail,req {}", getMessageTopic(), req, ex); |
96 | BillLogEvent buyererBillLogEvent = bleb.tradeStatus(200) | 103 | BillLogEvent buyererBillLogEvent = bleb.tradeStatus(200) |
@@ -19,10 +19,13 @@ import com.yohoufo.order.common.OrderStatus; | @@ -19,10 +19,13 @@ import com.yohoufo.order.common.OrderStatus; | ||
19 | import com.yohoufo.order.constants.MetaKey; | 19 | import com.yohoufo.order.constants.MetaKey; |
20 | import com.yohoufo.order.event.DeliverNoticeEvent; | 20 | import com.yohoufo.order.event.DeliverNoticeEvent; |
21 | import com.yohoufo.order.event.SellerCancelDeliverEvent; | 21 | import com.yohoufo.order.event.SellerCancelDeliverEvent; |
22 | +import com.yohoufo.order.model.AddressInfo; | ||
22 | import com.yohoufo.order.model.OrderInfo; | 23 | import com.yohoufo.order.model.OrderInfo; |
23 | import com.yohoufo.order.model.request.PaymentRequest; | 24 | import com.yohoufo.order.model.request.PaymentRequest; |
24 | import com.yohoufo.order.model.response.PrepayResponse; | 25 | import com.yohoufo.order.model.response.PrepayResponse; |
26 | +import com.yohoufo.order.service.impl.SellerAddressService; | ||
25 | import com.yohoufo.order.service.proxy.InBoxFacade; | 27 | import com.yohoufo.order.service.proxy.InBoxFacade; |
28 | +import com.yohoufo.order.utils.SmsHelper; | ||
26 | import org.apache.commons.lang3.StringUtils; | 29 | import org.apache.commons.lang3.StringUtils; |
27 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
28 | import org.slf4j.LoggerFactory; | 31 | import org.slf4j.LoggerFactory; |
@@ -53,6 +56,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -53,6 +56,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
53 | @Autowired | 56 | @Autowired |
54 | private SellerOrderGoodsMapper sellerOrderGoodsMapper; | 57 | private SellerOrderGoodsMapper sellerOrderGoodsMapper; |
55 | 58 | ||
59 | + @Autowired | ||
60 | + private SellerAddressService sellerAddressService; | ||
61 | + | ||
56 | /** | 62 | /** |
57 | * 更新订单状态 | 63 | * 更新订单状态 |
58 | * @param orderInfo | 64 | * @param orderInfo |
@@ -68,25 +74,31 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -68,25 +74,31 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
68 | // | 74 | // |
69 | orderInfo.setStatus(OrderStatus.HAS_PAYED.getCode()); | 75 | orderInfo.setStatus(OrderStatus.HAS_PAYED.getCode()); |
70 | 76 | ||
71 | - //TODO 通知卖家发货 | ||
72 | - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderInfo.getOrderCode()); | ||
73 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(buyerOrderGoods.getSkup()); | ||
74 | - inBoxFacade.sellerSkupPaidByBuyer(orderInfo.getSellerUid(), sellerOrderGoods.getProductName(),null); | 77 | + } |
75 | 78 | ||
76 | - DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder() | ||
77 | - .uid(orderInfo.getSellerUid()).prdName(sellerOrderGoods.getProductName()).build(); | 79 | + @Override |
80 | + public void processAfterPay(OrderInfo orderInfo) { | ||
81 | + Integer uid = orderInfo.getUid(); | ||
82 | + Integer sellerUid = orderInfo.getSellerUid(); | ||
83 | + // 通知卖家发货 | ||
84 | + BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderInfo.getOrderCode()); | ||
85 | + int skup = buyerOrderGoods.getSkup(); | ||
86 | + SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
87 | + AddressInfo addressInfo = sellerAddressService.getAddressInfo(sellerUid, skup); | ||
88 | + List<String> phones = SmsHelper.getPhones(addressInfo); | ||
89 | + inBoxFacade.sellerSkupPaidByBuyer(sellerUid, sellerOrderGoods.getProductName(), phones); | ||
90 | + | ||
91 | + DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder().skup(sellerOrderGoods.getId()) | ||
92 | + .uid(sellerUid).prdName(sellerOrderGoods.getProductName()).build(); | ||
78 | EventBusPublisher.publishEvent(deliverNoticeEvent); | 93 | EventBusPublisher.publishEvent(deliverNoticeEvent); |
79 | 94 | ||
80 | //卖家36小时不发货取消 | 95 | //卖家36小时不发货取消 |
81 | SellerCancelDeliverEvent event = SellerCancelDeliverEvent.builder() | 96 | SellerCancelDeliverEvent event = SellerCancelDeliverEvent.builder() |
82 | - .uid(uid).sellerUid(orderInfo.getSellerUid()).skup(sellerOrderGoods.getId()) | 97 | + .uid(uid).sellerUid(sellerUid).skup(sellerOrderGoods.getId()) |
83 | .orderCode(orderInfo.getOrderCode()).build(); | 98 | .orderCode(orderInfo.getOrderCode()).build(); |
84 | EventBusPublisher.publishEvent(event); | 99 | EventBusPublisher.publishEvent(event); |
85 | 100 | ||
86 | - } | ||
87 | 101 | ||
88 | - @Override | ||
89 | - public void processAfterPay(OrderInfo orderInfo) { | ||
90 | inBoxFacade.buyerFinishPaid(orderInfo.getUid(), orderInfo.getOrderCode()); | 102 | inBoxFacade.buyerFinishPaid(orderInfo.getUid(), orderInfo.getOrderCode()); |
91 | } | 103 | } |
92 | 104 |
1 | package com.yohoufo.order.service; | 1 | package com.yohoufo.order.service; |
2 | 2 | ||
3 | import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; | 3 | import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; |
4 | +import com.yohoufo.order.model.AddressInfo; | ||
4 | 5 | ||
5 | public interface IBuyerOrderMetaService { | 6 | public interface IBuyerOrderMetaService { |
6 | 7 | ||
7 | int updateDeliveryAddress(BuyerOrderMetaUpdateReq req); | 8 | int updateDeliveryAddress(BuyerOrderMetaUpdateReq req); |
9 | + | ||
10 | + | ||
11 | + AddressInfo getAddressInfo(int uid, long orderCode); | ||
8 | } | 12 | } |
@@ -21,17 +21,22 @@ import com.yohoufo.order.common.TransferCase; | @@ -21,17 +21,22 @@ import com.yohoufo.order.common.TransferCase; | ||
21 | import com.yohoufo.order.constants.AlarmConfig; | 21 | import com.yohoufo.order.constants.AlarmConfig; |
22 | import com.yohoufo.order.event.BillLogEvent; | 22 | import com.yohoufo.order.event.BillLogEvent; |
23 | import com.yohoufo.order.event.BuyerConfirmEvent; | 23 | import com.yohoufo.order.event.BuyerConfirmEvent; |
24 | +import com.yohoufo.order.model.AddressInfo; | ||
24 | import com.yohoufo.order.model.request.PaymentRequest; | 25 | import com.yohoufo.order.model.request.PaymentRequest; |
25 | import com.yohoufo.order.model.request.TransferMoneyRequest; | 26 | import com.yohoufo.order.model.request.TransferMoneyRequest; |
27 | +import com.yohoufo.order.service.IBuyerOrderMetaService; | ||
26 | import com.yohoufo.order.service.IExpressInfoService; | 28 | import com.yohoufo.order.service.IExpressInfoService; |
27 | import com.yohoufo.order.service.IPaymentService; | 29 | import com.yohoufo.order.service.IPaymentService; |
28 | import com.yohoufo.order.service.proxy.InBoxFacade; | 30 | import com.yohoufo.order.service.proxy.InBoxFacade; |
31 | +import com.yohoufo.order.utils.SmsHelper; | ||
29 | import org.slf4j.Logger; | 32 | import org.slf4j.Logger; |
30 | import org.slf4j.LoggerFactory; | 33 | import org.slf4j.LoggerFactory; |
31 | import org.springframework.beans.factory.annotation.Autowired; | 34 | import org.springframework.beans.factory.annotation.Autowired; |
32 | import org.springframework.stereotype.Service; | 35 | import org.springframework.stereotype.Service; |
33 | 36 | ||
34 | import java.math.BigDecimal; | 37 | import java.math.BigDecimal; |
38 | +import java.util.Arrays; | ||
39 | +import java.util.List; | ||
35 | 40 | ||
36 | /** | 41 | /** |
37 | * Created by chenchao on 2018/9/27. | 42 | * Created by chenchao on 2018/9/27. |
@@ -67,6 +72,9 @@ public class AppraiseService { | @@ -67,6 +72,9 @@ public class AppraiseService { | ||
67 | @Autowired | 72 | @Autowired |
68 | TransferService transferService; | 73 | TransferService transferService; |
69 | 74 | ||
75 | + @Autowired | ||
76 | + private IBuyerOrderMetaService buyerOrderMetaService; | ||
77 | + | ||
70 | 78 | ||
71 | public ApiResponse appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum){ | 79 | public ApiResponse appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum){ |
72 | ApiResponse apiResponse=new ApiResponse(); | 80 | ApiResponse apiResponse=new ApiResponse(); |
@@ -127,8 +135,11 @@ public class AppraiseService { | @@ -127,8 +135,11 @@ public class AppraiseService { | ||
127 | //记录物流信息 | 135 | //记录物流信息 |
128 | expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum); | 136 | expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum); |
129 | 137 | ||
138 | + AddressInfo addressInfo = buyerOrderMetaService.getAddressInfo(buyerUid, orderCode); | ||
139 | + List<String> phones = SmsHelper.getPhones(addressInfo); | ||
140 | + | ||
130 | //平台已发货给买家 | 141 | //平台已发货给买家 |
131 | - inBoxFacade.depotDeliver2Buyer(buyerUid, orderCode,null); | 142 | + inBoxFacade.depotDeliver2Buyer(buyerUid, orderCode, phones); |
132 | 143 | ||
133 | }catch (Exception ex){ | 144 | }catch (Exception ex){ |
134 | LOGGER.warn("in appraiseSuccess,refund fail, req {}", req, ex); | 145 | LOGGER.warn("in appraiseSuccess,refund fail, req {}", req, ex); |
@@ -179,6 +190,7 @@ public class AppraiseService { | @@ -179,6 +190,7 @@ public class AppraiseService { | ||
179 | } | 190 | } |
180 | 191 | ||
181 | 192 | ||
193 | + | ||
182 | /** | 194 | /** |
183 | * 更新发到卖家的物流信息 | 195 | * 更新发到卖家的物流信息 |
184 | * 将卖家的保证金分账给平台和买家 | 196 | * 将卖家的保证金分账给平台和买家 |
@@ -237,7 +249,10 @@ public class AppraiseService { | @@ -237,7 +249,10 @@ public class AppraiseService { | ||
237 | SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | 249 | SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
238 | inBoxFacade.noticeSellerWhenAppraiseFail(sellerUid, sellerOrderGoods.getProductName()); | 250 | inBoxFacade.noticeSellerWhenAppraiseFail(sellerUid, sellerOrderGoods.getProductName()); |
239 | 251 | ||
240 | - inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(),null); | 252 | + |
253 | + | ||
254 | + AddressInfo addressInfo = buyerOrderMetaService.getAddressInfo(buyerUid, buyerOrder.getOrderCode()); | ||
255 | + inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(), SmsHelper.getPhones(addressInfo)); | ||
241 | }catch (Exception ex){ | 256 | }catch (Exception ex){ |
242 | LOGGER.warn("in appraiseFail ,refund fail,req {}", req, ex); | 257 | LOGGER.warn("in appraiseFail ,refund fail,req {}", req, ex); |
243 | BillLogEvent buyererBillLogEvent = bleb.tradeStatus(200) | 258 | BillLogEvent buyererBillLogEvent = bleb.tradeStatus(200) |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
3 | import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; | 4 | import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; |
4 | import com.yohoufo.dal.order.BuyerOrderMetaMapper; | 5 | import com.yohoufo.dal.order.BuyerOrderMetaMapper; |
5 | import com.yohoufo.dal.order.model.BuyerOrderMeta; | 6 | import com.yohoufo.dal.order.model.BuyerOrderMeta; |
6 | import com.yohoufo.order.constants.MetaKey; | 7 | import com.yohoufo.order.constants.MetaKey; |
8 | +import com.yohoufo.order.model.AddressInfo; | ||
7 | import com.yohoufo.order.service.IBuyerOrderMetaService; | 9 | import com.yohoufo.order.service.IBuyerOrderMetaService; |
10 | +import org.apache.commons.lang3.StringUtils; | ||
8 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
9 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -31,4 +34,23 @@ public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService { | @@ -31,4 +34,23 @@ public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService { | ||
31 | return result; | 34 | return result; |
32 | } | 35 | } |
33 | 36 | ||
37 | + BuyerOrderMeta getBuyerOrderMeta(int uid, long orderCode, String metaKey) { | ||
38 | + BuyerOrderMeta buyerOrderMeta = buyerOrderMetaMapper.selectByMetaKey(uid, | ||
39 | + orderCode, metaKey); | ||
40 | + | ||
41 | + return buyerOrderMeta; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public AddressInfo getAddressInfo(int uid, long orderCode) { | ||
46 | + BuyerOrderMeta buyerOrderMeta = getBuyerOrderMeta(uid, | ||
47 | + orderCode, MetaKey.BUYER_DELIVERY_ADDRESS); | ||
48 | + AddressInfo userAddress = null; | ||
49 | + if ( null != buyerOrderMeta | ||
50 | + && StringUtils.isNotBlank(buyerOrderMeta.getMetaValue())){ | ||
51 | + userAddress = JSONObject.parseObject(buyerOrderMeta.getMetaValue(), AddressInfo.class); | ||
52 | + } | ||
53 | + return userAddress; | ||
54 | + } | ||
55 | + | ||
34 | } | 56 | } |
@@ -10,6 +10,7 @@ import com.yohoufo.dal.order.model.BuyerOrderGoods; | @@ -10,6 +10,7 @@ import com.yohoufo.dal.order.model.BuyerOrderGoods; | ||
10 | import com.yohoufo.dal.order.model.SellerOrder; | 10 | import com.yohoufo.dal.order.model.SellerOrder; |
11 | import com.yohoufo.dal.order.model.SellerOrderGoods; | 11 | import com.yohoufo.dal.order.model.SellerOrderGoods; |
12 | import com.yohoufo.order.common.*; | 12 | import com.yohoufo.order.common.*; |
13 | +import com.yohoufo.order.model.AddressInfo; | ||
13 | import com.yohoufo.order.model.request.OrderListRequest; | 14 | import com.yohoufo.order.model.request.OrderListRequest; |
14 | import com.yohoufo.order.model.request.OrderRequest; | 15 | import com.yohoufo.order.model.request.OrderRequest; |
15 | import com.yohoufo.order.model.response.OrderDetailInfo; | 16 | import com.yohoufo.order.model.response.OrderDetailInfo; |
@@ -17,6 +18,7 @@ import com.yohoufo.order.model.response.OrderSummaryResp; | @@ -17,6 +18,7 @@ import com.yohoufo.order.model.response.OrderSummaryResp; | ||
17 | import com.yohoufo.order.service.IBuyerOrderService; | 18 | import com.yohoufo.order.service.IBuyerOrderService; |
18 | import com.yohoufo.order.service.proxy.InBoxFacade; | 19 | import com.yohoufo.order.service.proxy.InBoxFacade; |
19 | import com.yohoufo.order.service.proxy.ProductProxyService; | 20 | import com.yohoufo.order.service.proxy.ProductProxyService; |
21 | +import com.yohoufo.order.utils.SmsHelper; | ||
20 | import org.slf4j.Logger; | 22 | import org.slf4j.Logger; |
21 | import org.slf4j.LoggerFactory; | 23 | import org.slf4j.LoggerFactory; |
22 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -51,6 +53,12 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -51,6 +53,12 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
51 | @Autowired | 53 | @Autowired |
52 | private ProductProxyService productProxyService; | 54 | private ProductProxyService productProxyService; |
53 | 55 | ||
56 | + @Autowired | ||
57 | + private InBoxFacade inBoxFacade; | ||
58 | + | ||
59 | + @Autowired | ||
60 | + private SellerAddressService sellerAddressService; | ||
61 | + | ||
54 | /** | 62 | /** |
55 | * 提交订单 | 63 | * 提交订单 |
56 | * @param orderRequest | 64 | * @param orderRequest |
@@ -91,8 +99,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -91,8 +99,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
91 | cancelBeforePaid(orderRequest, expectStatus, targetStatus); | 99 | cancelBeforePaid(orderRequest, expectStatus, targetStatus); |
92 | } | 100 | } |
93 | 101 | ||
94 | - @Autowired | ||
95 | - private InBoxFacade inBoxFacade; | 102 | + |
96 | 103 | ||
97 | public void cancelBeforePaid(OrderRequest orderRequest, OrderStatus exceptStatus, OrderStatus targetStatus){ | 104 | public void cancelBeforePaid(OrderRequest orderRequest, OrderStatus exceptStatus, OrderStatus targetStatus){ |
98 | // 状态 ![待付款] 不合法 | 105 | // 状态 ![待付款] 不合法 |
@@ -121,7 +128,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -121,7 +128,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
121 | // 恢复product skup的库存 | 128 | // 恢复product skup的库存 |
122 | boolean isReturnSuccess = productProxyService.returnStorage(skup); | 129 | boolean isReturnSuccess = productProxyService.returnStorage(skup); |
123 | // | 130 | // |
124 | - inBoxFacade.noticSellerWhenBuyerCancel(dataNode.buyerOrderInDB.getSellerUid(), psog.getProductName(),null); | 131 | + int sellerUid = dataNode.buyerOrderInDB.getSellerUid(); |
132 | + AddressInfo addressInfo = sellerAddressService.getAddressInfo(sellerUid, skup); | ||
133 | + inBoxFacade.noticSellerWhenBuyerCancel(sellerUid, psog.getProductName(), SmsHelper.getPhones(addressInfo)); | ||
125 | inBoxFacade.buyerCancelOrder(orderRequest.getUid(), orderRequest.getOrderCode()); | 134 | inBoxFacade.buyerCancelOrder(orderRequest.getUid(), orderRequest.getOrderCode()); |
126 | } | 135 | } |
127 | 136 |
@@ -18,11 +18,13 @@ import com.yohoufo.order.constants.AlarmConfig; | @@ -18,11 +18,13 @@ import com.yohoufo.order.constants.AlarmConfig; | ||
18 | import com.yohoufo.order.event.BillLogEvent; | 18 | import com.yohoufo.order.event.BillLogEvent; |
19 | import com.yohoufo.order.event.ErpCancelSellerOrderEvent; | 19 | import com.yohoufo.order.event.ErpCancelSellerOrderEvent; |
20 | import com.yohoufo.order.event.OrderCancelEvent; | 20 | import com.yohoufo.order.event.OrderCancelEvent; |
21 | +import com.yohoufo.order.model.AddressInfo; | ||
21 | import com.yohoufo.order.model.PayRefundBo; | 22 | import com.yohoufo.order.model.PayRefundBo; |
22 | import com.yohoufo.order.model.request.PaymentRequest; | 23 | import com.yohoufo.order.model.request.PaymentRequest; |
23 | import com.yohoufo.order.model.request.TransferMoneyRequest; | 24 | import com.yohoufo.order.model.request.TransferMoneyRequest; |
24 | import com.yohoufo.order.mq.TopicConstants; | 25 | import com.yohoufo.order.mq.TopicConstants; |
25 | import com.yohoufo.order.mq.producer.TradeMqSender; | 26 | import com.yohoufo.order.mq.producer.TradeMqSender; |
27 | +import com.yohoufo.order.service.IBuyerOrderMetaService; | ||
26 | import com.yohoufo.order.service.IPaymentService; | 28 | import com.yohoufo.order.service.IPaymentService; |
27 | import com.yohoufo.order.service.impl.visitor.AutoCancelCase; | 29 | import com.yohoufo.order.service.impl.visitor.AutoCancelCase; |
28 | import com.yohoufo.order.service.impl.visitor.OffShelveCancelCase; | 30 | import com.yohoufo.order.service.impl.visitor.OffShelveCancelCase; |
@@ -32,6 +34,7 @@ import com.yohoufo.order.service.proxy.ProductProxyService; | @@ -32,6 +34,7 @@ import com.yohoufo.order.service.proxy.ProductProxyService; | ||
32 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; | 34 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
33 | import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; | 35 | import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; |
34 | import com.yohoufo.order.utils.LoggerUtils; | 36 | import com.yohoufo.order.utils.LoggerUtils; |
37 | +import com.yohoufo.order.utils.SmsHelper; | ||
35 | import lombok.experimental.Builder; | 38 | import lombok.experimental.Builder; |
36 | import org.slf4j.Logger; | 39 | import org.slf4j.Logger; |
37 | import org.springframework.beans.factory.annotation.Autowired; | 40 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -81,6 +84,13 @@ public class SellerOrderCancelService { | @@ -81,6 +84,13 @@ public class SellerOrderCancelService { | ||
81 | @Autowired | 84 | @Autowired |
82 | private TransferService transferService; | 85 | private TransferService transferService; |
83 | 86 | ||
87 | + @Autowired | ||
88 | + private SellerAddressService sellerAddressService; | ||
89 | + | ||
90 | + | ||
91 | + @Autowired | ||
92 | + private IBuyerOrderMetaService buyerOrderMetaService; | ||
93 | + | ||
84 | /** | 94 | /** |
85 | * TODO 如何控制好并发,必须控制不能重复转账 退款 | 95 | * TODO 如何控制好并发,必须控制不能重复转账 退款 |
86 | * 使用乐观锁,带着查询到的状态且符合条件时再去更新 | 96 | * 使用乐观锁,带着查询到的状态且符合条件时再去更新 |
@@ -320,9 +330,9 @@ public class SellerOrderCancelService { | @@ -320,9 +330,9 @@ public class SellerOrderCancelService { | ||
320 | BillLogEvent buyererBillLogEvent = bleb.tradeStatus(100) | 330 | BillLogEvent buyererBillLogEvent = bleb.tradeStatus(100) |
321 | .build(); | 331 | .build(); |
322 | EventBusPublisher.publishEvent(buyererBillLogEvent); | 332 | EventBusPublisher.publishEvent(buyererBillLogEvent); |
323 | - | ||
324 | // | 333 | // |
325 | - inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode,null); | 334 | + AddressInfo addressInfo = buyerOrderMetaService.getAddressInfo(buyerUid, buyerOrderCode); |
335 | + inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode, SmsHelper.getPhones(addressInfo)); | ||
326 | //TODO 异步 | 336 | //TODO 异步 |
327 | SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup()); | 337 | SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup()); |
328 | inBoxFacade.sellerCancelAfterBuyerPaid(sellerUid, psog.getProductName()); | 338 | inBoxFacade.sellerCancelAfterBuyerPaid(sellerUid, psog.getProductName()); |
@@ -476,7 +486,9 @@ public class SellerOrderCancelService { | @@ -476,7 +486,9 @@ public class SellerOrderCancelService { | ||
476 | BillLogEvent sellerBillLogEvent = bleb.tradeStatus(100) | 486 | BillLogEvent sellerBillLogEvent = bleb.tradeStatus(100) |
477 | .build(); | 487 | .build(); |
478 | EventBusPublisher.publishEvent(sellerBillLogEvent); | 488 | EventBusPublisher.publishEvent(sellerBillLogEvent); |
479 | - inBoxFacade.notifyUnshelfCauseBySpecialReason(sellerUid, psog.getProductName(),null); | 489 | + |
490 | + AddressInfo addressInfo = sellerAddressService.getAddressInfo(sellerUid, skup); | ||
491 | + inBoxFacade.notifyUnshelfCauseBySpecialReason(sellerUid, psog.getProductName(), SmsHelper.getPhones(addressInfo)); | ||
480 | }catch (Exception ex){ | 492 | }catch (Exception ex){ |
481 | logger.warn("in yoho Off Shelve Cancel, refund earnestMoney fail, seller {}, order code {}, skup {}, earnestMoney {}", | 493 | logger.warn("in yoho Off Shelve Cancel, refund earnestMoney fail, seller {}, order code {}, skup {}, earnestMoney {}", |
482 | sellerUid, orderCode, skup, earnestMoney, ex); | 494 | sellerUid, orderCode, skup, earnestMoney, ex); |
@@ -313,6 +313,9 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -313,6 +313,9 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
313 | //the address of send back 2 seller | 313 | //the address of send back 2 seller |
314 | // | 314 | // |
315 | AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); | 315 | AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); |
316 | + | ||
317 | + | ||
318 | + | ||
316 | AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); | 319 | AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); |
317 | // | 320 | // |
318 | SellerOrderContext context = new SellerOrderContext(); | 321 | SellerOrderContext context = new SellerOrderContext(); |
1 | +package com.yohoufo.order.utils; | ||
2 | + | ||
3 | +import com.yohoufo.order.model.AddressInfo; | ||
4 | + | ||
5 | +import java.util.Arrays; | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * Created by chenchao on 2018/10/19. | ||
10 | + */ | ||
11 | +public class SmsHelper { | ||
12 | + | ||
13 | + | ||
14 | + public static List<String> getPhones(AddressInfo addressInfo){ | ||
15 | + | ||
16 | + | ||
17 | + List<String> phones = null; | ||
18 | + if (null != addressInfo && addressInfo.getMobile() != null){ | ||
19 | + phones = Arrays.asList(addressInfo.getMobile()); | ||
20 | + } | ||
21 | + | ||
22 | + return phones; | ||
23 | + } | ||
24 | +} |
-
Please register or login to post a comment