From ce9d974b578964097e2f5941bc7c101d333b1e52 Mon Sep 17 00:00:00 2001 From: luqingjie <544309509@qq.com> Date: Wed, 7 Oct 2026 23:25:47 -0400 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A8=E5=B1=80=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UsdtConfigController.java | 118 ++++++++ .../com/ruoyi/system/domain/UsdtConfig.java | 279 ++++++++++++++++++ .../ruoyi/system/domain/UsdtConfigPlus.java | 264 +++++++++++++++++ .../ruoyi/system/mapper/UsdtConfigMapper.java | 65 ++++ .../system/service/IUsdtConfigService.java | 89 ++++++ .../service/impl/UsdtConfigServiceImpl.java | 203 +++++++++++++ .../mapper/system/UsdtConfigMapper.xml | 136 +++++++++ 7 files changed, 1154 insertions(+) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/UsdtConfigController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfig.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfigPlus.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsdtConfigMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IUsdtConfigService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsdtConfigServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/UsdtConfigMapper.xml diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/UsdtConfigController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/UsdtConfigController.java new file mode 100644 index 0000000..0027aed --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/UsdtConfigController.java @@ -0,0 +1,118 @@ +package com.ruoyi.system.controller; +import com.ruoyi.common.select.Ids; +import com.ruoyi.common.select.SelectItem; +import java.util.List; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.UsdtConfig; +import com.ruoyi.system.domain.UsdtConfigPlus; +import com.ruoyi.system.service.IUsdtConfigService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 全局配置Controller + * + * @author luqj + * @date 2026-10-08 + */ +@RestController +@RequestMapping("/system/config") +public class UsdtConfigController extends BaseController +{ + @Autowired + private IUsdtConfigService usdtConfigService; + @PreAuthorize("@ss.hasPermi('system:config:getByIds')") + @PostMapping("/getByIds") + public AjaxResult getByIds(@RequestBody Ids ids) + { + List list = usdtConfigService.getByIds(ids.getLongIds(),UsdtConfigPlus::getVersion,UsdtConfigPlus::getId); + return AjaxResult.success(list); + } + @PreAuthorize("@ss.hasPermi('system:config:select')") + @GetMapping("/select") + public AjaxResult select(String keyword) + { + List list = usdtConfigService.select(keyword); + return AjaxResult.success(list); + } + /** + * 查询全局配置列表 + */ + @PreAuthorize("@ss.hasPermi('system:config:list')") + @GetMapping("/list") + public TableDataInfo list(UsdtConfig usdtConfig) + { + startPage(); + List list = usdtConfigService.selectUsdtConfigList(usdtConfig); + return getDataTable(list); + } + + /** + * 导出全局配置列表 + */ + @PreAuthorize("@ss.hasPermi('system:config:export')") + @Log(title = "全局配置", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(UsdtConfig usdtConfig) + { + List list = usdtConfigService.selectUsdtConfigList(usdtConfig); + ExcelUtil util = new ExcelUtil(UsdtConfig.class); + return util.exportExcel(list, "config"); + } + + /** + * 获取全局配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:config:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(usdtConfigService.selectUsdtConfigById(id)); + } + + /** + * 新增全局配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:add')") + @Log(title = "全局配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody UsdtConfig usdtConfig) + { + return toAjax(usdtConfigService.insertUsdtConfig(usdtConfig)); + } + + /** + * 修改全局配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:edit')") + @Log(title = "全局配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody UsdtConfig usdtConfig) + { + return toAjax(usdtConfigService.updateUsdtConfig(usdtConfig)); + } + + /** + * 删除全局配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "全局配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(usdtConfigService.deleteUsdtConfigByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfig.java new file mode 100644 index 0000000..136b102 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfig.java @@ -0,0 +1,279 @@ +package com.ruoyi.system.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import java.io.Serializable; +/** + * 全局配置对象 usdt_config + * + * @author luqj + * @date 2026-10-08 + */ +public class UsdtConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 代付手续费 */ + @Excel(name = "代付手续费") + private BigDecimal payUsdtNum; + + /** 代收手续费 */ + @Excel(name = "代收手续费") + private BigDecimal receiveUsdtNum; + + /** 波场网络类型 */ + @Excel(name = "波场网络类型") + private Integer tronNetType; + + /** 信封版本;配置密码轮换成功后递增 */ + @Excel(name = "信封版本;配置密码轮换成功后递增") + private Long version; + + /** 助记词和 DEK 使用的加密算法 */ + @Excel(name = "助记词和 DEK 使用的加密算法") + private String encryptionAlgorithm; + + /** 配置密码派生算法 */ + @Excel(name = "配置密码派生算法") + private String passwordKdf; + + /** PBKDF2 迭代次数;轮换时按当前安全策略更新 */ + @Excel(name = "PBKDF2 迭代次数;轮换时按当前安全策略更新") + private Long iterations; + + /** AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词 */ + @Excel(name = "AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词") + private String encryptedMnemonic; + + /** 助记词 AES-GCM nonce,Base64,通常为 12 字节 */ + @Excel(name = "助记词 AES-GCM nonce,Base64,通常为 12 字节") + private String mnemonicNonce; + + /** 由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK */ + @Excel(name = "由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK") + private String encryptedDek; + + /** DEK AES-GCM nonce,Base64,通常为 12 字节 */ + @Excel(name = "DEK AES-GCM nonce,Base64,通常为 12 字节") + private String dekNonce; + + /** 配置密码派生 KEK 使用的 salt,Base64 */ + @Excel(name = "配置密码派生 KEK 使用的 salt,Base64") + private String keySalt; + + /** 配置密码校验哈希使用的独立 salt,Base64 */ + @Excel(name = "配置密码校验哈希使用的独立 salt,Base64") + private String passwordSalt; + + /** PBKDF2 配置密码校验值,Base64;不是可逆密码 */ + @Excel(name = "PBKDF2 配置密码校验值,Base64;不是可逆密码") + private String passwordHash; + + /** 最近一次配置密码轮换时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "最近一次配置密码轮换时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date rotatedAt; + + /** $column.columnComment */ + @Excel(name = "最近一次配置密码轮换时间") + private BigDecimal trxNum; + + /** 主账号地址 */ + @Excel(name = "主账号地址") + private String tokenAddress; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPayUsdtNum(BigDecimal payUsdtNum) + { + this.payUsdtNum = payUsdtNum; + } + + public BigDecimal getPayUsdtNum() + { + return payUsdtNum; + } + public void setReceiveUsdtNum(BigDecimal receiveUsdtNum) + { + this.receiveUsdtNum = receiveUsdtNum; + } + + public BigDecimal getReceiveUsdtNum() + { + return receiveUsdtNum; + } + public void setTronNetType(Integer tronNetType) + { + this.tronNetType = tronNetType; + } + + public Integer getTronNetType() + { + return tronNetType; + } + public void setVersion(Long version) + { + this.version = version; + } + + public Long getVersion() + { + return version; + } + public void setEncryptionAlgorithm(String encryptionAlgorithm) + { + this.encryptionAlgorithm = encryptionAlgorithm; + } + + public String getEncryptionAlgorithm() + { + return encryptionAlgorithm; + } + public void setPasswordKdf(String passwordKdf) + { + this.passwordKdf = passwordKdf; + } + + public String getPasswordKdf() + { + return passwordKdf; + } + public void setIterations(Long iterations) + { + this.iterations = iterations; + } + + public Long getIterations() + { + return iterations; + } + public void setEncryptedMnemonic(String encryptedMnemonic) + { + this.encryptedMnemonic = encryptedMnemonic; + } + + public String getEncryptedMnemonic() + { + return encryptedMnemonic; + } + public void setMnemonicNonce(String mnemonicNonce) + { + this.mnemonicNonce = mnemonicNonce; + } + + public String getMnemonicNonce() + { + return mnemonicNonce; + } + public void setEncryptedDek(String encryptedDek) + { + this.encryptedDek = encryptedDek; + } + + public String getEncryptedDek() + { + return encryptedDek; + } + public void setDekNonce(String dekNonce) + { + this.dekNonce = dekNonce; + } + + public String getDekNonce() + { + return dekNonce; + } + public void setKeySalt(String keySalt) + { + this.keySalt = keySalt; + } + + public String getKeySalt() + { + return keySalt; + } + public void setPasswordSalt(String passwordSalt) + { + this.passwordSalt = passwordSalt; + } + + public String getPasswordSalt() + { + return passwordSalt; + } + public void setPasswordHash(String passwordHash) + { + this.passwordHash = passwordHash; + } + + public String getPasswordHash() + { + return passwordHash; + } + public void setRotatedAt(Date rotatedAt) + { + this.rotatedAt = rotatedAt; + } + + public Date getRotatedAt() + { + return rotatedAt; + } + public void setTrxNum(BigDecimal trxNum) + { + this.trxNum = trxNum; + } + + public BigDecimal getTrxNum() + { + return trxNum; + } + public void setTokenAddress(String tokenAddress) + { + this.tokenAddress = tokenAddress; + } + + public String getTokenAddress() + { + return tokenAddress; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("payUsdtNum", getPayUsdtNum()) + .append("receiveUsdtNum", getReceiveUsdtNum()) + .append("tronNetType", getTronNetType()) + .append("version", getVersion()) + .append("encryptionAlgorithm", getEncryptionAlgorithm()) + .append("passwordKdf", getPasswordKdf()) + .append("iterations", getIterations()) + .append("encryptedMnemonic", getEncryptedMnemonic()) + .append("mnemonicNonce", getMnemonicNonce()) + .append("encryptedDek", getEncryptedDek()) + .append("dekNonce", getDekNonce()) + .append("keySalt", getKeySalt()) + .append("passwordSalt", getPasswordSalt()) + .append("passwordHash", getPasswordHash()) + .append("rotatedAt", getRotatedAt()) + .append("trxNum", getTrxNum()) + .append("tokenAddress", getTokenAddress()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfigPlus.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfigPlus.java new file mode 100644 index 0000000..503b678 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/UsdtConfigPlus.java @@ -0,0 +1,264 @@ +package com.ruoyi.system.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import java.io.Serializable; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableName; +/** + * 全局配置对象 usdt_config + * + * @author luqj + * @date 2026-10-08 + */ +@TableName(value = "usdt_config") +public class UsdtConfigPlus implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + /** 代付手续费 */ + @Excel(name = "代付手续费") + private BigDecimal payUsdtNum; + /** 代收手续费 */ + @Excel(name = "代收手续费") + private BigDecimal receiveUsdtNum; + /** 波场网络类型 */ + @Excel(name = "波场网络类型 0 测试网络, 1 正式网络") + private Integer tronNetType; + /** 信封版本;配置密码轮换成功后递增 */ + @Excel(name = "信封版本;配置密码轮换成功后递增") + private Long version; + /** 助记词和 DEK 使用的加密算法 */ + @Excel(name = "助记词和 DEK 使用的加密算法") + private String encryptionAlgorithm; + /** 配置密码派生算法 */ + @Excel(name = "配置密码派生算法") + private String passwordKdf; + /** PBKDF2 迭代次数;轮换时按当前安全策略更新 */ + @Excel(name = "PBKDF2 迭代次数;轮换时按当前安全策略更新") + private Long iterations; + /** AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词 */ + @Excel(name = "AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词") + private String encryptedMnemonic; + /** 助记词 AES-GCM nonce,Base64,通常为 12 字节 */ + @Excel(name = "助记词 AES-GCM nonce,Base64,通常为 12 字节") + private String mnemonicNonce; + /** 由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK */ + @Excel(name = "由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK") + private String encryptedDek; + /** DEK AES-GCM nonce,Base64,通常为 12 字节 */ + @Excel(name = "DEK AES-GCM nonce,Base64,通常为 12 字节") + private String dekNonce; + /** 配置密码派生 KEK 使用的 salt,Base64 */ + @Excel(name = "配置密码派生 KEK 使用的 salt,Base64") + private String keySalt; + /** 配置密码校验哈希使用的独立 salt,Base64 */ + @Excel(name = "配置密码校验哈希使用的独立 salt,Base64") + private String passwordSalt; + /** PBKDF2 配置密码校验值,Base64;不是可逆密码 */ + @Excel(name = "PBKDF2 配置密码校验值,Base64;不是可逆密码") + private String passwordHash; + /** 最近一次配置密码轮换时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "最近一次配置密码轮换时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date rotatedAt; + /** $column.columnComment */ + @Excel(name = "最近一次配置密码轮换时间") + private BigDecimal trxNum; + /** 主账号地址 */ + @Excel(name = "主账号地址") + private String tokenAddress; + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPayUsdtNum(BigDecimal payUsdtNum) + { + this.payUsdtNum = payUsdtNum; + } + + public BigDecimal getPayUsdtNum() + { + return payUsdtNum; + } + public void setReceiveUsdtNum(BigDecimal receiveUsdtNum) + { + this.receiveUsdtNum = receiveUsdtNum; + } + + public BigDecimal getReceiveUsdtNum() + { + return receiveUsdtNum; + } + public void setTronNetType(Integer tronNetType) + { + this.tronNetType = tronNetType; + } + + public Integer getTronNetType() + { + return tronNetType; + } + public void setVersion(Long version) + { + this.version = version; + } + + public Long getVersion() + { + return version; + } + public void setEncryptionAlgorithm(String encryptionAlgorithm) + { + this.encryptionAlgorithm = encryptionAlgorithm; + } + + public String getEncryptionAlgorithm() + { + return encryptionAlgorithm; + } + public void setPasswordKdf(String passwordKdf) + { + this.passwordKdf = passwordKdf; + } + + public String getPasswordKdf() + { + return passwordKdf; + } + public void setIterations(Long iterations) + { + this.iterations = iterations; + } + + public Long getIterations() + { + return iterations; + } + public void setEncryptedMnemonic(String encryptedMnemonic) + { + this.encryptedMnemonic = encryptedMnemonic; + } + + public String getEncryptedMnemonic() + { + return encryptedMnemonic; + } + public void setMnemonicNonce(String mnemonicNonce) + { + this.mnemonicNonce = mnemonicNonce; + } + + public String getMnemonicNonce() + { + return mnemonicNonce; + } + public void setEncryptedDek(String encryptedDek) + { + this.encryptedDek = encryptedDek; + } + + public String getEncryptedDek() + { + return encryptedDek; + } + public void setDekNonce(String dekNonce) + { + this.dekNonce = dekNonce; + } + + public String getDekNonce() + { + return dekNonce; + } + public void setKeySalt(String keySalt) + { + this.keySalt = keySalt; + } + + public String getKeySalt() + { + return keySalt; + } + public void setPasswordSalt(String passwordSalt) + { + this.passwordSalt = passwordSalt; + } + + public String getPasswordSalt() + { + return passwordSalt; + } + public void setPasswordHash(String passwordHash) + { + this.passwordHash = passwordHash; + } + + public String getPasswordHash() + { + return passwordHash; + } + public void setRotatedAt(Date rotatedAt) + { + this.rotatedAt = rotatedAt; + } + + public Date getRotatedAt() + { + return rotatedAt; + } + public void setTrxNum(BigDecimal trxNum) + { + this.trxNum = trxNum; + } + + public BigDecimal getTrxNum() + { + return trxNum; + } + public void setTokenAddress(String tokenAddress) + { + this.tokenAddress = tokenAddress; + } + + public String getTokenAddress() + { + return tokenAddress; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("payUsdtNum", getPayUsdtNum()) + .append("receiveUsdtNum", getReceiveUsdtNum()) + .append("tronNetType", getTronNetType()) + .append("version", getVersion()) + .append("encryptionAlgorithm", getEncryptionAlgorithm()) + .append("passwordKdf", getPasswordKdf()) + .append("iterations", getIterations()) + .append("encryptedMnemonic", getEncryptedMnemonic()) + .append("mnemonicNonce", getMnemonicNonce()) + .append("encryptedDek", getEncryptedDek()) + .append("dekNonce", getDekNonce()) + .append("keySalt", getKeySalt()) + .append("passwordSalt", getPasswordSalt()) + .append("passwordHash", getPasswordHash()) + .append("rotatedAt", getRotatedAt()) + .append("trxNum", getTrxNum()) + .append("tokenAddress", getTokenAddress()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsdtConfigMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsdtConfigMapper.java new file mode 100644 index 0000000..75fcf2f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsdtConfigMapper.java @@ -0,0 +1,65 @@ +package com.ruoyi.system.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import com.ruoyi.system.domain.UsdtConfig; +import com.ruoyi.system.domain.UsdtConfigPlus; + +/** + * 全局配置Mapper接口 + * + * @author luqj + * @date 2026-10-08 + */ +public interface UsdtConfigMapper extends BaseMapper +{ + /** + * 查询全局配置 + * + * @param id 全局配置ID + * @return 全局配置 + */ + public UsdtConfig selectUsdtConfigById(Long id); + + /** + * 查询全局配置列表 + * + * @param usdtConfig 全局配置 + * @return 全局配置集合 + */ + public List selectUsdtConfigList(UsdtConfig usdtConfig); + + /** + * 新增全局配置 + * + * @param usdtConfig 全局配置 + * @return 结果 + */ + public int insertUsdtConfig(UsdtConfig usdtConfig); + + /** + * 修改全局配置 + * + * @param usdtConfig 全局配置 + * @return 结果 + */ + public int updateUsdtConfig(UsdtConfig usdtConfig); + + /** + * 删除全局配置 + * + * @param id 全局配置ID + * @return 结果 + */ + public int deleteUsdtConfigById(Long id); + + /** + * 批量删除全局配置 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteUsdtConfigByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IUsdtConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IUsdtConfigService.java new file mode 100644 index 0000000..137b96e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IUsdtConfigService.java @@ -0,0 +1,89 @@ +package com.ruoyi.system.service; +import java.util.Map; +import java.util.List; +import com.ruoyi.system.domain.UsdtConfig; +import com.ruoyi.system.domain.UsdtConfigPlus; +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 2026-10-08 + */ +public interface IUsdtConfigService extends IService +{ + + List select(String keyword); + /** + * 查询全局配置 + * + * @param id 全局配置ID + * @return 全局配置 + */ + public UsdtConfig selectUsdtConfigById(Long id); + + /** + * 查询全局配置列表 + * + * @param usdtConfig 全局配置 + * @return 全局配置集合 + */ + public List selectUsdtConfigList(UsdtConfig usdtConfig); + + /** + * 新增全局配置 + * + * @param usdtConfig 全局配置 + * @return 结果 + */ + public int insertUsdtConfig(UsdtConfig usdtConfig); + + /** + * 修改全局配置 + * + * @param usdtConfig 全局配置 + * @return 结果 + */ + public int updateUsdtConfig(UsdtConfig usdtConfig); + + /** + * 批量删除全局配置 + * + * @param ids 需要删除的全局配置ID + * @return 结果 + */ + public int deleteUsdtConfigByIds(Long[] ids); + + /** + * 删除全局配置信息 + * + * @param id 全局配置ID + * @return 结果 + */ + public int deleteUsdtConfigById(Long id); + + List getByIds(List ids, SFunction... columns); + + UsdtConfigPlus getById(Long id, SFunction... columns); + + Map getMapByIds(List ids, SFunction... columns); + + List getByIds(List ids); + + Map getMapByIds(List ids); + + /** + * @param field sum 字段 + * @param where 条件 + * @param tClass 返回类型 + * @param + * @return + */ + T sum(String field, String where, Class tClass); + + Long count(String where); + + List countByGroupBy(String select, String where, String groupby, Class tClass); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsdtConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsdtConfigServiceImpl.java new file mode 100644 index 0000000..6a9b0bf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsdtConfigServiceImpl.java @@ -0,0 +1,203 @@ +package com.ruoyi.system.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import java.util.HashMap; +import com.ruoyi.common.utils.StringUtils; +import com.alibaba.fastjson.JSONArray; +import java.util.List; +import java.util.Map; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.UsdtConfigMapper; +import com.ruoyi.system.domain.UsdtConfig; +import com.ruoyi.system.domain.UsdtConfigPlus; +import com.ruoyi.system.service.IUsdtConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import com.ruoyi.common.select.SelectItem; +/** + * 全局配置Service业务层处理 + * + * @author luqj + * @date 2026-10-08 + */ +@Service +public class UsdtConfigServiceImpl extends ServiceImpl implements IUsdtConfigService +{ + @Autowired + private UsdtConfigMapper usdtConfigMapper; + @Autowired + private JdbcTemplate jdbcTemplate; + + @Override + public List getByIds(List ids, SFunction... columns) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(columns).in(UsdtConfigPlus::getId, ids); + return this.list(lambdaQueryWrapper); + } + @Override + public List select(String keyword) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(UsdtConfigPlus::getId, UsdtConfigPlus::getName) + .like(UsdtConfigPlus::getName, keyword); + List list = this.list(lambdaQueryWrapper); + List result =new ArrayList<>(); + for (UsdtConfigPlus item : list){ + SelectItem selectItem = new SelectItem(); + selectItem.setName(item.getName()); + selectItem.setId(item.getId()); + result.add(selectItem); + } + return result; + } + @Override + public UsdtConfigPlus getById(Long id, SFunction... columns) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(columns).eq(UsdtConfigPlus::getId, id); + return baseMapper.selectOne(lambdaQueryWrapper); + } + + @Override + public Map getMapByIds(List ids, SFunction... columns) { + List list = this.getByIds(ids, columns); + Map map = new HashMap<>(); + for (UsdtConfigPlus item : list) { + map.put(item.getId(), item); + } + return map; + } + + @Override + public Map getMapByIds(List ids) { + List list = this.getByIds(ids); + Map map = new HashMap<>(); + for (UsdtConfigPlus item : list) { + map.put(item.getId(), item); + } + return map; + } + + @Override + public List getByIds(List ids) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(UsdtConfigPlus::getId, ids); + return this.list(lambdaQueryWrapper); + } + + public T sum(String field, String where, Class tClass) { + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select "); + stringBuffer.append(" sum(" + field + ") as total "); + stringBuffer.append(" from usdt_config "); + 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_config "); + if (StringUtils.isNotBlank(where)) { + stringBuffer.append(" where "); + stringBuffer.append(where); + } + Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); + return result; + } + + public List countByGroupBy(String select, String where, String groupby, Class tClass) { + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select "); + stringBuffer.append(select); + stringBuffer.append(" from "); + stringBuffer.append(" usdt_config "); + if (StringUtils.isNotBlank(where)) { + stringBuffer.append(" where "); + stringBuffer.append(where); + } + stringBuffer.append(" group by "); + stringBuffer.append(groupby); + List result = jdbcTemplate.queryForList(stringBuffer.toString()); + List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); + return tList; + } + /** + * 查询全局配置 + * + * @param id 全局配置ID + * @return 全局配置 + */ + @Override + public UsdtConfig selectUsdtConfigById(Long id) + { + return usdtConfigMapper.selectUsdtConfigById(id); + } + + /** + * 查询全局配置列表 + * + * @param usdtConfig 全局配置 + * @return 全局配置 + */ + @Override + public List selectUsdtConfigList(UsdtConfig usdtConfig) + { + return usdtConfigMapper.selectUsdtConfigList(usdtConfig); + } + + /** + * 新增全局配置 + * + * @param usdtConfig 全局配置 + * @return 结果 + */ + @Override + public int insertUsdtConfig(UsdtConfig usdtConfig) + { + return usdtConfigMapper.insertUsdtConfig(usdtConfig); + } + + /** + * 修改全局配置 + * + * @param usdtConfig 全局配置 + * @return 结果 + */ + @Override + public int updateUsdtConfig(UsdtConfig usdtConfig) + { + return usdtConfigMapper.updateUsdtConfig(usdtConfig); + } + + /** + * 批量删除全局配置 + * + * @param ids 需要删除的全局配置ID + * @return 结果 + */ + @Override + public int deleteUsdtConfigByIds(Long[] ids) + { + return usdtConfigMapper.deleteUsdtConfigByIds(ids); + } + + /** + * 删除全局配置信息 + * + * @param id 全局配置ID + * @return 结果 + */ + @Override + public int deleteUsdtConfigById(Long id) + { + return usdtConfigMapper.deleteUsdtConfigById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/UsdtConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/UsdtConfigMapper.xml new file mode 100644 index 0000000..62fb4b7 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/UsdtConfigMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, pay_usdt_num, receive_usdt_num, tron_net_type, version, encryption_algorithm, password_kdf, iterations, encrypted_mnemonic, mnemonic_nonce, encrypted_dek, dek_nonce, key_salt, password_salt, password_hash, rotated_at, trx_num, token_address from usdt_config + + + + + + + + insert into usdt_config + + pay_usdt_num, + receive_usdt_num, + tron_net_type, + version, + encryption_algorithm, + password_kdf, + iterations, + encrypted_mnemonic, + mnemonic_nonce, + encrypted_dek, + dek_nonce, + key_salt, + password_salt, + password_hash, + rotated_at, + trx_num, + token_address, + + + #{payUsdtNum}, + #{receiveUsdtNum}, + #{tronNetType}, + #{version}, + #{encryptionAlgorithm}, + #{passwordKdf}, + #{iterations}, + #{encryptedMnemonic}, + #{mnemonicNonce}, + #{encryptedDek}, + #{dekNonce}, + #{keySalt}, + #{passwordSalt}, + #{passwordHash}, + #{rotatedAt}, + #{trxNum}, + #{tokenAddress}, + + + + + update usdt_config + + pay_usdt_num = #{payUsdtNum}, + receive_usdt_num = #{receiveUsdtNum}, + tron_net_type = #{tronNetType}, + version = #{version}, + encryption_algorithm = #{encryptionAlgorithm}, + password_kdf = #{passwordKdf}, + iterations = #{iterations}, + encrypted_mnemonic = #{encryptedMnemonic}, + mnemonic_nonce = #{mnemonicNonce}, + encrypted_dek = #{encryptedDek}, + dek_nonce = #{dekNonce}, + key_salt = #{keySalt}, + password_salt = #{passwordSalt}, + password_hash = #{passwordHash}, + rotated_at = #{rotatedAt}, + trx_num = #{trxNum}, + token_address = #{tokenAddress}, + + where id = #{id} + + + + delete from usdt_config where id = #{id} + + + + delete from usdt_config where id in + + #{id} + + + \ No newline at end of file