feat(agent): 代理佣金列表增加

main-p
shi 2025-03-04 14:40:36 +08:00
parent 9ef8d8c2e5
commit 8289375ff2
5 changed files with 367 additions and 100 deletions

View File

@ -12,6 +12,8 @@ import com.ff.agent.service.ITenantAgentWithdrawalService;
import com.ff.base.annotation.Excel;
import com.ff.base.constant.Constants;
import com.ff.base.enums.CommissionApprovalStatus;
import com.ff.base.enums.CommissionSourceType;
import com.ff.base.enums.CommissionType;
import com.ff.base.system.domain.TenantAgent;
import com.ff.base.system.service.ITenantAgentService;
import com.github.pagehelper.util.StringUtil;
@ -59,14 +61,40 @@ public class TenantAgentCommissionController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('agent:commission:list')")
@GetMapping("/list")
public TableDataInfo list(TenantAgentCommission tenantAgentCommission) {
public AjaxResult list(TenantAgentCommission tenantAgentCommission) {
startPage();
tenantAgentCommission.setAgentId(getUserId());
List<TenantAgentCommission> list = tenantAgentCommissionService.selectTenantAgentCommissionList(tenantAgentCommission);
return getDataTable(list);
//未提现佣金
tenantAgentCommission.setApprovalStatus(CommissionApprovalStatus.UNWITHDRAWN.getValue());
BigDecimal unwithdrawn = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
//已提现佣金
tenantAgentCommission.setApprovalStatus(CommissionApprovalStatus.WITHDRAWN.getValue());
BigDecimal withdrawn = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
//总佣金
tenantAgentCommission.setApprovalStatus(null);
BigDecimal total = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
// 邀请佣金
tenantAgentCommission.setCommissionType(CommissionType.INVITE.getValue());
BigDecimal invite = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
//抽成佣金
tenantAgentCommission.setCommissionType(CommissionType.TAKE.getValue());
BigDecimal take = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
TableDataInfo dataTable = getDataTable(list);
AjaxResult ajaxResult = success(dataTable);
ajaxResult.put("unwithdrawn", unwithdrawn);
ajaxResult.put("withdrawn", withdrawn);
ajaxResult.put("total", total);
ajaxResult.put("invite", invite);
ajaxResult.put("take", take);
return ajaxResult;
}
/**
*
*/

View File

@ -1,5 +1,6 @@
package com.ff.agent.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.ff.agent.domain.TenantAgentCommission;
@ -58,4 +59,14 @@ public interface TenantAgentCommissionMapper
* @return
*/
int deleteTenantAgentCommissionByIds(Long[] ids);
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission);
}

View File

@ -1,5 +1,6 @@
package com.ff.agent.service;
import java.math.BigDecimal;
import java.util.List;
import com.ff.agent.domain.TenantAgentCommission;
@ -27,6 +28,15 @@ public interface ITenantAgentCommissionService
*/
List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission);
/**
*
*

View File

@ -1,5 +1,6 @@
package com.ff.agent.service.impl;
import java.math.BigDecimal;
import java.util.List;
import cn.hutool.core.util.IdUtil;
@ -46,6 +47,17 @@ public class TenantAgentCommissionServiceImpl implements ITenantAgentCommissionS
return tenantAgentCommissionMapper.selectTenantAgentCommissionList(tenantAgentCommission);
}
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
@Override
public BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission) {
return tenantAgentCommissionMapper.getAgentCommissionSum(tenantAgentCommission);
}
/**
*
*

View File

@ -1,58 +1,102 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ff.agent.mapper.TenantAgentCommissionMapper">
<resultMap type="TenantAgentCommission" id="TenantAgentCommissionResult">
<result property="id" column="id" />
<result property="agentId" column="agent_id" />
<result property="sourceId" column="source_id" />
<result property="sourceType" column="source_type" />
<result property="commissionType" column="commission_type" />
<result property="currencyCode" column="currency_code" />
<result property="platformCode" column="platform—_code" />
<result property="costBalance" column="cost_balance" />
<result property="merchantBalance" column="merchant_balance" />
<result property="balance" column="balance" />
<result property="commissionBalance" column="commission_balance" />
<result property="usdtBalance" column="usdt_balance" />
<result property="approvalStatus" column="approval_status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="agentWithdrawalId" column="agent_withdrawal_id" />
<result property="id" column="id"/>
<result property="agentId" column="agent_id"/>
<result property="sourceId" column="source_id"/>
<result property="sourceType" column="source_type"/>
<result property="commissionType" column="commission_type"/>
<result property="currencyCode" column="currency_code"/>
<result property="platformCode" column="platform—_code"/>
<result property="costBalance" column="cost_balance"/>
<result property="merchantBalance" column="merchant_balance"/>
<result property="balance" column="balance"/>
<result property="commissionBalance" column="commission_balance"/>
<result property="usdtBalance" column="usdt_balance"/>
<result property="approvalStatus" column="approval_status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="agentWithdrawalId" column="agent_withdrawal_id"/>
</resultMap>
<sql id="selectTenantAgentCommissionVo">
select id,agent_withdrawal_id,agent_id, source_id, source_type, commission_type, currency_code, platform_code, cost_balance, merchant_balance, balance, commission_balance, usdt_balance, approval_status, create_by, create_time, update_by, update_time from ff_tenant_agent_commission
select id,
agent_withdrawal_id,
agent_id,
source_id,
source_type,
commission_type,
currency_code,
platform_code,
cost_balance,
merchant_balance,
balance,
commission_balance,
usdt_balance,
approval_status,
create_by,
create_time,
update_by,
update_time
from ff_tenant_agent_commission
</sql>
<select id="selectTenantAgentCommissionList" parameterType="TenantAgentCommission" resultMap="TenantAgentCommissionResult">
<select id="selectTenantAgentCommissionList" parameterType="TenantAgentCommission"
resultMap="TenantAgentCommissionResult">
<include refid="selectTenantAgentCommissionVo"/>
<where>
<if test="agentId != null"> and agent_id = #{agentId}</if>
<if test="sourceId != null "> and source_id = #{sourceId}</if>
<if test="sourceType != null "> and source_type = #{sourceType}</if>
<if test="commissionType != null "> and commission_type = #{commissionType}</if>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="platformCode != null and platformCode != ''"> and platform—_code = #{platformCode}</if>
<if test="costBalance != null "> and cost_balance = #{costBalance}</if>
<if test="merchantBalance != null "> and merchant_balance = #{merchantBalance}</if>
<if test="balance != null "> and balance = #{balance}</if>
<if test="commissionBalance != null "> and commission_balance = #{commissionBalance}</if>
<if test="usdtBalance != null "> and usdt_balance = #{usdtBalance}</if>
<if test="approvalStatus != null "> and approval_status = #{approvalStatus}</if>
<if test="params.beginTime != null "><!-- 开始时间检索 -->
<if test="agentId != null">
and agent_id = #{agentId}
</if>
<if test="sourceId != null ">
and source_id = #{sourceId}
</if>
<if test="sourceType != null ">
and source_type = #{sourceType}
</if>
<if test="commissionType != null ">
and commission_type = #{commissionType}
</if>
<if test="currencyCode != null and currencyCode != ''">
and currency_code = #{currencyCode}
</if>
<if test="platformCode != null and platformCode != ''">
and platform—_code = #{platformCode}
</if>
<if test="costBalance != null ">
and cost_balance = #{costBalance}
</if>
<if test="merchantBalance != null ">
and merchant_balance = #{merchantBalance}
</if>
<if test="balance != null ">
and balance = #{balance}
</if>
<if test="commissionBalance != null ">
and commission_balance = #{commissionBalance}
</if>
<if test="usdtBalance != null ">
and usdt_balance = #{usdtBalance}
</if>
<if test="approvalStatus != null ">
and approval_status = #{approvalStatus}
</if>
<if test="params.beginTime != null ">
<!-- 开始时间检索 -->
and create_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null "><!-- 结束时间检索 -->
<if test="params.endTime != null ">
<!-- 结束时间检索 -->
and create_time &lt;= #{params.endTime}
</if>
<if test="agentWithdrawalId != null"> and agent_withdrawal_id = #{agentWithdrawalId}</if>
<if test="agentWithdrawalId != null">
and agent_withdrawal_id = #{agentWithdrawalId}
</if>
</where>
</select>
@ -61,76 +105,238 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="getAgentCommissionSum" parameterType="Long" resultMap="TenantAgentCommissionResult">
select sum(commission_balance)
from ff_tenant_agent_commission
<where>
<if test="agentId != null">
and agent_id = #{agentId}
</if>
<if test="sourceId != null ">
and source_id = #{sourceId}
</if>
<if test="sourceType != null ">
and source_type = #{sourceType}
</if>
<if test="commissionType != null ">
and commission_type = #{commissionType}
</if>
<if test="currencyCode != null and currencyCode != ''">
and currency_code = #{currencyCode}
</if>
<if test="platformCode != null and platformCode != ''">
and platform—_code = #{platformCode}
</if>
<if test="costBalance != null ">
and cost_balance = #{costBalance}
</if>
<if test="merchantBalance != null ">
and merchant_balance = #{merchantBalance}
</if>
<if test="balance != null ">
and balance = #{balance}
</if>
<if test="commissionBalance != null ">
and commission_balance = #{commissionBalance}
</if>
<if test="usdtBalance != null ">
and usdt_balance = #{usdtBalance}
</if>
<if test="approvalStatus != null ">
and approval_status = #{approvalStatus}
</if>
<if test="params.beginTime != null ">
<!-- 开始时间检索 -->
and create_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null ">
<!-- 结束时间检索 -->
and create_time &lt;= #{params.endTime}
</if>
<if test="agentWithdrawalId != null">
and agent_withdrawal_id = #{agentWithdrawalId}
</if>
</where>
</select>
<insert id="insertTenantAgentCommission" parameterType="TenantAgentCommission">
insert into ff_tenant_agent_commission
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="agentId != null">agent_id,</if>
<if test="sourceId != null">source_id,</if>
<if test="sourceType != null">source_type,</if>
<if test="commissionType != null">commission_type,</if>
<if test="currencyCode != null">currency_code,</if>
<if test="platformCode != null">platform—_code,</if>
<if test="costBalance != null">cost_balance,</if>
<if test="merchantBalance != null">merchant_balance,</if>
<if test="balance != null">balance,</if>
<if test="commissionBalance != null">commission_balance,</if>
<if test="usdtBalance != null">usdt_balance,</if>
<if test="approvalStatus != null">approval_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="agentWithdrawalId != null">agent_withdrawal_id,</if>
</trim>
<if test="id != null">
id,
</if>
<if test="agentId != null">
agent_id,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="sourceType != null">
source_type,
</if>
<if test="commissionType != null">
commission_type,
</if>
<if test="currencyCode != null">
currency_code,
</if>
<if test="platformCode != null">
platform—_code,
</if>
<if test="costBalance != null">
cost_balance,
</if>
<if test="merchantBalance != null">
merchant_balance,
</if>
<if test="balance != null">
balance,
</if>
<if test="commissionBalance != null">
commission_balance,
</if>
<if test="usdtBalance != null">
usdt_balance,
</if>
<if test="approvalStatus != null">
approval_status,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="agentWithdrawalId != null">
agent_withdrawal_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="agentId != null">#{agentId},</if>
<if test="sourceId != null">#{sourceId},</if>
<if test="sourceType != null">#{sourceType},</if>
<if test="commissionType != null">#{commissionType},</if>
<if test="currencyCode != null">#{currencyCode},</if>
<if test="platformCode != null">#{platformCode},</if>
<if test="costBalance != null">#{costBalance},</if>
<if test="merchantBalance != null">#{merchantBalance},</if>
<if test="balance != null">#{balance},</if>
<if test="commissionBalance != null">#{commissionBalance},</if>
<if test="usdtBalance != null">#{usdtBalance},</if>
<if test="approvalStatus != null">#{approvalStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="agentWithdrawalId != null">#{agentWithdrawalId},</if>
</trim>
<if test="id != null">
#{id},
</if>
<if test="agentId != null">
#{agentId},
</if>
<if test="sourceId != null">
#{sourceId},
</if>
<if test="sourceType != null">
#{sourceType},
</if>
<if test="commissionType != null">
#{commissionType},
</if>
<if test="currencyCode != null">
#{currencyCode},
</if>
<if test="platformCode != null">
#{platformCode},
</if>
<if test="costBalance != null">
#{costBalance},
</if>
<if test="merchantBalance != null">
#{merchantBalance},
</if>
<if test="balance != null">
#{balance},
</if>
<if test="commissionBalance != null">
#{commissionBalance},
</if>
<if test="usdtBalance != null">
#{usdtBalance},
</if>
<if test="approvalStatus != null">
#{approvalStatus},
</if>
<if test="createBy != null">
#{createBy},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="agentWithdrawalId != null">
#{agentWithdrawalId},
</if>
</trim>
</insert>
<update id="updateTenantAgentCommission" parameterType="TenantAgentCommission">
update ff_tenant_agent_commission
<trim prefix="SET" suffixOverrides=",">
<if test="agentId != null">agent_id = #{agentId},</if>
<if test="sourceId != null">source_id = #{sourceId},</if>
<if test="sourceType != null">source_type = #{sourceType},</if>
<if test="commissionType != null">commission_type = #{commissionType},</if>
<if test="currencyCode != null">currency_code = #{currencyCode},</if>
<if test="platformCode != null">platform—_code = #{platformCode},</if>
<if test="costBalance != null">cost_balance = #{costBalance},</if>
<if test="merchantBalance != null">merchant_balance = #{merchantBalance},</if>
<if test="balance != null">balance = #{balance},</if>
<if test="commissionBalance != null">commission_balance = #{commissionBalance},</if>
<if test="usdtBalance != null">usdt_balance = #{usdtBalance},</if>
<if test="approvalStatus != null">approval_status = #{approvalStatus},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="agentWithdrawalId != null">agent_withdrawal_id = #{agentWithdrawalId},</if>
<if test="agentId != null">
agent_id = #{agentId},
</if>
<if test="sourceId != null">
source_id = #{sourceId},
</if>
<if test="sourceType != null">
source_type = #{sourceType},
</if>
<if test="commissionType != null">
commission_type = #{commissionType},
</if>
<if test="currencyCode != null">
currency_code = #{currencyCode},
</if>
<if test="platformCode != null">
platform—_code = #{platformCode},
</if>
<if test="costBalance != null">
cost_balance = #{costBalance},
</if>
<if test="merchantBalance != null">
merchant_balance = #{merchantBalance},
</if>
<if test="balance != null">
balance = #{balance},
</if>
<if test="commissionBalance != null">
commission_balance = #{commissionBalance},
</if>
<if test="usdtBalance != null">
usdt_balance = #{usdtBalance},
</if>
<if test="approvalStatus != null">
approval_status = #{approvalStatus},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="agentWithdrawalId != null">
agent_withdrawal_id = #{agentWithdrawalId},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTenantAgentCommissionById" parameterType="Long">
delete from ff_tenant_agent_commission where id = #{id}
delete
from ff_tenant_agent_commission
where id = #{id}
</delete>
<delete id="deleteTenantAgentCommissionByIds" parameterType="String">