123
This commit is contained in:
1 parent
8d2c4e0159
commit
05b5a3d3cc
43 files changed
+434
-4728
No files matched your search
@@ -1,91 +0,0 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.system.domain.UsdtFundFlow;
|
||||
import com.ruoyi.system.domain.UsdtFundFlowPlus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
/**
|
||||
* 资金流水Service接口
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface IUsdtFundFlowService extends IService<UsdtFundFlowPlus>
|
||||
{
|
||||
|
||||
List<SelectItem> select(String keyword,boolean isUser);
|
||||
/**
|
||||
* 查询资金流水
|
||||
*
|
||||
* @param id 资金流水ID
|
||||
* @return 资金流水
|
||||
*/
|
||||
public UsdtFundFlow selectUsdtFundFlowById(Long id,boolean isUser);
|
||||
|
||||
/**
|
||||
* 查询资金流水列表
|
||||
*
|
||||
* @param usdtFundFlow 资金流水
|
||||
* @return 资金流水集合
|
||||
*/
|
||||
public List<UsdtFundFlow> selectUsdtFundFlowList(UsdtFundFlow usdtFundFlow,boolean isUser);
|
||||
|
||||
/**
|
||||
* 新增资金流水
|
||||
*
|
||||
* @param usdtFundFlow 资金流水
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUsdtFundFlow(UsdtFundFlow usdtFundFlow,boolean isUser);
|
||||
|
||||
/**
|
||||
* 修改资金流水
|
||||
*
|
||||
* @param usdtFundFlow 资金流水
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUsdtFundFlow(UsdtFundFlow usdtFundFlow,boolean isUser);
|
||||
|
||||
/**
|
||||
* 批量删除资金流水
|
||||
*
|
||||
* @param ids 需要删除的资金流水ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUsdtFundFlowByIds(Long[] ids,boolean isUser);
|
||||
|
||||
/**
|
||||
* 删除资金流水信息
|
||||
*
|
||||
* @param id 资金流水ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUsdtFundFlowById(Long id,boolean isUser);
|
||||
|
||||
List<UsdtFundFlowPlus> getByIds(List<Long> ids,boolean isUser, SFunction<UsdtFundFlowPlus, ?>... columns);
|
||||
|
||||
UsdtFundFlowPlus getById(Long id, SFunction<UsdtFundFlowPlus, ?>... columns);
|
||||
|
||||
Map<Long, UsdtFundFlowPlus> getMapByIds(List<Long> ids, SFunction<UsdtFundFlowPlus, ?>... columns);
|
||||
|
||||
List<UsdtFundFlowPlus> getByIds(List<Long> ids);
|
||||
|
||||
Map<Long, UsdtFundFlowPlus> getMapByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* @param field sum 字段
|
||||
* @param where 条件
|
||||
* @param tClass 返回类型
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> T sum(String field, String where, Class<T> tClass);
|
||||
|
||||
Long count(String where);
|
||||
|
||||
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.system.domain.UsdtUserSettlementConfiguration;
|
||||
import com.ruoyi.system.domain.UsdtUserSettlementConfigurationPlus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
/**
|
||||
* 商户配置Service接口
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface IUsdtUserSettlementConfigurationService extends IService<UsdtUserSettlementConfigurationPlus>
|
||||
{
|
||||
|
||||
List<SelectItem> select(String keyword,boolean isUser);
|
||||
/**
|
||||
* 查询商户配置
|
||||
*
|
||||
* @param id 商户配置ID
|
||||
* @return 商户配置
|
||||
*/
|
||||
public UsdtUserSettlementConfiguration selectUsdtUserSettlementConfigurationById(Long id,boolean isUser);
|
||||
|
||||
|
||||
UsdtUserSettlementConfigurationPlus getByUserId(Long userId);
|
||||
/**
|
||||
* 查询商户配置列表
|
||||
*
|
||||
* @param usdtUserSettlementConfiguration 商户配置
|
||||
* @return 商户配置集合
|
||||
*/
|
||||
public List<UsdtUserSettlementConfiguration> selectUsdtUserSettlementConfigurationList(UsdtUserSettlementConfiguration usdtUserSettlementConfiguration,boolean isUser);
|
||||
|
||||
/**
|
||||
* 新增商户配置
|
||||
*
|
||||
* @param usdtUserSettlementConfiguration 商户配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUsdtUserSettlementConfiguration(UsdtUserSettlementConfiguration usdtUserSettlementConfiguration,boolean isUser);
|
||||
|
||||
/**
|
||||
* 修改商户配置
|
||||
*
|
||||
* @param usdtUserSettlementConfiguration 商户配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUsdtUserSettlementConfiguration(UsdtUserSettlementConfiguration usdtUserSettlementConfiguration,boolean isUser);
|
||||
|
||||
/**
|
||||
* 批量删除商户配置
|
||||
*
|
||||
* @param ids 需要删除的商户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUsdtUserSettlementConfigurationByIds(Long[] ids,boolean isUser);
|
||||
|
||||
/**
|
||||
* 删除商户配置信息
|
||||
*
|
||||
* @param id 商户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUsdtUserSettlementConfigurationById(Long id,boolean isUser);
|
||||
|
||||
List<UsdtUserSettlementConfigurationPlus> getByIds(List<Long> ids,boolean isUser, SFunction<UsdtUserSettlementConfigurationPlus, ?>... columns);
|
||||
|
||||
UsdtUserSettlementConfigurationPlus getById(Long id, SFunction<UsdtUserSettlementConfigurationPlus, ?>... columns);
|
||||
|
||||
Map<Long, UsdtUserSettlementConfigurationPlus> getMapByIds(List<Long> ids, SFunction<UsdtUserSettlementConfigurationPlus, ?>... columns);
|
||||
|
||||
List<UsdtUserSettlementConfigurationPlus> getByIds(List<Long> ids);
|
||||
|
||||
Map<Long, UsdtUserSettlementConfigurationPlus> getMapByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* @param field sum 字段
|
||||
* @param where 条件
|
||||
* @param tClass 返回类型
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> T sum(String field, String where, Class<T> tClass);
|
||||
|
||||
Long count(String where);
|
||||
|
||||
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package com.ruoyi.system.service;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.UserAuth;
|
||||
import com.ruoyi.system.domain.UserAuthPlus;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
/**
|
||||
* 用户授权Service接口
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-11-25
|
||||
*/
|
||||
public interface IUserAuthService extends IService<UserAuthPlus>
|
||||
{
|
||||
|
||||
List<SelectItem> select(String keyword,boolean isUser);
|
||||
/**
|
||||
* 查询用户授权
|
||||
*
|
||||
* @param id 用户授权ID
|
||||
* @return 用户授权
|
||||
*/
|
||||
public UserAuth selectUserAuthById(Long id,boolean isUser);
|
||||
|
||||
/**
|
||||
* 查询用户授权列表
|
||||
*
|
||||
* @param userAuth 用户授权
|
||||
* @return 用户授权集合
|
||||
*/
|
||||
public List<UserAuth> selectUserAuthList(UserAuth userAuth,boolean isUser);
|
||||
|
||||
/**
|
||||
* 新增用户授权
|
||||
*
|
||||
* @param userAuth 用户授权
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserAuth(UserAuth userAuth,boolean isUser);
|
||||
|
||||
/**
|
||||
* 修改用户授权
|
||||
*
|
||||
* @param userAuth 用户授权
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserAuth(UserAuth userAuth,boolean isUser);
|
||||
|
||||
/**
|
||||
* 批量删除用户授权
|
||||
*
|
||||
* @param ids 需要删除的用户授权ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserAuthByIds(Long[] ids,boolean isUser);
|
||||
|
||||
/**
|
||||
* 删除用户授权信息
|
||||
*
|
||||
* @param id 用户授权ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserAuthById(Long id,boolean isUser);
|
||||
|
||||
List<UserAuthPlus> getByIds(List<Long> ids,boolean isUser, SFunction<UserAuthPlus, ?>... columns);
|
||||
|
||||
UserAuthPlus getById(Long id, SFunction<UserAuthPlus, ?>... columns);
|
||||
|
||||
Map<Long, UserAuthPlus> getMapByIds(List<Long> ids, SFunction<UserAuthPlus, ?>... columns);
|
||||
|
||||
List<UserAuthPlus> getByIds(List<Long> ids);
|
||||
|
||||
Map<Long, UserAuthPlus> getMapByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* @param field sum 字段
|
||||
* @param where 条件
|
||||
* @param tClass 返回类型
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> T sum(String field, String where, Class<T> tClass);
|
||||
|
||||
Long count(String where);
|
||||
|
||||
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||
}
|
||||
@@ -77,7 +77,6 @@ public interface IWalletAddressService extends IService<WalletAddressPlus>
|
||||
|
||||
Map<Long, WalletAddressPlus> getMapByIds(List<Long> ids, SFunction<WalletAddressPlus, ?>... columns);
|
||||
|
||||
boolean updateWithdrawUsdtBalanceById(Long id, BigDecimal withdrawUsdtBalance);
|
||||
|
||||
List<WalletAddressPlus> getByIds(List<Long> ids);
|
||||
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.ruoyi.system.service;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.Web3Wallet;
|
||||
import com.ruoyi.system.domain.Web3WalletPlus;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
/**
|
||||
* 钱包管理Service接口
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-11-25
|
||||
*/
|
||||
public interface IWeb3WalletService extends IService<Web3WalletPlus>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询钱包管理
|
||||
*
|
||||
* @param id 钱包管理ID
|
||||
* @return 钱包管理
|
||||
*/
|
||||
public Web3Wallet selectWeb3WalletById(Long id,boolean isUser);
|
||||
|
||||
/**
|
||||
* 查询钱包管理列表
|
||||
*
|
||||
* @param web3Wallet 钱包管理
|
||||
* @return 钱包管理集合
|
||||
*/
|
||||
public List<Web3Wallet> selectWeb3WalletList(Web3Wallet web3Wallet,boolean isUser);
|
||||
|
||||
/**
|
||||
* 新增钱包管理
|
||||
*
|
||||
* @param web3Wallet 钱包管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWeb3Wallet(Web3Wallet web3Wallet,boolean isUser);
|
||||
|
||||
/**
|
||||
* 修改钱包管理
|
||||
*
|
||||
* @param web3Wallet 钱包管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWeb3Wallet(Web3Wallet web3Wallet,boolean isUser);
|
||||
|
||||
/**
|
||||
* 批量删除钱包管理
|
||||
*
|
||||
* @param ids 需要删除的钱包管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWeb3WalletByIds(Long[] ids,boolean isUser);
|
||||
|
||||
/**
|
||||
* 删除钱包管理信息
|
||||
*
|
||||
* @param id 钱包管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWeb3WalletById(Long id,boolean isUser);
|
||||
|
||||
List<Web3WalletPlus> getByIds(List<Long> ids,boolean isUser, SFunction<Web3WalletPlus, ?>... columns);
|
||||
|
||||
Web3WalletPlus getById(Long id, SFunction<Web3WalletPlus, ?>... columns);
|
||||
|
||||
Map<Long, Web3WalletPlus> getMapByIds(List<Long> ids, SFunction<Web3WalletPlus, ?>... columns);
|
||||
|
||||
List<Web3WalletPlus> getByIds(List<Long> ids);
|
||||
|
||||
Map<Long, Web3WalletPlus> getMapByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* @param field sum 字段
|
||||
* @param where 条件
|
||||
* @param tClass 返回类型
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> T sum(String field, String where, Class<T> tClass);
|
||||
|
||||
Long count(String where);
|
||||
|
||||
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||
}
|
||||
+1
-122
@@ -39,8 +39,6 @@ public class UsdtAggregationTaskServiceImpl extends ServiceImpl<UsdtAggregationT
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private IWeb3WalletService web3WalletService;
|
||||
@Autowired
|
||||
private IWalletAddressService walletAddressService;
|
||||
|
||||
@Override
|
||||
@@ -240,126 +238,7 @@ public class UsdtAggregationTaskServiceImpl extends ServiceImpl<UsdtAggregationT
|
||||
usdtAggregationTask.setUpdatedAt(DateUtils.getNowDate());
|
||||
if (isUser) {
|
||||
usdtAggregationTask.setUserId(SecurityUtils.getUserId());
|
||||
if (usdtAggregationTask.getAppId() == null) {
|
||||
throw new RuntimeException("AppId为空");
|
||||
}
|
||||
AppsPlus apps = this.appsService.getById(usdtAggregationTask.getAppId());
|
||||
if (apps == null) {
|
||||
throw new RuntimeException("App为空");
|
||||
}
|
||||
if (SecurityUtils.getUserId() == null) {
|
||||
throw new RuntimeException("没有登入");
|
||||
}
|
||||
if (usdtAggregationTask.getExeTime() == null) {
|
||||
throw new RuntimeException("执行时间为空");
|
||||
}
|
||||
if (apps.getUserId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("没有权限");
|
||||
}
|
||||
Web3WalletPlus web3WalletPlus = web3WalletService.getById(SecurityUtils.getUserId());
|
||||
if (web3WalletPlus.getUsdtBalance().subtract(usdtAggregationTask.getTotalAmount()).longValue() < 0) {
|
||||
throw new RuntimeException("超过账户金额");
|
||||
}
|
||||
if (usdtAggregationTask.getTaskName() == null) {
|
||||
throw new RuntimeException("任务名称为空");
|
||||
}
|
||||
if (usdtAggregationTask.getTotalAmount() == null || usdtAggregationTask.getTotalAmount().longValue() <= 0) {
|
||||
throw new RuntimeException("归集金额为空");
|
||||
}
|
||||
if (usdtAggregationTask.getExeTime() == null) {
|
||||
usdtAggregationTask.setExeTime(DateUtils.getNowDate());
|
||||
}
|
||||
usdtAggregationTask.setUserId(SecurityUtils.getUserId());
|
||||
usdtAggregationTask.setDistTokenAddress(apps.getDistTokenAddress());
|
||||
usdtAggregationTask.setVerifyStatus(1);
|
||||
usdtAggregationTask.setStatus(0);
|
||||
List<WalletAddressPlus> list = walletAddressService.getListByAppId(usdtAggregationTask.getAppId());
|
||||
list.sort(new Comparator<WalletAddressPlus>() {
|
||||
@Override
|
||||
public int compare(WalletAddressPlus p1, WalletAddressPlus p2) {
|
||||
return Double.compare(p2.getWithdrawUsdtBalance().doubleValue(), p1.getWithdrawUsdtBalance().doubleValue()); // 倒序排序
|
||||
}
|
||||
});
|
||||
String willTxAmount = this.sum("total_amount","status = 0 and verify_status=1 and user_id="+usdtAggregationTask.getUserId(),String.class);
|
||||
if(willTxAmount == null){
|
||||
willTxAmount ="0.00";
|
||||
}
|
||||
if(new BigDecimal(willTxAmount).add(usdtAggregationTask.getTotalAmount())
|
||||
.subtract(web3WalletPlus.getUsdtBalance()).doubleValue()>0){
|
||||
throw new RuntimeException("待提现金额超过账户金额");
|
||||
}
|
||||
LambdaQueryWrapper<UsdtAggregationTaskPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtAggregationTaskPlus>()
|
||||
.eq(UsdtAggregationTaskPlus::getAppId, usdtAggregationTask.getAppId())
|
||||
.eq(UsdtAggregationTaskPlus::getUserId,usdtAggregationTask.getUserId())
|
||||
.eq(UsdtAggregationTaskPlus::getStatus,0);
|
||||
if(count(lambdaQueryWrapper) > 0){
|
||||
throw new RuntimeException("存在正在提现的记录");
|
||||
}
|
||||
|
||||
this.usdtAggregationTaskMapper.insertUsdtAggregationTask(usdtAggregationTask);
|
||||
BigDecimal totalAmount = usdtAggregationTask.getTotalAmount();
|
||||
List<UsdtAggregationTaskItemPlus> usdtAggregationTaskItems = new ArrayList<>();
|
||||
BigDecimal hasTxItem = new BigDecimal(0);
|
||||
for (WalletAddressPlus item : list) {
|
||||
if (item.getWithdrawUsdtBalance() == null) {
|
||||
item.setWithdrawUsdtBalance(new BigDecimal(0));
|
||||
}
|
||||
UsdtAggregationTaskItemPlus usdtAggregationTaskItem = new UsdtAggregationTaskItemPlus();
|
||||
usdtAggregationTaskItem.setUserId(SecurityUtils.getUserId());
|
||||
usdtAggregationTaskItem.setAppId(usdtAggregationTask.getAppId());
|
||||
usdtAggregationTaskItem.setCreatedAt(new Date());
|
||||
usdtAggregationTaskItem.setUpdatedAt(new Date());
|
||||
usdtAggregationTaskItem.setStatus(0);
|
||||
usdtAggregationTaskItem.setDistTokenAddress(usdtAggregationTask.getDistTokenAddress());
|
||||
usdtAggregationTaskItem.setParentId(usdtAggregationTask.getId());
|
||||
usdtAggregationTaskItem.setTokenAddress(item.getToken());
|
||||
|
||||
if (item.getEnergyNum() < tronService.defaultEstimateEnergy()) {
|
||||
log.error(item.getToken()+"能量不足,需要手续费");
|
||||
continue;
|
||||
}
|
||||
long bandwidth = tronService.defaultEstimateBandwidth();
|
||||
if (bandwidth > item.getBandwidthNum()) {
|
||||
log.error(item.getToken()+"带宽不足需要手续费");
|
||||
continue;
|
||||
}
|
||||
if(bandwidth > item.getBandwidthStakedNum()
|
||||
&& bandwidth > (item.getBandwidthNum()-item.getBandwidthStakedNum())){
|
||||
log.error("代理|免费带宽不足需要手续费");
|
||||
continue;
|
||||
}
|
||||
|
||||
String tempAmount = usdtAggregationTaskItemService.sum("ope_amount","status = 0 and token_address ='"+item.getToken()+"'",String.class);
|
||||
if(tempAmount ==null){
|
||||
tempAmount = "0.00";
|
||||
}
|
||||
if (item.getWithdrawUsdtBalance().subtract(totalAmount).longValue() > 0) {
|
||||
usdtAggregationTaskItem.setOpeAmount(totalAmount);
|
||||
usdtAggregationTaskItems.add(usdtAggregationTaskItem);
|
||||
hasTxItem = hasTxItem.add(item.getWithdrawUsdtBalance().subtract(new BigDecimal(tempAmount))
|
||||
.subtract(totalAmount));
|
||||
totalAmount = new BigDecimal(0);
|
||||
break;
|
||||
} else {
|
||||
usdtAggregationTaskItem.setOpeAmount(item.getWithdrawUsdtBalance());
|
||||
totalAmount = totalAmount.subtract(item.getWithdrawUsdtBalance());
|
||||
usdtAggregationTaskItems.add(usdtAggregationTaskItem);
|
||||
hasTxItem = hasTxItem.add(item.getWithdrawUsdtBalance().subtract(new BigDecimal(tempAmount))
|
||||
.subtract(item.getWithdrawUsdtBalance()));
|
||||
}
|
||||
}
|
||||
if (hasTxItem.doubleValue() < 0) {
|
||||
throw new RuntimeException("app下的地址可提现金额不足,amount=" + hasTxItem.toString());
|
||||
}
|
||||
if (totalAmount.longValue() > 0) {
|
||||
throw new RuntimeException("app下的地址可提现金额不足,amount=" + totalAmount.toString());
|
||||
}
|
||||
if (!usdtAggregationTaskItems.isEmpty()) {
|
||||
this.usdtAggregationTaskItemService.saveBatch(usdtAggregationTaskItems);
|
||||
}else{
|
||||
throw new RuntimeException("没有可以免费提现的地址");
|
||||
}
|
||||
return 1;
|
||||
return this.usdtAggregationTaskMapper.insertUsdtAggregationTask(usdtAggregationTask);
|
||||
} else {
|
||||
return usdtAggregationTaskMapper.insertUsdtAggregationTask(usdtAggregationTask);
|
||||
}
|
||||
|
||||
-270
@@ -1,270 +0,0 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.UsdtFundFlow;
|
||||
import com.ruoyi.system.domain.UsdtFundFlowPlus;
|
||||
import com.ruoyi.system.mapper.UsdtFundFlowMapper;
|
||||
import com.ruoyi.system.service.IUsdtFundFlowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
/**
|
||||
* 资金流水Service业务层处理
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Service
|
||||
public class UsdtFundFlowServiceImpl extends ServiceImpl<UsdtFundFlowMapper, UsdtFundFlowPlus> implements IUsdtFundFlowService
|
||||
{
|
||||
@Autowired
|
||||
private UsdtFundFlowMapper usdtFundFlowMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Override
|
||||
public List<UsdtFundFlowPlus> getByIds(List<Long> ids ,boolean isUser, SFunction<UsdtFundFlowPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<UsdtFundFlowPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtFundFlowPlus>()
|
||||
.select(columns).in(UsdtFundFlowPlus::getId, ids);
|
||||
if(isUser){
|
||||
lambdaQueryWrapper.eq(UsdtFundFlowPlus::getUserId, SecurityUtils.getUserId());
|
||||
}
|
||||
List<UsdtFundFlowPlus> list = this.list(lambdaQueryWrapper);
|
||||
if(isUser){
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private void checkUserPlus(List<UsdtFundFlowPlus> list) {
|
||||
for (UsdtFundFlowPlus item : list){
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkUser(List<UsdtFundFlow> list) {
|
||||
for (UsdtFundFlow item : list){
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkUser(UsdtFundFlowPlus item) {
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
private void checkUser(UsdtFundFlow item) {
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<SelectItem> select(String keyword,boolean isUser) {
|
||||
LambdaQueryWrapper<UsdtFundFlowPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtFundFlowPlus>()
|
||||
.select(UsdtFundFlowPlus::getId,UsdtFundFlowPlus::getUserId, UsdtFundFlowPlus::getRemark)
|
||||
.like(UsdtFundFlowPlus::getRemark, keyword);
|
||||
if(isUser){
|
||||
lambdaQueryWrapper.eq(UsdtFundFlowPlus::getUserId, SecurityUtils.getUserId());
|
||||
}
|
||||
List<UsdtFundFlowPlus> list = this.list(lambdaQueryWrapper);
|
||||
if(isUser){
|
||||
checkUserPlus(list);
|
||||
}
|
||||
List<SelectItem> result =new ArrayList<>();
|
||||
for (UsdtFundFlowPlus item : list){
|
||||
SelectItem selectItem = new SelectItem();
|
||||
selectItem.setName(item.getRemark());
|
||||
selectItem.setId(item.getId());
|
||||
result.add(selectItem);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public UsdtFundFlowPlus getById(Long id, SFunction<UsdtFundFlowPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<UsdtFundFlowPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtFundFlowPlus>()
|
||||
.select(columns).eq(UsdtFundFlowPlus::getId, id);
|
||||
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, UsdtFundFlowPlus> getMapByIds(List<Long> ids, SFunction<UsdtFundFlowPlus, ?>... columns) {
|
||||
List<UsdtFundFlowPlus> list = this.getByIds(ids,false, columns);
|
||||
Map<Long, UsdtFundFlowPlus> map = new HashMap<>();
|
||||
for (UsdtFundFlowPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, UsdtFundFlowPlus> getMapByIds(List<Long> ids) {
|
||||
List<UsdtFundFlowPlus> list = this.getByIds(ids);
|
||||
Map<Long, UsdtFundFlowPlus> map = new HashMap<>();
|
||||
for (UsdtFundFlowPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UsdtFundFlowPlus> getByIds(List<Long> ids) {
|
||||
LambdaQueryWrapper<UsdtFundFlowPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtFundFlowPlus>().in(UsdtFundFlowPlus::getId, ids);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" sum(" + field + ") as total ");
|
||||
stringBuffer.append(" from usdt_fund_flow ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Long count(String where) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" count(1)");
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" usdt_fund_flow ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(select);
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" usdt_fund_flow ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
stringBuffer.append(" group by ");
|
||||
stringBuffer.append(groupby);
|
||||
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||
return tList;
|
||||
}
|
||||
/**
|
||||
* 查询资金流水
|
||||
*
|
||||
* @param id 资金流水ID
|
||||
* @return 资金流水
|
||||
*/
|
||||
@Override
|
||||
public UsdtFundFlow selectUsdtFundFlowById(Long id,boolean isUser)
|
||||
{
|
||||
UsdtFundFlow vo = usdtFundFlowMapper.selectUsdtFundFlowById(id);
|
||||
if(isUser){
|
||||
checkUser(vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资金流水列表
|
||||
*
|
||||
* @param usdtFundFlow 资金流水
|
||||
* @return 资金流水
|
||||
*/
|
||||
@Override
|
||||
public List<UsdtFundFlow> selectUsdtFundFlowList(UsdtFundFlow usdtFundFlow,boolean isUser)
|
||||
{
|
||||
if(usdtFundFlow == null){
|
||||
usdtFundFlow = new UsdtFundFlow();
|
||||
}
|
||||
if(isUser){
|
||||
usdtFundFlow.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
List<UsdtFundFlow> list = usdtFundFlowMapper.selectUsdtFundFlowList(usdtFundFlow);
|
||||
if(isUser){
|
||||
checkUser(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资金流水
|
||||
*
|
||||
* @param usdtFundFlow 资金流水
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUsdtFundFlow(UsdtFundFlow usdtFundFlow,boolean isUser)
|
||||
{
|
||||
usdtFundFlow.setCreatedAt(DateUtils.getNowDate());
|
||||
usdtFundFlow.setUpdatedAt(DateUtils.getNowDate());
|
||||
if(isUser){
|
||||
usdtFundFlow.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
return usdtFundFlowMapper.insertUsdtFundFlow(usdtFundFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资金流水
|
||||
*
|
||||
* @param usdtFundFlow 资金流水
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUsdtFundFlow(UsdtFundFlow usdtFundFlow,boolean isUser)
|
||||
{
|
||||
usdtFundFlow.setUpdatedAt(DateUtils.getNowDate());
|
||||
if(isUser){
|
||||
checkUser(usdtFundFlow);
|
||||
}
|
||||
return usdtFundFlowMapper.updateUsdtFundFlow(usdtFundFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除资金流水
|
||||
*
|
||||
* @param ids 需要删除的资金流水ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUsdtFundFlowByIds(Long[] ids,boolean isUser)
|
||||
{
|
||||
if(isUser){
|
||||
List<UsdtFundFlowPlus> list= getByIds(Arrays.asList(ids),false,UsdtFundFlowPlus::getUserId,UsdtFundFlowPlus::getId);
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return usdtFundFlowMapper.deleteUsdtFundFlowByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资金流水信息
|
||||
*
|
||||
* @param id 资金流水ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUsdtFundFlowById(Long id,boolean isUser)
|
||||
{
|
||||
if(isUser){
|
||||
UsdtFundFlowPlus vo = getById(id,UsdtFundFlowPlus::getUserId,UsdtFundFlowPlus::getId);
|
||||
checkUser(vo);
|
||||
}
|
||||
return usdtFundFlowMapper.deleteUsdtFundFlowById(id);
|
||||
}
|
||||
}
|
||||
-277
@@ -1,277 +0,0 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.UsdtUserSettlementConfiguration;
|
||||
import com.ruoyi.system.domain.UsdtUserSettlementConfigurationPlus;
|
||||
import com.ruoyi.system.mapper.UsdtUserSettlementConfigurationMapper;
|
||||
import com.ruoyi.system.service.IUsdtUserSettlementConfigurationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
/**
|
||||
* 商户配置Service业务层处理
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Service
|
||||
public class UsdtUserSettlementConfigurationServiceImpl extends ServiceImpl<UsdtUserSettlementConfigurationMapper, UsdtUserSettlementConfigurationPlus> implements IUsdtUserSettlementConfigurationService
|
||||
{
|
||||
@Autowired
|
||||
private UsdtUserSettlementConfigurationMapper usdtUserSettlementConfigurationMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Override
|
||||
public List<UsdtUserSettlementConfigurationPlus> getByIds(List<Long> ids ,boolean isUser, SFunction<UsdtUserSettlementConfigurationPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus>()
|
||||
.select(columns).in(UsdtUserSettlementConfigurationPlus::getId, ids);
|
||||
if(isUser){
|
||||
lambdaQueryWrapper.eq(UsdtUserSettlementConfigurationPlus::getUserId, SecurityUtils.getUserId());
|
||||
}
|
||||
List<UsdtUserSettlementConfigurationPlus> list = this.list(lambdaQueryWrapper);
|
||||
if(isUser){
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private void checkUserPlus(List<UsdtUserSettlementConfigurationPlus> list) {
|
||||
for (UsdtUserSettlementConfigurationPlus item : list){
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkUser(List<UsdtUserSettlementConfiguration> list) {
|
||||
for (UsdtUserSettlementConfiguration item : list){
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkUser(UsdtUserSettlementConfigurationPlus item) {
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
private void checkUser(UsdtUserSettlementConfiguration item) {
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<SelectItem> select(String keyword,boolean isUser) {
|
||||
LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus>()
|
||||
.select(UsdtUserSettlementConfigurationPlus::getId,UsdtUserSettlementConfigurationPlus::getUserId, UsdtUserSettlementConfigurationPlus::getRemark)
|
||||
.like(UsdtUserSettlementConfigurationPlus::getRemark, keyword);
|
||||
if(isUser){
|
||||
lambdaQueryWrapper.eq(UsdtUserSettlementConfigurationPlus::getUserId, SecurityUtils.getUserId());
|
||||
}
|
||||
List<UsdtUserSettlementConfigurationPlus> list = this.list(lambdaQueryWrapper);
|
||||
if(isUser){
|
||||
checkUserPlus(list);
|
||||
}
|
||||
List<SelectItem> result =new ArrayList<>();
|
||||
for (UsdtUserSettlementConfigurationPlus item : list){
|
||||
SelectItem selectItem = new SelectItem();
|
||||
selectItem.setName(item.getRemark());
|
||||
selectItem.setId(item.getId());
|
||||
result.add(selectItem);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public UsdtUserSettlementConfigurationPlus getById(Long id, SFunction<UsdtUserSettlementConfigurationPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus>()
|
||||
.select(columns).eq(UsdtUserSettlementConfigurationPlus::getId, id);
|
||||
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, UsdtUserSettlementConfigurationPlus> getMapByIds(List<Long> ids, SFunction<UsdtUserSettlementConfigurationPlus, ?>... columns) {
|
||||
List<UsdtUserSettlementConfigurationPlus> list = this.getByIds(ids,false, columns);
|
||||
Map<Long, UsdtUserSettlementConfigurationPlus> map = new HashMap<>();
|
||||
for (UsdtUserSettlementConfigurationPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, UsdtUserSettlementConfigurationPlus> getMapByIds(List<Long> ids) {
|
||||
List<UsdtUserSettlementConfigurationPlus> list = this.getByIds(ids);
|
||||
Map<Long, UsdtUserSettlementConfigurationPlus> map = new HashMap<>();
|
||||
for (UsdtUserSettlementConfigurationPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UsdtUserSettlementConfigurationPlus> getByIds(List<Long> ids) {
|
||||
LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus>().in(UsdtUserSettlementConfigurationPlus::getId, ids);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" sum(" + field + ") as total ");
|
||||
stringBuffer.append(" from usdt_user_settlement_configuration ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Long count(String where) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" count(1)");
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" usdt_user_settlement_configuration ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(select);
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" usdt_user_settlement_configuration ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
stringBuffer.append(" group by ");
|
||||
stringBuffer.append(groupby);
|
||||
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||
return tList;
|
||||
}
|
||||
/**
|
||||
* 查询商户配置
|
||||
*
|
||||
* @param id 商户配置ID
|
||||
* @return 商户配置
|
||||
*/
|
||||
@Override
|
||||
public UsdtUserSettlementConfiguration selectUsdtUserSettlementConfigurationById(Long id,boolean isUser)
|
||||
{
|
||||
UsdtUserSettlementConfiguration vo = usdtUserSettlementConfigurationMapper.selectUsdtUserSettlementConfigurationById(id);
|
||||
if(isUser){
|
||||
checkUser(vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UsdtUserSettlementConfigurationPlus getByUserId(Long userId) {
|
||||
LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UsdtUserSettlementConfigurationPlus>()
|
||||
.eq(UsdtUserSettlementConfigurationPlus::getUserId, userId);
|
||||
return getOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商户配置列表
|
||||
*
|
||||
* @param usdtUserSettlementConfiguration 商户配置
|
||||
* @return 商户配置
|
||||
*/
|
||||
@Override
|
||||
public List<UsdtUserSettlementConfiguration> selectUsdtUserSettlementConfigurationList(UsdtUserSettlementConfiguration usdtUserSettlementConfiguration,boolean isUser)
|
||||
{
|
||||
if(usdtUserSettlementConfiguration == null){
|
||||
usdtUserSettlementConfiguration = new UsdtUserSettlementConfiguration();
|
||||
}
|
||||
if(isUser){
|
||||
usdtUserSettlementConfiguration.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
List<UsdtUserSettlementConfiguration> list = usdtUserSettlementConfigurationMapper.selectUsdtUserSettlementConfigurationList(usdtUserSettlementConfiguration);
|
||||
if(isUser){
|
||||
checkUser(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商户配置
|
||||
*
|
||||
* @param usdtUserSettlementConfiguration 商户配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUsdtUserSettlementConfiguration(UsdtUserSettlementConfiguration usdtUserSettlementConfiguration,boolean isUser)
|
||||
{
|
||||
usdtUserSettlementConfiguration.setCreatedAt(DateUtils.getNowDate());
|
||||
usdtUserSettlementConfiguration.setUpdatedAt(DateUtils.getNowDate());
|
||||
if(isUser){
|
||||
usdtUserSettlementConfiguration.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
return usdtUserSettlementConfigurationMapper.insertUsdtUserSettlementConfiguration(usdtUserSettlementConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商户配置
|
||||
*
|
||||
* @param usdtUserSettlementConfiguration 商户配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUsdtUserSettlementConfiguration(UsdtUserSettlementConfiguration usdtUserSettlementConfiguration,boolean isUser)
|
||||
{
|
||||
usdtUserSettlementConfiguration.setUpdatedAt(DateUtils.getNowDate());
|
||||
if(isUser){
|
||||
checkUser(usdtUserSettlementConfiguration);
|
||||
}
|
||||
return usdtUserSettlementConfigurationMapper.updateUsdtUserSettlementConfiguration(usdtUserSettlementConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商户配置
|
||||
*
|
||||
* @param ids 需要删除的商户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUsdtUserSettlementConfigurationByIds(Long[] ids,boolean isUser)
|
||||
{
|
||||
if(isUser){
|
||||
List<UsdtUserSettlementConfigurationPlus> list= getByIds(Arrays.asList(ids),false,UsdtUserSettlementConfigurationPlus::getUserId,UsdtUserSettlementConfigurationPlus::getId);
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return usdtUserSettlementConfigurationMapper.deleteUsdtUserSettlementConfigurationByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商户配置信息
|
||||
*
|
||||
* @param id 商户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUsdtUserSettlementConfigurationById(Long id,boolean isUser)
|
||||
{
|
||||
if(isUser){
|
||||
UsdtUserSettlementConfigurationPlus vo = getById(id,UsdtUserSettlementConfigurationPlus::getUserId,UsdtUserSettlementConfigurationPlus::getId);
|
||||
checkUser(vo);
|
||||
}
|
||||
return usdtUserSettlementConfigurationMapper.deleteUsdtUserSettlementConfigurationById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,271 +0,0 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.UserAuth;
|
||||
import com.ruoyi.system.domain.UserAuthPlus;
|
||||
import com.ruoyi.system.mapper.UserAuthMapper;
|
||||
import com.ruoyi.system.service.IUserAuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户授权Service业务层处理
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-11-25
|
||||
*/
|
||||
@Service
|
||||
public class UserAuthServiceImpl extends ServiceImpl<UserAuthMapper, UserAuthPlus> implements IUserAuthService {
|
||||
@Autowired
|
||||
private UserAuthMapper userAuthMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Override
|
||||
public List<UserAuthPlus> getByIds(List<Long> ids, boolean isUser, SFunction<UserAuthPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<UserAuthPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UserAuthPlus>()
|
||||
.select(columns).in(UserAuthPlus::getId, ids);
|
||||
if (isUser) {
|
||||
lambdaQueryWrapper.eq(UserAuthPlus::getUserId, SecurityUtils.getUserId());
|
||||
}
|
||||
List<UserAuthPlus> list = this.list(lambdaQueryWrapper);
|
||||
if (isUser) {
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void checkUserPlus(List<UserAuthPlus> list) {
|
||||
for (UserAuthPlus item : list) {
|
||||
if (null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUser(List<UserAuth> list) {
|
||||
for (UserAuth item : list) {
|
||||
if (null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUser(UserAuthPlus item) {
|
||||
if (null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUser(UserAuth item) {
|
||||
if (null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectItem> select(String keyword, boolean isUser) {
|
||||
LambdaQueryWrapper<UserAuthPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UserAuthPlus>()
|
||||
.select(UserAuthPlus::getId, UserAuthPlus::getUserId, UserAuthPlus::getName)
|
||||
.like(UserAuthPlus::getName, keyword);
|
||||
if (isUser) {
|
||||
lambdaQueryWrapper.eq(UserAuthPlus::getUserId, SecurityUtils.getUserId());
|
||||
}
|
||||
List<UserAuthPlus> list = this.list(lambdaQueryWrapper);
|
||||
if (isUser) {
|
||||
checkUserPlus(list);
|
||||
}
|
||||
List<SelectItem> result = new ArrayList<>();
|
||||
for (UserAuthPlus item : list) {
|
||||
SelectItem selectItem = new SelectItem();
|
||||
selectItem.setName(item.getName());
|
||||
selectItem.setId(item.getId());
|
||||
result.add(selectItem);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAuthPlus getById(Long id, SFunction<UserAuthPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<UserAuthPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UserAuthPlus>()
|
||||
.select(columns).eq(UserAuthPlus::getId, id);
|
||||
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, UserAuthPlus> getMapByIds(List<Long> ids, SFunction<UserAuthPlus, ?>... columns) {
|
||||
List<UserAuthPlus> list = this.getByIds(ids, false, columns);
|
||||
Map<Long, UserAuthPlus> map = new HashMap<>();
|
||||
for (UserAuthPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, UserAuthPlus> getMapByIds(List<Long> ids) {
|
||||
List<UserAuthPlus> list = this.getByIds(ids);
|
||||
Map<Long, UserAuthPlus> map = new HashMap<>();
|
||||
for (UserAuthPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserAuthPlus> getByIds(List<Long> ids) {
|
||||
LambdaQueryWrapper<UserAuthPlus> lambdaQueryWrapper = new LambdaQueryWrapper<UserAuthPlus>().in(UserAuthPlus::getId, ids);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" sum(" + field + ") as total ");
|
||||
stringBuffer.append(" from user_auth ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Long count(String where) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" count(1)");
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" user_auth ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(select);
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" user_auth ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
stringBuffer.append(" group by ");
|
||||
stringBuffer.append(groupby);
|
||||
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||
return tList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户授权
|
||||
*
|
||||
* @param id 用户授权ID
|
||||
* @return 用户授权
|
||||
*/
|
||||
@Override
|
||||
public UserAuth selectUserAuthById(Long id, boolean isUser) {
|
||||
UserAuth vo = userAuthMapper.selectUserAuthById(id);
|
||||
if (isUser) {
|
||||
checkUser(vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户授权列表
|
||||
*
|
||||
* @param userAuth 用户授权
|
||||
* @return 用户授权
|
||||
*/
|
||||
@Override
|
||||
public List<UserAuth> selectUserAuthList(UserAuth userAuth, boolean isUser) {
|
||||
if (userAuth == null) {
|
||||
userAuth = new UserAuth();
|
||||
}
|
||||
if (isUser) {
|
||||
userAuth.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
List<UserAuth> list = userAuthMapper.selectUserAuthList(userAuth);
|
||||
if (isUser) {
|
||||
checkUser(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户授权
|
||||
*
|
||||
* @param userAuth 用户授权
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUserAuth(UserAuth userAuth, boolean isUser) {
|
||||
userAuth.setCreatedAt(DateUtils.getNowDate());
|
||||
userAuth.setUpdatedAt(DateUtils.getNowDate());
|
||||
if (isUser) {
|
||||
userAuth.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
return userAuthMapper.insertUserAuth(userAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户授权
|
||||
*
|
||||
* @param userAuth 用户授权
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserAuth(UserAuth userAuth, boolean isUser) {
|
||||
userAuth.setUpdatedAt(DateUtils.getNowDate());
|
||||
if (isUser) {
|
||||
checkUser(userAuth);
|
||||
}
|
||||
return userAuthMapper.updateUserAuth(userAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户授权
|
||||
*
|
||||
* @param ids 需要删除的用户授权ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserAuthByIds(Long[] ids, boolean isUser) {
|
||||
if (isUser) {
|
||||
List<UserAuthPlus> list = getByIds(Arrays.asList(ids), false, UserAuthPlus::getUserId, UserAuthPlus::getId);
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return userAuthMapper.deleteUserAuthByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户授权信息
|
||||
*
|
||||
* @param id 用户授权ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserAuthById(Long id, boolean isUser) {
|
||||
if (isUser) {
|
||||
UserAuthPlus vo = getById(id, UserAuthPlus::getUserId, UserAuthPlus::getId);
|
||||
checkUser(vo);
|
||||
}
|
||||
return userAuthMapper.deleteUserAuthById(id);
|
||||
}
|
||||
}
|
||||
@@ -184,14 +184,6 @@ public class WalletAddressServiceImpl extends ServiceImpl<WalletAddressMapper, W
|
||||
return map;
|
||||
}
|
||||
@Override
|
||||
public boolean updateWithdrawUsdtBalanceById(Long id, BigDecimal withdrawUsdtBalance){
|
||||
WalletAddressPlus walletAddressPlus = new WalletAddressPlus();
|
||||
walletAddressPlus.setWithdrawUsdtBalance(withdrawUsdtBalance);
|
||||
LambdaQueryWrapper<WalletAddressPlus> lambdaQueryWrapper = new LambdaQueryWrapper<WalletAddressPlus>();
|
||||
lambdaQueryWrapper.eq(WalletAddressPlus::getId, id);
|
||||
return this.update(walletAddressPlus,lambdaQueryWrapper);
|
||||
}
|
||||
@Override
|
||||
public Map<Long, WalletAddressPlus> getMapByIds(List<Long> ids) {
|
||||
List<WalletAddressPlus> list = this.getByIds(ids);
|
||||
Map<Long, WalletAddressPlus> map = new HashMap<>();
|
||||
|
||||
@@ -1,261 +0,0 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.Web3Wallet;
|
||||
import com.ruoyi.system.domain.Web3WalletPlus;
|
||||
import com.ruoyi.system.mapper.Web3WalletMapper;
|
||||
import com.ruoyi.system.service.IWeb3WalletService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 钱包管理Service业务层处理
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2025-11-25
|
||||
*/
|
||||
@Service
|
||||
public class Web3WalletServiceImpl extends ServiceImpl<Web3WalletMapper, Web3WalletPlus> implements IWeb3WalletService {
|
||||
@Autowired
|
||||
private Web3WalletMapper web3WalletMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Override
|
||||
public List<Web3WalletPlus> getByIds(List<Long> ids, boolean isUser, SFunction<Web3WalletPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<Web3WalletPlus> lambdaQueryWrapper = null;
|
||||
if (isUser) {
|
||||
lambdaQueryWrapper = new LambdaQueryWrapper<Web3WalletPlus>()
|
||||
.select(columns).eq(Web3WalletPlus::getId, SecurityUtils.getUserId());
|
||||
} else {
|
||||
lambdaQueryWrapper = new LambdaQueryWrapper<Web3WalletPlus>()
|
||||
.select(columns).in(Web3WalletPlus::getId, ids);
|
||||
}
|
||||
List<Web3WalletPlus> list = this.list(lambdaQueryWrapper);
|
||||
if (isUser) {
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void checkUserPlus(List<Web3WalletPlus> list) {
|
||||
for (Web3WalletPlus item : list) {
|
||||
if (null != SecurityUtils.getUserId() && item.getId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUser(List<Web3Wallet> list) {
|
||||
for (Web3Wallet item : list) {
|
||||
if (null != SecurityUtils.getUserId() && item.getId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUser(Web3WalletPlus item) {
|
||||
if (null != SecurityUtils.getUserId() && item.getId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUser(Web3Wallet item) {
|
||||
if (null != SecurityUtils.getUserId() && item.getId().longValue() != SecurityUtils.getUserId()) {
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Web3WalletPlus getById(Long id, SFunction<Web3WalletPlus, ?>... columns) {
|
||||
LambdaQueryWrapper<Web3WalletPlus> lambdaQueryWrapper = new LambdaQueryWrapper<Web3WalletPlus>()
|
||||
.select(columns).eq(Web3WalletPlus::getId, id);
|
||||
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, Web3WalletPlus> getMapByIds(List<Long> ids, SFunction<Web3WalletPlus, ?>... columns) {
|
||||
List<Web3WalletPlus> list = this.getByIds(ids, false, columns);
|
||||
Map<Long, Web3WalletPlus> map = new HashMap<>();
|
||||
for (Web3WalletPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, Web3WalletPlus> getMapByIds(List<Long> ids) {
|
||||
List<Web3WalletPlus> list = this.getByIds(ids);
|
||||
Map<Long, Web3WalletPlus> map = new HashMap<>();
|
||||
for (Web3WalletPlus item : list) {
|
||||
map.put(item.getId(), item);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Web3WalletPlus> getByIds(List<Long> ids) {
|
||||
LambdaQueryWrapper<Web3WalletPlus> lambdaQueryWrapper = new LambdaQueryWrapper<Web3WalletPlus>().in(Web3WalletPlus::getId, ids);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" sum(" + field + ") as total ");
|
||||
stringBuffer.append(" from web3_wallet ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Long count(String where) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(" count(1)");
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" web3_wallet ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select ");
|
||||
stringBuffer.append(select);
|
||||
stringBuffer.append(" from ");
|
||||
stringBuffer.append(" web3_wallet ");
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
stringBuffer.append(" where ");
|
||||
stringBuffer.append(where);
|
||||
}
|
||||
stringBuffer.append(" group by ");
|
||||
stringBuffer.append(groupby);
|
||||
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||
return tList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询钱包管理
|
||||
*
|
||||
* @param id 钱包管理ID
|
||||
* @return 钱包管理
|
||||
*/
|
||||
@Override
|
||||
public Web3Wallet selectWeb3WalletById(Long id, boolean isUser) {
|
||||
Web3Wallet vo = web3WalletMapper.selectWeb3WalletById(id);
|
||||
if (isUser) {
|
||||
checkUser(vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询钱包管理列表
|
||||
*
|
||||
* @param web3Wallet 钱包管理
|
||||
* @return 钱包管理
|
||||
*/
|
||||
@Override
|
||||
public List<Web3Wallet> selectWeb3WalletList(Web3Wallet web3Wallet, boolean isUser) {
|
||||
if (isUser) {
|
||||
Web3WalletPlus myWallet = this.getById(SecurityUtils.getUserId());
|
||||
if(myWallet == null){
|
||||
myWallet = new Web3WalletPlus();
|
||||
myWallet.setId(SecurityUtils.getUserId());
|
||||
myWallet.setPassword(UUID.randomUUID().toString());
|
||||
myWallet.setEthBalance(new BigDecimal(0));
|
||||
myWallet.setTrxBalance(new BigDecimal(0));
|
||||
myWallet.setUsdtBalance(new BigDecimal(0));
|
||||
myWallet.setCreatedAt(new Date());
|
||||
myWallet.setUpdatedAt(new Date());
|
||||
this.save(myWallet);
|
||||
}
|
||||
web3Wallet.setId(SecurityUtils.getUserId());
|
||||
}
|
||||
List<Web3Wallet> list = web3WalletMapper.selectWeb3WalletList(web3Wallet);
|
||||
if (isUser) {
|
||||
checkUser(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钱包管理
|
||||
*
|
||||
* @param web3Wallet 钱包管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWeb3Wallet(Web3Wallet web3Wallet, boolean isUser) {
|
||||
web3Wallet.setCreatedAt(DateUtils.getNowDate());
|
||||
web3Wallet.setUpdatedAt(DateUtils.getNowDate());
|
||||
if (isUser) {
|
||||
web3Wallet.setId(SecurityUtils.getUserId());
|
||||
}
|
||||
return web3WalletMapper.insertWeb3Wallet(web3Wallet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改钱包管理
|
||||
*
|
||||
* @param web3Wallet 钱包管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWeb3Wallet(Web3Wallet web3Wallet, boolean isUser) {
|
||||
web3Wallet.setUpdatedAt(DateUtils.getNowDate());
|
||||
if (isUser) {
|
||||
checkUser(web3Wallet);
|
||||
}
|
||||
return web3WalletMapper.updateWeb3Wallet(web3Wallet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除钱包管理
|
||||
*
|
||||
* @param ids 需要删除的钱包管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWeb3WalletByIds(Long[] ids, boolean isUser) {
|
||||
if (isUser) {
|
||||
List<Web3WalletPlus> list = getByIds(Arrays.asList(ids), false, Web3WalletPlus::getUsdtBalance, Web3WalletPlus::getId);
|
||||
checkUserPlus(list);
|
||||
}
|
||||
return web3WalletMapper.deleteWeb3WalletByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除钱包管理信息
|
||||
*
|
||||
* @param id 钱包管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWeb3WalletById(Long id, boolean isUser) {
|
||||
if (isUser) {
|
||||
Web3WalletPlus vo = getById(id, Web3WalletPlus::getUsdtBalance, Web3WalletPlus::getId);
|
||||
checkUser(vo);
|
||||
}
|
||||
return web3WalletMapper.deleteWeb3WalletById(id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user