Commit 01ab2121 authored by renjie's avatar renjie

支付返送

parent 77f110c0
...@@ -249,14 +249,14 @@ public class AccountController { ...@@ -249,14 +249,14 @@ public class AccountController {
return paymentService.wechatPayCallback(tradno); return paymentService.wechatPayCallback(tradno);
} }
@RequestMapping(path = "/0xwxcheckorderstatus/{tradno}", method = RequestMethod.GET) @RequestMapping(path = "/0xwxcheckorderstatus/{tradno}/{more}", method = RequestMethod.GET)
public UserPaymentDto wechatCheckOrderStatus(Principal principal, @PathVariable String tradno) { public UserPaymentDto wechatCheckOrderStatus(Principal principal, @PathVariable String tradno, @PathVariable int more) {
return paymentService.wxCheckOrderStatus(tradno); return paymentService.wxCheckOrderStatus(tradno, more);
} }
@RequestMapping(path = "/wxpay/checkstatus/{tradno}", method = RequestMethod.GET) @RequestMapping(path = "/wxpay/checkstatus/{tradno}/{more}", method = RequestMethod.GET)
public UserPaymentDto wechatPayCheckStatus(@PathVariable String tradno) { public UserPaymentDto wechatPayCheckStatus(@PathVariable String tradno, @PathVariable int more) {
return paymentService.wxCheckOrderStatus(tradno); return paymentService.wxCheckOrderStatus(tradno, more);
} }
@RequestMapping(path = "/0xalipaycallback/{tradno}", method = RequestMethod.GET) @RequestMapping(path = "/0xalipaycallback/{tradno}", method = RequestMethod.GET)
...@@ -264,15 +264,15 @@ public class AccountController { ...@@ -264,15 +264,15 @@ public class AccountController {
paymentService.alipaCallback(tradno); paymentService.alipaCallback(tradno);
} }
@RequestMapping(path = "/0xalicheckorderstatus/{tradno}", method = RequestMethod.GET) @RequestMapping(path = "/0xalicheckorderstatus/{tradno}/{more}", method = RequestMethod.GET)
public UserPaymentDto alipayCheckOrderStatus(Principal principal, @PathVariable String tradno) { public UserPaymentDto alipayCheckOrderStatus(Principal principal, @PathVariable String tradno, @PathVariable int more) {
return paymentService.aliCheckOrderStatus(tradno); return paymentService.aliCheckOrderStatus(tradno, more);
} }
@RequestMapping(path = "/alipay/checkstatus/{tradno}", method = RequestMethod.GET) @RequestMapping(path = "/alipay/checkstatus/{tradno}/{more}", method = RequestMethod.GET)
@PreAuthorize("#oauth2.hasScope('server')") @PreAuthorize("#oauth2.hasScope('server')")
public UserPaymentDto alipayCheckStatus(@PathVariable String tradno) { public UserPaymentDto alipayCheckStatus(@PathVariable String tradno, @PathVariable int more) {
return paymentService.aliCheckOrderStatus(tradno); return paymentService.aliCheckOrderStatus(tradno, more);
} }
@RequestMapping(path = "/0xalipay/{amount}", method = RequestMethod.GET) @RequestMapping(path = "/0xalipay/{amount}", method = RequestMethod.GET)
......
...@@ -12,9 +12,9 @@ public interface PaymentService { ...@@ -12,9 +12,9 @@ public interface PaymentService {
String wechatPayCallback(String tradno); String wechatPayCallback(String tradno);
UserPaymentDto wxCheckOrderStatus(String tradno); UserPaymentDto wxCheckOrderStatus(String tradno, int more);
UserPaymentDto aliCheckOrderStatus(String tradno); UserPaymentDto aliCheckOrderStatus(String tradno, int more);
void alipaCallback(String tradno); void alipaCallback(String tradno);
......
...@@ -56,7 +56,7 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -56,7 +56,7 @@ public class PaymentServiceImpl implements PaymentService {
UserPayment byTradeNo = userPaymentRepository.findByTradeNo(tradno); UserPayment byTradeNo = userPaymentRepository.findByTradeNo(tradno);
if (byTradeNo != null && !byTradeNo.isSucceed()) { if (byTradeNo != null && !byTradeNo.isSucceed()) {
wxCheckOrderStatus(byTradeNo.getTradeNo()); wxCheckOrderStatus(byTradeNo.getTradeNo(), 0);
} }
return "<xml>\n" + return "<xml>\n" +
"\n" + "\n" +
...@@ -70,12 +70,12 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -70,12 +70,12 @@ public class PaymentServiceImpl implements PaymentService {
UserPayment byTradeNo = userPaymentRepository.findByTradeNo(tradno); UserPayment byTradeNo = userPaymentRepository.findByTradeNo(tradno);
if (byTradeNo != null && !byTradeNo.isSucceed()) { if (byTradeNo != null && !byTradeNo.isSucceed()) {
aliCheckOrderStatus(byTradeNo.getTradeNo()); aliCheckOrderStatus(byTradeNo.getTradeNo(), 0);
} }
} }
@Override @Override
public UserPaymentDto wxCheckOrderStatus(String tradeno) { public UserPaymentDto wxCheckOrderStatus(String tradeno, int more) {
UserPaymentDto result = new UserPaymentDto(); UserPaymentDto result = new UserPaymentDto();
result.setPaid(false); result.setPaid(false);
...@@ -84,7 +84,7 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -84,7 +84,7 @@ public class PaymentServiceImpl implements PaymentService {
UserPayment byTradeNo = userPaymentRepository.findByTradeNo(tradeno); UserPayment byTradeNo = userPaymentRepository.findByTradeNo(tradeno);
if (PaymentMethod.ALIPAY.equals(byTradeNo.getPaymentMethod())) if (PaymentMethod.ALIPAY.equals(byTradeNo.getPaymentMethod()))
return aliCheckOrderStatus(tradeno); return aliCheckOrderStatus(tradeno, more);
UserBalance balance = userBalanceRepository.findById(byTradeNo.getUsername()).orElse(null); UserBalance balance = userBalanceRepository.findById(byTradeNo.getUsername()).orElse(null);
...@@ -169,7 +169,7 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -169,7 +169,7 @@ public class PaymentServiceImpl implements PaymentService {
userPrePaidBillingRepository.save(bill); userPrePaidBillingRepository.save(bill);
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount()); balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + more);
userBalanceRepository.save(balance); userBalanceRepository.save(balance);
} }
...@@ -201,7 +201,7 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -201,7 +201,7 @@ public class PaymentServiceImpl implements PaymentService {
} }
@Override @Override
public UserPaymentDto aliCheckOrderStatus(String tradno) { public UserPaymentDto aliCheckOrderStatus(String tradno, int more) {
UserPaymentDto result = new UserPaymentDto(); UserPaymentDto result = new UserPaymentDto();
result.setPaid(false); result.setPaid(false);
try { try {
...@@ -271,7 +271,7 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -271,7 +271,7 @@ public class PaymentServiceImpl implements PaymentService {
bill.setYear(year); bill.setYear(year);
bill.setMonth(monthValue); bill.setMonth(monthValue);
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount()); balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + more);
userBalanceRepository.save(balance); userBalanceRepository.save(balance);
} }
......
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