Showing
10 changed files
with
188 additions
and
11 deletions
@@ -2,6 +2,7 @@ package com.yohoufo.dal.order; | @@ -2,6 +2,7 @@ package com.yohoufo.dal.order; | ||
2 | 2 | ||
3 | 3 | ||
4 | import com.yohoufo.dal.order.model.OrdersPayTransfer; | 4 | import com.yohoufo.dal.order.model.OrdersPayTransfer; |
5 | +import org.apache.ibatis.annotations.Param; | ||
5 | 6 | ||
6 | public interface OrdersPayTransferMapper { | 7 | public interface OrdersPayTransferMapper { |
7 | 8 | ||
@@ -11,6 +12,8 @@ public interface OrdersPayTransferMapper { | @@ -11,6 +12,8 @@ public interface OrdersPayTransferMapper { | ||
11 | 12 | ||
12 | OrdersPayTransfer selectByPrimaryKey(Integer id); | 13 | OrdersPayTransfer selectByPrimaryKey(Integer id); |
13 | 14 | ||
15 | + int selectByUidAndTransferType(@Param("uid") Integer uid, @Param("transferType") Integer transferType); | ||
16 | + | ||
14 | int updateByPrimaryKeySelective(OrdersPayTransfer record); | 17 | int updateByPrimaryKeySelective(OrdersPayTransfer record); |
15 | 18 | ||
16 | int updateByPrimaryKey(OrdersPayTransfer record); | 19 | int updateByPrimaryKey(OrdersPayTransfer record); |
@@ -48,6 +48,7 @@ public class SellerWalletDetail { | @@ -48,6 +48,7 @@ public class SellerWalletDetail { | ||
48 | SELLER_CANCEL("卖家不卖了", 31), | 48 | SELLER_CANCEL("卖家不卖了", 31), |
49 | SELLER_OVER_TIME("卖家发货超时", 32), | 49 | SELLER_OVER_TIME("卖家发货超时", 32), |
50 | APPRAISE_FAIL("鉴定不通过", 33), | 50 | APPRAISE_FAIL("鉴定不通过", 33), |
51 | + DEPOSIT_REBATE("申请寄存返利", 53), | ||
51 | SELLER_SHAM_SEND_OUT("卖家虚假发货", 34), | 52 | SELLER_SHAM_SEND_OUT("卖家虚假发货", 34), |
52 | MINI_FAULT_REJECT("瑕疵确认不接受", 35), | 53 | MINI_FAULT_REJECT("瑕疵确认不接受", 35), |
53 | BUYER_CANCEL_NO_DELIVERY("买家取消(无物流)", 41), | 54 | BUYER_CANCEL_NO_DELIVERY("买家取消(无物流)", 41), |
@@ -40,6 +40,14 @@ | @@ -40,6 +40,14 @@ | ||
40 | where buyer_order_code = #{buyerOrderCode,jdbcType=INTEGER} | 40 | where buyer_order_code = #{buyerOrderCode,jdbcType=INTEGER} |
41 | </select> | 41 | </select> |
42 | 42 | ||
43 | + <select id="selectByUidAndTransferType" resultMap="BaseResultMap" parameterType="java.lang.Long" > | ||
44 | + select | ||
45 | + count(1) | ||
46 | + from orders_pay_transfer | ||
47 | + where uid = #{uid,jdbcType=INTEGER} | ||
48 | + and transfer_type = #{transferType,jdbcType=INTEGER} | ||
49 | + </select> | ||
50 | + | ||
43 | <insert id="insert" parameterType="com.yohoufo.dal.order.model.OrdersPayTransfer" useGeneratedKeys="true" keyProperty="id" > | 51 | <insert id="insert" parameterType="com.yohoufo.dal.order.model.OrdersPayTransfer" useGeneratedKeys="true" keyProperty="id" > |
44 | insert into orders_pay_transfer (id, buyer_order_code, seller_order_code, | 52 | insert into orders_pay_transfer (id, buyer_order_code, seller_order_code, |
45 | alipay_trade_id, transfer_type, uid, | 53 | alipay_trade_id, transfer_type, uid, |
@@ -14,7 +14,8 @@ public enum TransferCase { | @@ -14,7 +14,8 @@ public enum TransferCase { | ||
14 | 14 | ||
15 | ALL_GOODS_MONEY_TO_SELLER(1, "货款->卖家"), | 15 | ALL_GOODS_MONEY_TO_SELLER(1, "货款->卖家"), |
16 | EARNEST_MONEY_TO_BUYER(3,"保证金->买家"), | 16 | EARNEST_MONEY_TO_BUYER(3,"保证金->买家"), |
17 | - PART_GOODS_MONEY_TO_SELLER(6,"部分货款->卖家"); | 17 | + PART_GOODS_MONEY_TO_SELLER(6,"部分货款->卖家"), |
18 | + DEPOSIT_REBATE_TO_USER(7, "申请寄存返利->用户"); | ||
18 | 19 | ||
19 | private int code; | 20 | private int code; |
20 | private String info; | 21 | private String info; |
@@ -27,6 +27,10 @@ public enum AlarmConfig { | @@ -27,6 +27,10 @@ public enum AlarmConfig { | ||
27 | "buyerOrder.transferEarnestMoney", | 27 | "buyerOrder.transferEarnestMoney", |
28 | "buyerOrder.refundGoodsMoney"), | 28 | "buyerOrder.refundGoodsMoney"), |
29 | 29 | ||
30 | + DEPOSIT_REBATE_FAIL("申请寄存返利", | ||
31 | + "appraiseOrder.depositRebate", | ||
32 | + ""), | ||
33 | + | ||
30 | SELLER_SHAM_SEND_OUT("卖家虚假发货", | 34 | SELLER_SHAM_SEND_OUT("卖家虚假发货", |
31 | "buyerOrder.transferEarnestMoney", | 35 | "buyerOrder.transferEarnestMoney", |
32 | "buyerOrder.refundGoodsMoney"); | 36 | "buyerOrder.refundGoodsMoney"); |
@@ -18,14 +18,13 @@ import com.yohoufo.order.model.request.OrderRequest; | @@ -18,14 +18,13 @@ import com.yohoufo.order.model.request.OrderRequest; | ||
18 | import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; | 18 | 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; | ||
22 | -import com.yohoufo.order.service.impl.BuyerOrderViewService; | ||
23 | -import com.yohoufo.order.service.impl.SellerOrderService; | 21 | +import com.yohoufo.order.service.impl.*; |
24 | import com.yohoufo.order.utils.LoggerUtils; | 22 | import com.yohoufo.order.utils.LoggerUtils; |
25 | import org.slf4j.Logger; | 23 | import org.slf4j.Logger; |
26 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
27 | import org.springframework.web.bind.annotation.*; | 25 | import org.springframework.web.bind.annotation.*; |
28 | 26 | ||
27 | +import java.util.List; | ||
29 | import java.util.Objects; | 28 | import java.util.Objects; |
30 | 29 | ||
31 | @RestController | 30 | @RestController |
@@ -48,6 +47,9 @@ public class ErpGWOrderController { | @@ -48,6 +47,9 @@ public class ErpGWOrderController { | ||
48 | BuyerOrderCancelService buyerOrderCancelService; | 47 | BuyerOrderCancelService buyerOrderCancelService; |
49 | 48 | ||
50 | @Autowired | 49 | @Autowired |
50 | + AppraiseOrderService appraiseOrderService; | ||
51 | + | ||
52 | + @Autowired | ||
51 | private BuyerOrderViewService buyerOrderViewService; | 53 | private BuyerOrderViewService buyerOrderViewService; |
52 | 54 | ||
53 | @RequestMapping(params = "method=ufo.buyer.orderNums") | 55 | @RequestMapping(params = "method=ufo.buyer.orderNums") |
@@ -161,6 +163,16 @@ public class ErpGWOrderController { | @@ -161,6 +163,16 @@ public class ErpGWOrderController { | ||
161 | return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build(); | 163 | return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build(); |
162 | } | 164 | } |
163 | 165 | ||
166 | + @IgnoreSession | ||
167 | + @IgnoreSignature | ||
168 | + @RequestMapping(value = "/depositRebate") | ||
169 | + public ApiResponse depositRebate(@RequestBody List<Long> orderCodeList) { | ||
170 | + LOG.info("method depositRebate in, req is {}", orderCodeList); | ||
171 | + appraiseOrderService.depositRebate(orderCodeList); | ||
172 | + LOG.info("method depositRebate, req is {}", orderCodeList); | ||
173 | + return new ApiResponse.ApiResponseBuilder().code(200).message("申请寄存返利").build(); | ||
174 | + } | ||
175 | + | ||
164 | 176 | ||
165 | /** | 177 | /** |
166 | * 后台手工确认的清关失败的订单 | 178 | * 后台手工确认的清关失败的订单 |
@@ -4,10 +4,19 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes; | @@ -4,10 +4,19 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes; | ||
4 | import com.yohobuy.ufo.model.order.req.DeliverToDepotReq; | 4 | import com.yohobuy.ufo.model.order.req.DeliverToDepotReq; |
5 | import com.yohoufo.dal.order.model.AppraiseOrder; | 5 | import com.yohoufo.dal.order.model.AppraiseOrder; |
6 | 6 | ||
7 | +import java.util.List; | ||
8 | + | ||
7 | public interface IGoodsService { | 9 | public interface IGoodsService { |
8 | 10 | ||
9 | 11 | ||
10 | /** | 12 | /** |
13 | + * 申请寄存返利 | ||
14 | + * @param orderCodeList | ||
15 | + */ | ||
16 | + void depositRebate(List<Long> orderCodeList); | ||
17 | + | ||
18 | + | ||
19 | + /** | ||
11 | * 发货 | 20 | * 发货 |
12 | * @param req | 21 | * @param req |
13 | */ | 22 | */ |
@@ -21,6 +21,22 @@ public class AlipayTransferChancelSelector { | @@ -21,6 +21,22 @@ public class AlipayTransferChancelSelector { | ||
21 | @Autowired | 21 | @Autowired |
22 | private ConfigReader configReader; | 22 | private ConfigReader configReader; |
23 | 23 | ||
24 | + /** | ||
25 | + * 申请寄存返利的单数 | ||
26 | + * @return | ||
27 | + */ | ||
28 | + public int getDepositRebateOrderCnt(){ | ||
29 | + return configReader.getInt("ufo.order.pay.depositRebateCnt", 4); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * 申请寄存返利一单返利数目 | ||
34 | + * @return | ||
35 | + */ | ||
36 | + public double getDepositRebateAmount(){ | ||
37 | + return configReader.getDouble("ufo.order.pay.depositRebatePerAmount", 40); | ||
38 | + } | ||
39 | + | ||
24 | public boolean isTransferWithAlipayExceedMillionTransfer() { | 40 | public boolean isTransferWithAlipayExceedMillionTransfer() { |
25 | boolean value = configReader.getBoolean("ufo.order.pay.exceedSwitch", false); | 41 | boolean value = configReader.getBoolean("ufo.order.pay.exceedSwitch", false); |
26 | if (value) { | 42 | if (value) { |
@@ -19,23 +19,31 @@ import com.yohoufo.common.utils.DateUtil; | @@ -19,23 +19,31 @@ import com.yohoufo.common.utils.DateUtil; | ||
19 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; | 19 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; |
20 | import com.yohoufo.dal.order.AppraiseOrderMapper; | 20 | import com.yohoufo.dal.order.AppraiseOrderMapper; |
21 | import com.yohoufo.dal.order.AppraiseOrderMetaMapper; | 21 | import com.yohoufo.dal.order.AppraiseOrderMetaMapper; |
22 | +import com.yohoufo.dal.order.OrdersPayTransferMapper; | ||
22 | import com.yohoufo.dal.order.model.*; | 23 | import com.yohoufo.dal.order.model.*; |
23 | import com.yohoufo.order.common.ClientType; | 24 | import com.yohoufo.order.common.ClientType; |
25 | +import com.yohoufo.order.common.TransferCase; | ||
26 | +import com.yohoufo.order.constants.AlarmConfig; | ||
24 | import com.yohoufo.order.constants.MetaKey; | 27 | import com.yohoufo.order.constants.MetaKey; |
25 | import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor; | 28 | import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor; |
26 | import com.yohoufo.order.convert.SellerOrderConvertor; | 29 | import com.yohoufo.order.convert.SellerOrderConvertor; |
27 | import com.yohoufo.order.model.dto.AppraiseOrderContext; | 30 | import com.yohoufo.order.model.dto.AppraiseOrderContext; |
31 | +import com.yohoufo.order.model.request.TranseferCellNode; | ||
32 | +import com.yohoufo.order.model.request.TransferMoneyRequest; | ||
28 | import com.yohoufo.order.service.IExpressInfoService; | 33 | import com.yohoufo.order.service.IExpressInfoService; |
29 | import com.yohoufo.order.service.IGoodsService; | 34 | import com.yohoufo.order.service.IGoodsService; |
30 | import com.yohoufo.order.service.handler.GoodsServiceRefundHandler; | 35 | import com.yohoufo.order.service.handler.GoodsServiceRefundHandler; |
36 | +import com.yohoufo.order.service.handler.transfer.AlipayTransferChancelSelector; | ||
31 | import com.yohoufo.order.service.proxy.InBoxFacade; | 37 | import com.yohoufo.order.service.proxy.InBoxFacade; |
32 | import com.yohoufo.order.service.proxy.ProductProxyService; | 38 | import com.yohoufo.order.service.proxy.ProductProxyService; |
33 | import com.yohoufo.order.service.proxy.UserProxyService; | 39 | import com.yohoufo.order.service.proxy.UserProxyService; |
34 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; | 40 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
35 | import com.yohoufo.order.utils.AddressHelper; | 41 | import com.yohoufo.order.utils.AddressHelper; |
36 | import com.yohoufo.order.utils.LoggerUtils; | 42 | import com.yohoufo.order.utils.LoggerUtils; |
43 | +import com.yohoufo.order.utils.NamedThreadFactory; | ||
37 | import lombok.Builder; | 44 | import lombok.Builder; |
38 | import lombok.Data; | 45 | import lombok.Data; |
46 | +import org.apache.commons.collections.CollectionUtils; | ||
39 | import org.apache.commons.lang3.StringUtils; | 47 | import org.apache.commons.lang3.StringUtils; |
40 | import org.slf4j.Logger; | 48 | import org.slf4j.Logger; |
41 | import org.springframework.beans.factory.annotation.Autowired; | 49 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -46,6 +54,10 @@ import java.util.ArrayList; | @@ -46,6 +54,10 @@ import java.util.ArrayList; | ||
46 | import java.util.List; | 54 | import java.util.List; |
47 | import java.util.Map; | 55 | import java.util.Map; |
48 | import java.util.Objects; | 56 | import java.util.Objects; |
57 | +import java.util.concurrent.ArrayBlockingQueue; | ||
58 | +import java.util.concurrent.ExecutorService; | ||
59 | +import java.util.concurrent.ThreadPoolExecutor; | ||
60 | +import java.util.concurrent.TimeUnit; | ||
49 | import java.util.function.Function; | 61 | import java.util.function.Function; |
50 | import java.util.stream.Collectors; | 62 | import java.util.stream.Collectors; |
51 | 63 | ||
@@ -68,10 +80,6 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | @@ -68,10 +80,6 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | ||
68 | @Autowired | 80 | @Autowired |
69 | IExpressInfoService expressInfoService; | 81 | IExpressInfoService expressInfoService; |
70 | 82 | ||
71 | - | ||
72 | - @Autowired | ||
73 | - private OrderCodeGenerator orderCodeGenerator; | ||
74 | - | ||
75 | @Autowired | 83 | @Autowired |
76 | private AppraiseOrderMetaMapper appraiseOrderMetaMapper; | 84 | private AppraiseOrderMetaMapper appraiseOrderMetaMapper; |
77 | 85 | ||
@@ -87,6 +95,82 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | @@ -87,6 +95,82 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | ||
87 | @Autowired | 95 | @Autowired |
88 | private PayRefundService payRefundService; | 96 | private PayRefundService payRefundService; |
89 | 97 | ||
98 | + @Autowired | ||
99 | + OrderCodeGenerator orderCodeGenerator; | ||
100 | + | ||
101 | + @Autowired | ||
102 | + private AlipayTransferChancelSelector alipayTransferChancelSelector; | ||
103 | + | ||
104 | + @Autowired | ||
105 | + TransferService transferService; | ||
106 | + | ||
107 | + @Autowired | ||
108 | + OrdersPayTransferMapper ordersPayTransferMapper; | ||
109 | + | ||
110 | + private ExecutorService executorService = new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS, | ||
111 | + new ArrayBlockingQueue<>(1000), | ||
112 | + NamedThreadFactory.newThreadFactory("appraise")); | ||
113 | + | ||
114 | + /** | ||
115 | + * 申请寄存返利 | ||
116 | + * @param orderCodeList | ||
117 | + */ | ||
118 | + public void depositRebate(List<Long> orderCodeList){ | ||
119 | + | ||
120 | + logger.info("depositRebate param is {}", orderCodeList); | ||
121 | + | ||
122 | + if (CollectionUtils.isEmpty(orderCodeList)){ | ||
123 | + return; | ||
124 | + } | ||
125 | + | ||
126 | + // 过滤1: 通过code过滤出来 goods_service的订单号 | ||
127 | + List<Long> goodServiceOrderLists = orderCodeList.stream() | ||
128 | + .filter(orderCode -> orderCodeGenerator.expId(orderCode).getType() == OrderCodeType.GOODS_SERVICE.getType()) | ||
129 | + .collect(Collectors.toList()); | ||
130 | + | ||
131 | + // 过滤2: 通过查表 appaise_order & attribute | ||
132 | + List<AppraiseOrder> appraiseOrderList = appraiseOrderMapper.selectByOrderCodeList(goodServiceOrderLists); | ||
133 | + | ||
134 | + if (CollectionUtils.isEmpty(appraiseOrderList)){ | ||
135 | + return; | ||
136 | + } | ||
137 | + List<AppraiseOrder> depositCodeList = appraiseOrderList.stream() | ||
138 | + .filter(appraiseOrder -> appraiseOrder.getAttributes() == OrderAttributes.DEPOSITE.getCode()) | ||
139 | + .collect(Collectors.toList()); | ||
140 | + | ||
141 | +// executorService.execute(() -> { | ||
142 | + | ||
143 | + // 只返4单 | ||
144 | + int DEFAULT_REBATE_CNT = alipayTransferChancelSelector.getDepositRebateOrderCnt(); | ||
145 | + depositCodeList.stream().forEach(depositCode -> { | ||
146 | + | ||
147 | + int rebateCnt = ordersPayTransferMapper.selectByUidAndTransferType(depositCode.getUid(),TransferCase.DEPOSIT_REBATE_TO_USER.getCode()); | ||
148 | + logger.info("rebate transfer cnt {}, uid {}", rebateCnt, depositCode.getUid()); | ||
149 | + if (rebateCnt < DEFAULT_REBATE_CNT){ | ||
150 | + TransferCase transferCase = TransferCase.DEPOSIT_REBATE_TO_USER; | ||
151 | + TranseferCellNode transeferCellNode = new TranseferCellNode(); | ||
152 | + transeferCellNode.setUid(depositCode.getUid()); | ||
153 | + transeferCellNode.setAmount(new BigDecimal(alipayTransferChancelSelector.getDepositRebateAmount())); // 一单返40元 | ||
154 | + | ||
155 | + TransferMoneyRequest tmReq = TransferMoneyRequest.builder() | ||
156 | + .sellerUid(depositCode.getUid()) | ||
157 | + .buyerOrderCode(depositCode.getOrderCode()) | ||
158 | + .type(transferCase.getCode()) | ||
159 | + .transferCase(transferCase) | ||
160 | + .transeferCellNode(transeferCellNode) | ||
161 | + .swdType(SellerWalletDetail.Type.DEPOSIT_REBATE) | ||
162 | + .alarmConfig(AlarmConfig.DEPOSIT_REBATE_FAIL) // 打款失败的时候警告 | ||
163 | + .build(); | ||
164 | + | ||
165 | + transferService.transfer(tmReq); | ||
166 | + } | ||
167 | + | ||
168 | + }); | ||
169 | + | ||
170 | +// }); | ||
171 | + | ||
172 | + } | ||
173 | + | ||
90 | 174 | ||
91 | public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ | 175 | public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ |
92 | logger.info("in AppraiseOrderService.compute req {}", req); | 176 | logger.info("in AppraiseOrderService.compute req {}", req); |
@@ -100,9 +100,6 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -100,9 +100,6 @@ public class PaymentServiceImpl implements IPaymentService { | ||
100 | MerchantOrderPaymentService merchantOrderPaymentService; | 100 | MerchantOrderPaymentService merchantOrderPaymentService; |
101 | 101 | ||
102 | @Autowired | 102 | @Autowired |
103 | - OrderCodeGenerator orderCodeGenerator; | ||
104 | - | ||
105 | - @Autowired | ||
106 | WeixinPayUFORealAppService weixinPayAppService; | 103 | WeixinPayUFORealAppService weixinPayAppService; |
107 | 104 | ||
108 | @Autowired | 105 | @Autowired |
@@ -171,6 +168,9 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -171,6 +168,9 @@ public class PaymentServiceImpl implements IPaymentService { | ||
171 | @Autowired | 168 | @Autowired |
172 | private RefundManager refundManager; | 169 | private RefundManager refundManager; |
173 | 170 | ||
171 | + @Autowired | ||
172 | + OrderCodeGenerator orderCodeGenerator; | ||
173 | + | ||
174 | 174 | ||
175 | /** | 175 | /** |
176 | * 订单支付结果确认 | 176 | * 订单支付结果确认 |
@@ -419,6 +419,11 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -419,6 +419,11 @@ public class PaymentServiceImpl implements IPaymentService { | ||
419 | 419 | ||
420 | 420 | ||
421 | private void penaltyEarnestIfWalletSellerOrder(BiFunction penaltyEarnestFunction, SellerWalletDetail.Type swdType, SellerOrder sellerOrder) { | 421 | private void penaltyEarnestIfWalletSellerOrder(BiFunction penaltyEarnestFunction, SellerWalletDetail.Type swdType, SellerOrder sellerOrder) { |
422 | + | ||
423 | + if (sellerOrder == null){ | ||
424 | + return; | ||
425 | + } | ||
426 | + | ||
422 | Integer sellerUid = sellerOrder.getUid(); | 427 | Integer sellerUid = sellerOrder.getUid(); |
423 | Long sellerOrderCode = sellerOrder.getOrderCode(); | 428 | Long sellerOrderCode = sellerOrder.getOrderCode(); |
424 | Integer skup = sellerOrder.getSkup(); | 429 | Integer skup = sellerOrder.getSkup(); |
@@ -462,6 +467,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -462,6 +467,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
462 | Integer targetUid = transferMoneyModel.getTargetUid(); | 467 | Integer targetUid = transferMoneyModel.getTargetUid(); |
463 | int now = transferMoneyModel.getNow(); | 468 | int now = transferMoneyModel.getNow(); |
464 | 469 | ||
470 | + | ||
465 | penaltyEarnestIfWalletSellerOrder(request.getPenaltyEarnestFunction(), request.getSwdType(), sellerOrder); | 471 | penaltyEarnestIfWalletSellerOrder(request.getPenaltyEarnestFunction(), request.getSwdType(), sellerOrder); |
466 | 472 | ||
467 | OrdersPayTransfer transfer = createTransfer(buyerOrderCode, sellerOrderCode, transferCase.getCode(), null, targetUid, BigDecimal.ZERO, now); | 473 | OrdersPayTransfer transfer = createTransfer(buyerOrderCode, sellerOrderCode, transferCase.getCode(), null, targetUid, BigDecimal.ZERO, now); |
@@ -1310,7 +1316,12 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1310,7 +1316,12 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1310 | } | 1316 | } |
1311 | 1317 | ||
1312 | public TransferMoneyModel invoke() { | 1318 | public TransferMoneyModel invoke() { |
1319 | + | ||
1313 | buyerOrderCode = request.getBuyerOrderCode(); | 1320 | buyerOrderCode = request.getBuyerOrderCode(); |
1321 | + | ||
1322 | + CodeMeta codeMeta = orderCodeGenerator.expId(buyerOrderCode); | ||
1323 | + // 买家订单号 | ||
1324 | + if (codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){ | ||
1314 | logTag = String.format("transfer money orderCode is %s", buyerOrderCode); | 1325 | logTag = String.format("transfer money orderCode is %s", buyerOrderCode); |
1315 | // 订单号check | 1326 | // 订单号check |
1316 | if (buyerOrderCode < 1L) { | 1327 | if (buyerOrderCode < 1L) { |
@@ -1357,7 +1368,35 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -1357,7 +1368,35 @@ public class PaymentServiceImpl implements IPaymentService { | ||
1357 | now = (int) (System.currentTimeMillis() / 1000); | 1368 | now = (int) (System.currentTimeMillis() / 1000); |
1358 | // 查看是否已经有转账记录 | 1369 | // 查看是否已经有转账记录 |
1359 | checkTransferExist(buyerOrderCode); | 1370 | checkTransferExist(buyerOrderCode); |
1371 | + } | ||
1372 | + // 商品服务 | ||
1373 | + else if(codeMeta.getType() == OrderCodeType.GOODS_SERVICE.getType()){ | ||
1374 | + | ||
1375 | + | ||
1376 | + logTag = String.format("transfer money orderCode is %s", buyerOrderCode); | ||
1377 | + | ||
1378 | + // 类型检查 | ||
1379 | + transferCase = TransferCase.getTransferCase(request.getType()); | ||
1380 | + if (transferCase == null) { | ||
1381 | + logger.warn("{}, transfer fail transferType invalid", logTag); | ||
1382 | + throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); | ||
1383 | + } | ||
1384 | + | ||
1385 | + // 商品返利的场合,不存在 买家订单号|卖家订单号的区分 | ||
1386 | + sellerOrderCode = buyerOrderCode; | ||
1387 | + targetUserType = TargetUserType.seller; | ||
1388 | + targetUid = request.getSellerUid(); | ||
1389 | + | ||
1390 | + if (targetUid == null || targetUid < 1) { | ||
1391 | + logger.warn("{}, transfer fail uid {} invalid", logTag, targetUid); | ||
1392 | + throw new ServiceException(400, "uid[" + targetUid + "]不合法"); | ||
1393 | + } | ||
1394 | + now = (int) (System.currentTimeMillis() / 1000); | ||
1395 | + | ||
1396 | + } | ||
1397 | + | ||
1360 | return this; | 1398 | return this; |
1399 | + | ||
1361 | } | 1400 | } |
1362 | 1401 | ||
1363 | 1402 |
-
Please register or login to post a comment