diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppsBalanceLedgerController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppsBalanceLedgerController.java new file mode 100644 index 0000000..771271b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppsBalanceLedgerController.java @@ -0,0 +1,170 @@ +package com.ruoyi.system.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.select.Ids; +import com.ruoyi.common.select.SelectItem; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.AppsBalanceLedger; +import com.ruoyi.system.domain.AppsBalanceLedgerPlus; +import com.ruoyi.system.service.IAppsBalanceLedgerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 应用账面余额流水Controller + * + * @author luqj + * @date 2026-10-13 + */ +@RestController +@RequestMapping("/system/appsBalanceLedger") +public class AppsBalanceLedgerController extends BaseController +{ + @Autowired + private IAppsBalanceLedgerService appsBalanceLedgerService; + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:getByIds')") + @PostMapping("/getByIds") + public AjaxResult getByIds(@RequestBody Ids ids) + { + List list = appsBalanceLedgerService.getByIds(ids.getLongIds(),false,AppsBalanceLedgerPlus::getAppId,AppsBalanceLedgerPlus::getId); + return AjaxResult.success(list); + } + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:user-getByIds')") + @PostMapping("/user/getByIds") + public AjaxResult userGetByIds(@RequestBody Ids ids) + { + List list = appsBalanceLedgerService.getByIds(ids.getLongIds(),true,AppsBalanceLedgerPlus::getUserId,AppsBalanceLedgerPlus::getAppId,AppsBalanceLedgerPlus::getId); + return AjaxResult.success(list); + } + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:select')") + @GetMapping("/select") + public AjaxResult select(String keyword) + { + List list = appsBalanceLedgerService.select(keyword,false); + return AjaxResult.success(list); + } + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:user-select')") + @GetMapping("/user/select") + public AjaxResult userSelect(String keyword) + { + List list = appsBalanceLedgerService.select(keyword,true); + return AjaxResult.success(list); + } + /** + * 查询应用账面余额流水列表 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:list')") + @GetMapping("/list") + public TableDataInfo list(AppsBalanceLedger appsBalanceLedger) + { + startPage(); + List list = appsBalanceLedgerService.selectAppsBalanceLedgerList(appsBalanceLedger,false); + return getDataTable(list); + } +/** + * 查询应用账面余额流水列表 + */ +@PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:user-list')") +@GetMapping("/user/list") + public TableDataInfo userList(AppsBalanceLedger appsBalanceLedger) + { + startPage(); + List list = appsBalanceLedgerService.selectAppsBalanceLedgerList(appsBalanceLedger,true); + return getDataTable(list); + } + /** + * 导出应用账面余额流水列表 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:export')") + @Log(title = "应用账面余额流水", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(AppsBalanceLedger appsBalanceLedger) + { + List list = appsBalanceLedgerService.selectAppsBalanceLedgerList(appsBalanceLedger,false); + ExcelUtil util = new ExcelUtil(AppsBalanceLedger.class); + return util.exportExcel(list, "appsBalanceLedger"); + } + + /** + * 获取应用账面余额流水详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(appsBalanceLedgerService.selectAppsBalanceLedgerById(id,false)); + } + /** + * 获取应用账面余额流水详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:user-query')") + @GetMapping(value = "/user/{id}") + public AjaxResult userGetInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(appsBalanceLedgerService.selectAppsBalanceLedgerById(id,true)); + } + /** + * 新增应用账面余额流水 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:add')") + @Log(title = "应用账面余额流水", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody AppsBalanceLedger appsBalanceLedger) + { + return toAjax(appsBalanceLedgerService.insertAppsBalanceLedger(appsBalanceLedger,false)); + } + /** + * 新增应用账面余额流水 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:user-add')") + @Log(title = "应用账面余额流水", businessType = BusinessType.INSERT) + @PostMapping("/user") + public AjaxResult userAdd(@RequestBody AppsBalanceLedger appsBalanceLedger) + { + return toAjax(appsBalanceLedgerService.insertAppsBalanceLedger(appsBalanceLedger,true)); + } + /** + * 修改应用账面余额流水 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:edit')") + @Log(title = "应用账面余额流水", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody AppsBalanceLedger appsBalanceLedger) + { + return toAjax(appsBalanceLedgerService.updateAppsBalanceLedger(appsBalanceLedger,false)); + } + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:user-edit')") + @Log(title = "应用账面余额流水", businessType = BusinessType.UPDATE) + @PutMapping("/user") + public AjaxResult userEdit(@RequestBody AppsBalanceLedger appsBalanceLedger) + { + return toAjax(appsBalanceLedgerService.updateAppsBalanceLedger(appsBalanceLedger,true)); + } + /** + * 删除应用账面余额流水 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:remove')") + @Log(title = "应用账面余额流水", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(appsBalanceLedgerService.deleteAppsBalanceLedgerByIds(ids,false)); + } + /** + * 删除应用账面余额流水 + */ + @PreAuthorize("@ss.hasPermi('system:appsBalanceLedger:user-remove')") + @Log(title = "应用账面余额流水", businessType = BusinessType.DELETE) + @DeleteMapping("/user/{ids}") + public AjaxResult userRemove(@PathVariable Long[] ids) + { + return toAjax(appsBalanceLedgerService.deleteAppsBalanceLedgerByIds(ids,true)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/WalletAddressLedgerController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/WalletAddressLedgerController.java new file mode 100644 index 0000000..b6bde31 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/WalletAddressLedgerController.java @@ -0,0 +1,170 @@ +package com.ruoyi.system.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.select.Ids; +import com.ruoyi.common.select.SelectItem; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.WalletAddressLedger; +import com.ruoyi.system.domain.WalletAddressLedgerPlus; +import com.ruoyi.system.service.IWalletAddressLedgerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 钱包地址资金流水Controller + * + * @author luqj + * @date 2026-10-13 + */ +@RestController +@RequestMapping("/system/walletAddressLedger") +public class WalletAddressLedgerController extends BaseController +{ + @Autowired + private IWalletAddressLedgerService walletAddressLedgerService; + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:getByIds')") + @PostMapping("/getByIds") + public AjaxResult getByIds(@RequestBody Ids ids) + { + List list = walletAddressLedgerService.getByIds(ids.getLongIds(),false,WalletAddressLedgerPlus::getWalletAddress,WalletAddressLedgerPlus::getId); + return AjaxResult.success(list); + } + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:user-getByIds')") + @PostMapping("/user/getByIds") + public AjaxResult userGetByIds(@RequestBody Ids ids) + { + List list = walletAddressLedgerService.getByIds(ids.getLongIds(),true,WalletAddressLedgerPlus::getUserId,WalletAddressLedgerPlus::getWalletAddress,WalletAddressLedgerPlus::getId); + return AjaxResult.success(list); + } + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:select')") + @GetMapping("/select") + public AjaxResult select(String keyword) + { + List list = walletAddressLedgerService.select(keyword,false); + return AjaxResult.success(list); + } + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:user-select')") + @GetMapping("/user/select") + public AjaxResult userSelect(String keyword) + { + List list = walletAddressLedgerService.select(keyword,true); + return AjaxResult.success(list); + } + /** + * 查询钱包地址资金流水列表 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:list')") + @GetMapping("/list") + public TableDataInfo list(WalletAddressLedger walletAddressLedger) + { + startPage(); + List list = walletAddressLedgerService.selectWalletAddressLedgerList(walletAddressLedger,false); + return getDataTable(list); + } +/** + * 查询钱包地址资金流水列表 + */ +@PreAuthorize("@ss.hasPermi('system:walletAddressLedger:user-list')") +@GetMapping("/user/list") + public TableDataInfo userList(WalletAddressLedger walletAddressLedger) + { + startPage(); + List list = walletAddressLedgerService.selectWalletAddressLedgerList(walletAddressLedger,true); + return getDataTable(list); + } + /** + * 导出钱包地址资金流水列表 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:export')") + @Log(title = "钱包地址资金流水", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(WalletAddressLedger walletAddressLedger) + { + List list = walletAddressLedgerService.selectWalletAddressLedgerList(walletAddressLedger,false); + ExcelUtil util = new ExcelUtil(WalletAddressLedger.class); + return util.exportExcel(list, "walletAddressLedger"); + } + + /** + * 获取钱包地址资金流水详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(walletAddressLedgerService.selectWalletAddressLedgerById(id,false)); + } + /** + * 获取钱包地址资金流水详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:user-query')") + @GetMapping(value = "/user/{id}") + public AjaxResult userGetInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(walletAddressLedgerService.selectWalletAddressLedgerById(id,true)); + } + /** + * 新增钱包地址资金流水 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:add')") + @Log(title = "钱包地址资金流水", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WalletAddressLedger walletAddressLedger) + { + return toAjax(walletAddressLedgerService.insertWalletAddressLedger(walletAddressLedger,false)); + } + /** + * 新增钱包地址资金流水 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:user-add')") + @Log(title = "钱包地址资金流水", businessType = BusinessType.INSERT) + @PostMapping("/user") + public AjaxResult userAdd(@RequestBody WalletAddressLedger walletAddressLedger) + { + return toAjax(walletAddressLedgerService.insertWalletAddressLedger(walletAddressLedger,true)); + } + /** + * 修改钱包地址资金流水 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:edit')") + @Log(title = "钱包地址资金流水", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WalletAddressLedger walletAddressLedger) + { + return toAjax(walletAddressLedgerService.updateWalletAddressLedger(walletAddressLedger,false)); + } + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:user-edit')") + @Log(title = "钱包地址资金流水", businessType = BusinessType.UPDATE) + @PutMapping("/user") + public AjaxResult userEdit(@RequestBody WalletAddressLedger walletAddressLedger) + { + return toAjax(walletAddressLedgerService.updateWalletAddressLedger(walletAddressLedger,true)); + } + /** + * 删除钱包地址资金流水 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:remove')") + @Log(title = "钱包地址资金流水", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(walletAddressLedgerService.deleteWalletAddressLedgerByIds(ids,false)); + } + /** + * 删除钱包地址资金流水 + */ + @PreAuthorize("@ss.hasPermi('system:walletAddressLedger:user-remove')") + @Log(title = "钱包地址资金流水", businessType = BusinessType.DELETE) + @DeleteMapping("/user/{ids}") + public AjaxResult userRemove(@PathVariable Long[] ids) + { + return toAjax(walletAddressLedgerService.deleteWalletAddressLedgerByIds(ids,true)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/AppsBalanceLedger.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/AppsBalanceLedger.java new file mode 100644 index 0000000..723481e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/AppsBalanceLedger.java @@ -0,0 +1,364 @@ +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; +/** + * 应用账面余额流水对象 apps_balance_ledger + * + * @author luqj + * @date 2026-10-13 + */ +public class AppsBalanceLedger extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水ID */ + private Long id; + + /** 平台流水号 */ + @Excel(name = "平台流水号") + private String tradeNo; + + /** 幂等键 */ + @Excel(name = "幂等键") + private String idempotencyKey; + + /** 应用ID */ + @Excel(name = "应用ID") + private Long appId; + + /** 应用所属用户 */ + @Excel(name = "应用所属用户") + private Long userId; + + /** 币种:USDT、TRX */ + @Excel(name = "币种:USDT、TRX") + private String currency; + + /** 余额类型:1可用,2冻结 */ + @Excel(name = "余额类型:1可用,2冻结") + private Integer balanceType; + + /** 业务类型 */ + @Excel(name = "业务类型") + private String businessType; + + /** 方向:1收入,2支出 */ + @Excel(name = "方向:1收入,2支出") + private Integer direction; + + /** 变动金额,始终为正数 */ + @Excel(name = "变动金额,始终为正数") + private BigDecimal amount; + + /** 变动前余额 */ + @Excel(name = "变动前余额") + private BigDecimal balanceBefore; + + /** 变动后余额 */ + @Excel(name = "变动后余额") + private BigDecimal balanceAfter; + + /** 变动前可用余额 */ + @Excel(name = "变动前可用余额") + private BigDecimal availableBefore; + + /** 变动后可用余额 */ + @Excel(name = "变动后可用余额") + private BigDecimal availableAfter; + + /** 变动前冻结余额 */ + @Excel(name = "变动前冻结余额") + private BigDecimal frozenBefore; + + /** 变动后冻结余额 */ + @Excel(name = "变动后冻结余额") + private BigDecimal frozenAfter; + + /** orders.id */ + @Excel(name = "orders.id") + private Long orderId; + + /** 商户订单号 */ + @Excel(name = "商户订单号") + private String merchantOrderId; + + /** 归集任务ID */ + @Excel(name = "归集任务ID") + private Long aggregationTaskId; + + /** 关联钱包流水ID */ + @Excel(name = "关联钱包流水ID") + private Long walletLedgerId; + + /** 链上交易哈希 */ + @Excel(name = "链上交易哈希") + private String transactionId; + + /** 操作人ID */ + @Excel(name = "操作人ID") + private Long operatorId; + + /** 请求追踪ID */ + @Excel(name = "请求追踪ID") + private String requestId; + + /** $column.columnComment */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "请求追踪ID", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTradeNo(String tradeNo) + { + this.tradeNo = tradeNo; + } + + public String getTradeNo() + { + return tradeNo; + } + public void setIdempotencyKey(String idempotencyKey) + { + this.idempotencyKey = idempotencyKey; + } + + public String getIdempotencyKey() + { + return idempotencyKey; + } + public void setAppId(Long appId) + { + this.appId = appId; + } + + public Long getAppId() + { + return appId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setCurrency(String currency) + { + this.currency = currency; + } + + public String getCurrency() + { + return currency; + } + public void setBalanceType(Integer balanceType) + { + this.balanceType = balanceType; + } + + public Integer getBalanceType() + { + return balanceType; + } + public void setBusinessType(String businessType) + { + this.businessType = businessType; + } + + public String getBusinessType() + { + return businessType; + } + public void setDirection(Integer direction) + { + this.direction = direction; + } + + public Integer getDirection() + { + return direction; + } + public void setAmount(BigDecimal amount) + { + this.amount = amount; + } + + public BigDecimal getAmount() + { + return amount; + } + public void setBalanceBefore(BigDecimal balanceBefore) + { + this.balanceBefore = balanceBefore; + } + + public BigDecimal getBalanceBefore() + { + return balanceBefore; + } + public void setBalanceAfter(BigDecimal balanceAfter) + { + this.balanceAfter = balanceAfter; + } + + public BigDecimal getBalanceAfter() + { + return balanceAfter; + } + public void setAvailableBefore(BigDecimal availableBefore) + { + this.availableBefore = availableBefore; + } + + public BigDecimal getAvailableBefore() + { + return availableBefore; + } + public void setAvailableAfter(BigDecimal availableAfter) + { + this.availableAfter = availableAfter; + } + + public BigDecimal getAvailableAfter() + { + return availableAfter; + } + public void setFrozenBefore(BigDecimal frozenBefore) + { + this.frozenBefore = frozenBefore; + } + + public BigDecimal getFrozenBefore() + { + return frozenBefore; + } + public void setFrozenAfter(BigDecimal frozenAfter) + { + this.frozenAfter = frozenAfter; + } + + public BigDecimal getFrozenAfter() + { + return frozenAfter; + } + public void setOrderId(Long orderId) + { + this.orderId = orderId; + } + + public Long getOrderId() + { + return orderId; + } + public void setMerchantOrderId(String merchantOrderId) + { + this.merchantOrderId = merchantOrderId; + } + + public String getMerchantOrderId() + { + return merchantOrderId; + } + public void setAggregationTaskId(Long aggregationTaskId) + { + this.aggregationTaskId = aggregationTaskId; + } + + public Long getAggregationTaskId() + { + return aggregationTaskId; + } + public void setWalletLedgerId(Long walletLedgerId) + { + this.walletLedgerId = walletLedgerId; + } + + public Long getWalletLedgerId() + { + return walletLedgerId; + } + public void setTransactionId(String transactionId) + { + this.transactionId = transactionId; + } + + public String getTransactionId() + { + return transactionId; + } + public void setOperatorId(Long operatorId) + { + this.operatorId = operatorId; + } + + public Long getOperatorId() + { + return operatorId; + } + public void setRequestId(String requestId) + { + this.requestId = requestId; + } + + public String getRequestId() + { + return requestId; + } + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tradeNo", getTradeNo()) + .append("idempotencyKey", getIdempotencyKey()) + .append("appId", getAppId()) + .append("userId", getUserId()) + .append("currency", getCurrency()) + .append("balanceType", getBalanceType()) + .append("businessType", getBusinessType()) + .append("direction", getDirection()) + .append("amount", getAmount()) + .append("balanceBefore", getBalanceBefore()) + .append("balanceAfter", getBalanceAfter()) + .append("availableBefore", getAvailableBefore()) + .append("availableAfter", getAvailableAfter()) + .append("frozenBefore", getFrozenBefore()) + .append("frozenAfter", getFrozenAfter()) + .append("orderId", getOrderId()) + .append("merchantOrderId", getMerchantOrderId()) + .append("aggregationTaskId", getAggregationTaskId()) + .append("walletLedgerId", getWalletLedgerId()) + .append("transactionId", getTransactionId()) + .append("operatorId", getOperatorId()) + .append("requestId", getRequestId()) + .append("remark", getRemark()) + .append("createdAt", getCreatedAt()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/AppsBalanceLedgerPlus.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/AppsBalanceLedgerPlus.java new file mode 100644 index 0000000..ff937b9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/AppsBalanceLedgerPlus.java @@ -0,0 +1,355 @@ +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; +/** + * 应用账面余额流水对象 apps_balance_ledger + * + * @author luqj + * @date 2026-10-13 + */ +@TableName(value = "apps_balance_ledger") +public class AppsBalanceLedgerPlus implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 流水ID */ + private Long id; + /** 平台流水号 */ + @Excel(name = "平台流水号") + private String tradeNo; + /** 幂等键 */ + @Excel(name = "幂等键") + private String idempotencyKey; + /** 应用ID */ + @Excel(name = "应用ID") + private Long appId; + /** 应用所属用户 */ + @Excel(name = "应用所属用户") + private Long userId; + /** 币种:USDT、TRX */ + @Excel(name = "币种:USDT、TRX") + private String currency; + /** 余额类型:1可用,2冻结 */ + @Excel(name = "余额类型:1可用,2冻结") + private Integer balanceType; + /** 业务类型 */ + @Excel(name = "业务类型") + private String businessType; + /** 方向:1收入,2支出 */ + @Excel(name = "方向:1收入,2支出") + private Integer direction; + /** 变动金额,始终为正数 */ + @Excel(name = "变动金额,始终为正数") + private BigDecimal amount; + /** 变动前余额 */ + @Excel(name = "变动前余额") + private BigDecimal balanceBefore; + /** 变动后余额 */ + @Excel(name = "变动后余额") + private BigDecimal balanceAfter; + /** 变动前可用余额 */ + @Excel(name = "变动前可用余额") + private BigDecimal availableBefore; + /** 变动后可用余额 */ + @Excel(name = "变动后可用余额") + private BigDecimal availableAfter; + /** 变动前冻结余额 */ + @Excel(name = "变动前冻结余额") + private BigDecimal frozenBefore; + /** 变动后冻结余额 */ + @Excel(name = "变动后冻结余额") + private BigDecimal frozenAfter; + /** orders.id */ + @Excel(name = "orders.id") + private Long orderId; + /** 商户订单号 */ + @Excel(name = "商户订单号") + private String merchantOrderId; + /** 归集任务ID */ + @Excel(name = "归集任务ID") + private Long aggregationTaskId; + /** 关联钱包流水ID */ + @Excel(name = "关联钱包流水ID") + private Long walletLedgerId; + /** 链上交易哈希 */ + @Excel(name = "链上交易哈希") + private String transactionId; + /** 操作人ID */ + @Excel(name = "操作人ID") + private Long operatorId; + /** 请求追踪ID */ + @Excel(name = "请求追踪ID") + private String requestId; + /** 备注 */ + @Excel(name = "备注") + private String remark; + /** $column.columnComment */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "备注", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTradeNo(String tradeNo) + { + this.tradeNo = tradeNo; + } + + public String getTradeNo() + { + return tradeNo; + } + public void setIdempotencyKey(String idempotencyKey) + { + this.idempotencyKey = idempotencyKey; + } + + public String getIdempotencyKey() + { + return idempotencyKey; + } + public void setAppId(Long appId) + { + this.appId = appId; + } + + public Long getAppId() + { + return appId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setCurrency(String currency) + { + this.currency = currency; + } + + public String getCurrency() + { + return currency; + } + public void setBalanceType(Integer balanceType) + { + this.balanceType = balanceType; + } + + public Integer getBalanceType() + { + return balanceType; + } + public void setBusinessType(String businessType) + { + this.businessType = businessType; + } + + public String getBusinessType() + { + return businessType; + } + public void setDirection(Integer direction) + { + this.direction = direction; + } + + public Integer getDirection() + { + return direction; + } + public void setAmount(BigDecimal amount) + { + this.amount = amount; + } + + public BigDecimal getAmount() + { + return amount; + } + public void setBalanceBefore(BigDecimal balanceBefore) + { + this.balanceBefore = balanceBefore; + } + + public BigDecimal getBalanceBefore() + { + return balanceBefore; + } + public void setBalanceAfter(BigDecimal balanceAfter) + { + this.balanceAfter = balanceAfter; + } + + public BigDecimal getBalanceAfter() + { + return balanceAfter; + } + public void setAvailableBefore(BigDecimal availableBefore) + { + this.availableBefore = availableBefore; + } + + public BigDecimal getAvailableBefore() + { + return availableBefore; + } + public void setAvailableAfter(BigDecimal availableAfter) + { + this.availableAfter = availableAfter; + } + + public BigDecimal getAvailableAfter() + { + return availableAfter; + } + public void setFrozenBefore(BigDecimal frozenBefore) + { + this.frozenBefore = frozenBefore; + } + + public BigDecimal getFrozenBefore() + { + return frozenBefore; + } + public void setFrozenAfter(BigDecimal frozenAfter) + { + this.frozenAfter = frozenAfter; + } + + public BigDecimal getFrozenAfter() + { + return frozenAfter; + } + public void setOrderId(Long orderId) + { + this.orderId = orderId; + } + + public Long getOrderId() + { + return orderId; + } + public void setMerchantOrderId(String merchantOrderId) + { + this.merchantOrderId = merchantOrderId; + } + + public String getMerchantOrderId() + { + return merchantOrderId; + } + public void setAggregationTaskId(Long aggregationTaskId) + { + this.aggregationTaskId = aggregationTaskId; + } + + public Long getAggregationTaskId() + { + return aggregationTaskId; + } + public void setWalletLedgerId(Long walletLedgerId) + { + this.walletLedgerId = walletLedgerId; + } + + public Long getWalletLedgerId() + { + return walletLedgerId; + } + public void setTransactionId(String transactionId) + { + this.transactionId = transactionId; + } + + public String getTransactionId() + { + return transactionId; + } + public void setOperatorId(Long operatorId) + { + this.operatorId = operatorId; + } + + public Long getOperatorId() + { + return operatorId; + } + public void setRequestId(String requestId) + { + this.requestId = requestId; + } + + public String getRequestId() + { + return requestId; + } + public void setRemark(String remark) + { + this.remark = remark; + } + + public String getRemark() + { + return remark; + } + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tradeNo", getTradeNo()) + .append("idempotencyKey", getIdempotencyKey()) + .append("appId", getAppId()) + .append("userId", getUserId()) + .append("currency", getCurrency()) + .append("balanceType", getBalanceType()) + .append("businessType", getBusinessType()) + .append("direction", getDirection()) + .append("amount", getAmount()) + .append("balanceBefore", getBalanceBefore()) + .append("balanceAfter", getBalanceAfter()) + .append("availableBefore", getAvailableBefore()) + .append("availableAfter", getAvailableAfter()) + .append("frozenBefore", getFrozenBefore()) + .append("frozenAfter", getFrozenAfter()) + .append("orderId", getOrderId()) + .append("merchantOrderId", getMerchantOrderId()) + .append("aggregationTaskId", getAggregationTaskId()) + .append("walletLedgerId", getWalletLedgerId()) + .append("transactionId", getTransactionId()) + .append("operatorId", getOperatorId()) + .append("requestId", getRequestId()) + .append("remark", getRemark()) + .append("createdAt", getCreatedAt()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/WalletAddressLedger.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/WalletAddressLedger.java new file mode 100644 index 0000000..5c13229 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/WalletAddressLedger.java @@ -0,0 +1,534 @@ +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; +/** + * 钱包地址资金流水对象 wallet_address_ledger + * + * @author luqj + * @date 2026-10-13 + */ +public class WalletAddressLedger extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流水ID */ + private Long id; + + /** 平台流水号,同一业务事件下不同币种可共用 */ + @Excel(name = "平台流水号,同一业务事件下不同币种可共用") + private String tradeNo; + + /** 幂等键 */ + @Excel(name = "幂等键") + private String idempotencyKey; + + /** 所属应用ID */ + @Excel(name = "所属应用ID") + private Long appId; + + /** 所属用户ID */ + @Excel(name = "所属用户ID") + private Long userId; + + /** wallet_address主键 */ + @Excel(name = "wallet_address主键") + private Long walletAddressId; + + /** 发生余额变化的钱包地址 */ + @Excel(name = "发生余额变化的钱包地址") + private String walletAddress; + + /** 交易对手地址 */ + @Excel(name = "交易对手地址") + private String counterpartyAddress; + + /** 币种:USDT、TRX */ + @Excel(name = "币种:USDT、TRX") + private String currency; + + /** 业务类型 */ + @Excel(name = "业务类型") + private String businessType; + + /** 方向:1收入,2支出 */ + @Excel(name = "方向:1收入,2支出") + private Integer direction; + + /** 变动金额,始终为正数 */ + @Excel(name = "变动金额,始终为正数") + private BigDecimal amount; + + /** 操作前链上余额 */ + @Excel(name = "操作前链上余额") + private BigDecimal balanceBefore; + + /** 操作后链上余额 */ + @Excel(name = "操作后链上余额") + private BigDecimal balanceAfter; + + /** 手续费币种,通常为TRX */ + @Excel(name = "手续费币种,通常为TRX") + private String feeCurrency; + + /** 实际手续费 */ + @Excel(name = "实际手续费") + private BigDecimal feeAmount; + + /** 实际消耗能量 */ + @Excel(name = "实际消耗能量") + private Long energyUsed; + + /** 实际消耗带宽 */ + @Excel(name = "实际消耗带宽") + private Long bandwidthUsed; + + /** 资源不足燃烧的TRX */ + @Excel(name = "资源不足燃烧的TRX") + private BigDecimal burnedTrx; + + /** orders.id */ + @Excel(name = "orders.id") + private Long orderId; + + /** 商户订单号 */ + @Excel(name = "商户订单号") + private String merchantOrderId; + + /** 平台订单交易号 */ + @Excel(name = "平台订单交易号") + private String tradeId; + + /** 归集任务ID */ + @Excel(name = "归集任务ID") + private Long aggregationTaskId; + + /** 归集明细ID */ + @Excel(name = "归集明细ID") + private Long aggregationItemId; + + /** 链上交易哈希 */ + @Excel(name = "链上交易哈希") + private String transactionId; + + /** 区块高度 */ + @Excel(name = "区块高度") + private Long blockNumber; + + /** 链上确认时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "链上确认时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date blockTime; + + /** 确认数 */ + @Excel(name = "确认数") + private Long confirmationCount; + + /** 0处理中,1成功,2失败,3取消 */ + @Excel(name = "0处理中,1成功,2失败,3取消") + private Integer status; + + /** 来源:CHAIN、ORDER、AGGREGATION、MANUAL、SYSTEM */ + @Excel(name = "来源:CHAIN、ORDER、AGGREGATION、MANUAL、SYSTEM") + private String sourceType; + + /** 请求追踪ID */ + @Excel(name = "请求追踪ID") + private String requestId; + + /** 后台操作人ID */ + @Excel(name = "后台操作人ID") + private Long operatorId; + + /** 失败代码 */ + @Excel(name = "失败代码") + private String errorCode; + + /** 脱敏后的失败信息 */ + @Excel(name = "脱敏后的失败信息") + private String errorMessage; + + /** $column.columnComment */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "脱敏后的失败信息", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + /** $column.columnComment */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "脱敏后的失败信息", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedAt; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTradeNo(String tradeNo) + { + this.tradeNo = tradeNo; + } + + public String getTradeNo() + { + return tradeNo; + } + public void setIdempotencyKey(String idempotencyKey) + { + this.idempotencyKey = idempotencyKey; + } + + public String getIdempotencyKey() + { + return idempotencyKey; + } + public void setAppId(Long appId) + { + this.appId = appId; + } + + public Long getAppId() + { + return appId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setWalletAddressId(Long walletAddressId) + { + this.walletAddressId = walletAddressId; + } + + public Long getWalletAddressId() + { + return walletAddressId; + } + public void setWalletAddress(String walletAddress) + { + this.walletAddress = walletAddress; + } + + public String getWalletAddress() + { + return walletAddress; + } + public void setCounterpartyAddress(String counterpartyAddress) + { + this.counterpartyAddress = counterpartyAddress; + } + + public String getCounterpartyAddress() + { + return counterpartyAddress; + } + public void setCurrency(String currency) + { + this.currency = currency; + } + + public String getCurrency() + { + return currency; + } + public void setBusinessType(String businessType) + { + this.businessType = businessType; + } + + public String getBusinessType() + { + return businessType; + } + public void setDirection(Integer direction) + { + this.direction = direction; + } + + public Integer getDirection() + { + return direction; + } + public void setAmount(BigDecimal amount) + { + this.amount = amount; + } + + public BigDecimal getAmount() + { + return amount; + } + public void setBalanceBefore(BigDecimal balanceBefore) + { + this.balanceBefore = balanceBefore; + } + + public BigDecimal getBalanceBefore() + { + return balanceBefore; + } + public void setBalanceAfter(BigDecimal balanceAfter) + { + this.balanceAfter = balanceAfter; + } + + public BigDecimal getBalanceAfter() + { + return balanceAfter; + } + public void setFeeCurrency(String feeCurrency) + { + this.feeCurrency = feeCurrency; + } + + public String getFeeCurrency() + { + return feeCurrency; + } + public void setFeeAmount(BigDecimal feeAmount) + { + this.feeAmount = feeAmount; + } + + public BigDecimal getFeeAmount() + { + return feeAmount; + } + public void setEnergyUsed(Long energyUsed) + { + this.energyUsed = energyUsed; + } + + public Long getEnergyUsed() + { + return energyUsed; + } + public void setBandwidthUsed(Long bandwidthUsed) + { + this.bandwidthUsed = bandwidthUsed; + } + + public Long getBandwidthUsed() + { + return bandwidthUsed; + } + public void setBurnedTrx(BigDecimal burnedTrx) + { + this.burnedTrx = burnedTrx; + } + + public BigDecimal getBurnedTrx() + { + return burnedTrx; + } + public void setOrderId(Long orderId) + { + this.orderId = orderId; + } + + public Long getOrderId() + { + return orderId; + } + public void setMerchantOrderId(String merchantOrderId) + { + this.merchantOrderId = merchantOrderId; + } + + public String getMerchantOrderId() + { + return merchantOrderId; + } + public void setTradeId(String tradeId) + { + this.tradeId = tradeId; + } + + public String getTradeId() + { + return tradeId; + } + public void setAggregationTaskId(Long aggregationTaskId) + { + this.aggregationTaskId = aggregationTaskId; + } + + public Long getAggregationTaskId() + { + return aggregationTaskId; + } + public void setAggregationItemId(Long aggregationItemId) + { + this.aggregationItemId = aggregationItemId; + } + + public Long getAggregationItemId() + { + return aggregationItemId; + } + public void setTransactionId(String transactionId) + { + this.transactionId = transactionId; + } + + public String getTransactionId() + { + return transactionId; + } + public void setBlockNumber(Long blockNumber) + { + this.blockNumber = blockNumber; + } + + public Long getBlockNumber() + { + return blockNumber; + } + public void setBlockTime(Date blockTime) + { + this.blockTime = blockTime; + } + + public Date getBlockTime() + { + return blockTime; + } + public void setConfirmationCount(Long confirmationCount) + { + this.confirmationCount = confirmationCount; + } + + public Long getConfirmationCount() + { + return confirmationCount; + } + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + public void setSourceType(String sourceType) + { + this.sourceType = sourceType; + } + + public String getSourceType() + { + return sourceType; + } + public void setRequestId(String requestId) + { + this.requestId = requestId; + } + + public String getRequestId() + { + return requestId; + } + public void setOperatorId(Long operatorId) + { + this.operatorId = operatorId; + } + + public Long getOperatorId() + { + return operatorId; + } + public void setErrorCode(String errorCode) + { + this.errorCode = errorCode; + } + + public String getErrorCode() + { + return errorCode; + } + public void setErrorMessage(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getErrorMessage() + { + return errorMessage; + } + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tradeNo", getTradeNo()) + .append("idempotencyKey", getIdempotencyKey()) + .append("appId", getAppId()) + .append("userId", getUserId()) + .append("walletAddressId", getWalletAddressId()) + .append("walletAddress", getWalletAddress()) + .append("counterpartyAddress", getCounterpartyAddress()) + .append("currency", getCurrency()) + .append("businessType", getBusinessType()) + .append("direction", getDirection()) + .append("amount", getAmount()) + .append("balanceBefore", getBalanceBefore()) + .append("balanceAfter", getBalanceAfter()) + .append("feeCurrency", getFeeCurrency()) + .append("feeAmount", getFeeAmount()) + .append("energyUsed", getEnergyUsed()) + .append("bandwidthUsed", getBandwidthUsed()) + .append("burnedTrx", getBurnedTrx()) + .append("orderId", getOrderId()) + .append("merchantOrderId", getMerchantOrderId()) + .append("tradeId", getTradeId()) + .append("aggregationTaskId", getAggregationTaskId()) + .append("aggregationItemId", getAggregationItemId()) + .append("transactionId", getTransactionId()) + .append("blockNumber", getBlockNumber()) + .append("blockTime", getBlockTime()) + .append("confirmationCount", getConfirmationCount()) + .append("status", getStatus()) + .append("sourceType", getSourceType()) + .append("requestId", getRequestId()) + .append("operatorId", getOperatorId()) + .append("errorCode", getErrorCode()) + .append("errorMessage", getErrorMessage()) + .append("remark", getRemark()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/WalletAddressLedgerPlus.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/WalletAddressLedgerPlus.java new file mode 100644 index 0000000..088aad8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/WalletAddressLedgerPlus.java @@ -0,0 +1,513 @@ +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; +/** + * 钱包地址资金流水对象 wallet_address_ledger + * + * @author luqj + * @date 2026-10-13 + */ +@TableName(value = "wallet_address_ledger") +public class WalletAddressLedgerPlus implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 流水ID */ + private Long id; + /** 平台流水号,同一业务事件下不同币种可共用 */ + @Excel(name = "平台流水号,同一业务事件下不同币种可共用") + private String tradeNo; + /** 幂等键 */ + @Excel(name = "幂等键") + private String idempotencyKey; + /** 所属应用ID */ + @Excel(name = "所属应用ID") + private Long appId; + /** 所属用户ID */ + @Excel(name = "所属用户ID") + private Long userId; + /** wallet_address主键 */ + @Excel(name = "wallet_address主键") + private Long walletAddressId; + /** 发生余额变化的钱包地址 */ + @Excel(name = "发生余额变化的钱包地址") + private String walletAddress; + /** 交易对手地址 */ + @Excel(name = "交易对手地址") + private String counterpartyAddress; + /** 币种:USDT、TRX */ + @Excel(name = "币种:USDT、TRX") + private String currency; + /** 业务类型 */ + @Excel(name = "业务类型") + private String businessType; + /** 方向:1收入,2支出 */ + @Excel(name = "方向:1收入,2支出") + private Integer direction; + /** 变动金额,始终为正数 */ + @Excel(name = "变动金额,始终为正数") + private BigDecimal amount; + /** 操作前链上余额 */ + @Excel(name = "操作前链上余额") + private BigDecimal balanceBefore; + /** 操作后链上余额 */ + @Excel(name = "操作后链上余额") + private BigDecimal balanceAfter; + /** 手续费币种,通常为TRX */ + @Excel(name = "手续费币种,通常为TRX") + private String feeCurrency; + /** 实际手续费 */ + @Excel(name = "实际手续费") + private BigDecimal feeAmount; + /** 实际消耗能量 */ + @Excel(name = "实际消耗能量") + private Long energyUsed; + /** 实际消耗带宽 */ + @Excel(name = "实际消耗带宽") + private Long bandwidthUsed; + /** 资源不足燃烧的TRX */ + @Excel(name = "资源不足燃烧的TRX") + private BigDecimal burnedTrx; + /** orders.id */ + @Excel(name = "orders.id") + private Long orderId; + /** 商户订单号 */ + @Excel(name = "商户订单号") + private String merchantOrderId; + /** 平台订单交易号 */ + @Excel(name = "平台订单交易号") + private String tradeId; + /** 归集任务ID */ + @Excel(name = "归集任务ID") + private Long aggregationTaskId; + /** 归集明细ID */ + @Excel(name = "归集明细ID") + private Long aggregationItemId; + /** 链上交易哈希 */ + @Excel(name = "链上交易哈希") + private String transactionId; + /** 区块高度 */ + @Excel(name = "区块高度") + private Long blockNumber; + /** 链上确认时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "链上确认时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date blockTime; + /** 确认数 */ + @Excel(name = "确认数") + private Long confirmationCount; + /** 0处理中,1成功,2失败,3取消 */ + @Excel(name = "0处理中,1成功,2失败,3取消") + private Integer status; + /** 来源:CHAIN、ORDER、AGGREGATION、MANUAL、SYSTEM */ + @Excel(name = "来源:CHAIN、ORDER、AGGREGATION、MANUAL、SYSTEM") + private String sourceType; + /** 请求追踪ID */ + @Excel(name = "请求追踪ID") + private String requestId; + /** 后台操作人ID */ + @Excel(name = "后台操作人ID") + private Long operatorId; + /** 失败代码 */ + @Excel(name = "失败代码") + private String errorCode; + /** 脱敏后的失败信息 */ + @Excel(name = "脱敏后的失败信息") + private String errorMessage; + /** 备注 */ + @Excel(name = "备注") + private String remark; + /** $column.columnComment */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "备注", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + /** $column.columnComment */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "备注", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedAt; + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTradeNo(String tradeNo) + { + this.tradeNo = tradeNo; + } + + public String getTradeNo() + { + return tradeNo; + } + public void setIdempotencyKey(String idempotencyKey) + { + this.idempotencyKey = idempotencyKey; + } + + public String getIdempotencyKey() + { + return idempotencyKey; + } + public void setAppId(Long appId) + { + this.appId = appId; + } + + public Long getAppId() + { + return appId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setWalletAddressId(Long walletAddressId) + { + this.walletAddressId = walletAddressId; + } + + public Long getWalletAddressId() + { + return walletAddressId; + } + public void setWalletAddress(String walletAddress) + { + this.walletAddress = walletAddress; + } + + public String getWalletAddress() + { + return walletAddress; + } + public void setCounterpartyAddress(String counterpartyAddress) + { + this.counterpartyAddress = counterpartyAddress; + } + + public String getCounterpartyAddress() + { + return counterpartyAddress; + } + public void setCurrency(String currency) + { + this.currency = currency; + } + + public String getCurrency() + { + return currency; + } + public void setBusinessType(String businessType) + { + this.businessType = businessType; + } + + public String getBusinessType() + { + return businessType; + } + public void setDirection(Integer direction) + { + this.direction = direction; + } + + public Integer getDirection() + { + return direction; + } + public void setAmount(BigDecimal amount) + { + this.amount = amount; + } + + public BigDecimal getAmount() + { + return amount; + } + public void setBalanceBefore(BigDecimal balanceBefore) + { + this.balanceBefore = balanceBefore; + } + + public BigDecimal getBalanceBefore() + { + return balanceBefore; + } + public void setBalanceAfter(BigDecimal balanceAfter) + { + this.balanceAfter = balanceAfter; + } + + public BigDecimal getBalanceAfter() + { + return balanceAfter; + } + public void setFeeCurrency(String feeCurrency) + { + this.feeCurrency = feeCurrency; + } + + public String getFeeCurrency() + { + return feeCurrency; + } + public void setFeeAmount(BigDecimal feeAmount) + { + this.feeAmount = feeAmount; + } + + public BigDecimal getFeeAmount() + { + return feeAmount; + } + public void setEnergyUsed(Long energyUsed) + { + this.energyUsed = energyUsed; + } + + public Long getEnergyUsed() + { + return energyUsed; + } + public void setBandwidthUsed(Long bandwidthUsed) + { + this.bandwidthUsed = bandwidthUsed; + } + + public Long getBandwidthUsed() + { + return bandwidthUsed; + } + public void setBurnedTrx(BigDecimal burnedTrx) + { + this.burnedTrx = burnedTrx; + } + + public BigDecimal getBurnedTrx() + { + return burnedTrx; + } + public void setOrderId(Long orderId) + { + this.orderId = orderId; + } + + public Long getOrderId() + { + return orderId; + } + public void setMerchantOrderId(String merchantOrderId) + { + this.merchantOrderId = merchantOrderId; + } + + public String getMerchantOrderId() + { + return merchantOrderId; + } + public void setTradeId(String tradeId) + { + this.tradeId = tradeId; + } + + public String getTradeId() + { + return tradeId; + } + public void setAggregationTaskId(Long aggregationTaskId) + { + this.aggregationTaskId = aggregationTaskId; + } + + public Long getAggregationTaskId() + { + return aggregationTaskId; + } + public void setAggregationItemId(Long aggregationItemId) + { + this.aggregationItemId = aggregationItemId; + } + + public Long getAggregationItemId() + { + return aggregationItemId; + } + public void setTransactionId(String transactionId) + { + this.transactionId = transactionId; + } + + public String getTransactionId() + { + return transactionId; + } + public void setBlockNumber(Long blockNumber) + { + this.blockNumber = blockNumber; + } + + public Long getBlockNumber() + { + return blockNumber; + } + public void setBlockTime(Date blockTime) + { + this.blockTime = blockTime; + } + + public Date getBlockTime() + { + return blockTime; + } + public void setConfirmationCount(Long confirmationCount) + { + this.confirmationCount = confirmationCount; + } + + public Long getConfirmationCount() + { + return confirmationCount; + } + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + public void setSourceType(String sourceType) + { + this.sourceType = sourceType; + } + + public String getSourceType() + { + return sourceType; + } + public void setRequestId(String requestId) + { + this.requestId = requestId; + } + + public String getRequestId() + { + return requestId; + } + public void setOperatorId(Long operatorId) + { + this.operatorId = operatorId; + } + + public Long getOperatorId() + { + return operatorId; + } + public void setErrorCode(String errorCode) + { + this.errorCode = errorCode; + } + + public String getErrorCode() + { + return errorCode; + } + public void setErrorMessage(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getErrorMessage() + { + return errorMessage; + } + public void setRemark(String remark) + { + this.remark = remark; + } + + public String getRemark() + { + return remark; + } + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tradeNo", getTradeNo()) + .append("idempotencyKey", getIdempotencyKey()) + .append("appId", getAppId()) + .append("userId", getUserId()) + .append("walletAddressId", getWalletAddressId()) + .append("walletAddress", getWalletAddress()) + .append("counterpartyAddress", getCounterpartyAddress()) + .append("currency", getCurrency()) + .append("businessType", getBusinessType()) + .append("direction", getDirection()) + .append("amount", getAmount()) + .append("balanceBefore", getBalanceBefore()) + .append("balanceAfter", getBalanceAfter()) + .append("feeCurrency", getFeeCurrency()) + .append("feeAmount", getFeeAmount()) + .append("energyUsed", getEnergyUsed()) + .append("bandwidthUsed", getBandwidthUsed()) + .append("burnedTrx", getBurnedTrx()) + .append("orderId", getOrderId()) + .append("merchantOrderId", getMerchantOrderId()) + .append("tradeId", getTradeId()) + .append("aggregationTaskId", getAggregationTaskId()) + .append("aggregationItemId", getAggregationItemId()) + .append("transactionId", getTransactionId()) + .append("blockNumber", getBlockNumber()) + .append("blockTime", getBlockTime()) + .append("confirmationCount", getConfirmationCount()) + .append("status", getStatus()) + .append("sourceType", getSourceType()) + .append("requestId", getRequestId()) + .append("operatorId", getOperatorId()) + .append("errorCode", getErrorCode()) + .append("errorMessage", getErrorMessage()) + .append("remark", getRemark()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/AppsBalanceLedgerMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/AppsBalanceLedgerMapper.java new file mode 100644 index 0000000..6aeeba3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/AppsBalanceLedgerMapper.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.AppsBalanceLedger; +import com.ruoyi.system.domain.AppsBalanceLedgerPlus; + +/** + * 应用账面余额流水Mapper接口 + * + * @author luqj + * @date 2026-10-13 + */ +public interface AppsBalanceLedgerMapper extends BaseMapper +{ + /** + * 查询应用账面余额流水 + * + * @param id 应用账面余额流水ID + * @return 应用账面余额流水 + */ + public AppsBalanceLedger selectAppsBalanceLedgerById(Long id); + + /** + * 查询应用账面余额流水列表 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 应用账面余额流水集合 + */ + public List selectAppsBalanceLedgerList(AppsBalanceLedger appsBalanceLedger); + + /** + * 新增应用账面余额流水 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 结果 + */ + public int insertAppsBalanceLedger(AppsBalanceLedger appsBalanceLedger); + + /** + * 修改应用账面余额流水 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 结果 + */ + public int updateAppsBalanceLedger(AppsBalanceLedger appsBalanceLedger); + + /** + * 删除应用账面余额流水 + * + * @param id 应用账面余额流水ID + * @return 结果 + */ + public int deleteAppsBalanceLedgerById(Long id); + + /** + * 批量删除应用账面余额流水 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteAppsBalanceLedgerByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/WalletAddressLedgerMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/WalletAddressLedgerMapper.java new file mode 100644 index 0000000..290e10d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/WalletAddressLedgerMapper.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.WalletAddressLedger; +import com.ruoyi.system.domain.WalletAddressLedgerPlus; + +/** + * 钱包地址资金流水Mapper接口 + * + * @author luqj + * @date 2026-10-13 + */ +public interface WalletAddressLedgerMapper extends BaseMapper +{ + /** + * 查询钱包地址资金流水 + * + * @param id 钱包地址资金流水ID + * @return 钱包地址资金流水 + */ + public WalletAddressLedger selectWalletAddressLedgerById(Long id); + + /** + * 查询钱包地址资金流水列表 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 钱包地址资金流水集合 + */ + public List selectWalletAddressLedgerList(WalletAddressLedger walletAddressLedger); + + /** + * 新增钱包地址资金流水 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 结果 + */ + public int insertWalletAddressLedger(WalletAddressLedger walletAddressLedger); + + /** + * 修改钱包地址资金流水 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 结果 + */ + public int updateWalletAddressLedger(WalletAddressLedger walletAddressLedger); + + /** + * 删除钱包地址资金流水 + * + * @param id 钱包地址资金流水ID + * @return 结果 + */ + public int deleteWalletAddressLedgerById(Long id); + + /** + * 批量删除钱包地址资金流水 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteWalletAddressLedgerByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppsBalanceLedgerService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppsBalanceLedgerService.java new file mode 100644 index 0000000..23dc183 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppsBalanceLedgerService.java @@ -0,0 +1,91 @@ +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.AppsBalanceLedger; +import com.ruoyi.system.domain.AppsBalanceLedgerPlus; + +import java.util.List; +import java.util.Map; +/** + * 应用账面余额流水Service接口 + * + * @author luqj + * @date 2026-10-13 + */ +public interface IAppsBalanceLedgerService extends IService +{ + + List select(String keyword,boolean isUser); + /** + * 查询应用账面余额流水 + * + * @param id 应用账面余额流水ID + * @return 应用账面余额流水 + */ + public AppsBalanceLedger selectAppsBalanceLedgerById(Long id,boolean isUser); + + /** + * 查询应用账面余额流水列表 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 应用账面余额流水集合 + */ + public List selectAppsBalanceLedgerList(AppsBalanceLedger appsBalanceLedger,boolean isUser); + + /** + * 新增应用账面余额流水 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 结果 + */ + public int insertAppsBalanceLedger(AppsBalanceLedger appsBalanceLedger,boolean isUser); + + /** + * 修改应用账面余额流水 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 结果 + */ + public int updateAppsBalanceLedger(AppsBalanceLedger appsBalanceLedger,boolean isUser); + + /** + * 批量删除应用账面余额流水 + * + * @param ids 需要删除的应用账面余额流水ID + * @return 结果 + */ + public int deleteAppsBalanceLedgerByIds(Long[] ids,boolean isUser); + + /** + * 删除应用账面余额流水信息 + * + * @param id 应用账面余额流水ID + * @return 结果 + */ + public int deleteAppsBalanceLedgerById(Long id,boolean isUser); + + List getByIds(List ids,boolean isUser, SFunction... columns); + + AppsBalanceLedgerPlus 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/IWalletAddressLedgerService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IWalletAddressLedgerService.java new file mode 100644 index 0000000..f845d7e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IWalletAddressLedgerService.java @@ -0,0 +1,91 @@ +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.WalletAddressLedger; +import com.ruoyi.system.domain.WalletAddressLedgerPlus; + +import java.util.List; +import java.util.Map; +/** + * 钱包地址资金流水Service接口 + * + * @author luqj + * @date 2026-10-13 + */ +public interface IWalletAddressLedgerService extends IService +{ + + List select(String keyword,boolean isUser); + /** + * 查询钱包地址资金流水 + * + * @param id 钱包地址资金流水ID + * @return 钱包地址资金流水 + */ + public WalletAddressLedger selectWalletAddressLedgerById(Long id,boolean isUser); + + /** + * 查询钱包地址资金流水列表 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 钱包地址资金流水集合 + */ + public List selectWalletAddressLedgerList(WalletAddressLedger walletAddressLedger,boolean isUser); + + /** + * 新增钱包地址资金流水 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 结果 + */ + public int insertWalletAddressLedger(WalletAddressLedger walletAddressLedger,boolean isUser); + + /** + * 修改钱包地址资金流水 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 结果 + */ + public int updateWalletAddressLedger(WalletAddressLedger walletAddressLedger,boolean isUser); + + /** + * 批量删除钱包地址资金流水 + * + * @param ids 需要删除的钱包地址资金流水ID + * @return 结果 + */ + public int deleteWalletAddressLedgerByIds(Long[] ids,boolean isUser); + + /** + * 删除钱包地址资金流水信息 + * + * @param id 钱包地址资金流水ID + * @return 结果 + */ + public int deleteWalletAddressLedgerById(Long id,boolean isUser); + + List getByIds(List ids,boolean isUser, SFunction... columns); + + WalletAddressLedgerPlus 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/AppsBalanceLedgerServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppsBalanceLedgerServiceImpl.java new file mode 100644 index 0000000..427d993 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppsBalanceLedgerServiceImpl.java @@ -0,0 +1,268 @@ +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.AppsBalanceLedger; +import com.ruoyi.system.domain.AppsBalanceLedgerPlus; +import com.ruoyi.system.mapper.AppsBalanceLedgerMapper; +import com.ruoyi.system.service.IAppsBalanceLedgerService; +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 2026-10-13 + */ +@Service +public class AppsBalanceLedgerServiceImpl extends ServiceImpl implements IAppsBalanceLedgerService +{ + @Autowired + private AppsBalanceLedgerMapper appsBalanceLedgerMapper; + @Autowired + private JdbcTemplate jdbcTemplate; + + @Override + public List getByIds(List ids ,boolean isUser, SFunction... columns) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(columns).in(AppsBalanceLedgerPlus::getId, ids); + if(isUser){ + lambdaQueryWrapper.eq(AppsBalanceLedgerPlus::getUserId, SecurityUtils.getUserId()); + } + List list = this.list(lambdaQueryWrapper); + if(isUser){ + checkUserPlus(list); + } + return list; + } + private void checkUserPlus(List list) { + for (AppsBalanceLedgerPlus item : list){ + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + } + private void checkUser(List list) { + for (AppsBalanceLedger item : list){ + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + } + private void checkUser(AppsBalanceLedgerPlus item) { + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + private void checkUser(AppsBalanceLedger item) { + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + @Override + public List select(String keyword,boolean isUser) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(AppsBalanceLedgerPlus::getId,AppsBalanceLedgerPlus::getUserId, AppsBalanceLedgerPlus::getAppId) + .like(AppsBalanceLedgerPlus::getAppId, keyword); + if(isUser){ + lambdaQueryWrapper.eq(AppsBalanceLedgerPlus::getUserId, SecurityUtils.getUserId()); + } + List list = this.list(lambdaQueryWrapper); + if(isUser){ + checkUserPlus(list); + } + List result =new ArrayList<>(); + for (AppsBalanceLedgerPlus item : list){ + SelectItem selectItem = new SelectItem(); + selectItem.setName(item.getAppId()+""); + selectItem.setId(item.getId()); + result.add(selectItem); + } + return result; + } + @Override + public AppsBalanceLedgerPlus getById(Long id, SFunction... columns) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(columns).eq(AppsBalanceLedgerPlus::getId, id); + return baseMapper.selectOne(lambdaQueryWrapper); + } + + @Override + public Map getMapByIds(List ids, SFunction... columns) { + List list = this.getByIds(ids,false, columns); + Map map = new HashMap<>(); + for (AppsBalanceLedgerPlus 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 (AppsBalanceLedgerPlus item : list) { + map.put(item.getId(), item); + } + return map; + } + + @Override + public List getByIds(List ids) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(AppsBalanceLedgerPlus::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 apps_balance_ledger "); + 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(" apps_balance_ledger "); + 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(" apps_balance_ledger "); + 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 AppsBalanceLedger selectAppsBalanceLedgerById(Long id,boolean isUser) + { + AppsBalanceLedger vo = appsBalanceLedgerMapper.selectAppsBalanceLedgerById(id); + if(isUser){ + checkUser(vo); + } + return vo; + } + + /** + * 查询应用账面余额流水列表 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 应用账面余额流水 + */ + @Override + public List selectAppsBalanceLedgerList(AppsBalanceLedger appsBalanceLedger,boolean isUser) + { + if(appsBalanceLedger == null){ + appsBalanceLedger = new AppsBalanceLedger(); + } + if(isUser){ + appsBalanceLedger.setUserId(SecurityUtils.getUserId()); + } + List list = appsBalanceLedgerMapper.selectAppsBalanceLedgerList(appsBalanceLedger); + if(isUser){ + checkUser(list); + } + return list; + } + + /** + * 新增应用账面余额流水 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 结果 + */ + @Override + public int insertAppsBalanceLedger(AppsBalanceLedger appsBalanceLedger,boolean isUser) + { + appsBalanceLedger.setCreatedAt(DateUtils.getNowDate()); + if(isUser){ + appsBalanceLedger.setUserId(SecurityUtils.getUserId()); + } + return appsBalanceLedgerMapper.insertAppsBalanceLedger(appsBalanceLedger); + } + + /** + * 修改应用账面余额流水 + * + * @param appsBalanceLedger 应用账面余额流水 + * @return 结果 + */ + @Override + public int updateAppsBalanceLedger(AppsBalanceLedger appsBalanceLedger,boolean isUser) + { + if(isUser){ + checkUser(appsBalanceLedger); + } + return appsBalanceLedgerMapper.updateAppsBalanceLedger(appsBalanceLedger); + } + + /** + * 批量删除应用账面余额流水 + * + * @param ids 需要删除的应用账面余额流水ID + * @return 结果 + */ + @Override + public int deleteAppsBalanceLedgerByIds(Long[] ids,boolean isUser) + { + if(isUser){ + List list= getByIds(Arrays.asList(ids),false,AppsBalanceLedgerPlus::getUserId,AppsBalanceLedgerPlus::getId); + checkUserPlus(list); + } + return appsBalanceLedgerMapper.deleteAppsBalanceLedgerByIds(ids); + } + + /** + * 删除应用账面余额流水信息 + * + * @param id 应用账面余额流水ID + * @return 结果 + */ + @Override + public int deleteAppsBalanceLedgerById(Long id,boolean isUser) + { + if(isUser){ + AppsBalanceLedgerPlus vo = getById(id,AppsBalanceLedgerPlus::getUserId,AppsBalanceLedgerPlus::getId); + checkUser(vo); + } + return appsBalanceLedgerMapper.deleteAppsBalanceLedgerById(id); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WalletAddressLedgerServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WalletAddressLedgerServiceImpl.java new file mode 100644 index 0000000..b54d927 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WalletAddressLedgerServiceImpl.java @@ -0,0 +1,270 @@ +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.WalletAddressLedger; +import com.ruoyi.system.domain.WalletAddressLedgerPlus; +import com.ruoyi.system.mapper.WalletAddressLedgerMapper; +import com.ruoyi.system.service.IWalletAddressLedgerService; +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 2026-10-13 + */ +@Service +public class WalletAddressLedgerServiceImpl extends ServiceImpl implements IWalletAddressLedgerService +{ + @Autowired + private WalletAddressLedgerMapper walletAddressLedgerMapper; + @Autowired + private JdbcTemplate jdbcTemplate; + + @Override + public List getByIds(List ids ,boolean isUser, SFunction... columns) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(columns).in(WalletAddressLedgerPlus::getId, ids); + if(isUser){ + lambdaQueryWrapper.eq(WalletAddressLedgerPlus::getUserId, SecurityUtils.getUserId()); + } + List list = this.list(lambdaQueryWrapper); + if(isUser){ + checkUserPlus(list); + } + return list; + } + private void checkUserPlus(List list) { + for (WalletAddressLedgerPlus item : list){ + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + } + private void checkUser(List list) { + for (WalletAddressLedger item : list){ + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + } + private void checkUser(WalletAddressLedgerPlus item) { + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + private void checkUser(WalletAddressLedger item) { + if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ + throw new RuntimeException("无权限"); + } + } + @Override + public List select(String keyword,boolean isUser) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(WalletAddressLedgerPlus::getId,WalletAddressLedgerPlus::getUserId, WalletAddressLedgerPlus::getWalletAddress) + .like(WalletAddressLedgerPlus::getWalletAddress, keyword); + if(isUser){ + lambdaQueryWrapper.eq(WalletAddressLedgerPlus::getUserId, SecurityUtils.getUserId()); + } + List list = this.list(lambdaQueryWrapper); + if(isUser){ + checkUserPlus(list); + } + List result =new ArrayList<>(); + for (WalletAddressLedgerPlus item : list){ + SelectItem selectItem = new SelectItem(); + selectItem.setName(item.getWalletAddress()); + selectItem.setId(item.getId()); + result.add(selectItem); + } + return result; + } + @Override + public WalletAddressLedgerPlus getById(Long id, SFunction... columns) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() + .select(columns).eq(WalletAddressLedgerPlus::getId, id); + return baseMapper.selectOne(lambdaQueryWrapper); + } + + @Override + public Map getMapByIds(List ids, SFunction... columns) { + List list = this.getByIds(ids,false, columns); + Map map = new HashMap<>(); + for (WalletAddressLedgerPlus 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 (WalletAddressLedgerPlus item : list) { + map.put(item.getId(), item); + } + return map; + } + + @Override + public List getByIds(List ids) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(WalletAddressLedgerPlus::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 wallet_address_ledger "); + 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(" wallet_address_ledger "); + 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(" wallet_address_ledger "); + 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 WalletAddressLedger selectWalletAddressLedgerById(Long id,boolean isUser) + { + WalletAddressLedger vo = walletAddressLedgerMapper.selectWalletAddressLedgerById(id); + if(isUser){ + checkUser(vo); + } + return vo; + } + + /** + * 查询钱包地址资金流水列表 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 钱包地址资金流水 + */ + @Override + public List selectWalletAddressLedgerList(WalletAddressLedger walletAddressLedger,boolean isUser) + { + if(walletAddressLedger == null){ + walletAddressLedger = new WalletAddressLedger(); + } + if(isUser){ + walletAddressLedger.setUserId(SecurityUtils.getUserId()); + } + List list = walletAddressLedgerMapper.selectWalletAddressLedgerList(walletAddressLedger); + if(isUser){ + checkUser(list); + } + return list; + } + + /** + * 新增钱包地址资金流水 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 结果 + */ + @Override + public int insertWalletAddressLedger(WalletAddressLedger walletAddressLedger,boolean isUser) + { + walletAddressLedger.setCreatedAt(DateUtils.getNowDate()); + walletAddressLedger.setUpdatedAt(DateUtils.getNowDate()); + if(isUser){ + walletAddressLedger.setUserId(SecurityUtils.getUserId()); + } + return walletAddressLedgerMapper.insertWalletAddressLedger(walletAddressLedger); + } + + /** + * 修改钱包地址资金流水 + * + * @param walletAddressLedger 钱包地址资金流水 + * @return 结果 + */ + @Override + public int updateWalletAddressLedger(WalletAddressLedger walletAddressLedger,boolean isUser) + { + walletAddressLedger.setUpdatedAt(DateUtils.getNowDate()); + if(isUser){ + checkUser(walletAddressLedger); + } + return walletAddressLedgerMapper.updateWalletAddressLedger(walletAddressLedger); + } + + /** + * 批量删除钱包地址资金流水 + * + * @param ids 需要删除的钱包地址资金流水ID + * @return 结果 + */ + @Override + public int deleteWalletAddressLedgerByIds(Long[] ids,boolean isUser) + { + if(isUser){ + List list= getByIds(Arrays.asList(ids),false,WalletAddressLedgerPlus::getUserId,WalletAddressLedgerPlus::getId); + checkUserPlus(list); + } + return walletAddressLedgerMapper.deleteWalletAddressLedgerByIds(ids); + } + + /** + * 删除钱包地址资金流水信息 + * + * @param id 钱包地址资金流水ID + * @return 结果 + */ + @Override + public int deleteWalletAddressLedgerById(Long id,boolean isUser) + { + if(isUser){ + WalletAddressLedgerPlus vo = getById(id,WalletAddressLedgerPlus::getUserId,WalletAddressLedgerPlus::getId); + checkUser(vo); + } + return walletAddressLedgerMapper.deleteWalletAddressLedgerById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/AppsBalanceLedgerMapper.xml b/ruoyi-system/src/main/resources/mapper/system/AppsBalanceLedgerMapper.xml new file mode 100644 index 0000000..1f1ed0f --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/AppsBalanceLedgerMapper.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, trade_no, idempotency_key, app_id, user_id, currency, balance_type, business_type, direction, amount, balance_before, balance_after, available_before, available_after, frozen_before, frozen_after, order_id, merchant_order_id, aggregation_task_id, wallet_ledger_id, transaction_id, operator_id, request_id, remark, created_at from apps_balance_ledger + + + + + + + + insert into apps_balance_ledger + + trade_no, + idempotency_key, + app_id, + user_id, + currency, + balance_type, + business_type, + direction, + amount, + balance_before, + balance_after, + available_before, + available_after, + frozen_before, + frozen_after, + order_id, + merchant_order_id, + aggregation_task_id, + wallet_ledger_id, + transaction_id, + operator_id, + request_id, + remark, + created_at, + + + #{tradeNo}, + #{idempotencyKey}, + #{appId}, + #{userId}, + #{currency}, + #{balanceType}, + #{businessType}, + #{direction}, + #{amount}, + #{balanceBefore}, + #{balanceAfter}, + #{availableBefore}, + #{availableAfter}, + #{frozenBefore}, + #{frozenAfter}, + #{orderId}, + #{merchantOrderId}, + #{aggregationTaskId}, + #{walletLedgerId}, + #{transactionId}, + #{operatorId}, + #{requestId}, + #{remark}, + #{createdAt}, + + + + + update apps_balance_ledger + + trade_no = #{tradeNo}, + idempotency_key = #{idempotencyKey}, + app_id = #{appId}, + user_id = #{userId}, + currency = #{currency}, + balance_type = #{balanceType}, + business_type = #{businessType}, + direction = #{direction}, + amount = #{amount}, + balance_before = #{balanceBefore}, + balance_after = #{balanceAfter}, + available_before = #{availableBefore}, + available_after = #{availableAfter}, + frozen_before = #{frozenBefore}, + frozen_after = #{frozenAfter}, + order_id = #{orderId}, + merchant_order_id = #{merchantOrderId}, + aggregation_task_id = #{aggregationTaskId}, + wallet_ledger_id = #{walletLedgerId}, + transaction_id = #{transactionId}, + operator_id = #{operatorId}, + request_id = #{requestId}, + remark = #{remark}, + created_at = #{createdAt}, + + where id = #{id} + + + + delete from apps_balance_ledger where id = #{id} + + + + delete from apps_balance_ledger where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/WalletAddressLedgerMapper.xml b/ruoyi-system/src/main/resources/mapper/system/WalletAddressLedgerMapper.xml new file mode 100644 index 0000000..a878b67 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/WalletAddressLedgerMapper.xml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, trade_no, idempotency_key, app_id, user_id, wallet_address_id, wallet_address, counterparty_address, currency, business_type, direction, amount, balance_before, balance_after, fee_currency, fee_amount, energy_used, bandwidth_used, burned_trx, order_id, merchant_order_id, trade_id, aggregation_task_id, aggregation_item_id, transaction_id, block_number, block_time, confirmation_count, status, source_type, request_id, operator_id, error_code, error_message, remark, created_at, updated_at from wallet_address_ledger + + + + + + + + insert into wallet_address_ledger + + trade_no, + idempotency_key, + app_id, + user_id, + wallet_address_id, + wallet_address, + counterparty_address, + currency, + business_type, + direction, + amount, + balance_before, + balance_after, + fee_currency, + fee_amount, + energy_used, + bandwidth_used, + burned_trx, + order_id, + merchant_order_id, + trade_id, + aggregation_task_id, + aggregation_item_id, + transaction_id, + block_number, + block_time, + confirmation_count, + status, + source_type, + request_id, + operator_id, + error_code, + error_message, + remark, + created_at, + updated_at, + + + #{tradeNo}, + #{idempotencyKey}, + #{appId}, + #{userId}, + #{walletAddressId}, + #{walletAddress}, + #{counterpartyAddress}, + #{currency}, + #{businessType}, + #{direction}, + #{amount}, + #{balanceBefore}, + #{balanceAfter}, + #{feeCurrency}, + #{feeAmount}, + #{energyUsed}, + #{bandwidthUsed}, + #{burnedTrx}, + #{orderId}, + #{merchantOrderId}, + #{tradeId}, + #{aggregationTaskId}, + #{aggregationItemId}, + #{transactionId}, + #{blockNumber}, + #{blockTime}, + #{confirmationCount}, + #{status}, + #{sourceType}, + #{requestId}, + #{operatorId}, + #{errorCode}, + #{errorMessage}, + #{remark}, + #{createdAt}, + #{updatedAt}, + + + + + update wallet_address_ledger + + trade_no = #{tradeNo}, + idempotency_key = #{idempotencyKey}, + app_id = #{appId}, + user_id = #{userId}, + wallet_address_id = #{walletAddressId}, + wallet_address = #{walletAddress}, + counterparty_address = #{counterpartyAddress}, + currency = #{currency}, + business_type = #{businessType}, + direction = #{direction}, + amount = #{amount}, + balance_before = #{balanceBefore}, + balance_after = #{balanceAfter}, + fee_currency = #{feeCurrency}, + fee_amount = #{feeAmount}, + energy_used = #{energyUsed}, + bandwidth_used = #{bandwidthUsed}, + burned_trx = #{burnedTrx}, + order_id = #{orderId}, + merchant_order_id = #{merchantOrderId}, + trade_id = #{tradeId}, + aggregation_task_id = #{aggregationTaskId}, + aggregation_item_id = #{aggregationItemId}, + transaction_id = #{transactionId}, + block_number = #{blockNumber}, + block_time = #{blockTime}, + confirmation_count = #{confirmationCount}, + status = #{status}, + source_type = #{sourceType}, + request_id = #{requestId}, + operator_id = #{operatorId}, + error_code = #{errorCode}, + error_message = #{errorMessage}, + remark = #{remark}, + created_at = #{createdAt}, + updated_at = #{updatedAt}, + + where id = #{id} + + + + delete from wallet_address_ledger where id = #{id} + + + + delete from wallet_address_ledger where id in + + #{id} + + + \ No newline at end of file