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.annotation.Excel;
import com.ff.base.constant.Constants; import com.ff.base.constant.Constants;
import com.ff.base.enums.CommissionApprovalStatus; 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.domain.TenantAgent;
import com.ff.base.system.service.ITenantAgentService; import com.ff.base.system.service.ITenantAgentService;
import com.github.pagehelper.util.StringUtil; import com.github.pagehelper.util.StringUtil;
@ -59,14 +61,40 @@ public class TenantAgentCommissionController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('agent:commission:list')") @PreAuthorize("@ss.hasPermi('agent:commission:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(TenantAgentCommission tenantAgentCommission) { public AjaxResult list(TenantAgentCommission tenantAgentCommission) {
startPage(); startPage();
tenantAgentCommission.setAgentId(getUserId()); tenantAgentCommission.setAgentId(getUserId());
List<TenantAgentCommission> list = tenantAgentCommissionService.selectTenantAgentCommissionList(tenantAgentCommission); 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; package com.ff.agent.mapper;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.ff.agent.domain.TenantAgentCommission; import com.ff.agent.domain.TenantAgentCommission;
@ -58,4 +59,14 @@ public interface TenantAgentCommissionMapper
* @return * @return
*/ */
int deleteTenantAgentCommissionByIds(Long[] ids); int deleteTenantAgentCommissionByIds(Long[] ids);
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission);
} }

View File

@ -1,5 +1,6 @@
package com.ff.agent.service; package com.ff.agent.service;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.ff.agent.domain.TenantAgentCommission; import com.ff.agent.domain.TenantAgentCommission;
@ -27,6 +28,15 @@ public interface ITenantAgentCommissionService
*/ */
List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission); 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; package com.ff.agent.service.impl;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
@ -46,6 +47,17 @@ public class TenantAgentCommissionServiceImpl implements ITenantAgentCommissionS
return tenantAgentCommissionMapper.selectTenantAgentCommissionList(tenantAgentCommission); 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" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ff.agent.mapper.TenantAgentCommissionMapper"> <mapper namespace="com.ff.agent.mapper.TenantAgentCommissionMapper">
<resultMap type="TenantAgentCommission" id="TenantAgentCommissionResult"> <resultMap type="TenantAgentCommission" id="TenantAgentCommissionResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="agentId" column="agent_id" /> <result property="agentId" column="agent_id"/>
<result property="sourceId" column="source_id" /> <result property="sourceId" column="source_id"/>
<result property="sourceType" column="source_type" /> <result property="sourceType" column="source_type"/>
<result property="commissionType" column="commission_type" /> <result property="commissionType" column="commission_type"/>
<result property="currencyCode" column="currency_code" /> <result property="currencyCode" column="currency_code"/>
<result property="platformCode" column="platform—_code" /> <result property="platformCode" column="platform—_code"/>
<result property="costBalance" column="cost_balance" /> <result property="costBalance" column="cost_balance"/>
<result property="merchantBalance" column="merchant_balance" /> <result property="merchantBalance" column="merchant_balance"/>
<result property="balance" column="balance" /> <result property="balance" column="balance"/>
<result property="commissionBalance" column="commission_balance" /> <result property="commissionBalance" column="commission_balance"/>
<result property="usdtBalance" column="usdt_balance" /> <result property="usdtBalance" column="usdt_balance"/>
<result property="approvalStatus" column="approval_status" /> <result property="approvalStatus" column="approval_status"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="agentWithdrawalId" column="agent_withdrawal_id" /> <result property="agentWithdrawalId" column="agent_withdrawal_id"/>
</resultMap> </resultMap>
<sql id="selectTenantAgentCommissionVo"> <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> </sql>
<select id="selectTenantAgentCommissionList" parameterType="TenantAgentCommission" resultMap="TenantAgentCommissionResult"> <select id="selectTenantAgentCommissionList" parameterType="TenantAgentCommission"
resultMap="TenantAgentCommissionResult">
<include refid="selectTenantAgentCommissionVo"/> <include refid="selectTenantAgentCommissionVo"/>
<where> <where>
<if test="agentId != null"> and agent_id = #{agentId}</if> <if test="agentId != null">
<if test="sourceId != null "> and source_id = #{sourceId}</if> and agent_id = #{agentId}
<if test="sourceType != null "> and source_type = #{sourceType}</if> </if>
<if test="commissionType != null "> and commission_type = #{commissionType}</if> <if test="sourceId != null ">
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if> and source_id = #{sourceId}
<if test="platformCode != null and platformCode != ''"> and platform—_code = #{platformCode}</if> </if>
<if test="costBalance != null "> and cost_balance = #{costBalance}</if> <if test="sourceType != null ">
<if test="merchantBalance != null "> and merchant_balance = #{merchantBalance}</if> and source_type = #{sourceType}
<if test="balance != null "> and balance = #{balance}</if> </if>
<if test="commissionBalance != null "> and commission_balance = #{commissionBalance}</if> <if test="commissionType != null ">
<if test="usdtBalance != null "> and usdt_balance = #{usdtBalance}</if> and commission_type = #{commissionType}
<if test="approvalStatus != null "> and approval_status = #{approvalStatus}</if> </if>
<if test="params.beginTime != null "><!-- 开始时间检索 --> <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} and create_time &gt;= #{params.beginTime}
</if> </if>
<if test="params.endTime != null "><!-- 结束时间检索 --> <if test="params.endTime != null ">
<!-- 结束时间检索 -->
and create_time &lt;= #{params.endTime} and create_time &lt;= #{params.endTime}
</if> </if>
<if test="agentWithdrawalId != null"> and agent_withdrawal_id = #{agentWithdrawalId}</if> <if test="agentWithdrawalId != null">
and agent_withdrawal_id = #{agentWithdrawalId}
</if>
</where> </where>
</select> </select>
@ -61,76 +105,238 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </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 id="insertTenantAgentCommission" parameterType="TenantAgentCommission">
insert into ff_tenant_agent_commission insert into ff_tenant_agent_commission
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">
<if test="agentId != null">agent_id,</if> id,
<if test="sourceId != null">source_id,</if> </if>
<if test="sourceType != null">source_type,</if> <if test="agentId != null">
<if test="commissionType != null">commission_type,</if> agent_id,
<if test="currencyCode != null">currency_code,</if> </if>
<if test="platformCode != null">platform—_code,</if> <if test="sourceId != null">
<if test="costBalance != null">cost_balance,</if> source_id,
<if test="merchantBalance != null">merchant_balance,</if> </if>
<if test="balance != null">balance,</if> <if test="sourceType != null">
<if test="commissionBalance != null">commission_balance,</if> source_type,
<if test="usdtBalance != null">usdt_balance,</if> </if>
<if test="approvalStatus != null">approval_status,</if> <if test="commissionType != null">
<if test="createBy != null">create_by,</if> commission_type,
<if test="createTime != null">create_time,</if> </if>
<if test="updateBy != null">update_by,</if> <if test="currencyCode != null">
<if test="updateTime != null">update_time,</if> currency_code,
<if test="agentWithdrawalId != null">agent_withdrawal_id,</if> </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>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">
<if test="agentId != null">#{agentId},</if> #{id},
<if test="sourceId != null">#{sourceId},</if> </if>
<if test="sourceType != null">#{sourceType},</if> <if test="agentId != null">
<if test="commissionType != null">#{commissionType},</if> #{agentId},
<if test="currencyCode != null">#{currencyCode},</if> </if>
<if test="platformCode != null">#{platformCode},</if> <if test="sourceId != null">
<if test="costBalance != null">#{costBalance},</if> #{sourceId},
<if test="merchantBalance != null">#{merchantBalance},</if> </if>
<if test="balance != null">#{balance},</if> <if test="sourceType != null">
<if test="commissionBalance != null">#{commissionBalance},</if> #{sourceType},
<if test="usdtBalance != null">#{usdtBalance},</if> </if>
<if test="approvalStatus != null">#{approvalStatus},</if> <if test="commissionType != null">
<if test="createBy != null">#{createBy},</if> #{commissionType},
<if test="createTime != null">#{createTime},</if> </if>
<if test="updateBy != null">#{updateBy},</if> <if test="currencyCode != null">
<if test="updateTime != null">#{updateTime},</if> #{currencyCode},
<if test="agentWithdrawalId != null">#{agentWithdrawalId},</if> </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> </trim>
</insert> </insert>
<update id="updateTenantAgentCommission" parameterType="TenantAgentCommission"> <update id="updateTenantAgentCommission" parameterType="TenantAgentCommission">
update ff_tenant_agent_commission update ff_tenant_agent_commission
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="agentId != null">agent_id = #{agentId},</if> <if test="agentId != null">
<if test="sourceId != null">source_id = #{sourceId},</if> agent_id = #{agentId},
<if test="sourceType != null">source_type = #{sourceType},</if> </if>
<if test="commissionType != null">commission_type = #{commissionType},</if> <if test="sourceId != null">
<if test="currencyCode != null">currency_code = #{currencyCode},</if> source_id = #{sourceId},
<if test="platformCode != null">platform—_code = #{platformCode},</if> </if>
<if test="costBalance != null">cost_balance = #{costBalance},</if> <if test="sourceType != null">
<if test="merchantBalance != null">merchant_balance = #{merchantBalance},</if> source_type = #{sourceType},
<if test="balance != null">balance = #{balance},</if> </if>
<if test="commissionBalance != null">commission_balance = #{commissionBalance},</if> <if test="commissionType != null">
<if test="usdtBalance != null">usdt_balance = #{usdtBalance},</if> commission_type = #{commissionType},
<if test="approvalStatus != null">approval_status = #{approvalStatus},</if> </if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="currencyCode != null">
<if test="createTime != null">create_time = #{createTime},</if> currency_code = #{currencyCode},
<if test="updateBy != null">update_by = #{updateBy},</if> </if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="platformCode != null">
<if test="agentWithdrawalId != null">agent_withdrawal_id = #{agentWithdrawalId},</if> 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> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteTenantAgentCommissionById" parameterType="Long"> <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>
<delete id="deleteTenantAgentCommissionByIds" parameterType="String"> <delete id="deleteTenantAgentCommissionByIds" parameterType="String">