2
0

feat: paypal配置

This commit is contained in:
caiyuchao
2025-04-29 18:03:46 +08:00
parent e9765d7d39
commit 01f4a5c3d6
7 changed files with 109 additions and 12 deletions

View File

@@ -306,13 +306,15 @@ public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IU
Long userId = uClient.getUserId();
if (userId != null) {
UAccount account = accountService.getOne(Wrappers.<UAccount>lambdaQuery().eq(UAccount::getUserId, userId), false);
if (AccountUtil.isPackageValidNoUsedBalance(account, new Date())) {
uClient.setUseType(UserTypeEnum.PACKAGE.getCode());
uClient.setUseId(account.getPackageId());
} else if (AccountUtil.isBalanceValid(account)) {
uClient.setUseType(UserTypeEnum.BALANCE.getCode());
} else {
uClient.setUseType(UserTypeEnum.OTHER.getCode());
if (account != null) {
if (AccountUtil.isPackageValidNoUsedBalance(account, new Date())) {
uClient.setUseType(UserTypeEnum.PACKAGE.getCode());
uClient.setUseId(account.getPackageId());
} else if (AccountUtil.isBalanceValid(account)) {
uClient.setUseType(UserTypeEnum.BALANCE.getCode());
} else {
uClient.setUseType(UserTypeEnum.OTHER.getCode());
}
}
}
clientService.updateById(uClient);

View File

@@ -37,7 +37,7 @@ public class UConfigServiceImpl implements IUConfigService
private static final String DEFAULT_SYS_PAY_CURRENCY_VALUE = "USD";
private static final String DEFAULT_SYS_PAY_CURRENCY_SYMBOL_VALUE = "$";
private static final String[] DEFAULT_SYS_PAY_PAYMENT_METHOD_VALUE = {"paypal"};
private static final String[] DEFAULT_SYS_PAY_PAYMENT_METHOD_VALUE = {"paypal", "stripe"};
/**
* 项目启动时,初始化参数到缓存

View File

@@ -14,15 +14,22 @@ import org.wfc.common.core.utils.bean.BeanValidators;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.domain.UAccount;
import org.wfc.user.domain.UPost;
import org.wfc.user.domain.UUserPost;
import org.wfc.user.domain.UUserRole;
import org.wfc.user.mapper.*;
import org.wfc.user.mapper.UAccountMapper;
import org.wfc.user.mapper.UPostMapper;
import org.wfc.user.mapper.URoleMapper;
import org.wfc.user.mapper.UUserMapper;
import org.wfc.user.mapper.UUserPostMapper;
import org.wfc.user.mapper.UUserRoleMapper;
import org.wfc.user.service.IUConfigService;
import org.wfc.user.service.IUDeptService;
import org.wfc.user.service.IUUserService;
import javax.validation.Validator;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -61,6 +68,9 @@ public class UUserServiceImpl implements IUUserService
@Autowired
protected Validator validator;
@Autowired
private UAccountMapper accountMapper;
/**
* 根据条件分页查询用户列表
*
@@ -276,7 +286,17 @@ public class UUserServiceImpl implements IUUserService
@Override
public boolean registerUser(UUser user)
{
return userMapper.insertUser(user) > 0;
boolean flag = userMapper.insertUser(user) > 0;
try {
UAccount account = new UAccount();
account.setUserId(user.getUserId());
account.setBalance(BigDecimal.ZERO);
account.setBalanceUsed(BigDecimal.ZERO);
accountMapper.insert(account);
} catch (Exception e) {
log.error("register add account error {}", e.getMessage());
}
return flag;
}
/**