删除旧 PayoutOrderController,功能统一到 [UsdtPayoutOrderController.java (line 23)](D:/myprojects/usdt/myEpusdt/ruoyi-system/src/main/java/com/ruoyi/system/controller/UsdtPayoutOrderController.java:23)。
删除旧 system/payout 页面及 API。 管理员和商户页面统一使用共享组件 [PayoutOrderView.vue](D:/myprojects/usdt/usdt-ui/src/views/system/usdtPayoutOrder/components/PayoutOrderView.vue)。 管理员支持查询、统计、详情、导出、审核、密码广播和失败重试。 商户仅支持查询、统计和详情,无增删改、审核及执行权限。 增加状态统计、完成 USDT/TRX 金额、手续费汇总。 增加应用、用户、订单号、币种、状态、时间范围等查询条件。 后端关联返回应用名称和用户名。 通用新增、修改、删除接口已移除,防止绕过冻结余额和审核状态机。 更新 [usdt_payout_menu.sql](D:/myprojects/usdt/myEpusdt/sql/usdt_payout_menu.sql),可幂等迁移旧 system:payout:* 权限。
This commit is contained in:
1 parent
1eca7a77bc
commit
c58e55a2e1
9 files changed
+193
-225
No files matched your search
@@ -1,64 +0,0 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.UsdtPayoutOrder;
|
||||
import com.ruoyi.system.domain.UsdtPayoutOrderPlus;
|
||||
import com.ruoyi.system.domain.dto.PayoutExecuteRequest;
|
||||
import com.ruoyi.system.mapper.UsdtPayoutOrderMapper;
|
||||
import com.ruoyi.system.service.PayoutProcessingService;
|
||||
import com.ruoyi.system.service.TelegramAuditService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 管理后台代付审核与执行接口。 */
|
||||
@RestController
|
||||
@RequestMapping("/system/payout")
|
||||
public class PayoutOrderController extends BaseController {
|
||||
@Autowired
|
||||
private UsdtPayoutOrderMapper mapper;
|
||||
@Autowired
|
||||
private PayoutProcessingService processingService;
|
||||
@Autowired
|
||||
private TelegramAuditService telegramAuditService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:payout:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UsdtPayoutOrder query) {
|
||||
LambdaQueryWrapper<UsdtPayoutOrderPlus> wrapper = new LambdaQueryWrapper<UsdtPayoutOrderPlus>()
|
||||
.isNull(UsdtPayoutOrderPlus::getDeletedAt)
|
||||
.orderByDesc(UsdtPayoutOrderPlus::getId);
|
||||
if (query.getAppId() != null) {
|
||||
wrapper.eq(UsdtPayoutOrderPlus::getAppId, query.getAppId());
|
||||
}
|
||||
if (query.getStatus() != null) {
|
||||
wrapper.eq(UsdtPayoutOrderPlus::getStatus, query.getStatus());
|
||||
}
|
||||
startPage();
|
||||
List<UsdtPayoutOrderPlus> rows = mapper.selectList(wrapper);
|
||||
return getDataTable(rows);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:payout:review')")
|
||||
@PostMapping("/{id}/review")
|
||||
public AjaxResult review(@PathVariable Long id, @RequestParam boolean approved,
|
||||
@RequestParam(required = false) String remark) {
|
||||
telegramAuditService.reviewPayoutFromBackoffice(id, approved, remark);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:payout:execute')")
|
||||
@PostMapping("/{id}/execute")
|
||||
public AjaxResult execute(@PathVariable Long id, @RequestBody PayoutExecuteRequest request) {
|
||||
try {
|
||||
return AjaxResult.success(processingService.execute(id, request.getConfigurationPassword()));
|
||||
} finally {
|
||||
request.setConfigurationPassword(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
+48
-122
@@ -5,164 +5,90 @@ 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.UsdtPayoutOrder;
|
||||
import com.ruoyi.system.domain.UsdtPayoutOrderPlus;
|
||||
import com.ruoyi.system.domain.dto.PayoutExecuteRequest;
|
||||
import com.ruoyi.system.service.IUsdtPayoutOrderService;
|
||||
import com.ruoyi.system.service.PayoutProcessingService;
|
||||
import com.ruoyi.system.service.TelegramAuditService;
|
||||
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-17
|
||||
*/
|
||||
/** 代付订单只读查询、统计、审核和链上执行接口。 */
|
||||
@RestController
|
||||
@RequestMapping("/system/usdtPayoutOrder")
|
||||
public class UsdtPayoutOrderController extends BaseController {
|
||||
@Autowired
|
||||
private IUsdtPayoutOrderService usdtPayoutOrderService;
|
||||
private IUsdtPayoutOrderService payoutOrderService;
|
||||
@Autowired
|
||||
private PayoutProcessingService processingService;
|
||||
@Autowired
|
||||
private TelegramAuditService telegramAuditService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:getByIds')")
|
||||
@PostMapping("/getByIds")
|
||||
public AjaxResult getByIds(@RequestBody Ids ids) {
|
||||
List<UsdtPayoutOrderPlus> list = usdtPayoutOrderService.getByIds(ids.getLongIds(), false, UsdtPayoutOrderPlus::getTradeId, UsdtPayoutOrderPlus::getId);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-getByIds')")
|
||||
@PostMapping("/user/getByIds")
|
||||
public AjaxResult userGetByIds(@RequestBody Ids ids) {
|
||||
List<UsdtPayoutOrderPlus> list = usdtPayoutOrderService.getByIds(ids.getLongIds(), true, UsdtPayoutOrderPlus::getUserId, UsdtPayoutOrderPlus::getTradeId, UsdtPayoutOrderPlus::getId);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:select')")
|
||||
@GetMapping("/select")
|
||||
public AjaxResult select(String keyword) {
|
||||
List<SelectItem> list = usdtPayoutOrderService.select(keyword, false);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-select')")
|
||||
@GetMapping("/user/select")
|
||||
public AjaxResult userSelect(String keyword) {
|
||||
List<SelectItem> list = usdtPayoutOrderService.select(keyword, true);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用代付订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UsdtPayoutOrder usdtPayoutOrder) {
|
||||
public TableDataInfo list(UsdtPayoutOrder query) {
|
||||
startPage();
|
||||
List<UsdtPayoutOrder> list = usdtPayoutOrderService.selectUsdtPayoutOrderList(usdtPayoutOrder, false);
|
||||
return getDataTable(list);
|
||||
return getDataTable(payoutOrderService.selectUsdtPayoutOrderList(query, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用代付订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-list')")
|
||||
@GetMapping("/user/list")
|
||||
public TableDataInfo userList(UsdtPayoutOrder usdtPayoutOrder) {
|
||||
public TableDataInfo userList(UsdtPayoutOrder query) {
|
||||
startPage();
|
||||
List<UsdtPayoutOrder> list = usdtPayoutOrderService.selectUsdtPayoutOrderList(usdtPayoutOrder, true);
|
||||
return getDataTable(list);
|
||||
return getDataTable(payoutOrderService.selectUsdtPayoutOrderList(query, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出应用代付订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:export')")
|
||||
@Log(title = "应用代付订单", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(UsdtPayoutOrder usdtPayoutOrder) {
|
||||
List<UsdtPayoutOrder> list = usdtPayoutOrderService.selectUsdtPayoutOrderList(usdtPayoutOrder, false);
|
||||
ExcelUtil<UsdtPayoutOrder> util = new ExcelUtil<UsdtPayoutOrder>(UsdtPayoutOrder.class);
|
||||
return util.exportExcel(list, "usdtPayoutOrder");
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:list')")
|
||||
@GetMapping("/statistics")
|
||||
public AjaxResult statistics(UsdtPayoutOrder query) {
|
||||
return AjaxResult.success(payoutOrderService.selectStatistics(query, false));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-list')")
|
||||
@GetMapping("/user/statistics")
|
||||
public AjaxResult userStatistics(UsdtPayoutOrder query) {
|
||||
return AjaxResult.success(payoutOrderService.selectStatistics(query, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用代付订单详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(usdtPayoutOrderService.selectUsdtPayoutOrderById(id, false));
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
return AjaxResult.success(payoutOrderService.selectUsdtPayoutOrderById(id, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用代付订单详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-query')")
|
||||
@GetMapping(value = "/user/{id}")
|
||||
public AjaxResult userGetInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(usdtPayoutOrderService.selectUsdtPayoutOrderById(id, true));
|
||||
@GetMapping("/user/{id}")
|
||||
public AjaxResult userGetInfo(@PathVariable Long id) {
|
||||
return AjaxResult.success(payoutOrderService.selectUsdtPayoutOrderById(id, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增应用代付订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:add')")
|
||||
@Log(title = "应用代付订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UsdtPayoutOrder usdtPayoutOrder) {
|
||||
return toAjax(usdtPayoutOrderService.insertUsdtPayoutOrder(usdtPayoutOrder, false));
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:export')")
|
||||
@Log(title = "代付订单", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(UsdtPayoutOrder query) {
|
||||
List<UsdtPayoutOrder> list = payoutOrderService.selectUsdtPayoutOrderList(query, false);
|
||||
return new ExcelUtil<UsdtPayoutOrder>(UsdtPayoutOrder.class).exportExcel(list, "代付订单");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增应用代付订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-add')")
|
||||
@Log(title = "应用代付订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/user")
|
||||
public AjaxResult userAdd(@RequestBody UsdtPayoutOrder usdtPayoutOrder) {
|
||||
return toAjax(usdtPayoutOrderService.insertUsdtPayoutOrder(usdtPayoutOrder, true));
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:review')")
|
||||
@PostMapping("/{id}/review")
|
||||
public AjaxResult review(@PathVariable Long id, @RequestParam boolean approved,
|
||||
@RequestParam(required = false) String remark) {
|
||||
telegramAuditService.reviewPayoutFromBackoffice(id, approved, remark);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用代付订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:edit')")
|
||||
@Log(title = "应用代付订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UsdtPayoutOrder usdtPayoutOrder) {
|
||||
return toAjax(usdtPayoutOrderService.updateUsdtPayoutOrder(usdtPayoutOrder, false));
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:execute')")
|
||||
@PostMapping("/{id}/execute")
|
||||
public AjaxResult execute(@PathVariable Long id, @RequestBody PayoutExecuteRequest request) {
|
||||
try {
|
||||
return AjaxResult.success(processingService.execute(id, request.getConfigurationPassword()));
|
||||
} finally {
|
||||
request.setConfigurationPassword(null);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-edit')")
|
||||
@Log(title = "应用代付订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/user")
|
||||
public AjaxResult userEdit(@RequestBody UsdtPayoutOrder usdtPayoutOrder) {
|
||||
return toAjax(usdtPayoutOrderService.updateUsdtPayoutOrder(usdtPayoutOrder, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用代付订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:remove')")
|
||||
@Log(title = "应用代付订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(usdtPayoutOrderService.deleteUsdtPayoutOrderByIds(ids, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用代付订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:usdtPayoutOrder:user-remove')")
|
||||
@Log(title = "应用代付订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/user/{ids}")
|
||||
public AjaxResult userRemove(@PathVariable Long[] ids) {
|
||||
return toAjax(usdtPayoutOrderService.deleteUsdtPayoutOrderByIds(ids, true));
|
||||
}
|
||||
}
|
||||
@@ -131,6 +131,12 @@ public class UsdtPayoutOrder extends BaseEntity
|
||||
@Excel(name = "0未确认 1已确认", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deletedAt;
|
||||
|
||||
/** 关联应用名称,仅用于查询展示。 */
|
||||
private String appName;
|
||||
|
||||
/** 应用所属用户名称,仅用于查询展示。 */
|
||||
private String userName;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@@ -374,6 +380,10 @@ public class UsdtPayoutOrder extends BaseEntity
|
||||
{
|
||||
return deletedAt;
|
||||
}
|
||||
public String getAppName() { return appName; }
|
||||
public void setAppName(String appName) { this.appName = appName; }
|
||||
public String getUserName() { return userName; }
|
||||
public void setUserName(String userName) { this.userName = userName; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -405,6 +415,8 @@ public class UsdtPayoutOrder extends BaseEntity
|
||||
.append("createdAt", getCreatedAt())
|
||||
.append("updatedAt", getUpdatedAt())
|
||||
.append("deletedAt", getDeletedAt())
|
||||
.append("appName", getAppName())
|
||||
.append("userName", getUserName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** 代付订单查询条件范围内的状态和金额汇总。 */
|
||||
public class PayoutOrderStatistics {
|
||||
private Long totalCount;
|
||||
private Long pendingAuditCount;
|
||||
private Long pendingExecuteCount;
|
||||
private Long confirmingCount;
|
||||
private Long completedCount;
|
||||
private Long rejectedCount;
|
||||
private Long failedCount;
|
||||
private BigDecimal completedUsdtAmount;
|
||||
private BigDecimal completedTrxAmount;
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
public Long getTotalCount() { return totalCount; }
|
||||
public void setTotalCount(Long totalCount) { this.totalCount = totalCount; }
|
||||
public Long getPendingAuditCount() { return pendingAuditCount; }
|
||||
public void setPendingAuditCount(Long pendingAuditCount) { this.pendingAuditCount = pendingAuditCount; }
|
||||
public Long getPendingExecuteCount() { return pendingExecuteCount; }
|
||||
public void setPendingExecuteCount(Long pendingExecuteCount) { this.pendingExecuteCount = pendingExecuteCount; }
|
||||
public Long getConfirmingCount() { return confirmingCount; }
|
||||
public void setConfirmingCount(Long confirmingCount) { this.confirmingCount = confirmingCount; }
|
||||
public Long getCompletedCount() { return completedCount; }
|
||||
public void setCompletedCount(Long completedCount) { this.completedCount = completedCount; }
|
||||
public Long getRejectedCount() { return rejectedCount; }
|
||||
public void setRejectedCount(Long rejectedCount) { this.rejectedCount = rejectedCount; }
|
||||
public Long getFailedCount() { return failedCount; }
|
||||
public void setFailedCount(Long failedCount) { this.failedCount = failedCount; }
|
||||
public BigDecimal getCompletedUsdtAmount() { return completedUsdtAmount; }
|
||||
public void setCompletedUsdtAmount(BigDecimal completedUsdtAmount) { this.completedUsdtAmount = completedUsdtAmount; }
|
||||
public BigDecimal getCompletedTrxAmount() { return completedTrxAmount; }
|
||||
public void setCompletedTrxAmount(BigDecimal completedTrxAmount) { this.completedTrxAmount = completedTrxAmount; }
|
||||
public BigDecimal getFeeAmount() { return feeAmount; }
|
||||
public void setFeeAmount(BigDecimal feeAmount) { this.feeAmount = feeAmount; }
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.system.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.system.domain.UsdtPayoutOrder;
|
||||
import com.ruoyi.system.domain.UsdtPayoutOrderPlus;
|
||||
import com.ruoyi.system.domain.vo.PayoutOrderStatistics;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
@@ -85,6 +86,8 @@ public interface UsdtPayoutOrderMapper extends BaseMapper<UsdtPayoutOrderPlus> {
|
||||
*/
|
||||
public List<UsdtPayoutOrder> selectUsdtPayoutOrderList(UsdtPayoutOrder usdtPayoutOrder);
|
||||
|
||||
PayoutOrderStatistics selectStatistics(UsdtPayoutOrder usdtPayoutOrder);
|
||||
|
||||
/**
|
||||
* 新增应用代付订单
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.system.domain.UsdtPayoutOrderPlus;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.system.domain.vo.PayoutOrderStatistics;
|
||||
/**
|
||||
* 应用代付订单Service接口
|
||||
*
|
||||
@@ -32,6 +33,8 @@ public interface IUsdtPayoutOrderService extends IService<UsdtPayoutOrderPlus>
|
||||
*/
|
||||
public List<UsdtPayoutOrder> selectUsdtPayoutOrderList(UsdtPayoutOrder usdtPayoutOrder,boolean isUser);
|
||||
|
||||
PayoutOrderStatistics selectStatistics(UsdtPayoutOrder usdtPayoutOrder, boolean isUser);
|
||||
|
||||
/**
|
||||
* 新增应用代付订单
|
||||
*
|
||||
|
||||
+17
-1
@@ -20,6 +20,8 @@ import com.ruoyi.system.service.IUsdtPayoutOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.system.domain.vo.PayoutOrderStatistics;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
/**
|
||||
* 应用代付订单Service业务层处理
|
||||
*
|
||||
@@ -67,8 +69,11 @@ public class UsdtPayoutOrderServiceImpl extends ServiceImpl<UsdtPayoutOrderMappe
|
||||
}
|
||||
}
|
||||
private void checkUser(UsdtPayoutOrder item) {
|
||||
if (item == null) {
|
||||
throw new CustomException("代付订单不存在");
|
||||
}
|
||||
if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){
|
||||
throw new RuntimeException("无权限");
|
||||
throw new CustomException("无权查看该代付订单");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -206,6 +211,17 @@ public class UsdtPayoutOrderServiceImpl extends ServiceImpl<UsdtPayoutOrderMappe
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayoutOrderStatistics selectStatistics(UsdtPayoutOrder usdtPayoutOrder, boolean isUser) {
|
||||
if (usdtPayoutOrder == null) {
|
||||
usdtPayoutOrder = new UsdtPayoutOrder();
|
||||
}
|
||||
if (isUser) {
|
||||
usdtPayoutOrder.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
return usdtPayoutOrderMapper.selectStatistics(usdtPayoutOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增应用代付订单
|
||||
*
|
||||
|
||||
@@ -32,47 +32,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
<result property="deletedAt" column="deleted_at" />
|
||||
<result property="appName" column="app_name" />
|
||||
<result property="userName" column="user_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUsdtPayoutOrderVo">
|
||||
select id, trade_id, order_id, app_id, user_id, currency, amount, fee_currency, fee_amount, to_address, status, audit_type, auditor_id, audit_remark, audited_at, block_transaction_id, execute_error, execute_count, executed_at, confirmed_at, notify_url, redirect_url, callback_num, callback_confirm, created_at, updated_at, deleted_at from usdt_payout_order
|
||||
select p.id, p.trade_id, p.order_id, p.app_id, p.user_id, p.currency, p.amount,
|
||||
p.fee_currency, p.fee_amount, p.to_address, p.status, p.audit_type,
|
||||
p.auditor_id, p.audit_remark, p.audited_at, p.block_transaction_id,
|
||||
p.execute_error, p.execute_count, p.executed_at, p.confirmed_at,
|
||||
p.notify_url, p.redirect_url, p.callback_num, p.callback_confirm,
|
||||
p.created_at, p.updated_at, p.deleted_at,
|
||||
a.name as app_name, u.user_name
|
||||
from usdt_payout_order p
|
||||
left join apps a on a.id = p.app_id
|
||||
left join sys_user u on u.user_id = p.user_id
|
||||
</sql>
|
||||
|
||||
<sql id="payoutQueryConditions">
|
||||
p.deleted_at is null
|
||||
<if test="tradeId != null and tradeId != ''"> and p.trade_id like concat('%', #{tradeId}, '%')</if>
|
||||
<if test="orderId != null and orderId != ''"> and p.order_id like concat('%', #{orderId}, '%')</if>
|
||||
<if test="appId != null"> and p.app_id = #{appId}</if>
|
||||
<if test="userId != null"> and p.user_id = #{userId}</if>
|
||||
<if test="currency != null and currency != ''"> and p.currency = #{currency}</if>
|
||||
<if test="toAddress != null and toAddress != ''"> and p.to_address like concat('%', #{toAddress}, '%')</if>
|
||||
<if test="status != null"> and p.status = #{status}</if>
|
||||
<if test="auditType != null and auditType != ''"> and p.audit_type = #{auditType}</if>
|
||||
<if test="callbackConfirm != null"> and p.callback_confirm = #{callbackConfirm}</if>
|
||||
<if test="params != null and params.beginTime != null and params.beginTime != ''">
|
||||
and p.created_at <![CDATA[ >= ]]> #{params.beginTime}
|
||||
</if>
|
||||
<if test="params != null and params.endTime != null and params.endTime != ''">
|
||||
and p.created_at <![CDATA[ < ]]> date_add(#{params.endTime}, interval 1 day)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectUsdtPayoutOrderList" parameterType="UsdtPayoutOrder" resultMap="UsdtPayoutOrderResult">
|
||||
<include refid="selectUsdtPayoutOrderVo"/>
|
||||
<where>
|
||||
<if test="tradeId != null and tradeId != ''"> and trade_id = #{tradeId}</if>
|
||||
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
|
||||
<if test="appId != null "> and app_id = #{appId}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="currency != null and currency != ''"> and currency = #{currency}</if>
|
||||
<if test="amount != null "> and amount = #{amount}</if>
|
||||
<if test="feeCurrency != null and feeCurrency != ''"> and fee_currency = #{feeCurrency}</if>
|
||||
<if test="feeAmount != null "> and fee_amount = #{feeAmount}</if>
|
||||
<if test="toAddress != null and toAddress != ''"> and to_address = #{toAddress}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="auditType != null and auditType != ''"> and audit_type = #{auditType}</if>
|
||||
<if test="auditorId != null and auditorId != ''"> and auditor_id = #{auditorId}</if>
|
||||
<if test="auditRemark != null and auditRemark != ''"> and audit_remark = #{auditRemark}</if>
|
||||
<if test="auditedAt != null "> and audited_at = #{auditedAt}</if>
|
||||
<if test="blockTransactionId != null and blockTransactionId != ''"> and block_transaction_id = #{blockTransactionId}</if>
|
||||
<if test="executeError != null and executeError != ''"> and execute_error = #{executeError}</if>
|
||||
<if test="executeCount != null "> and execute_count = #{executeCount}</if>
|
||||
<if test="executedAt != null "> and executed_at = #{executedAt}</if>
|
||||
<if test="confirmedAt != null "> and confirmed_at = #{confirmedAt}</if>
|
||||
<if test="notifyUrl != null and notifyUrl != ''"> and notify_url = #{notifyUrl}</if>
|
||||
<if test="redirectUrl != null and redirectUrl != ''"> and redirect_url = #{redirectUrl}</if>
|
||||
<if test="callbackNum != null "> and callback_num = #{callbackNum}</if>
|
||||
<if test="callbackConfirm != null "> and callback_confirm = #{callbackConfirm}</if>
|
||||
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||||
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
||||
<if test="deletedAt != null "> and deleted_at = #{deletedAt}</if>
|
||||
</where>
|
||||
where <include refid="payoutQueryConditions"/>
|
||||
order by p.id desc
|
||||
</select>
|
||||
|
||||
<select id="selectStatistics" parameterType="UsdtPayoutOrder"
|
||||
resultType="com.ruoyi.system.domain.vo.PayoutOrderStatistics">
|
||||
select count(1) as totalCount,
|
||||
coalesce(sum(case when p.status = 0 then 1 else 0 end), 0) as pendingAuditCount,
|
||||
coalesce(sum(case when p.status = 1 then 1 else 0 end), 0) as pendingExecuteCount,
|
||||
coalesce(sum(case when p.status = 2 then 1 else 0 end), 0) as confirmingCount,
|
||||
coalesce(sum(case when p.status = 3 then 1 else 0 end), 0) as completedCount,
|
||||
coalesce(sum(case when p.status = 4 then 1 else 0 end), 0) as rejectedCount,
|
||||
coalesce(sum(case when p.status = 5 then 1 else 0 end), 0) as failedCount,
|
||||
coalesce(sum(case when p.status = 3 and p.currency = 'USDT' then p.amount else 0 end), 0) as completedUsdtAmount,
|
||||
coalesce(sum(case when p.status = 3 and p.currency = 'TRX' then p.amount else 0 end), 0) as completedTrxAmount,
|
||||
coalesce(sum(case when p.status = 3 then p.fee_amount else 0 end), 0) as feeAmount
|
||||
from usdt_payout_order p
|
||||
where <include refid="payoutQueryConditions"/>
|
||||
</select>
|
||||
|
||||
<select id="selectUsdtPayoutOrderById" parameterType="Long" resultMap="UsdtPayoutOrderResult">
|
||||
<include refid="selectUsdtPayoutOrderVo"/>
|
||||
where id = #{id}
|
||||
where p.id = #{id} and p.deleted_at is null
|
||||
</select>
|
||||
|
||||
<insert id="insertUsdtPayoutOrder" parameterType="UsdtPayoutOrder" useGeneratedKeys="true" keyProperty="id">
|
||||
|
||||
@@ -1,26 +1,40 @@
|
||||
-- 代付订单后台菜单和权限。父菜单名称请按实际部署环境调整。
|
||||
-- 先迁移旧菜单及按钮权限,避免新旧权限并存时重复插入菜单。
|
||||
UPDATE sys_menu
|
||||
SET path = 'usdtPayoutOrder', component = 'system/usdtPayoutOrder/index',
|
||||
perms = 'system:usdtPayoutOrder:list', update_by = 'admin', update_time = NOW()
|
||||
WHERE perms = 'system:payout:list';
|
||||
|
||||
UPDATE sys_menu
|
||||
SET perms = 'system:usdtPayoutOrder:review', update_by = 'admin', update_time = NOW()
|
||||
WHERE perms = 'system:payout:review';
|
||||
|
||||
UPDATE sys_menu
|
||||
SET perms = 'system:usdtPayoutOrder:execute', update_by = 'admin', update_time = NOW()
|
||||
WHERE perms = 'system:payout:execute';
|
||||
|
||||
SET @parent_id = (SELECT menu_id FROM sys_menu WHERE menu_name = 'USDT管理' AND menu_type = 'M' LIMIT 1);
|
||||
INSERT INTO sys_menu
|
||||
(menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type,
|
||||
visible, status, perms, icon, create_by, create_time)
|
||||
SELECT '代付订单', @parent_id, 8, 'payout', 'system/payout/index', 1, 0, 'C',
|
||||
'0', '0', 'system:payout:list', 'money', 'admin', NOW()
|
||||
SELECT '代付订单', @parent_id, 8, 'usdtPayoutOrder', 'system/usdtPayoutOrder/index', 1, 0, 'C',
|
||||
'0', '0', 'system:usdtPayoutOrder:list', 'money', 'admin', NOW()
|
||||
WHERE @parent_id IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'system:payout:list');
|
||||
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'system:usdtPayoutOrder:list');
|
||||
|
||||
SET @payout_menu_id = (SELECT menu_id FROM sys_menu WHERE perms = 'system:payout:list' LIMIT 1);
|
||||
SET @payout_menu_id = (SELECT menu_id FROM sys_menu WHERE perms = 'system:usdtPayoutOrder:list' LIMIT 1);
|
||||
INSERT INTO sys_menu
|
||||
(menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type,
|
||||
visible, status, perms, icon, create_by, create_time)
|
||||
SELECT '代付审核', @payout_menu_id, 1, '#', '', 1, 0, 'F',
|
||||
'0', '0', 'system:payout:review', '#', 'admin', NOW()
|
||||
'0', '0', 'system:usdtPayoutOrder:review', '#', 'admin', NOW()
|
||||
WHERE @payout_menu_id IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'system:payout:review');
|
||||
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'system:usdtPayoutOrder:review');
|
||||
|
||||
INSERT INTO sys_menu
|
||||
(menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type,
|
||||
visible, status, perms, icon, create_by, create_time)
|
||||
SELECT '代付执行', @payout_menu_id, 2, '#', '', 1, 0, 'F',
|
||||
'0', '0', 'system:payout:execute', '#', 'admin', NOW()
|
||||
'0', '0', 'system:usdtPayoutOrder:execute', '#', 'admin', NOW()
|
||||
WHERE @payout_menu_id IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'system:payout:execute');
|
||||
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'system:usdtPayoutOrder:execute');
|
||||
Reference in new issue
Block a user