|
@@ -11,6 +11,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
|
+import com.google.common.util.concurrent.AtomicDouble;
|
|
|
import com.kym.common.config.WxFapiaoConfig;
|
|
import com.kym.common.config.WxFapiaoConfig;
|
|
|
import com.kym.common.config.WxPayConfig;
|
|
import com.kym.common.config.WxPayConfig;
|
|
|
import com.kym.common.constant.ResponseEnum;
|
|
import com.kym.common.constant.ResponseEnum;
|
|
@@ -360,7 +361,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
var chargingOrder = chargeOrderService.getChargingOrderByUserId(walletDetail.getUserId());
|
|
var chargingOrder = chargeOrderService.getChargingOrderByUserId(walletDetail.getUserId());
|
|
|
if (chargingOrder != null) {
|
|
if (chargingOrder != null) {
|
|
|
var account = accountService.getAccountByUserId(walletDetail.getUserId());
|
|
var account = accountService.getAccountByUserId(walletDetail.getUserId());
|
|
|
- // TODO: 2023-11-30 快充这里考虑过充的金额要提高
|
|
|
|
|
|
|
+ // TODO: 2023-11-30 快充这里考虑过充的金额要提高
|
|
|
var res = enPlusService.updateBalanceByQueryEquipChargeStatus(chargingOrder.getStartChargeSeq(), account.getBalance() - 50);
|
|
var res = enPlusService.updateBalanceByQueryEquipChargeStatus(chargingOrder.getStartChargeSeq(), account.getBalance() - 50);
|
|
|
LOGGER.info("用户:{}充电过程中充值,已更新en+充电金额,en+返回数据:{}", account.getUserId(), res);
|
|
LOGGER.info("用户:{}充电过程中充值,已更新en+充电金额,en+返回数据:{}", account.getUserId(), res);
|
|
|
}
|
|
}
|
|
@@ -414,7 +415,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
.eq(UserRechargeRights::getStatus, UserRechargeRights.STATUS_有效)
|
|
.eq(UserRechargeRights::getStatus, UserRechargeRights.STATUS_有效)
|
|
|
.update();
|
|
.update();
|
|
|
|
|
|
|
|
- // 余减去优惠金额作为退款金额
|
|
|
|
|
|
|
+ // 余额减去优惠金额作为退款金额,优惠金额数据每次退款完成后重新计算
|
|
|
AtomicInteger refundAmount = new AtomicInteger(account.getBalance() - account.getDiscountAmount());
|
|
AtomicInteger refundAmount = new AtomicInteger(account.getBalance() - account.getDiscountAmount());
|
|
|
var originalRefundAmount = BigDecimal.valueOf(refundAmount.get());
|
|
var originalRefundAmount = BigDecimal.valueOf(refundAmount.get());
|
|
|
// 充值记录
|
|
// 充值记录
|
|
@@ -608,11 +609,6 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
.eq(WalletDetail::getId, walletDetail.getId()).update();
|
|
.eq(WalletDetail::getId, walletDetail.getId()).update();
|
|
|
LOGGER.info("微信退款回调{}:业务处理结束", notifyRes[2]);
|
|
LOGGER.info("微信退款回调{}:业务处理结束", notifyRes[2]);
|
|
|
|
|
|
|
|
- // 退款时,充值权益失效(权益余额转入冻结余额,接收退款通知时权益状态设置为失效)
|
|
|
|
|
-// userRechargeRightsService.lambdaUpdate().set(UserRechargeRights::getStatus, UserRechargeRights.STATUS_无效)
|
|
|
|
|
-// .eq(UserRechargeRights::getUserId, walletDetail.getUserId())
|
|
|
|
|
-// .eq(UserRechargeRights::getStatus, UserRechargeRights.STATUS_有效).update();
|
|
|
|
|
-
|
|
|
|
|
return ResponseEntity.status(HttpStatus.OK).build();
|
|
return ResponseEntity.status(HttpStatus.OK).build();
|
|
|
} else {
|
|
} else {
|
|
|
// 退款失败
|
|
// 退款失败
|
|
@@ -987,4 +983,4 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
return res.getServiceResponse();
|
|
return res.getServiceResponse();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
|
|
+}
|