Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

silent 4 лет назад
Родитель
Сommit
7d0208cacd

+ 8 - 1
src/main/java/org/springblade/payment/callback/trade/UserPointTransferWithdrawCallback.java

@@ -12,6 +12,7 @@ import org.springblade.common.cache.PaymentCache;
 import org.springblade.common.enums.OrderType;
 import org.springblade.common.enums.WithdrawStatus;
 import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.log.logger.BladeLogger;
 import org.springblade.ldt.bills.entity.WithdrawRec;
 import org.springblade.ldt.bills.service.IWithdrawRecService;
 import org.springblade.ldt.shop.entity.Shop;
@@ -24,7 +25,6 @@ import org.springblade.yeePay.entity.saas.account.WithdrawOrderDto;
 import org.springblade.yeePay.service.YeepaySaasService;
 import org.springframework.context.event.EventListener;
 import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Objects;
 
@@ -44,6 +44,7 @@ public class UserPointTransferWithdrawCallback {
 	private IShopService shopService;
 	private YeepaySaasService yeepaySaasService;
 	private YeePayConst yeePayConst;
+	private BladeLogger bladeLogger;
 
 	@EventListener
 	public void PaySuccess(UserPointTransferWithdrawEvent userPointTransferWithdrawEvent) {
@@ -70,6 +71,12 @@ public class UserPointTransferWithdrawCallback {
 		YopResponse yopResponse = yeepaySaasService.withdrawOrder(withdrawOrderDto);
 		JSONObject res = JSON.parseObject(yopResponse.getStringResult());
 		if (!Objects.equals(res.getString("returnCode"), "UA00000")) {
+
+			withdrawRec.setWithdrawStatus(WithdrawStatus.FAIL.getValue());
+			withdrawRec.setFailReason(res.getString("returnMsg"));
+			withdrawRecService.saveOrUpdate(withdrawRec);
+
+			bladeLogger.info("userPointWithdraw-提现", res.toJSONString());
 			throw new ServiceException(res.getString("returnMsg"));
 		}
 

+ 5 - 3
src/main/java/org/springblade/payment/plugin/WithdrawPlugin.java

@@ -16,15 +16,14 @@ import org.springblade.common.enums.PaymentType;
 import org.springblade.common.enums.TransferStatus;
 import org.springblade.common.enums.WithdrawStatus;
 import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.log.logger.BladeLogger;
 import org.springblade.core.tool.api.R;
 import org.springblade.ldt.bills.entity.TransferRec;
 import org.springblade.ldt.bills.entity.WithdrawRec;
-import org.springblade.ldt.bills.service.IBillsService;
 import org.springblade.ldt.bills.service.ITransferRecService;
 import org.springblade.ldt.bills.service.IWithdrawRecService;
 import org.springblade.ldt.shop.entity.Shop;
 import org.springblade.ldt.shop.service.IShopService;
-import org.springblade.ldt.user.service.ILoginUserService;
 import org.springblade.payment.entity.PayParam;
 import org.springblade.payment.entity.SuccessParams;
 import org.springblade.payment.event.UserPointTransferWithdrawEvent;
@@ -55,7 +54,7 @@ import java.util.Set;
 @Component
 @Slf4j
 @AllArgsConstructor
-public class WithdrawPlugin implements Withdraw{
+public class WithdrawPlugin implements Withdraw {
 
 	YeePayService yeePayService;
 	PaymentService paymentService;
@@ -65,6 +64,7 @@ public class WithdrawPlugin implements Withdraw{
 	IShopService shopService;
 	ApplicationEventPublisher eventPublisher;
 	ITransferRecService transferRecService;
+	BladeLogger bladeLogger;
 
 	@Override
 	public void callback(HttpServletRequest request) {
@@ -138,6 +138,7 @@ public class WithdrawPlugin implements Withdraw{
 		JSONObject res = JSON.parseObject(yopResponse.getStringResult());
 		if (!Objects.equals(res.getString("returnCode"), "UA00000")) {
 			userPointWithdrawFail(transferRec, res);
+			bladeLogger.info("userPointWithdraw-转账", res.toJSONString());
 			throw new ServiceException(res.getString("returnMsg"));
 		}
 
@@ -173,6 +174,7 @@ public class WithdrawPlugin implements Withdraw{
 		WithdrawRec withdrawRec = withdrawRecService.getById(transferRec.getWithdrawId());
 		withdrawRec.setWithdrawStatus(WithdrawStatus.FAIL.getValue());
 		withdrawRec.setResponseJson(res.toJSONString());
+		withdrawRec.setFailReason("转账环节出错:" + res.toJSONString());
 		withdrawRecService.saveOrUpdate(withdrawRec);
 
 		//更新转账记录