更改购买套餐包扣款

This commit is contained in:
1215525055@qq.com 2025-03-05 02:18:25 +08:00
parent b8d6b98faf
commit d206e2b370
3 changed files with 34 additions and 16 deletions

View File

@ -18,6 +18,8 @@ public class AccountItemVO {
@ApiModelProperty(name = "accountId", value = "关联账户ID") @ApiModelProperty(name = "accountId", value = "关联账户ID")
private String accountId; private String accountId;
@ApiModelProperty(name = "accountItemId", value = "关联账户流水ID")
private String accountItemId;
@ApiModelProperty(name = "accountBeforeMoney", value = "动账前余额") @ApiModelProperty(name = "accountBeforeMoney", value = "动账前余额")
@CheckNumberAnnotation(name = "动账前余额") @CheckNumberAnnotation(name = "动账前余额")
private Integer accountBeforeMoney; private Integer accountBeforeMoney;
@ -43,6 +45,13 @@ public class AccountItemVO {
private String checkStatus; private String checkStatus;
private Integer isPostpaid; private Integer isPostpaid;
public String getAccountItemId() {
return accountItemId == null ? "" : accountItemId.trim();
}
public void setAccountItemId(String accountItemId) {
this.accountItemId = accountItemId;
}
public String getOrderType() { public String getOrderType() {
return orderType == null ? "" : orderType.trim(); return orderType == null ? "" : orderType.trim();

View File

@ -87,7 +87,7 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou
@Override @Override
public synchronized String saveReturnId(String token, AccountItemVO accountItemVO) { public synchronized String saveReturnId(String token, AccountItemVO accountItemVO) {
String accountItemId = UUIDUtil.getUUID(); String accountItemId = StringUtils.isEmpty(accountItemVO.getAccountItemId()) ? UUIDUtil.getUUID() : accountItemVO.getAccountItemId();
/** /**
* 找出账户 * 找出账户
*/ */

View File

@ -4,6 +4,7 @@ import cn.com.tenlion.operator.enums.RechargeCheckEnum;
import cn.com.tenlion.operator.enums.RechargeTypeEnum; import cn.com.tenlion.operator.enums.RechargeTypeEnum;
import cn.com.tenlion.operator.enums.ReconciliationStatusEnum; import cn.com.tenlion.operator.enums.ReconciliationStatusEnum;
import cn.com.tenlion.operator.enums.ThirdPartyEnum; import cn.com.tenlion.operator.enums.ThirdPartyEnum;
import cn.com.tenlion.operator.pojo.dtos.account.AccountDTO;
import cn.com.tenlion.operator.pojo.dtos.accountbank.AccountBankDTO; import cn.com.tenlion.operator.pojo.dtos.accountbank.AccountBankDTO;
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO; import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO;
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO; import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO;
@ -366,6 +367,15 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
if(!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("2")) { if(!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("2")) {
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
PackageOrderDTO packageInfoDTO = operatorPluginRemoteService.getByNo(systemApiPathProperties.getOperatorPlugin(), accountRechargeId , accessToken); PackageOrderDTO packageInfoDTO = operatorPluginRemoteService.getByNo(systemApiPathProperties.getOperatorPlugin(), accountRechargeId , accessToken);
// 远程更改套餐包的付款到账状态
String accountItemId1 = UUIDUtil.getUUID();
// 获取用户余额 , 如果不够 , 则不购买
AccountDTO accountDTO = iAccountService.get(dto.getAccountId());
if(accountDTO.getAccountMoney() >= packageInfoDTO.getPackageTotalMoney()) {
SuccessResultData<String> result = operatorPluginRemoteService.updatePay(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accountItemId1, accessToken);
if (result.getData().equals("Success")) {
AccountDTO accountDTO2 = iAccountService.get(dto.getAccountId());
if(accountDTO2.getAccountMoney() >= packageInfoDTO.getPackageTotalMoney()) {
/** /**
* 1. 创建流水 * 1. 创建流水
*/ */
@ -375,13 +385,12 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
vo.setAccountId(dto.getCreator()); vo.setAccountId(dto.getCreator());
vo.setOrderId(packageInfoDTO.getPackageOrderId()); vo.setOrderId(packageInfoDTO.getPackageOrderId());
vo.setAccountMoney(packageInfoDTO.getPackageTotalMoney()); vo.setAccountMoney(packageInfoDTO.getPackageTotalMoney());
vo.setDescription("购买" + (packageInfoDTO.getPackageInfoAppDTO().getPackageType().equals("ALL") ? "全托管" : "写材料" ) + "套餐包 " + packageInfoDTO.getPackageInfoAppDTO().getPackageCount() + " 件:" + packageInfoDTO.getPackageInfoAppDTO().getPackageName()); vo.setDescription("购买" + (packageInfoDTO.getPackageInfoAppDTO().getPackageType().equals("ALL") ? "全托管" : "写材料") + "套餐包 " + packageInfoDTO.getPackageInfoAppDTO().getPackageCount() + " 件:" + packageInfoDTO.getPackageInfoAppDTO().getPackageName());
String accountItemId1 = iAccountItemService.saveReturnId(vo); iAccountItemService.saveReturnId(vo);
// 远程更改套餐包的付款到账状态 }
SuccessResultData<String> result = operatorPluginRemoteService.updatePay(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accountItemId1, accessToken); }else{
if (!result.getData().equals("Success")) {
System.out.println("调用套餐包到账结果 : " + result); System.out.println("调用套餐包到账结果 : " + result);
throw new SaveException(result.getData()); }
} }
} }
// 绑定了套餐包 & 已对账 & 已关闭 // 绑定了套餐包 & 已对账 & 已关闭