Explorar el Código

支付回调修改

lianghanqiang hace 4 años
padre
commit
8c6b557be1

+ 5 - 0
src/main/java/org/springblade/payment/callback/trade/MallSendCallback.java

@@ -52,6 +52,11 @@ public class MallSendCallback {
 		LoginUser user = loginUserService.getById(pointBills.getReceiveId());
 		Bills bills = billsService.getById(pointBills.getTradeNo());
 
+		//回调已处理,忽略后续回调
+		if (!Objects.equals(bills.getPayStatus(), AppConstant.BillPayStatus.待付款.name())){
+			return;
+		}
+
 		//更新用户账户
 		UserChannelPoint userChannelPoint = updateChannelAccount(mall, pointBills.getPrice(), user);
 		//会员数据更新

+ 4 - 0
src/main/java/org/springblade/payment/callback/trade/ShopSendCallback.java

@@ -49,6 +49,10 @@ public class ShopSendCallback {
 		LoginUser user = loginUserService.getById(balanceBills.getReceiveId());
 		Bills bills = billsService.getById(balanceBills.getTradeNo());
 
+		//回调已处理,忽略后续回调
+		if (!Objects.equals(bills.getPayStatus(), AppConstant.BillPayStatus.待付款.name())){
+			return;
+		}
 
 		//会员数据更新
 		Member member = handleShopMember(balanceBills, bills.getPrice());

+ 2 - 1
src/main/java/org/springblade/payment/callback/trade/UserPayCallback.java

@@ -192,9 +192,10 @@ public class UserPayCallback {
 		if (!Objects.isNull(bills)) {
 			shop =  shopService.getById(bills.getReceiveId());
 			shop.setBalance(shop.getBalance().add(
-				Optional.ofNullable(bills.getPrice()).orElse(BigDecimal.ZERO)).add(Optional.ofNullable(bills.getBalanceNum()).orElse(BigDecimal.ZERO))
+				Optional.ofNullable(bills.getPrice()).orElse(BigDecimal.ZERO))
 			);
 			shop.setCharge(shop.getCharge().add(bills.getPointNum()));
+			shop.setPoint(shop.getPoint().add(Optional.ofNullable(bills.getBalanceNum()).orElse(BigDecimal.ZERO)));
 		}
 		return Objects.isNull(shop) ? true : shopService.saveOrUpdate(shop);
 	}