Commit 840e792f authored by renjie's avatar renjie

推广礼金bug

parent b5d443a3
...@@ -209,8 +209,8 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -209,8 +209,8 @@ public class PaymentServiceImpl implements PaymentService {
if (byName.getPromotionCode() != null) { if (byName.getPromotionCode() != null) {
Account account = accountRepository.findByPromotion(byName.getPromotionCode()); Account account = accountRepository.findByPromotion(byName.getPromotionCode());
if (account != null) { if (account != null) {
byName.getPromotion().setCommission(byName.getPromotion().getCommission() + byTradeNo.getAmount()); account.getPromotion().setCommission(account.getPromotion().getCommission() + byTradeNo.getAmount());
accountRepository.save(byName); accountRepository.save(account);
} }
} }
...@@ -341,8 +341,8 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -341,8 +341,8 @@ public class PaymentServiceImpl implements PaymentService {
if (byName.getPromotionCode() != null) { if (byName.getPromotionCode() != null) {
Account account = accountRepository.findByPromotion(byName.getPromotionCode()); Account account = accountRepository.findByPromotion(byName.getPromotionCode());
if (account != null) { if (account != null) {
byName.getPromotion().setCommission(byName.getPromotion().getCommission() + byTradeNo.getAmount()); account.getPromotion().setCommission(account.getPromotion().getCommission() + byTradeNo.getAmount());
accountRepository.save(byName); accountRepository.save(account);
} }
} }
} }
...@@ -518,6 +518,14 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -518,6 +518,14 @@ public class PaymentServiceImpl implements PaymentService {
userBalanceRepository.incrementBalance(userBalance, amount, 0); userBalanceRepository.incrementBalance(userBalance, amount, 0);
} }
if (account.getPromotionCode() != null) {
Account account1 = accountRepository.findByPromotion(account.getPromotionCode());
if (account1 != null) {
account1.getPromotion().setCommission(account1.getPromotion().getCommission() + amount);
accountRepository.save(account1);
}
}
return userBalanceRepository.findById(username).orElse(null); return userBalanceRepository.findById(username).orElse(null);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment