Showing
1 changed file
with
42 additions
and
53 deletions
1 | package com.yohoufo.order.service; | 1 | package com.yohoufo.order.service; |
2 | 2 | ||
3 | -import java.math.BigDecimal; | ||
4 | -import java.text.SimpleDateFormat; | ||
5 | -import java.util.ArrayList; | ||
6 | -import java.util.Arrays; | ||
7 | -import java.util.Date; | ||
8 | -import java.util.List; | ||
9 | -import java.util.Map; | ||
10 | -import java.util.Objects; | ||
11 | - | ||
12 | -import com.yohoufo.common.alarm.EventBusPublisher; | ||
13 | -import com.yohoufo.order.common.EnterQuitEnum; | ||
14 | -import com.yohoufo.order.event.InviteRecordEvent; | ||
15 | -import com.yohoufo.order.service.impl.TradeBillsService; | ||
16 | -import org.apache.commons.lang3.StringUtils; | ||
17 | -import org.slf4j.Logger; | ||
18 | -import org.slf4j.LoggerFactory; | ||
19 | -import org.springframework.beans.factory.annotation.Autowired; | ||
20 | -import org.springframework.stereotype.Service; | ||
21 | - | ||
22 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
23 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
24 | import com.yoho.core.common.utils.DateUtil; | 5 | import com.yoho.core.common.utils.DateUtil; |
@@ -31,31 +12,33 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; | @@ -31,31 +12,33 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; | ||
31 | import com.yohobuy.ufo.model.order.common.EntrySellerType; | 12 | import com.yohobuy.ufo.model.order.common.EntrySellerType; |
32 | import com.yohobuy.ufo.model.order.common.OrderCodeType; | 13 | import com.yohobuy.ufo.model.order.common.OrderCodeType; |
33 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 14 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
15 | +import com.yohobuy.ufo.model.order.common.Payment; | ||
34 | import com.yohobuy.ufo.model.order.resp.EntryThreshold; | 16 | import com.yohobuy.ufo.model.order.resp.EntryThreshold; |
35 | import com.yohobuy.ufo.model.order.resp.PageResp; | 17 | import com.yohobuy.ufo.model.order.resp.PageResp; |
36 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | 18 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
37 | import com.yohoufo.common.alarm.CommonAlarmEventPublisher; | 19 | import com.yohoufo.common.alarm.CommonAlarmEventPublisher; |
20 | +import com.yohoufo.common.alarm.EventBusPublisher; | ||
38 | import com.yohoufo.common.caller.UfoServiceCaller; | 21 | import com.yohoufo.common.caller.UfoServiceCaller; |
39 | import com.yohoufo.common.utils.TimeUtils; | 22 | import com.yohoufo.common.utils.TimeUtils; |
40 | -import com.yohoufo.dal.order.EntrySellerRechargeOrderMapper; | ||
41 | -import com.yohoufo.dal.order.OrdersPayMapper; | ||
42 | -import com.yohoufo.dal.order.OrdersPayRefundMapper; | ||
43 | -import com.yohoufo.dal.order.SellerJoinHistoryMapper; | ||
44 | -import com.yohoufo.dal.order.SellerWalletDetailMapper; | ||
45 | -import com.yohoufo.dal.order.SellerWalletMapper; | ||
46 | -import com.yohoufo.dal.order.model.EntrySellerRechargeOrder; | ||
47 | -import com.yohoufo.dal.order.model.OrdersPay; | ||
48 | -import com.yohoufo.dal.order.model.OrdersPayRefund; | ||
49 | -import com.yohoufo.dal.order.model.SellerJoinHistory; | ||
50 | -import com.yohoufo.dal.order.model.SellerWallet; | ||
51 | -import com.yohoufo.dal.order.model.SellerWalletDetail; | ||
52 | -import com.yohoufo.dal.order.model.StoredSeller; | 23 | +import com.yohoufo.dal.order.*; |
24 | +import com.yohoufo.dal.order.model.*; | ||
53 | import com.yohoufo.dal.user.model.ZhiMaCert; | 25 | import com.yohoufo.dal.user.model.ZhiMaCert; |
54 | -import com.yohobuy.ufo.model.order.common.Payment; | 26 | +import com.yohoufo.order.common.EnterQuitEnum; |
27 | +import com.yohoufo.order.event.InviteRecordEvent; | ||
55 | import com.yohoufo.order.model.request.PaymentRequest; | 28 | import com.yohoufo.order.model.request.PaymentRequest; |
56 | import com.yohoufo.order.model.response.PrepayResponse; | 29 | import com.yohoufo.order.model.response.PrepayResponse; |
57 | import com.yohoufo.order.service.impl.PaymentServiceImpl; | 30 | import com.yohoufo.order.service.impl.PaymentServiceImpl; |
58 | import com.yohoufo.order.service.impl.SellerService; | 31 | import com.yohoufo.order.service.impl.SellerService; |
32 | +import com.yohoufo.order.service.impl.TradeBillsService; | ||
33 | +import org.apache.commons.lang3.StringUtils; | ||
34 | +import org.slf4j.Logger; | ||
35 | +import org.slf4j.LoggerFactory; | ||
36 | +import org.springframework.beans.factory.annotation.Autowired; | ||
37 | +import org.springframework.stereotype.Service; | ||
38 | + | ||
39 | +import java.math.BigDecimal; | ||
40 | +import java.text.SimpleDateFormat; | ||
41 | +import java.util.*; | ||
59 | 42 | ||
60 | @Service | 43 | @Service |
61 | public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | 44 | public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
@@ -139,28 +122,11 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | @@ -139,28 +122,11 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | ||
139 | return result; | 122 | return result; |
140 | } | 123 | } |
141 | 124 | ||
142 | - @Override | ||
143 | - public void processAfterPay(OrderInfo orderInfo) { | ||
144 | - logger.info("充值后回调,处理processAfterPay,orderInfo={}", orderInfo); | 125 | + private void processFirstTimeCharge(SellerWallet sw, OrderInfo orderInfo){ |
145 | Long orderCode = orderInfo.getOrderCode(); | 126 | Long orderCode = orderInfo.getOrderCode(); |
146 | BigDecimal amount = orderInfo.getAmount(); | 127 | BigDecimal amount = orderInfo.getAmount(); |
147 | - Integer payment = orderInfo.getPayment(); | ||
148 | - tradeBillsService.addPayRechargeEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, payment, | ||
149 | - orderInfo.getAmount()); | ||
150 | - | ||
151 | - BigDecimal beforeAmount = BigDecimal.ZERO; | ||
152 | - BigDecimal beforeLockAmount = BigDecimal.ZERO; | ||
153 | - | ||
154 | - BigDecimal afterAmount = BigDecimal.ZERO; | ||
155 | - BigDecimal afterLockAmount = BigDecimal.ZERO; | ||
156 | - | ||
157 | Integer uid = orderInfo.getUid(); | 128 | Integer uid = orderInfo.getUid(); |
158 | 129 | ||
159 | - | ||
160 | - | ||
161 | - SellerWallet sw = sellerWalletMapper.selectByUidAndType(uid, 1); | ||
162 | - logger.info("充值后回调,处理总账表,orderCode={}", orderCode); | ||
163 | - if (orderInfo.getType() == TYPE_FIRST_RECHARGE) { | ||
164 | ZhiMaCert cert = null; | 130 | ZhiMaCert cert = null; |
165 | try { | 131 | try { |
166 | ApiResponse<?> resp = ufoServiceCaller.call("ufo.user.zhiMaCertInfo", ApiResponse.class, uid); | 132 | ApiResponse<?> resp = ufoServiceCaller.call("ufo.user.zhiMaCertInfo", ApiResponse.class, uid); |
@@ -231,8 +197,31 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | @@ -231,8 +197,31 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | ||
231 | EventBusPublisher.publishEvent(inviteRecordEvent); | 197 | EventBusPublisher.publishEvent(inviteRecordEvent); |
232 | } | 198 | } |
233 | addJoinHistory(uid, certNo); | 199 | addJoinHistory(uid, certNo); |
234 | - afterAmount = amount; | ||
235 | 200 | ||
201 | + } | ||
202 | + | ||
203 | + @Override | ||
204 | + public void processAfterPay(OrderInfo orderInfo) { | ||
205 | + logger.info("充值后回调,处理processAfterPay,orderInfo={}", orderInfo); | ||
206 | + Long orderCode = orderInfo.getOrderCode(); | ||
207 | + BigDecimal amount = orderInfo.getAmount(); | ||
208 | + Integer payment = orderInfo.getPayment(); | ||
209 | + tradeBillsService.addPayRechargeEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, payment, | ||
210 | + orderInfo.getAmount()); | ||
211 | + | ||
212 | + BigDecimal beforeAmount = BigDecimal.ZERO; | ||
213 | + BigDecimal beforeLockAmount = BigDecimal.ZERO; | ||
214 | + | ||
215 | + BigDecimal afterAmount = BigDecimal.ZERO; | ||
216 | + BigDecimal afterLockAmount = BigDecimal.ZERO; | ||
217 | + | ||
218 | + Integer uid = orderInfo.getUid(); | ||
219 | + | ||
220 | + SellerWallet sw = sellerWalletMapper.selectByUidAndType(uid, 1); | ||
221 | + logger.info("充值后回调,处理总账表,orderCode={}", orderCode); | ||
222 | + if (orderInfo.getType() == TYPE_FIRST_RECHARGE) { | ||
223 | + processFirstTimeCharge(sw, orderInfo); | ||
224 | + afterAmount = amount; | ||
236 | } else { | 225 | } else { |
237 | // 修改钱包余额 | 226 | // 修改钱包余额 |
238 | if (sw == null) { | 227 | if (sw == null) { |
@@ -1040,7 +1029,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | @@ -1040,7 +1029,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { | ||
1040 | newRecord.setStatus((byte) 0); | 1029 | newRecord.setStatus((byte) 0); |
1041 | newRecord.setSerialNo(Integer.toString(swd.getId())); | 1030 | newRecord.setSerialNo(Integer.toString(swd.getId())); |
1042 | newRecord.setOrderType(0); | 1031 | newRecord.setOrderType(0); |
1043 | - int timeStamp = (int) (new Date().getTime() / 1000); | 1032 | + int timeStamp = DateUtil.currentTimeSeconds(); |
1044 | newRecord.setCreateTime(timeStamp); | 1033 | newRecord.setCreateTime(timeStamp); |
1045 | newRecord.setUpdateTime(timeStamp); | 1034 | newRecord.setUpdateTime(timeStamp); |
1046 | logger.info("商品下架,添加退款记录,bean={}", newRecord); | 1035 | logger.info("商品下架,添加退款记录,bean={}", newRecord); |
-
Please register or login to post a comment