Showing
9 changed files
with
69 additions
and
80 deletions
@@ -6,13 +6,13 @@ import java.util.Optional; | @@ -6,13 +6,13 @@ import java.util.Optional; | ||
6 | import java.util.function.Supplier; | 6 | import java.util.function.Supplier; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * 1:鉴定通过(货款-->卖家 + 平台); | 9 | + * 1:鉴定通过(货款-->卖家 + 平台); |
10 | * 2:鉴定不通过(保证金 --> 买家 + 平台); | 10 | * 2:鉴定不通过(保证金 --> 买家 + 平台); |
11 | * 3:有买家时卖家不卖了(保证金 --> 买家+ 平台) | 11 | * 3:有买家时卖家不卖了(保证金 --> 买家+ 平台) |
12 | * 4:超时发货(保证金 --> 买家 + 平台) | 12 | * 4:超时发货(保证金 --> 买家 + 平台) |
13 | - * Created by chenchao on 2018/10/9. | ||
14 | - * 5:买家付款后[卖家未发货],取消订单(货款部分-->卖家); | 13 | + * 5:买家付款后[卖家未发货],取消订单(货款部分-->卖家); |
15 | * 6:买家付款后[卖家已发货],取消订单(货款部分-->卖家); | 14 | * 6:买家付款后[卖家已发货],取消订单(货款部分-->卖家); |
15 | + * 100:保证金->买家 | ||
16 | */ | 16 | */ |
17 | public enum TransferCase { | 17 | public enum TransferCase { |
18 | 18 | ||
@@ -23,7 +23,7 @@ public enum TransferCase { | @@ -23,7 +23,7 @@ public enum TransferCase { | ||
23 | DELIVER_TIME_OUT(4,"卖家超时发货[保证金->买家]"), | 23 | DELIVER_TIME_OUT(4,"卖家超时发货[保证金->买家]"), |
24 | BUYER_CANCEL_BEFORE_SELLER_DELIVER(5,"卖家未发货时买家取消[部分货款->卖家]"), | 24 | BUYER_CANCEL_BEFORE_SELLER_DELIVER(5,"卖家未发货时买家取消[部分货款->卖家]"), |
25 | BUYER_CANCEL_BEFORE_DEPOT_RECEIVE(6,"卖家已发货时买家取消[部分货款->卖家]"), | 25 | BUYER_CANCEL_BEFORE_DEPOT_RECEIVE(6,"卖家已发货时买家取消[部分货款->卖家]"), |
26 | - CS_CANCEL_BEFORE_DEPOT_RECEIVE(7,"鉴定中心收货前客服取消[保证金->买家]"); | 26 | + EARNEST_MONEY_TO_BUYER(100,"保证金->买家"); |
27 | 27 | ||
28 | private int code; | 28 | private int code; |
29 | private String info; | 29 | private String info; |
1 | package com.yohoufo.order.constants; | 1 | package com.yohoufo.order.constants; |
2 | 2 | ||
3 | +import lombok.Getter; | ||
4 | + | ||
3 | /** | 5 | /** |
4 | * Created by chenchao on 2018/10/16. | 6 | * Created by chenchao on 2018/10/16. |
5 | */ | 7 | */ |
6 | public enum AlarmConfig { | 8 | public enum AlarmConfig { |
7 | 9 | ||
10 | + APPRAISE_SUCCESS("鉴定通过", "buyerOrder.transferGoodsMoney", "buyerOrder.refundEarnestMoney"), | ||
11 | + APPRAISE_FAIL("鉴定不通过", "buyerOrder.transferEarnestMoney", "buyerOrder.refundGoodsMoney"), | ||
12 | + SELLER_PLAY_BUYER("卖家取消", "buyerOrder.transferEarnestMoney", "buyerOrder.refundGoodsMoney"), | ||
13 | + DELIVER_TIME_OUT("卖家发货超时", "buyerOrder.transferEarnestMoney", "buyerOrder.refundGoodsMoney"), | ||
14 | + CS_CANCEL_BEFORE_DEPOT_RECEIVE("鉴定中心收货前客服取消", "buyerOrder.transferEarnestMoney", "buyerOrder.refundGoodsMoney"); | ||
8 | 15 | ||
9 | - APPRAISE_SUCCESS("buyerOrder.transferGoodsMoney","buyerOrder.refundEarnestMoney"), | ||
10 | - APPRAISE_FAIL("buyerOrder.transferEarnestMoney","buyerOrder.refundGoodsMoney"), | ||
11 | - SELLER_PLAY_BUYER("buyerOrder.transferEarnestMoney","buyerOrder.refundGoodsMoney"), | ||
12 | - DELIVER_TIME_OUT("buyerOrder.transferEarnestMoney","buyerOrder.refundGoodsMoney"), | ||
13 | - CS_CANCEL_BEFORE_DEPOT_RECEIVE("buyerOrder.transferEarnestMoney","buyerOrder.refundGoodsMoney"); | ||
14 | - | 16 | + @Getter |
17 | + private String desc; | ||
15 | private String transferName; | 18 | private String transferName; |
16 | private String refundName; | 19 | private String refundName; |
17 | 20 | ||
18 | - AlarmConfig(String transferName, String refundName) { | 21 | + AlarmConfig(String desc, String transferName, String refundName) { |
22 | + this.desc = desc; | ||
19 | this.transferName = transferName; | 23 | this.transferName = transferName; |
20 | this.refundName = refundName; | 24 | this.refundName = refundName; |
21 | } | 25 | } |
@@ -2,6 +2,7 @@ package com.yohoufo.order.model.request; | @@ -2,6 +2,7 @@ package com.yohoufo.order.model.request; | ||
2 | 2 | ||
3 | import com.yohoufo.dal.order.model.SellerWalletDetail; | 3 | import com.yohoufo.dal.order.model.SellerWalletDetail; |
4 | import com.yohoufo.order.common.TransferCase; | 4 | import com.yohoufo.order.common.TransferCase; |
5 | +import com.yohoufo.order.constants.AlarmConfig; | ||
5 | import lombok.AllArgsConstructor; | 6 | import lombok.AllArgsConstructor; |
6 | import lombok.Data; | 7 | import lombok.Data; |
7 | import lombok.NoArgsConstructor; | 8 | import lombok.NoArgsConstructor; |
@@ -37,9 +38,12 @@ public class TransferMoneyRequest { | @@ -37,9 +38,12 @@ public class TransferMoneyRequest { | ||
37 | 38 | ||
38 | private TransferCase transferCase; | 39 | private TransferCase transferCase; |
39 | 40 | ||
41 | + private AlarmConfig alarmConfig; | ||
42 | + | ||
40 | public TransferMoneyRequest(long buyerOrderCode, long sellerOrderCode, int type) { | 43 | public TransferMoneyRequest(long buyerOrderCode, long sellerOrderCode, int type) { |
41 | this.buyerOrderCode = buyerOrderCode; | 44 | this.buyerOrderCode = buyerOrderCode; |
42 | this.sellerOrderCode = sellerOrderCode; | 45 | this.sellerOrderCode = sellerOrderCode; |
43 | this.type = type; | 46 | this.type = type; |
44 | } | 47 | } |
48 | + | ||
45 | } | 49 | } |
@@ -141,8 +141,12 @@ public class AppraiseService { | @@ -141,8 +141,12 @@ public class AppraiseService { | ||
141 | tso.setExceptStatus(expectSOStatus.getCode()); | 141 | tso.setExceptStatus(expectSOStatus.getCode()); |
142 | int soCnt = sellerOrderMapper.updateByOrderCode(tso); | 142 | int soCnt = sellerOrderMapper.updateByOrderCode(tso); |
143 | TransferCase transferCase = TransferCase.APPRAISE_SUCCESS; | 143 | TransferCase transferCase = TransferCase.APPRAISE_SUCCESS; |
144 | - TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode) | ||
145 | - .type(transferCase.getCode()).transferCase(transferCase).build(); | 144 | + TransferMoneyRequest tmReq = TransferMoneyRequest.builder() |
145 | + .buyerOrderCode(orderCode) | ||
146 | + .type(transferCase.getCode()) | ||
147 | + .transferCase(transferCase) | ||
148 | + .alarmConfig(AlarmConfig.APPRAISE_SUCCESS) | ||
149 | + .build(); | ||
146 | 150 | ||
147 | //先校验,提前把错误抛出 | 151 | //先校验,提前把错误抛出 |
148 | paymentService.transferMonCheck(tmReq); | 152 | paymentService.transferMonCheck(tmReq); |
@@ -491,8 +495,13 @@ public class AppraiseService { | @@ -491,8 +495,13 @@ public class AppraiseService { | ||
491 | 495 | ||
492 | //将卖家的保证金分账给平台和买家 | 496 | //将卖家的保证金分账给平台和买家 |
493 | TransferCase transferCase = TransferCase.APPRAISE_FAIL; | 497 | TransferCase transferCase = TransferCase.APPRAISE_FAIL; |
494 | - TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode) | ||
495 | - .type(transferCase.getCode()).swdType(SellerWalletDetail.Type.APPRAISE_FAIL).transferCase(transferCase).build(); | 498 | + TransferMoneyRequest tmReq = TransferMoneyRequest.builder() |
499 | + .buyerOrderCode(orderCode) | ||
500 | + .type(transferCase.getCode()) | ||
501 | + .transferCase(transferCase) | ||
502 | + .swdType(SellerWalletDetail.Type.APPRAISE_FAIL) | ||
503 | + .alarmConfig(AlarmConfig.APPRAISE_FAIL) | ||
504 | + .build(); | ||
496 | 505 | ||
497 | //先校验,提前把错误抛出 | 506 | //先校验,提前把错误抛出 |
498 | paymentService.transferMonCheck(tmReq); | 507 | paymentService.transferMonCheck(tmReq); |
@@ -54,7 +54,6 @@ class BuyerOrderCancelHandler { | @@ -54,7 +54,6 @@ class BuyerOrderCancelHandler { | ||
54 | private BuyerOrderGoodsMapper buyerOrderGoodsMapper; | 54 | private BuyerOrderGoodsMapper buyerOrderGoodsMapper; |
55 | 55 | ||
56 | private TransferService transferService; | 56 | private TransferService transferService; |
57 | - private int transferType; | ||
58 | private TransferCase transferCase; | 57 | private TransferCase transferCase; |
59 | private SellerWalletDetail.Type sellerWalletDetailType; | 58 | private SellerWalletDetail.Type sellerWalletDetailType; |
60 | 59 | ||
@@ -85,11 +84,9 @@ class BuyerOrderCancelHandler { | @@ -85,11 +84,9 @@ class BuyerOrderCancelHandler { | ||
85 | } | 84 | } |
86 | 85 | ||
87 | public BuyerOrderCancelHandler withTransfer(TransferService transferService, | 86 | public BuyerOrderCancelHandler withTransfer(TransferService transferService, |
88 | - int transferType, | ||
89 | TransferCase transferCase, | 87 | TransferCase transferCase, |
90 | SellerWalletDetail.Type sellerWalletDetailType) { | 88 | SellerWalletDetail.Type sellerWalletDetailType) { |
91 | this.transferService = transferService; | 89 | this.transferService = transferService; |
92 | - this.transferType = transferType; | ||
93 | this.transferCase = transferCase; | 90 | this.transferCase = transferCase; |
94 | this.sellerWalletDetailType = sellerWalletDetailType; | 91 | this.sellerWalletDetailType = sellerWalletDetailType; |
95 | return this; | 92 | return this; |
@@ -182,9 +179,10 @@ class BuyerOrderCancelHandler { | @@ -182,9 +179,10 @@ class BuyerOrderCancelHandler { | ||
182 | } | 179 | } |
183 | val transferMoneyRequest = TransferMoneyRequest.builder() | 180 | val transferMoneyRequest = TransferMoneyRequest.builder() |
184 | .buyerOrderCode(orderCode) | 181 | .buyerOrderCode(orderCode) |
185 | - .type(transferType) | 182 | + .type(transferCase.getCode()) |
186 | .transferCase(transferCase) | 183 | .transferCase(transferCase) |
187 | .swdType(sellerWalletDetailType) | 184 | .swdType(sellerWalletDetailType) |
185 | + .alarmConfig(failAlarm) | ||
188 | .build(); | 186 | .build(); |
189 | log.info("transfer by order {} request is {}", orderCode, transferMoneyRequest); | 187 | log.info("transfer by order {} request is {}", orderCode, transferMoneyRequest); |
190 | transferService.transfer(transferMoneyRequest); | 188 | transferService.transfer(transferMoneyRequest); |
@@ -154,7 +154,7 @@ public class BuyerOrderCancelService { | @@ -154,7 +154,7 @@ public class BuyerOrderCancelService { | ||
154 | // 已付款 -> 超时未发货取消 | 154 | // 已付款 -> 超时未发货取消 |
155 | .withStateTransition(OrderStatus.HAS_PAYED, OrderStatus.SEND_OUT_TIMEOUT, orderStatusFlowService) | 155 | .withStateTransition(OrderStatus.HAS_PAYED, OrderStatus.SEND_OUT_TIMEOUT, orderStatusFlowService) |
156 | // 保证金分账给平台和买家 | 156 | // 保证金分账给平台和买家 |
157 | - .withTransfer(transferService, TransferCase.SELLER_PLAY_BUYER.getCode(), TransferCase.DELIVER_TIME_OUT, SellerWalletDetail.Type.SELLER_OVER_TIME) | 157 | + .withTransfer(transferService, TransferCase.EARNEST_MONEY_TO_BUYER, SellerWalletDetail.Type.SELLER_OVER_TIME) |
158 | // 退买家货款 | 158 | // 退买家货款 |
159 | .withRefundGoodsMoney(payRefundService::refund).refundCase(RefundCase.BUYER_GOODS_MONEY).skup(skup).and() | 159 | .withRefundGoodsMoney(payRefundService::refund).refundCase(RefundCase.BUYER_GOODS_MONEY).skup(skup).and() |
160 | .withFailAlarm(AlarmConfig.DELIVER_TIME_OUT) | 160 | .withFailAlarm(AlarmConfig.DELIVER_TIME_OUT) |
@@ -171,7 +171,7 @@ public class BuyerOrderCancelService { | @@ -171,7 +171,7 @@ public class BuyerOrderCancelService { | ||
171 | // 卖家发货 -> 鉴定中心收货前客服取消 | 171 | // 卖家发货 -> 鉴定中心收货前客服取消 |
172 | .withStateTransition(OrderStatus.SELLER_SEND_OUT, OrderStatus.CS_CANCEL_BEFORE_DEPOT_RECEIVE, orderStatusFlowService) | 172 | .withStateTransition(OrderStatus.SELLER_SEND_OUT, OrderStatus.CS_CANCEL_BEFORE_DEPOT_RECEIVE, orderStatusFlowService) |
173 | // 保证金分账给平台和买家 | 173 | // 保证金分账给平台和买家 |
174 | - .withTransfer(transferService, TransferCase.CS_CANCEL_BEFORE_DEPOT_RECEIVE.getCode(), TransferCase.CS_CANCEL_BEFORE_DEPOT_RECEIVE, SellerWalletDetail.Type.CS_CANCEL_BEFORE_DEPOT_RECEIVE) | 174 | + .withTransfer(transferService, TransferCase.EARNEST_MONEY_TO_BUYER, SellerWalletDetail.Type.CS_CANCEL_BEFORE_DEPOT_RECEIVE) |
175 | // 退买家货款 | 175 | // 退买家货款 |
176 | .withRefundGoodsMoney(payRefundService::refund).refundCase(RefundCase.BUYER_GOODS_MONEY).and() | 176 | .withRefundGoodsMoney(payRefundService::refund).refundCase(RefundCase.BUYER_GOODS_MONEY).and() |
177 | // 通知卖家涉及虚假发货 | 177 | // 通知卖家涉及虚假发货 |
@@ -46,17 +46,13 @@ import com.yohoufo.order.utils.PaymentHelper; | @@ -46,17 +46,13 @@ import com.yohoufo.order.utils.PaymentHelper; | ||
46 | import org.apache.commons.collections.CollectionUtils; | 46 | import org.apache.commons.collections.CollectionUtils; |
47 | import org.apache.commons.lang3.StringUtils; | 47 | import org.apache.commons.lang3.StringUtils; |
48 | import org.slf4j.Logger; | 48 | import org.slf4j.Logger; |
49 | -import org.slf4j.LoggerFactory; | ||
50 | import org.springframework.beans.factory.annotation.Autowired; | 49 | import org.springframework.beans.factory.annotation.Autowired; |
51 | -import org.springframework.beans.factory.annotation.Value; | ||
52 | import org.springframework.stereotype.Service; | 50 | import org.springframework.stereotype.Service; |
53 | 51 | ||
54 | import java.math.BigDecimal; | 52 | import java.math.BigDecimal; |
55 | import java.util.Date; | 53 | import java.util.Date; |
56 | import java.util.Objects; | 54 | import java.util.Objects; |
57 | 55 | ||
58 | -import javax.annotation.PostConstruct; | ||
59 | - | ||
60 | 56 | ||
61 | @Service | 57 | @Service |
62 | public class PaymentServiceImpl implements IPaymentService { | 58 | public class PaymentServiceImpl implements IPaymentService { |
@@ -532,7 +528,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -532,7 +528,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
532 | TargetUserType targetUserType = (transferCase == TransferCase.APPRAISE_FAIL | 528 | TargetUserType targetUserType = (transferCase == TransferCase.APPRAISE_FAIL |
533 | || transferCase == TransferCase.SELLER_PLAY_BUYER | 529 | || transferCase == TransferCase.SELLER_PLAY_BUYER |
534 | || transferCase == TransferCase.DELIVER_TIME_OUT | 530 | || transferCase == TransferCase.DELIVER_TIME_OUT |
535 | - || transferCase == TransferCase.CS_CANCEL_BEFORE_DEPOT_RECEIVE) ? TargetUserType.buyer : TargetUserType.seller; | 531 | + || transferCase == TransferCase.EARNEST_MONEY_TO_BUYER) ? TargetUserType.buyer : TargetUserType.seller; |
536 | Integer targetUid = targetUserType == TargetUserType.buyer ? buyerOrder.getUid() : sellerUid; | 532 | Integer targetUid = targetUserType == TargetUserType.buyer ? buyerOrder.getUid() : sellerUid; |
537 | 533 | ||
538 | if (targetUid == null || targetUid < 1) { | 534 | if (targetUid == null || targetUid < 1) { |
@@ -474,8 +474,13 @@ public class SellerOrderCancelService { | @@ -474,8 +474,13 @@ public class SellerOrderCancelService { | ||
474 | try{ | 474 | try{ |
475 | //分赃(分账) 有待考虑使用2比对 | 475 | //分赃(分账) 有待考虑使用2比对 |
476 | TransferCase transferCase = TransferCase.SELLER_PLAY_BUYER; | 476 | TransferCase transferCase = TransferCase.SELLER_PLAY_BUYER; |
477 | - TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(buyerOrderCode) | ||
478 | - .type(transferCase.getCode()).swdType(SellerWalletDetail.Type.SELLER_CANCEL).transferCase(transferCase).build(); | 477 | + TransferMoneyRequest tmReq = TransferMoneyRequest.builder() |
478 | + .buyerOrderCode(buyerOrderCode) | ||
479 | + .type(transferCase.getCode()) | ||
480 | + .transferCase(transferCase) | ||
481 | + .swdType(SellerWalletDetail.Type.SELLER_CANCEL) | ||
482 | + .alarmConfig(AlarmConfig.SELLER_PLAY_BUYER) | ||
483 | + .build(); | ||
479 | transferService.transfer(tmReq); | 484 | transferService.transfer(tmReq); |
480 | PayRefundBo refundResp = payRefundService.refund(refundReq, bleb); | 485 | PayRefundBo refundResp = payRefundService.refund(refundReq, bleb); |
481 | 486 |
@@ -4,90 +4,63 @@ import com.yohoufo.common.alarm.EventBusPublisher; | @@ -4,90 +4,63 @@ import com.yohoufo.common.alarm.EventBusPublisher; | ||
4 | import com.yohoufo.common.alarm.SmsAlarmEvent; | 4 | import com.yohoufo.common.alarm.SmsAlarmEvent; |
5 | import com.yohoufo.order.common.TransferCase; | 5 | import com.yohoufo.order.common.TransferCase; |
6 | import com.yohoufo.order.constants.AlarmConfig; | 6 | import com.yohoufo.order.constants.AlarmConfig; |
7 | -import com.yohoufo.order.event.BillLogEvent; | ||
8 | import com.yohoufo.order.model.request.TransferMoneyRequest; | 7 | import com.yohoufo.order.model.request.TransferMoneyRequest; |
9 | import com.yohoufo.order.service.IPaymentService; | 8 | import com.yohoufo.order.service.IPaymentService; |
10 | -import com.yohoufo.order.utils.LoggerUtils; | ||
11 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
12 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
15 | 13 | ||
14 | +import java.util.Objects; | ||
15 | + | ||
16 | /** | 16 | /** |
17 | * Created by chenchao on 2018/10/16. | 17 | * Created by chenchao on 2018/10/16. |
18 | */ | 18 | */ |
19 | @Service | 19 | @Service |
20 | public class TransferService { | 20 | public class TransferService { |
21 | 21 | ||
22 | - private final Logger closeLogger = LoggerUtils.getOrderCloseLogger(); | ||
23 | - | ||
24 | private final Logger logger = LoggerFactory.getLogger(getClass()); | 22 | private final Logger logger = LoggerFactory.getLogger(getClass()); |
25 | 23 | ||
26 | @Autowired | 24 | @Autowired |
27 | private IPaymentService paymentService; | 25 | private IPaymentService paymentService; |
28 | 26 | ||
29 | - public boolean transfer(TransferMoneyRequest req){ | 27 | + public boolean transfer(TransferMoneyRequest req) { |
28 | + logger.info("in transfer, req is {}", req); | ||
30 | TransferCase transferCase = req.getTransferCase(); | 29 | TransferCase transferCase = req.getTransferCase(); |
31 | - | ||
32 | - if (transferCase == null){ | 30 | + if (transferCase == null) { |
33 | return true; | 31 | return true; |
34 | } | 32 | } |
35 | - boolean transferFlag=true; | ||
36 | - try{ | 33 | + boolean transferFlag = true; |
34 | + try { | ||
37 | paymentService.transferMon(req); | 35 | paymentService.transferMon(req); |
38 | - }catch (Exception ex){ | 36 | + } catch (Exception ex) { |
39 | transferFlag = false; | 37 | transferFlag = false; |
40 | logger.warn("in transfer, transfer fail,req {}", req, ex); | 38 | logger.warn("in transfer, transfer fail,req {}", req, ex); |
41 | - | ||
42 | SmsAlarmEvent smsAlarmEvent = getSmsAlarmEvent(req, transferCase); | 39 | SmsAlarmEvent smsAlarmEvent = getSmsAlarmEvent(req, transferCase); |
43 | EventBusPublisher.publishEvent(smsAlarmEvent); | 40 | EventBusPublisher.publishEvent(smsAlarmEvent); |
44 | } | 41 | } |
45 | return transferFlag; | 42 | return transferFlag; |
46 | } | 43 | } |
47 | 44 | ||
48 | - SmsAlarmEvent getSmsAlarmEvent(TransferMoneyRequest req, TransferCase transferCase){ | ||
49 | - String content; | ||
50 | - SmsAlarmEvent smsAlarmEvent; | ||
51 | - AlarmConfig alarmConfig ; | ||
52 | - switch (transferCase){ | ||
53 | - case APPRAISE_SUCCESS: | ||
54 | - content = "鉴定通过时,订单"+ req.getBuyerOrderCode() + "货款分账失败"; | ||
55 | - alarmConfig = AlarmConfig.APPRAISE_SUCCESS; | ||
56 | - | ||
57 | - break; | ||
58 | - | ||
59 | - case APPRAISE_FAIL: | ||
60 | - content = "鉴定不通过时,订单"+ req.getBuyerOrderCode() + "保证金分账失败"; | ||
61 | - alarmConfig = AlarmConfig.APPRAISE_FAIL; | ||
62 | - break; | ||
63 | - | ||
64 | - case SELLER_PLAY_BUYER: | ||
65 | - closeLogger.warn("in cancelAfterPayExistBuyAction , transfer fail,req {}", req); | ||
66 | - content = "卖家取消,订单"+ req.getBuyerOrderCode() + "保证金分账失败"; | ||
67 | - alarmConfig = AlarmConfig.SELLER_PLAY_BUYER; | ||
68 | - break; | ||
69 | - | ||
70 | - | ||
71 | - case DELIVER_TIME_OUT: | ||
72 | - closeLogger.warn("in deliver timeout , transfer fail,req {}", req); | ||
73 | - content = "卖家发货超时,订单"+ req.getBuyerOrderCode() + "保证金分账失败"; | ||
74 | - alarmConfig = AlarmConfig.DELIVER_TIME_OUT; | ||
75 | - break; | ||
76 | - | ||
77 | - case CS_CANCEL_BEFORE_DEPOT_RECEIVE: | ||
78 | - closeLogger.warn("in deliver timeout , transfer fail,req {}", req); | ||
79 | - content = "鉴定中心收货前客服取消,订单"+ req.getBuyerOrderCode() + "保证金分账失败"; | ||
80 | - alarmConfig = AlarmConfig.CS_CANCEL_BEFORE_DEPOT_RECEIVE; | ||
81 | - break; | ||
82 | - | ||
83 | - default: | ||
84 | - return null; | 45 | + SmsAlarmEvent getSmsAlarmEvent(TransferMoneyRequest req, TransferCase transferCase) { |
46 | + AlarmConfig alarmConfig = req.getAlarmConfig(); | ||
47 | + if (Objects.isNull(alarmConfig)) { | ||
48 | + switch (transferCase) { | ||
49 | + case APPRAISE_FAIL: | ||
50 | + alarmConfig = AlarmConfig.APPRAISE_FAIL; | ||
51 | + break; | ||
52 | + default: | ||
53 | + return null; | ||
54 | + } | ||
55 | + } | ||
56 | + if (Objects.nonNull(alarmConfig)) { | ||
57 | + String content = alarmConfig.getDesc() + "分账失败,订单" + req.getBuyerOrderCode(); | ||
58 | + return new SmsAlarmEvent(alarmConfig.getTransferName(), alarmConfig.name(), content); | ||
59 | + } else { | ||
60 | + String content = "买家订单分账失败,订单" + req.getBuyerOrderCode(); | ||
61 | + return new SmsAlarmEvent("buyerOrder.transfer", "transfer", content); | ||
85 | } | 62 | } |
86 | - | ||
87 | - smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getTransferName(), alarmConfig.name(), content); | ||
88 | - return smsAlarmEvent; | ||
89 | } | 63 | } |
90 | 64 | ||
91 | 65 | ||
92 | - | ||
93 | } | 66 | } |
-
Please register or login to post a comment