订单页面修改

This commit is contained in:
lu7213 committed 2026-10-19 03:35:47 -04:00
1 parent f5b1a9f638
commit 37754f3af0
3 files changed
+41 -2

No files matched your search

@@ -29,6 +29,23 @@ public class UsdtOrdersController extends BaseController {
@Autowired @Autowired
private IUsdtOrdersService usdtOrdersService; private IUsdtOrdersService usdtOrdersService;
@Autowired
private com.ruoyi.system.mapper.UsdtOrdersMapper usdtOrdersMapper;
/** 统计范围与管理列表一致,复用查询权限,不允许客户端控制商户归属。 */
@PreAuthorize("@ss.hasPermi('system:usdt_orders:list')")
@GetMapping("/statistics")
public AjaxResult statistics(UsdtOrders filter) {
return AjaxResult.success(usdtOrdersMapper.selectOrderStatistics(filter));
}
@PreAuthorize("@ss.hasPermi('system:usdt_orders:user-list')")
@GetMapping("/user/statistics")
public AjaxResult userStatistics(UsdtOrders filter) {
filter.setUserId(com.ruoyi.common.utils.SecurityUtils.getUserId());
return AjaxResult.success(usdtOrdersMapper.selectOrderStatistics(filter));
}
@PreAuthorize("@ss.hasPermi('system:usdt_orders:getByIds')") @PreAuthorize("@ss.hasPermi('system:usdt_orders:getByIds')")
@PostMapping("/getByIds") @PostMapping("/getByIds")
public AjaxResult getByIds(@RequestBody Ids ids) { public AjaxResult getByIds(@RequestBody Ids ids) {
@@ -15,6 +15,9 @@ import com.ruoyi.system.domain.UsdtOrdersPlus;
*/ */
public interface UsdtOrdersMapper extends BaseMapper<UsdtOrdersPlus> public interface UsdtOrdersMapper extends BaseMapper<UsdtOrdersPlus>
{ {
/** 按列表相同条件聚合全部订单,金额由数据库以 DECIMAL 计算,不受分页影响。 */
java.util.Map<String, Object> selectOrderStatistics(UsdtOrders filter);
UsdtOrdersPlus selectByIdForUpdate(@Param("id") Long id); UsdtOrdersPlus selectByIdForUpdate(@Param("id") Long id);
int countByTransactionId(@Param("transactionId") String transactionId, int countByTransactionId(@Param("transactionId") String transactionId,
@@ -34,9 +34,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from orders from orders
</sql> </sql>
<select id="selectUsdtOrdersList" parameterType="UsdtOrders" resultMap="UsdtOrdersResult"> <sql id="orderQueryWhere">
<include refid="selectUsdtOrdersVo"/>
<where> <where>
and deleted_at is null
<if test="params.beginTime != null and params.beginTime != ''"> and created_at &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and created_at &lt;= #{params.endTime}</if>
<if test="tradeId != null and tradeId != ''"> and trade_id like concat('%', #{tradeId}, '%')</if> <if test="tradeId != null and tradeId != ''"> and trade_id like concat('%', #{tradeId}, '%')</if>
<if test="orderId != null and orderId != ''"> and order_id like concat('%', #{orderId}, '%')</if> <if test="orderId != null and orderId != ''"> and order_id like concat('%', #{orderId}, '%')</if>
<if test="token != null and token != ''"> and token = #{token}</if> <if test="token != null and token != ''"> and token = #{token}</if>
@@ -48,6 +50,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null "> and user_id = #{userId}</if> <if test="userId != null "> and user_id = #{userId}</if>
<if test="orderType != null "> and order_type = #{orderType}</if> <if test="orderType != null "> and order_type = #{orderType}</if>
</where> </where>
</sql>
<select id="selectUsdtOrdersList" parameterType="UsdtOrders" resultMap="UsdtOrdersResult">
<include refid="selectUsdtOrdersVo"/>
<include refid="orderQueryWhere"/>
order by created_at desc, id desc
</select>
<select id="selectOrderStatistics" parameterType="UsdtOrders" resultType="java.util.LinkedHashMap">
select count(*) as total,
coalesce(sum(case when status = 1 then 1 else 0 end), 0) as pending,
coalesce(sum(case when status = 2 then 1 else 0 end), 0) as paid,
coalesce(sum(case when status = 3 then 1 else 0 end), 0) as expired,
cast(coalesce(sum(case when status = 2 then actual_amount else 0 end), 0) as char) as receivedAmount,
coalesce(sum(case when status = 2 and (callback_confirm is null or callback_confirm != 1) then 1 else 0 end), 0) as callbackPending
from orders
<include refid="orderQueryWhere"/>
</select> </select>
<select id="selectUsdtOrdersById" parameterType="Long" resultMap="UsdtOrdersResult"> <select id="selectUsdtOrdersById" parameterType="Long" resultMap="UsdtOrdersResult">