|
|
@@ -19,6 +19,7 @@ import com.kym.common.utils.OrderUtils;
|
|
|
import com.kym.entity.miniapp.Account;
|
|
|
import com.kym.entity.miniapp.*;
|
|
|
import com.kym.entity.wechat.*;
|
|
|
+import com.kym.service.enplus.EnPlusService;
|
|
|
import com.kym.service.miniapp.*;
|
|
|
import com.kym.service.wechat.WxPayService;
|
|
|
import com.wechat.pay.java.core.Config;
|
|
|
@@ -94,13 +95,15 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
|
|
|
private final InvoiceTitleService invoiceTitleService;
|
|
|
|
|
|
+ private final EnPlusService enPlusService;
|
|
|
+
|
|
|
/**
|
|
|
* 微信支付专用,支持自动签名验签解密等
|
|
|
*/
|
|
|
private OkHttpClientAdapter wxHttpClient;
|
|
|
|
|
|
|
|
|
- public WxPayServiceImpl(WxPayConfig conf, WxFapiaoConfig fapiaoConfig, WalletDetailService walletDetailService, PayLogService payLogService, AccountService accountService, ChargeOrderService chargeOrderService, RefundLogService refundLogService, InvoiceService invoiceService, InvoiceTitleService invoiceTitleService) {
|
|
|
+ public WxPayServiceImpl(WxPayConfig conf, WxFapiaoConfig fapiaoConfig, WalletDetailService walletDetailService, PayLogService payLogService, AccountService accountService, ChargeOrderService chargeOrderService, RefundLogService refundLogService, InvoiceService invoiceService, InvoiceTitleService invoiceTitleService, EnPlusService enPlusService) {
|
|
|
this.conf = conf;
|
|
|
this.fapiaoConfig = fapiaoConfig;
|
|
|
this.walletDetailService = walletDetailService;
|
|
|
@@ -110,6 +113,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
this.refundLogService = refundLogService;
|
|
|
this.invoiceService = invoiceService;
|
|
|
this.invoiceTitleService = invoiceTitleService;
|
|
|
+ this.enPlusService = enPlusService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -318,6 +322,14 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
payLogService.save(payLog);
|
|
|
LOGGER.info("微信支付回调{}:业务处理结束", notifyRes[2]);
|
|
|
|
|
|
+ // 如果存在进行中的订单,则向en+更新用户余额
|
|
|
+ var chargingOrder = chargeOrderService.getChargingOrderByUserId(walletDetail.getUserId());
|
|
|
+ if (chargingOrder != null) {
|
|
|
+ var account = accountService.getAccountByUserId(walletDetail.getUserId());
|
|
|
+ var res = enPlusService.updateBalanceByQueryEquipChargeStatus(chargingOrder.getStartChargeSeq(), account.getBalance() - 50);
|
|
|
+ LOGGER.info("用户:{}充电过程中充值,已更新en+充电金额,en+返回数据:{}", account.getUserId(), res);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
LOGGER.error("微信支付通知处理异常,资金流水为空,回调信息:{}", transaction);
|
|
|
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR);
|