Merge remote-tracking branch 'origin/main'

main-p
998998 2025-03-04 15:35:15 +08:00
commit 9956a27d2a
327 changed files with 8062 additions and 1032 deletions

View File

@ -1,124 +0,0 @@
package com.ff.agent.contoller;
import cn.hutool.core.util.IdUtil;
import com.ff.agent.dto.AgentTenantSecretKeyDTO;
import com.ff.agent.request.AgentCreateTenantRequest;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.core.page.TableDataInfo;
import com.ff.base.system.dto.TenantSecretKeyDTO;
import com.ff.base.system.service.ISysDeptService;
import com.ff.base.system.service.ISysRoleService;
import com.ff.base.system.service.ISysUserService;
import com.ff.base.utils.MessageUtils;
import com.ff.base.utils.SecurityUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.base.utils.uuid.IdUtils;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.base.system.service.ITenantSecretKeyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* api
*
* @author shi
* @date 2025/02/10
*/
@RestController
@RequestMapping("/agent/tenant")
@Slf4j
public class AgentController extends BaseController {
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
@Resource
private ISysRoleService roleService;
@Resource
private ISysDeptService deptService;
@Resource
private ISysUserService userService;
/**
*
*
* @param tenantSecretKeyDTO
* @return {@link TableDataInfo }
*/
@GetMapping("/list")
@Transactional
@PreAuthorize("@ss.hasPermi('agent:tenant:list')")
public TableDataInfo list(TenantSecretKeyDTO tenantSecretKeyDTO) {
startPage();
tenantSecretKeyDTO.setAgentId(getUserId());
List<TenantSecretKey> tenantSecretKeys = tenantSecretKeyService.selectTenantSecretKeyDTOList(tenantSecretKeyDTO);
TableDataInfo dataTable = getDataTable(tenantSecretKeys);
List<AgentTenantSecretKeyDTO> list=new ArrayList<>();
for (TenantSecretKey row : (List<TenantSecretKey>) dataTable.getRows()) {
AgentTenantSecretKeyDTO agentTenantSecretKeyDTO=new AgentTenantSecretKeyDTO();
BeanUtils.copyProperties(row, agentTenantSecretKeyDTO);
list.add(agentTenantSecretKeyDTO);
}
dataTable.setRows(list);
return dataTable;
}
/**
*
*
* @return {@link AjaxResult }
*/
@PostMapping("/create")
@Transactional
@PreAuthorize("@ss.hasPermi('agent:tenant:create')")
public AjaxResult createTenant(@Validated @RequestBody AgentCreateTenantRequest agentCreateTenantRequest) {
Assert.isTrue(CollectionUtils.isEmpty(tenantSecretKeyService.selectTenantSecretKeyList(TenantSecretKey.builder()
.tenantKey(agentCreateTenantRequest.getAccount())
.build())), MessageUtils.message("operation.tenant.account.already.used"));
Assert.isTrue(agentCreateTenantRequest.getPassword().equals(agentCreateTenantRequest.getConfirmPassword()),MessageUtils.message("operation.password.mismatch"));
//创建租户
TenantSecretKey tenantSecretKey = new TenantSecretKey();
tenantSecretKey.setAgentId(getUserId());
tenantSecretKey.setTenantKey(agentCreateTenantRequest.getAccount());
tenantSecretKey.setPassword(SecurityUtils.encryptPassword(agentCreateTenantRequest.getPassword()));
tenantSecretKey.setTenantSn(tenantSecretKeyService.generateTenantSn());
tenantSecretKey.setTenantSecret(IdUtils.simpleUUID());
tenantSecretKey.setDepositRatio(agentCreateTenantRequest.getDepositRatio());
tenantSecretKey.setTenantType(agentCreateTenantRequest.getTenantType());
tenantSecretKey.setCreateBy(getUsername());
tenantSecretKey.setTenantStatus(Boolean.TRUE);
int insertedTenantSecretKey = tenantSecretKeyService.insertTenantSecretKey(tenantSecretKey);
return toAjax(insertedTenantSecretKey);
}
}

View File

@ -1,104 +0,0 @@
package com.ff.common.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-11
*/
@RestController
@RequestMapping("/common/key")
public class TenantSecretKeyController extends BaseController
{
@Autowired
private ITenantSecretKeyService tenantSecretKeyService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:key:list')")
@GetMapping("/list")
public TableDataInfo list(TenantSecretKey tenantSecretKey)
{
startPage();
List<TenantSecretKey> list = tenantSecretKeyService.selectTenantSecretKeyList(tenantSecretKey);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:key:export')")
@Log(title = "用户租户密钥", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TenantSecretKey tenantSecretKey)
{
List<TenantSecretKey> list = tenantSecretKeyService.selectTenantSecretKeyList(tenantSecretKey);
ExcelUtil<TenantSecretKey> util = new ExcelUtil<TenantSecretKey>(TenantSecretKey.class);
util.exportExcel(response, list, "用户租户密钥数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:key:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tenantSecretKeyService.selectTenantSecretKeyById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:key:add')")
@Log(title = "用户租户密钥", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TenantSecretKey tenantSecretKey)
{
return toAjax(tenantSecretKeyService.insertTenantSecretKey(tenantSecretKey));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:key:edit')")
@Log(title = "用户租户密钥", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TenantSecretKey tenantSecretKey)
{
return toAjax(tenantSecretKeyService.updateTenantSecretKey(tenantSecretKey));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:key:remove')")
@Log(title = "用户租户密钥", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tenantSecretKeyService.deleteTenantSecretKeyByIds(ids));
}
}

View File

@ -1,40 +0,0 @@
package com.ff.common.domain;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_agent
*
* @author shi
* @date 2025-02-20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantAgent extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 账号 */
@Excel(name = "账号")
private String account;
/** 密码 */
@Excel(name = "密码")
private String password;
/** 代理状态 1正常 0停用 */
@Excel(name = "代理状态 1正常 0停用")
private Boolean agentStatus;
}

View File

@ -1,104 +0,0 @@
package com.ff.member.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-10
*/
@RestController
@RequestMapping("/member/member")
public class MemberController extends BaseController
{
@Autowired
private IMemberService memberService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('member:member:list')")
@GetMapping("/list")
public TableDataInfo list(Member member)
{
startPage();
List<Member> list = memberService.selectMemberList(member);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('member:member:export')")
@Log(title = "会员", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Member member)
{
List<Member> list = memberService.selectMemberList(member);
ExcelUtil<Member> util = new ExcelUtil<Member>(Member.class);
util.exportExcel(response, list, "会员数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('member:member:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(memberService.selectMemberById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('member:member:add')")
@Log(title = "会员", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Member member)
{
return toAjax(memberService.insertMember(member));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('member:member:edit')")
@Log(title = "会员", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Member member)
{
return toAjax(memberService.updateMember(member));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('member:member:remove')")
@Log(title = "会员", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(memberService.deleteMemberByIds(ids));
}
}

View File

@ -1,82 +0,0 @@
<?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">
<mapper namespace="com.ff.common.mapper.TenantAgentMapper">
<resultMap type="TenantAgent" id="TenantAgentResult">
<result property="id" column="id" />
<result property="account" column="account" />
<result property="password" column="password" />
<result property="agentStatus" column="agent_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" />
</resultMap>
<sql id="selectTenantAgentVo">
select id, account, password, agent_status, create_by, create_time, update_by, update_time from ff_tenant_agent
</sql>
<select id="selectTenantAgentList" parameterType="TenantAgent" resultMap="TenantAgentResult">
<include refid="selectTenantAgentVo"/>
<where>
<if test="account != null and account != ''"> and account = #{account}</if>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="agentStatus != null "> and agent_status = #{agentStatus}</if>
</where>
</select>
<select id="selectTenantAgentById" parameterType="Long" resultMap="TenantAgentResult">
<include refid="selectTenantAgentVo"/>
where id = #{id}
</select>
<insert id="insertTenantAgent" parameterType="TenantAgent" useGeneratedKeys="true" keyProperty="id">
insert into ff_tenant_agent
<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if>
<if test="account != null">account,</if>
<if test="password != null">password,</if>
<if test="agentStatus != null">agent_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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if>
<if test="account != null">#{account},</if>
<if test="password != null">#{password},</if>
<if test="agentStatus != null">#{agentStatus},</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>
</trim>
</insert>
<update id="updateTenantAgent" parameterType="TenantAgent">
update ff_tenant_agent
<trim prefix="SET" suffixOverrides=",">
<if test="account != null">account = #{account},</if>
<if test="password != null">password = #{password},</if>
<if test="agentStatus != null">agent_status = #{agentStatus},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteTenantAgentById" parameterType="Long">
delete from ff_tenant_agent where id = #{id}
</delete>
<delete id="deleteTenantAgentByIds" parameterType="String">
delete from ff_tenant_agent where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,156 +0,0 @@
<?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">
<mapper namespace="com.ff.common.mapper.TenantGameQuotaFlowMapper">
<resultMap type="TenantGameQuotaFlow" id="TenantGameQuotaFlowResult">
<result property="id" column="id" />
<result property="tenantKey" column="tenant_key" />
<result property="quotaType" column="quota_type" />
<result property="memberId" column="member_id" />
<result property="platformCode" column="platform_code" />
<result property="currencyCode" column="currency_code" />
<result property="isOut" column="is_out" />
<result property="operationType" column="operation_type" />
<result property="balanceBefore" column="balance_before" />
<result property="balance" column="balance" />
<result property="exchangeRatio" column="exchange_ratio" />
<result property="exchangeMoney" column="exchange_money" />
<result property="balanceAfter" column="balance_after" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTenantGameQuotaFlowVo">
select id, tenant_key, quota_type, member_id, platform_code, currency_code, is_out, operation_type, balance_before, balance, exchange_ratio, exchange_money, balance_after, remark, create_by, create_time, update_by, update_time from ff_tenant_game_quota_flow
</sql>
<select id="selectTenantGameQuotaFlowList" parameterType="TenantGameQuotaFlow" resultMap="TenantGameQuotaFlowResult">
<include refid="selectTenantGameQuotaFlowVo"/>
<where>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="quotaType != null and quotaType != ''"> and quota_type = #{quotaType}</if>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="platformCode != null and platformCode != ''"> and platform_code = #{platformCode}</if>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="isOut != null "> and is_out = #{isOut}</if>
<if test="operationType != null "> and operation_type = #{operationType}</if>
<if test="balanceBefore != null "> and balance_before = #{balanceBefore}</if>
<if test="balance != null "> and balance = #{balance}</if>
<if test="exchangeRatio != null "> and exchange_ratio = #{exchangeRatio}</if>
<if test="exchangeMoney != null "> and exchange_money = #{exchangeMoney}</if>
<if test="balanceAfter != null "> and balance_after = #{balanceAfter}</if>
</where>
</select>
<select id="selectTenantGameQuotaFlowById" parameterType="Long" resultMap="TenantGameQuotaFlowResult">
<include refid="selectTenantGameQuotaFlowVo"/>
where id = #{id}
</select>
<insert id="insertTenantGameQuotaFlow" parameterType="TenantGameQuotaFlow" useGeneratedKeys="true" keyProperty="id">
insert into ff_tenant_game_quota_flow
<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if>
<if test="tenantKey != null and tenantKey != ''">tenant_key,</if>
<if test="quotaType != null">quota_type,</if>
<if test="memberId != null">member_id,</if>
<if test="platformCode != null">platform_code,</if>
<if test="currencyCode != null">currency_code,</if>
<if test="isOut != null">is_out,</if>
<if test="operationType != null">operation_type,</if>
<if test="balanceBefore != null">balance_before,</if>
<if test="balance != null">balance,</if>
<if test="exchangeRatio != null">exchange_ratio,</if>
<if test="exchangeMoney != null">exchange_money,</if>
<if test="balanceAfter != null">balance_after,</if>
<if test="remark != null">remark,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if>
<if test="tenantKey != null and tenantKey != ''">#{tenantKey},</if>
<if test="quotaType != null">#{quotaType},</if>
<if test="memberId != null">#{memberId},</if>
<if test="platformCode != null">#{platformCode},</if>
<if test="currencyCode != null">#{currencyCode},</if>
<if test="isOut != null">#{isOut},</if>
<if test="operationType != null">#{operationType},</if>
<if test="balanceBefore != null">#{balanceBefore},</if>
<if test="balance != null">#{balance},</if>
<if test="exchangeRatio != null">#{exchangeRatio},</if>
<if test="exchangeMoney != null">#{exchangeMoney},</if>
<if test="balanceAfter != null">#{balanceAfter},</if>
<if test="remark != null">#{remark},</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>
</trim>
</insert>
<update id="updateTenantGameQuotaFlow" parameterType="TenantGameQuotaFlow">
update ff_tenant_game_quota_flow
<trim prefix="SET" suffixOverrides=",">
<if test="tenantKey != null and tenantKey != ''">tenant_key = #{tenantKey},</if>
<if test="quotaType != null">quota_type = #{quotaType},</if>
<if test="memberId != null">member_id = #{memberId},</if>
<if test="platformCode != null">platform_code = #{platformCode},</if>
<if test="currencyCode != null">currency_code = #{currencyCode},</if>
<if test="isOut != null">is_out = #{isOut},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="balanceBefore != null">balance_before = #{balanceBefore},</if>
<if test="balance != null">balance = #{balance},</if>
<if test="exchangeRatio != null">exchange_ratio = #{exchangeRatio},</if>
<if test="exchangeMoney != null">exchange_money = #{exchangeMoney},</if>
<if test="balanceAfter != null">balance_after = #{balanceAfter},</if>
<if test="remark != null">remark = #{remark},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteTenantGameQuotaFlowById" parameterType="Long">
delete from ff_tenant_game_quota_flow where id = #{id}
</delete>
<delete id="deleteTenantGameQuotaFlowByIds" parameterType="String">
delete from ff_tenant_game_quota_flow where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getExchangeMoneyByMemberId" parameterType="TenantGameQuotaFlow" resultType="java.math.BigDecimal">
select ifnull(sum(exchange_money),0) from ff_tenant_game_quota_flow
<where>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="quotaType != null and quotaType != ''"> and quota_type = #{quotaType}</if>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="isOut != null "> and is_out = #{isOut}</if>
<if test="operationType != null "> and operation_type = #{operationType}</if>
<if test="balanceBefore != null "> and balance_before = #{balanceBefore}</if>
<if test="balance != null "> and balance = #{balance}</if>
<if test="balanceAfter != null "> and balance_after = #{balanceAfter}</if>
</where>
group by member_id
</select>
<select id="getBalanceByTenantKey" resultMap="TenantGameQuotaFlowResult">
select tenant_key, sum(if(is_out,exchange_money,0))-sum(if(!is_out,exchange_money,0)) as exchange_money,currency_code
from ff_tenant_game_quota_flow
where create_time between #{params.beginTime} and #{params.endTime}
and quota_type =#{quotaType} and operation_type = #{operationType}
group by tenant_key,currency_code
</select>
</mapper>

View File

@ -1,97 +0,0 @@
<?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">
<mapper namespace="com.ff.common.mapper.TenantGameQuotaMapper">
<resultMap type="TenantGameQuota" id="TenantGameQuotaResult">
<result property="id" column="id" />
<result property="tenantKey" column="tenant_key" />
<result property="balance" column="balance" />
<result property="quotaType" column="quota_type" />
<result property="version" column="version" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTenantGameQuotaVo">
select id, tenant_key, balance, quota_type, version, create_by, create_time, update_by, update_time from ff_tenant_game_quota
</sql>
<select id="selectTenantGameQuotaByTenantKey" resultMap="TenantGameQuotaResult">
<include refid="selectTenantGameQuotaVo"/>
where tenant_key = #{tenantKey} and quota_type = #{quotaType}
</select>
<select id="selectTenantGameQuotaList" parameterType="TenantGameQuota" resultMap="TenantGameQuotaResult">
<include refid="selectTenantGameQuotaVo"/>
<where>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="balance != null "> and balance = #{balance}</if>
<if test="quotaType != null and quotaType != ''"> and quota_type = #{quotaType}</if>
<if test="version != null "> and version = #{version}</if>
</where>
</select>
<select id="selectTenantGameQuotaById" parameterType="Long" resultMap="TenantGameQuotaResult">
<include refid="selectTenantGameQuotaVo"/>
where id = #{id}
</select>
<update id="changeBalance" parameterType="TenantGameQuota">
update ff_tenant_game_quota set balance = #{balance},version =version+1
where tenant_key = #{tenantKey} and quota_type = #{quotaType} and version = #{version}
</update>
<insert id="insertTenantGameQuota" parameterType="TenantGameQuota" useGeneratedKeys="true" keyProperty="id">
insert into ff_tenant_game_quota
<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if>
<if test="tenantKey != null and tenantKey != ''">tenant_key,</if>
<if test="balance != null">balance,</if>
<if test="quotaType != null">quota_type,</if>
<if test="version != null">version,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if>
<if test="tenantKey != null and tenantKey != ''">#{tenantKey},</if>
<if test="balance != null">#{balance},</if>
<if test="quotaType != null">#{quotaType},</if>
<if test="version != null">#{version},</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>
</trim>
</insert>
<update id="updateTenantGameQuota" parameterType="TenantGameQuota">
update ff_tenant_game_quota
<trim prefix="SET" suffixOverrides=",">
<if test="tenantKey != null and tenantKey != ''">tenant_key = #{tenantKey},</if>
<if test="balance != null">balance = #{balance},</if>
<if test="quotaType != null">quota_type = #{quotaType},</if>
<if test="version != null">version = #{version},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteTenantGameQuotaById" parameterType="Long">
delete from ff_tenant_game_quota where id = #{id}
</delete>
<delete id="deleteTenantGameQuotaByIds" parameterType="String">
delete from ff_tenant_game_quota where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,137 +0,0 @@
<?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">
<mapper namespace="com.ff.game.mapper.GameExchangeMoneyMapper">
<resultMap type="GameExchangeMoney" id="GameExchangeMoneyResult">
<result property="id" column="id" />
<result property="tenantKey" column="tenant_key" />
<result property="orderId" column="order_id" />
<result property="currencyCode" column="currency_code" />
<result property="transactionId" column="transaction_id" />
<result property="memberId" column="member_id" />
<result property="platformCode" column="platform_code" />
<result property="balance" column="balance" />
<result property="quota" column="quota" />
<result property="coinBefore" column="coin_before" />
<result property="coinAfter" column="coin_after" />
<result property="currencyBefore" column="currency_before" />
<result property="currencyAfter" column="currency_after" />
<result property="exchangeType" column="exchange_type" />
<result property="status" column="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" />
</resultMap>
<sql id="selectGameExchangeMoneyVo">
select id, tenant_key,order_id, currency_code, transaction_id, member_id, platform_code, balance, quota, coin_before, coin_after, currency_before, currency_after, exchange_type, status, create_by, create_time, update_by, update_time from ff_game_exchange_money
</sql>
<select id="selectGameExchangeMoneyList" parameterType="GameExchangeMoney" resultMap="GameExchangeMoneyResult">
<include refid="selectGameExchangeMoneyVo"/>
<where>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="transactionId != null and transactionId != ''"> and transaction_id = #{transactionId}</if>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="platformCode != null and platformCode != ''"> and platform_code = #{platformCode}</if>
<if test="balance != null "> and balance = #{balance}</if>
<if test="quota != null "> and quota = #{quota}</if>
<if test="coinBefore != null "> and coin_before = #{coinBefore}</if>
<if test="coinAfter != null "> and coin_after = #{coinAfter}</if>
<if test="currencyBefore != null "> and currency_before = #{currencyBefore}</if>
<if test="currencyAfter != null "> and currency_after = #{currencyAfter}</if>
<if test="exchangeType != null "> and exchange_type = #{exchangeType}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectGameExchangeMoneyById" parameterType="Long" resultMap="GameExchangeMoneyResult">
<include refid="selectGameExchangeMoneyVo"/>
where id = #{id}
</select>
<insert id="insertGameExchangeMoney" parameterType="GameExchangeMoney" useGeneratedKeys="true" keyProperty="id">
insert into ff_game_exchange_money
<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if>
<if test="tenantKey != null">tenant_key,</if>
<if test="currencyCode != null">currency_code,</if>
<if test="orderId != null">order_id,</if>
<if test="transactionId != null">transaction_id,</if>
<if test="memberId != null">member_id,</if>
<if test="platformCode != null">platform_code,</if>
<if test="balance != null">balance,</if>
<if test="quota != null">quota,</if>
<if test="coinBefore != null">coin_before,</if>
<if test="coinAfter != null">coin_after,</if>
<if test="currencyBefore != null">currency_before,</if>
<if test="currencyAfter != null">currency_after,</if>
<if test="exchangeType != null">exchange_type,</if>
<if test="status != null">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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if>
<if test="tenantKey != null">#{tenantKey},</if>
<if test="currencyCode != null">#{currencyCode},</if>
<if test="orderId != null">#{orderId},</if>
<if test="transactionId != null">#{transactionId},</if>
<if test="memberId != null">#{memberId},</if>
<if test="platformCode != null">#{platformCode},</if>
<if test="balance != null">#{balance},</if>
<if test="quota != null">#{quota},</if>
<if test="coinBefore != null">#{coinBefore},</if>
<if test="coinAfter != null">#{coinAfter},</if>
<if test="currencyBefore != null">#{currencyBefore},</if>
<if test="currencyAfter != null">#{currencyAfter},</if>
<if test="exchangeType != null">#{exchangeType},</if>
<if test="status != null">#{status},</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>
</trim>
</insert>
<update id="updateGameExchangeMoney" parameterType="GameExchangeMoney">
update ff_game_exchange_money
<trim prefix="SET" suffixOverrides=",">
<if test="tenantKey != null">tenant_key = #{tenantKey},</if>
<if test="currencyCode != null">currency_code = #{currencyCode},</if>
<if test="orderId != null">order_id = #{orderId},</if>
<if test="transactionId != null">transaction_id = #{transactionId},</if>
<if test="memberId != null">member_id = #{memberId},</if>
<if test="platformCode != null">platform_code = #{platformCode},</if>
<if test="balance != null">balance = #{balance},</if>
<if test="quota != null">quota = #{quota},</if>
<if test="coinBefore != null">coin_before = #{coinBefore},</if>
<if test="coinAfter != null">coin_after = #{coinAfter},</if>
<if test="currencyBefore != null">currency_before = #{currencyBefore},</if>
<if test="currencyAfter != null">currency_after = #{currencyAfter},</if>
<if test="exchangeType != null">exchange_type = #{exchangeType},</if>
<if test="status != null">status = #{status},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteGameExchangeMoneyById" parameterType="Long">
delete from ff_game_exchange_money where id = #{id}
</delete>
<delete id="deleteGameExchangeMoneyByIds" parameterType="String">
delete from ff_game_exchange_money where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,8 +1,5 @@
package com.ff.base.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.constant.Constants;
import com.ff.base.interceptor.DataSourceSwitchInterceptor;
import com.ff.base.interceptor.RepeatSubmitInterceptor;
@ -10,8 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@ -19,7 +14,6 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
@ -36,6 +30,9 @@ public class ResourcesConfig implements WebMvcConfigurer
@Autowired
private DataSourceSwitchInterceptor dataSourceSwitchInterceptor;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{

View File

@ -6,6 +6,7 @@ import com.ff.base.security.filter.JwtAuthenticationTokenFilter;
import com.ff.base.security.handle.AuthenticationEntryPointImpl;
import com.ff.base.security.handle.LogoutSuccessHandlerImpl;
import com.ff.base.security.provider.MyDaoAuthenticationProvider;
import com.ff.base.web.service.AgentDetailsServiceImpl;
import com.ff.base.web.service.TenantDetailsServiceImpl;
import com.ff.base.web.service.UserDetailsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
@ -44,6 +45,11 @@ public class SecurityConfig {
@Autowired
private TenantDetailsServiceImpl tenantDetailsService;
@Autowired
private AgentDetailsServiceImpl agentDetailsService;
/**
*
*/
@ -84,6 +90,8 @@ public class SecurityConfig {
List<UserDetailsService> userDetailsServices = new ArrayList<>();
userDetailsServices.add(userDetailsService);
userDetailsServices.add(tenantDetailsService);
userDetailsServices.add(agentDetailsService);
List<AuthenticationProvider> providers = new ArrayList<>();
MyDaoAuthenticationProvider adminDaoAuthenticationProvider = new MyDaoAuthenticationProvider();
@ -97,6 +105,11 @@ public class SecurityConfig {
adminDaoAuthenticationProvider1.setPasswordEncoder(bCryptPasswordEncoder());
adminDaoAuthenticationProvider1.setUserDetailsServices(userDetailsServices);
MyDaoAuthenticationProvider adminDaoAuthenticationProvider2 = new MyDaoAuthenticationProvider();
adminDaoAuthenticationProvider2.setUserDetailsService(agentDetailsService);
adminDaoAuthenticationProvider2.setPasswordEncoder(bCryptPasswordEncoder());
adminDaoAuthenticationProvider2.setUserDetailsServices(userDetailsServices);
return new ProviderManager(providers);

View File

@ -8,68 +8,6 @@ package com.ff.base.constant;
public class ConfigConstants
{
/**
*
*/
public static final String GAME_RECHARGE = "game.recharge";
/**
*
*/
public static final String GAME_DOWNLOAD_APP = "game.download.app";
/**
*
*/
public static final String GAME_RECHARGE_DOWNLOAD_APP = "game.download.app";
/**
*
*/
public static final String GAME_ANDROID_DOWNLOAD_APP = "game.android.download.app";
/**
*
*/
public static final String HOT_ONE = "hot.one";
/**
*
*/
public static final String HOT_TWO = "hot.two";
/**
*
*/
public static final String NOTICE_ALL_DELETE_STATUS = "notice.all.delete.status";
/**
*
*/
public static final String NOTICE_ALL_READ_STATUS = "notice.all.read.status";
/**
*
*/
public static final String NOTICE_SHOW_CREATE_TIME = "notice.show.create.time";
/**
* key
*/
public static final String GAME_ACCOUNT = "game.account";
/**
*
*/
public static final String ABOUT_SWITCH = "about.switch";
/**
*
*/
public static final String SKIP_MESSAGE_CENTER = "skip.message.center";
/**
* 线
*/
public static final String OPEN_SERVICE = "open.service";
/**
@ -77,10 +15,6 @@ public class ConfigConstants
*/
public static final String VIEW_FILE_URL = "view.file.url";
/**
* H5 1 2
*/
public static final String H5_INTERCEPT_OPEN = "h5.intercept.open";
/**
* nginx
@ -91,4 +25,9 @@ public class ConfigConstants
* nginx
*/
public static final String DOMAIN_NGINX_CONFIG_PARAM = "domain.nginx.config.param";
/**
* url
*/
public static final String INVITE_URL = "invite.url";
}

View File

@ -2,6 +2,7 @@ package com.ff.base.constant;
import io.jsonwebtoken.Claims;
import java.math.BigDecimal;
import java.util.Locale;
/**
@ -261,4 +262,8 @@ public class Constants {
*
*/
public static final String TENANT_ROLE = "tenant";
/**
*
*/
public static final BigDecimal HUNDRED =new BigDecimal("100") ;
}

View File

@ -0,0 +1,25 @@
package com.ff.base.enums;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/02/26
*/
@Getter
public enum CommissionApprovalStatus {
UNWITHDRAWN(0, "未提现"),
WITHDRAWING(1, "提现中"),
WITHDRAWN(2, "已提现");
private final Integer value;
private final String description;
CommissionApprovalStatus(Integer value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -0,0 +1,23 @@
package com.ff.base.enums;
import lombok.Data;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/02/26
*/
@Getter
public enum CommissionSourceType {
AGENT_TENANT_REGISTER(1, "代理链接商户注册");
private final int value;
private final String description;
CommissionSourceType(int value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -0,0 +1,23 @@
package com.ff.base.enums;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/02/26
*/
@Getter
public enum CommissionType {
INVITE(1, "邀请"),
TAKE(2,"抽成");
private final int value;
private final String description;
CommissionType(int value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -1,5 +1,8 @@
package com.ff.base.enums;
import java.util.ArrayList;
import java.util.List;
public enum GamePlatforms {
JILI("JILI", "JILI"),
XK("XK", "XK"),
@ -14,6 +17,17 @@ public enum GamePlatforms {
this.info = info;
}
public static List<String> getCodes()
{
List<String> result=new ArrayList<>();
GamePlatforms[] values = GamePlatforms.values();
for (GamePlatforms value : values) {
result.add(value.getCode());
}
return result;
}
public String getCode()
{
return code;

View File

@ -0,0 +1,25 @@
package com.ff.base.enums;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/02/27
*/
@Getter
public enum InviteType {
TENANT(1, "租户"),
AGENT(2, "代理");
private final Integer value;
private final String description;
InviteType(Integer value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -0,0 +1,23 @@
package com.ff.base.enums;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/02/26
*/
@Getter
public enum InviterRegisterStatus {
PENDING(1, "待激活"),
ACTIVATED(2, "已激活");
private final Integer value; // 状态值
private final String description; // 状态描述
InviterRegisterStatus(Integer value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -11,7 +11,8 @@ import lombok.Getter;
@Getter
public enum OperationType {
API_BALANCE(1, "租户游玩操作余额"),
REAL_BALANCE_SETTLEMENT(2, "日用额度结算")
REAL_BALANCE_SETTLEMENT(2, "日用额度结算"),
TENANT_RECHARGE(3, "信誉额度充值")
;
private final Integer code;

View File

@ -0,0 +1,18 @@
package com.ff.base.enums;
import lombok.Getter;
@Getter
public enum Status {
PENDING(1, "待处理"),
PROCESSED(2, "已处理");
private final Integer value;
private final String description;
Status(Integer value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.annotation.Excel.ColumnType;
import com.ff.base.core.domain.BaseEntity;
@ -20,6 +22,7 @@ public class SysConfig extends BaseEntity
/** 参数主键 */
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
@JsonSerialize(using = ToStringSerializer.class)
private Long configId;
/** 参数名称 */
@ -37,7 +40,7 @@ public class SysConfig extends BaseEntity
/** 系统内置Y是 N否 */
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
private String configType;
@JsonSerialize(using = ToStringSerializer.class)
public Long getConfigId()
{
return configId;

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.Data;
@ -15,6 +17,7 @@ public class SysDatasource extends BaseEntity
private static final long serialVersionUID = 1L;
/** 主键id */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 租户id */

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -21,9 +23,11 @@ public class SysDept extends BaseEntity
private static final long serialVersionUID = 1L;
/** 部门ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long deptId;
/** 父部门ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** 祖级列表 */
@ -55,7 +59,7 @@ public class SysDept extends BaseEntity
/** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>();
@JsonSerialize(using = ToStringSerializer.class)
public Long getDeptId()
{
return deptId;
@ -65,7 +69,7 @@ public class SysDept extends BaseEntity
{
this.deptId = deptId;
}
@JsonSerialize(using = ToStringSerializer.class)
public Long getParentId()
{
return parentId;

View File

@ -1,6 +1,8 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.annotation.Excel.ColumnType;
import com.ff.base.constant.UserConstants;
@ -24,11 +26,13 @@ public class SysDictData extends BaseEntity
/** 字典编码 */
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
@JsonView(DictDataSimpleView.class)
@JsonSerialize(using = ToStringSerializer.class)
private Long dictCode;
/** 字典排序 */
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
@JsonView(DictDataSimpleView.class)
@JsonSerialize(using = ToStringSerializer.class)
private Long dictSort;
/** 字典标签 */
@ -74,7 +78,7 @@ public class SysDictData extends BaseEntity
}
@JsonView(DictDataSimpleView.class)
private String remark;
@JsonSerialize(using = ToStringSerializer.class)
public Long getDictCode()
{
return dictCode;
@ -84,7 +88,7 @@ public class SysDictData extends BaseEntity
{
this.dictCode = dictCode;
}
@JsonSerialize(using = ToStringSerializer.class)
public Long getDictSort()
{
return dictSort;

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.annotation.Excel.ColumnType;
import com.ff.base.core.domain.BaseEntity;
@ -21,6 +23,7 @@ public class SysDictType extends BaseEntity
/** 字典主键 */
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
@JsonSerialize(using = ToStringSerializer.class)
private Long dictId;
/** 字典名称 */
@ -34,7 +37,7 @@ public class SysDictType extends BaseEntity
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
@JsonSerialize(using = ToStringSerializer.class)
public Long getDictId()
{
return dictId;

View File

@ -17,6 +17,7 @@ public class SysLogininfor extends BaseEntity
/** ID */
@Excel(name = "序号", cellType = ColumnType.NUMERIC)
@JsonSerialize(using = ToStringSerializer.class)
private Long infoId;
/** 用户账号 */
@ -48,6 +49,7 @@ public class SysLogininfor extends BaseEntity
private String msg;
/** 访问时间 */
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Long loginTime;

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -20,6 +22,7 @@ public class SysMenu extends BaseEntity
private static final long serialVersionUID = 1L;
/** 菜单ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long menuId;
/** 菜单名称 */
@ -29,6 +32,7 @@ public class SysMenu extends BaseEntity
private String parentName;
/** 父菜单ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** 显示顺序 */
@ -69,7 +73,7 @@ public class SysMenu extends BaseEntity
/** 子菜单 */
private List<SysMenu> children = new ArrayList<SysMenu>();
@JsonSerialize(using = ToStringSerializer.class)
public Long getMenuId()
{
return menuId;

View File

@ -17,6 +17,7 @@ public class SysOperLog extends BaseEntity
/** 日志主键 */
@Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
@JsonSerialize(using = ToStringSerializer.class)
private Long operId;
/** 操作模块 */

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.annotation.Excel.ColumnType;
import com.ff.base.core.domain.BaseEntity;
@ -21,6 +23,7 @@ public class SysPost extends BaseEntity
/** 岗位序号 */
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
@JsonSerialize(using = ToStringSerializer.class)
private Long postId;
/** 岗位编码 */
@ -41,7 +44,7 @@ public class SysPost extends BaseEntity
/** 用户是否存在此岗位标识 默认不存在 */
private boolean flag = false;
@JsonSerialize(using = ToStringSerializer.class)
public Long getPostId()
{
return postId;

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.annotation.Excel.ColumnType;
import com.ff.base.core.domain.BaseEntity;
@ -22,6 +24,7 @@ public class SysRole extends BaseEntity
/** 角色ID */
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
@JsonSerialize(using = ToStringSerializer.class)
private Long roleId;
/** 角色名称 */
@ -74,7 +77,7 @@ public class SysRole extends BaseEntity
{
this.roleId = roleId;
}
@JsonSerialize(using = ToStringSerializer.class)
public Long getRoleId()
{
return roleId;

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -11,11 +13,13 @@ import org.apache.commons.lang3.builder.ToStringStyle;
public class SysRoleDept
{
/** 角色ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long roleId;
/** 部门ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long deptId;
@JsonSerialize(using = ToStringSerializer.class)
public Long getRoleId()
{
return roleId;
@ -25,7 +29,7 @@ public class SysRoleDept
{
this.roleId = roleId;
}
@JsonSerialize(using = ToStringSerializer.class)
public Long getDeptId()
{
return deptId;

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -11,11 +13,13 @@ import org.apache.commons.lang3.builder.ToStringStyle;
public class SysRoleMenu
{
/** 角色ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long roleId;
/** 菜单ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long menuId;
@JsonSerialize(using = ToStringSerializer.class)
public Long getRoleId()
{
return roleId;
@ -25,7 +29,7 @@ public class SysRoleMenu
{
this.roleId = roleId;
}
@JsonSerialize(using = ToStringSerializer.class)
public Long getMenuId()
{
return menuId;

View File

@ -1,5 +1,7 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.annotation.Excel.ColumnType;
import com.ff.base.annotation.Excel.Type;
@ -27,6 +29,7 @@ public class SysUser extends BaseEntity {
/**
* ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId;
@ -34,6 +37,7 @@ public class SysUser extends BaseEntity {
* ID
*/
@Excel(name = "部门编号", type = Type.IMPORT)
@JsonSerialize(using = ToStringSerializer.class)
private Long deptId;
/**
@ -105,6 +109,7 @@ public class SysUser extends BaseEntity {
*
*/
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
@JsonSerialize(using = ToStringSerializer.class)
private Long loginDate;
/**
@ -138,7 +143,7 @@ public class SysUser extends BaseEntity {
/**
* 0 1 2
* 0 1 2
*/
private Integer loginType;

View File

@ -0,0 +1,76 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_agent
*
* @author shi
* @date 2025-02-25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantAgent extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 账号 */
@Excel(name = "账号")
private String account;
/** 密码 */
@Excel(name = "密码")
private String password;
/** 注册时间 */
@Excel(name = "注册时间")
@JsonSerialize(using = ToStringSerializer.class)
private Long registerTime;
/** 注册IP */
@Excel(name = "注册IP")
private String registerIp;
/** 注册ip的城市 */
@Excel(name = "注册ip的城市")
private String registerIpCity;
/** 最后登录ip */
@Excel(name = "最后登录ip")
private String loginIp;
/** 最后登录时间 */
@Excel(name = "最后登录时间")
@JsonSerialize(using = ToStringSerializer.class)
private Long loginData;
/** 租户状态 1正常 0停用 */
@Excel(name = "租户状态 1正常 0停用")
private Boolean tenantStatus;
/**
*
*/
private String currencyAgreement;
/**
*
*/
private String walletAddress;
}

View File

@ -0,0 +1,53 @@
package com.ff.base.system.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_platform
*
* @author shi
* @date 2025-02-27
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantPlatform extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 租户id */
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "租户id", width = 30, dateFormat = "yyyy-MM-dd")
private Long tenantId;
/** 平台编码 */
@Excel(name = "平台编码")
private String platformCode;
/** 币种编码 */
@Excel(name = "币种编码")
private String currencyCode;
/** 成本 */
@Excel(name = "成本")
private BigDecimal cost;
/** 使用成本 */
@Excel(name = "使用成本")
private BigDecimal useCost;
}

View File

@ -2,8 +2,9 @@ package com.ff.base.system.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
@ -15,7 +16,7 @@ import lombok.NoArgsConstructor;
* ff_tenant_secret_key
*
* @author shi
* @date 2025-02-20
* @date 2025-02-25
*/
@Data
@AllArgsConstructor
@ -26,44 +27,51 @@ public class TenantSecretKey extends BaseEntity
private static final long serialVersionUID = 1L;
/** 主键id */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 租户key */
@Excel(name = "租户key")
private String tenantKey;
/** 密码 */
@Excel(name = "密码")
@JsonIgnore
private String password;
/** 注册时间 */
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "注册时间")
private Long registerTime;
/** 注册ip */
@Excel(name = "注册ip")
private String registerIp;
/** 注册ip的城市 */
@Excel(name = "注册ip的城市")
private String registerIpCity;
/** 最后登录ip */
@Excel(name = "最后登录ip")
private String loginIp;
/** 最后登录时间 */
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "最后登录时间")
private Long loginData;
/** 租户key */
@Excel(name = "租户key")
private String tenantKey;
/** 代理id */
@Excel(name = "代理id")
/** 上级代理id */
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "上级代理id")
private Long agentId;
/** 商户后缀 */
@Excel(name = "商户后缀")
@JsonIgnore
private String tenantSn;
/** 租户密钥 */
@Excel(name = "租户密钥")
@JsonIgnore
private String tenantSecret;
/** 租户状态 1正常 0停用 */

View File

@ -0,0 +1,39 @@
package com.ff.base.system.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_white
*
* @author shi
* @date 2025-02-27
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantWhite extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 租户id */
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "租户id", width = 30, dateFormat = "yyyy-MM-dd")
private Long tenantId;
/** 白名单ip地址 */
@Excel(name = "白名单ip地址")
private String whiteIp;
}

View File

@ -0,0 +1,73 @@
package com.ff.base.system.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.system.domain.TenantPlatform;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* dto
*
* @author shi
* @date 2025/02/26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CreateTenantDTO implements Serializable {
private final static long serialVersionUID = 1L;
/**
*
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long registerTime;
/** 注册ip */
private String registerIp;
/** 注册ip的城市 */
private String registerIpCity;
/**
* id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long agentId;
/**
*
*/
private String account;
/**
*
*/
private String password;
/** 买分比例 */
private BigDecimal scoreRatio;
/** 租户类型 TenantType 枚举 */
private Integer tenantType;
/** 透支比例 */
private BigDecimal depositRatio;
/**
*
*/
private List<TenantPlatform> tenantPlatforms;
}

View File

@ -0,0 +1,70 @@
package com.ff.base.system.mapper;
import com.ff.base.system.domain.TenantAgent;
import java.util.List;
/**
* Mapper
*
* @author shi
* @date 2025-02-25
*/
public interface TenantAgentMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgent selectTenantAgentById(Long id);
/**
*
*
* @param account
* @return {@link TenantAgent }
*/
TenantAgent selectTenantAgentByAccount(String account);
/**
*
*
* @param tenantAgent
* @return
*/
List<TenantAgent> selectTenantAgentList(TenantAgent tenantAgent);
/**
*
*
* @param tenantAgent
* @return
*/
int insertTenantAgent(TenantAgent tenantAgent);
/**
*
*
* @param tenantAgent
* @return
*/
int updateTenantAgent(TenantAgent tenantAgent);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentByIds(Long[] ids);
}

View File

@ -0,0 +1,80 @@
package com.ff.base.system.mapper;
import java.util.List;
import com.ff.base.system.domain.TenantPlatform;
/**
* Mapper
*
* @author shi
* @date 2025-02-27
*/
public interface TenantPlatformMapper
{
/**
*
*
* @param id
* @return
*/
TenantPlatform selectTenantPlatformById(Long id);
/**
*
*
* @param tenantPlatform
* @return {@link TenantPlatform }
*/
TenantPlatform findTenantPlatform(TenantPlatform tenantPlatform);
/**
* id
*
* @param tenantId id
* @return {@link List }<{@link String }>
*/
List<String> selectCurrencyCodeByTenantId(Long tenantId);
/**
*
*
* @param tenantPlatform
* @return
*/
List<TenantPlatform> selectTenantPlatformList(TenantPlatform tenantPlatform);
/**
*
*
* @param tenantPlatform
* @return
*/
int insertTenantPlatform(TenantPlatform tenantPlatform);
/**
*
*
* @param tenantPlatform
* @return
*/
int updateTenantPlatform(TenantPlatform tenantPlatform);
/**
*
*
* @param id
* @return
*/
int deleteTenantPlatformById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantPlatformByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ff.base.system.mapper;
import java.util.List;
import com.ff.base.system.domain.TenantWhite;
/**
* Mapper
*
* @author shi
* @date 2025-02-27
*/
public interface TenantWhiteMapper
{
/**
*
*
* @param id
* @return
*/
TenantWhite selectTenantWhiteById(Long id);
/**
*
*
* @param tenantWhite
* @return
*/
List<TenantWhite> selectTenantWhiteList(TenantWhite tenantWhite);
/**
*
*
* @param tenantWhite
* @return
*/
int insertTenantWhite(TenantWhite tenantWhite);
/**
*
*
* @param tenantWhite
* @return
*/
int updateTenantWhite(TenantWhite tenantWhite);
/**
*
*
* @param id
* @return
*/
int deleteTenantWhiteById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantWhiteByIds(Long[] ids);
}

View File

@ -0,0 +1,88 @@
package com.ff.base.system.service;
import com.ff.base.system.domain.TenantAgent;
import java.util.List;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
public interface ITenantAgentService
{
/**
*
*
* @param id
* @return
*/
TenantAgent selectTenantAgentById(Long id);
/**
*
*
* @param username
* @param password
* @return {@link String }
*/
String login(String username, String password);
/**
*
*
* @param account
* @return {@link TenantAgent }
*/
TenantAgent selectTenantAgentByAccount(String account);
/**
*
*
* @param tenantAgent
* @return
*/
List<TenantAgent> selectTenantAgentList(TenantAgent tenantAgent);
/**
*
*
* @param tenantAgent
* @return
*/
int insertTenantAgent(TenantAgent tenantAgent);
/**
*
*
* @param tenantAgent
* @return int
*/
int createTenantAgent(TenantAgent tenantAgent);
/**
*
*
* @param tenantAgent
* @return
*/
int updateTenantAgent(TenantAgent tenantAgent);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentById(Long id);
}

View File

@ -0,0 +1,78 @@
package com.ff.base.system.service;
import java.util.List;
import com.ff.base.system.domain.TenantPlatform;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
public interface ITenantPlatformService
{
/**
*
*
* @param id
* @return
*/
TenantPlatform selectTenantPlatformById(Long id);
/**
*
*
* @param tenantPlatform
* @return {@link TenantPlatform }
*/
TenantPlatform findTenantPlatform(TenantPlatform tenantPlatform);
/**
*
*
* @param tenantPlatform
* @return
*/
List<TenantPlatform> selectTenantPlatformList(TenantPlatform tenantPlatform);
/**
* id
*
* @param tenantId id
* @return {@link List }<{@link String }>
*/
List<String> selectCurrencyCodeByTenantId(Long tenantId);
/**
*
*
* @param tenantPlatform
* @return
*/
int insertTenantPlatform(TenantPlatform tenantPlatform);
/**
*
*
* @param tenantPlatform
* @return
*/
int updateTenantPlatform(TenantPlatform tenantPlatform);
/**
*
*
* @param ids
* @return
*/
int deleteTenantPlatformByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantPlatformById(Long id);
}

View File

@ -2,6 +2,7 @@ package com.ff.base.system.service;
import java.util.List;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.dto.CreateTenantDTO;
import com.ff.base.system.dto.TenantSecretKeyDTO;
/**
@ -70,6 +71,15 @@ public interface ITenantSecretKeyService
*/
int insertTenantSecretKey(TenantSecretKey tenantSecretKey);
/**
*
*
* @param createTenantDTO dto
* @return {@link Integer }
*/
Integer createTenant(CreateTenantDTO createTenantDTO);
/**
*
*

View File

@ -0,0 +1,61 @@
package com.ff.base.system.service;
import java.util.List;
import com.ff.base.system.domain.TenantWhite;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
public interface ITenantWhiteService
{
/**
*
*
* @param id
* @return
*/
TenantWhite selectTenantWhiteById(Long id);
/**
*
*
* @param tenantWhite
* @return
*/
List<TenantWhite> selectTenantWhiteList(TenantWhite tenantWhite);
/**
*
*
* @param tenantWhite
* @return
*/
int insertTenantWhite(TenantWhite tenantWhite);
/**
*
*
* @param tenantWhite
* @return
*/
int updateTenantWhite(TenantWhite tenantWhite);
/**
*
*
* @param ids
* @return
*/
int deleteTenantWhiteByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantWhiteById(Long id);
}

View File

@ -0,0 +1,184 @@
package com.ff.base.system.service.impl;
import java.util.List;
import com.ff.base.constant.Constants;
import com.ff.base.core.domain.model.LoginForm;
import com.ff.base.core.domain.model.LoginUser;
import com.ff.base.enums.LoginType;
import com.ff.base.exception.ServiceException;
import com.ff.base.exception.user.UserPasswordNotMatchException;
import com.ff.base.manager.AsyncManager;
import com.ff.base.manager.factory.AsyncFactory;
import com.ff.base.security.context.AuthenticationContextHolder;
import com.ff.base.system.domain.TenantAgent;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.mapper.TenantAgentMapper;
import com.ff.base.system.service.ITenantAgentService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.MessageUtils;
import com.ff.base.utils.ip.IpUtils;
import com.ff.base.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
@Service
public class TenantAgentServiceImpl implements ITenantAgentService {
@Autowired
private TenantAgentMapper tenantAgentMapper;
@Resource
private AuthenticationManager authenticationManager;
@Resource
private TokenService tokenService;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgent selectTenantAgentById(Long id) {
return tenantAgentMapper.selectTenantAgentById(id);
}
@Override
public String login(String username, String password) {
// 用户验证
Authentication authentication = null;
try {
LoginForm loginForm = new LoginForm();
loginForm.setAccountName(username);
loginForm.setPassword(password);
loginForm.setLoginType(LoginType.AGENT.getValue());
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, loginForm);
AuthenticationContextHolder.setContext(authenticationToken);
authentication = authenticationManager.authenticate(authenticationToken);
} catch (Exception e) {
if (e instanceof BadCredentialsException) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
} else {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
} finally {
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
//更新租户信息
TenantAgent tenantAgent = new TenantAgent();
tenantAgent.setId(loginUser.getUserId());
tenantAgent.setLoginIp(IpUtils.getIpAddr());
tenantAgent.setLoginData(DateUtils.getNowDate());
tenantAgentMapper.updateTenantAgent(tenantAgent);
// 生成token
return tokenService.createToken(loginUser);
}
/**
*
*
* @param account
* @return {@link TenantAgent }
*/
@Override
public TenantAgent selectTenantAgentByAccount(String account) {
return tenantAgentMapper.selectTenantAgentByAccount(account);
}
/**
*
*
* @param tenantAgent
* @return
*/
@Override
public List<TenantAgent> selectTenantAgentList(TenantAgent tenantAgent) {
return tenantAgentMapper.selectTenantAgentList(tenantAgent);
}
/**
*
*
* @param tenantAgent
* @return
*/
@Override
public int insertTenantAgent(TenantAgent tenantAgent) {
tenantAgent.setCreateTime(DateUtils.getNowDate());
return tenantAgentMapper.insertTenantAgent(tenantAgent);
}
/**
*
*
* @param tenantAgent
* @return int
*/
@Override
public synchronized int createTenantAgent(TenantAgent tenantAgent) {
TenantAgent tenantAgentByAccount = this.selectTenantAgentByAccount(tenantAgent.getAccount());
if (!ObjectUtils.isEmpty(tenantAgentByAccount)) {
return 0;
}
return this.insertTenantAgent(tenantAgent);
}
/**
*
*
* @param tenantAgent
* @return
*/
@Override
public int updateTenantAgent(TenantAgent tenantAgent) {
tenantAgent.setUpdateTime(DateUtils.getNowDate());
return tenantAgentMapper.updateTenantAgent(tenantAgent);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentByIds(Long[] ids) {
return tenantAgentMapper.deleteTenantAgentByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentById(Long id) {
return tenantAgentMapper.deleteTenantAgentById(id);
}
}

View File

@ -0,0 +1,122 @@
package com.ff.base.system.service.impl;
import java.util.Collections;
import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.base.system.mapper.TenantPlatformMapper;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.service.ITenantPlatformService;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
@Service
public class TenantPlatformServiceImpl implements ITenantPlatformService
{
@Autowired
private TenantPlatformMapper tenantPlatformMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantPlatform selectTenantPlatformById(Long id)
{
return tenantPlatformMapper.selectTenantPlatformById(id);
}
/**
*
*
* @param tenantPlatform
* @return {@link TenantPlatform }
*/
@Override
public TenantPlatform findTenantPlatform(TenantPlatform tenantPlatform) {
return tenantPlatformMapper.findTenantPlatform(tenantPlatform);
}
/**
*
*
* @param tenantPlatform
* @return
*/
@Override
public List<TenantPlatform> selectTenantPlatformList(TenantPlatform tenantPlatform)
{
return tenantPlatformMapper.selectTenantPlatformList(tenantPlatform);
}
/**
* id
*
* @param tenantId id
* @return {@link List }<{@link String }>
*/
@Override
public List<String> selectCurrencyCodeByTenantId(Long tenantId) {
return tenantPlatformMapper.selectCurrencyCodeByTenantId(tenantId);
}
/**
*
*
* @param tenantPlatform
* @return
*/
@Override
public int insertTenantPlatform(TenantPlatform tenantPlatform)
{
tenantPlatform.setId(IdUtil.getSnowflakeNextId());
tenantPlatform.setCreateTime(DateUtils.getNowDate());
return tenantPlatformMapper.insertTenantPlatform(tenantPlatform);
}
/**
*
*
* @param tenantPlatform
* @return
*/
@Override
public int updateTenantPlatform(TenantPlatform tenantPlatform)
{
tenantPlatform.setUpdateTime(DateUtils.getNowDate());
return tenantPlatformMapper.updateTenantPlatform(tenantPlatform);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantPlatformByIds(Long[] ids)
{
return tenantPlatformMapper.deleteTenantPlatformByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantPlatformById(Long id)
{
return tenantPlatformMapper.deleteTenantPlatformById(id);
}
}

View File

@ -8,18 +8,26 @@ import com.ff.base.constant.Constants;
import com.ff.base.core.domain.model.LoginForm;
import com.ff.base.core.domain.model.LoginUser;
import com.ff.base.enums.LoginType;
import com.ff.base.enums.OperationType;
import com.ff.base.enums.QuotaType;
import com.ff.base.exception.ServiceException;
import com.ff.base.exception.user.UserPasswordNotMatchException;
import com.ff.base.manager.AsyncManager;
import com.ff.base.manager.factory.AsyncFactory;
import com.ff.base.security.context.AuthenticationContextHolder;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.dto.CreateTenantDTO;
import com.ff.base.system.dto.TenantSecretKeyDTO;
import com.ff.base.system.service.ITenantPlatformService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.MessageUtils;
import com.ff.base.utils.NumberUtils;
import com.ff.base.utils.SecurityUtils;
import com.ff.base.utils.ip.IpUtils;
import com.ff.base.utils.uuid.IdUtils;
import com.ff.base.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -29,6 +37,7 @@ import com.ff.base.system.mapper.TenantSecretKeyMapper;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.service.ITenantSecretKeyService;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
@ -48,8 +57,13 @@ public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService {
@Resource
@Lazy
private AuthenticationManager authenticationManager;
@Resource
private ITenantPlatformService tenantPlatformService;
/**
*
*
@ -126,11 +140,11 @@ public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService {
*/
@Override
public synchronized String generateTenantSn() {
String sn = NumberUtils.generateRandomCode();
String sn = NumberUtils.generateRandomCode(3);
while (!CollectionUtils.isEmpty(tenantSecretKeyMapper.selectTenantSecretKeyList(TenantSecretKey.builder()
.tenantSn(sn)
.build()))) {
sn = NumberUtils.generateRandomCode();
sn = NumberUtils.generateRandomCode(3);
}
return sn;
}
@ -170,6 +184,50 @@ public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService {
return tenantSecretKeyMapper.insertTenantSecretKey(tenantSecretKey);
}
/**
*
*
* @param createTenantDTO dto
* @return {@link Integer }
*/
@Override
public synchronized Integer createTenant(CreateTenantDTO createTenantDTO) {
List<TenantSecretKey> tenantSecretKeys = this.selectTenantSecretKeyList(TenantSecretKey.builder()
.tenantKey(createTenantDTO.getAccount())
.build());
if (!CollectionUtils.isEmpty(tenantSecretKeys)) {
return 0;
}
//创建租户
TenantSecretKey tenantSecretKey = new TenantSecretKey();
tenantSecretKey.setAgentId(createTenantDTO.getAgentId());
tenantSecretKey.setRegisterIp(createTenantDTO.getRegisterIp());
tenantSecretKey.setRegisterTime(createTenantDTO.getRegisterTime());
tenantSecretKey.setRegisterIpCity(createTenantDTO.getRegisterIpCity());
tenantSecretKey.setTenantKey(createTenantDTO.getAccount());
tenantSecretKey.setPassword(SecurityUtils.encryptPassword(createTenantDTO.getPassword()));
tenantSecretKey.setTenantSn(this.generateTenantSn());
tenantSecretKey.setTenantSecret(IdUtils.simpleUUID());
tenantSecretKey.setDepositRatio(createTenantDTO.getDepositRatio());
tenantSecretKey.setTenantType(createTenantDTO.getTenantType());
tenantSecretKey.setCreateBy(createTenantDTO.getAccount());
tenantSecretKey.setTenantStatus(Boolean.TRUE);
int insertedTenantSecretKey = this.insertTenantSecretKey(tenantSecretKey);
if (insertedTenantSecretKey > 0) {
for (TenantPlatform tenantPlatform : createTenantDTO.getTenantPlatforms()) {
tenantPlatform.setTenantId(tenantSecretKey.getId());
tenantPlatform.setCreateBy(createTenantDTO.getAccount());
tenantPlatformService.insertTenantPlatform(tenantPlatform);
}
}
return insertedTenantSecretKey;
}
/**
*
*

View File

@ -0,0 +1,99 @@
package com.ff.base.system.service.impl;
import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.base.system.mapper.TenantWhiteMapper;
import com.ff.base.system.domain.TenantWhite;
import com.ff.base.system.service.ITenantWhiteService;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
@Service
public class TenantWhiteServiceImpl implements ITenantWhiteService
{
@Autowired
private TenantWhiteMapper tenantWhiteMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantWhite selectTenantWhiteById(Long id)
{
return tenantWhiteMapper.selectTenantWhiteById(id);
}
/**
*
*
* @param tenantWhite
* @return
*/
@Override
public List<TenantWhite> selectTenantWhiteList(TenantWhite tenantWhite)
{
return tenantWhiteMapper.selectTenantWhiteList(tenantWhite);
}
/**
*
*
* @param tenantWhite
* @return
*/
@Override
public int insertTenantWhite(TenantWhite tenantWhite)
{
tenantWhite.setId(IdUtil.getSnowflakeNextId());
tenantWhite.setCreateTime(DateUtils.getNowDate());
return tenantWhiteMapper.insertTenantWhite(tenantWhite);
}
/**
*
*
* @param tenantWhite
* @return
*/
@Override
public int updateTenantWhite(TenantWhite tenantWhite)
{
tenantWhite.setUpdateTime(DateUtils.getNowDate());
return tenantWhiteMapper.updateTenantWhite(tenantWhite);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantWhiteByIds(Long[] ids)
{
return tenantWhiteMapper.deleteTenantWhiteByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantWhiteById(Long id)
{
return tenantWhiteMapper.deleteTenantWhiteById(id);
}
}

View File

@ -64,12 +64,12 @@ public class NumberUtils {
*
* @return {@link String }
*/
public static String generateRandomCode() {
public static String generateRandomCode(Integer size) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
// 每位字符可以是字母A-Z, a-z或数字0-9
for (int i = 0; i < 3; i++) {
for (int i = 0; i <size ; i++) {
int choice = random.nextInt(3);
if (choice == 0) {
// 随机字母(大写或小写)

View File

@ -0,0 +1,95 @@
package com.ff.base.web.service;
import com.ff.base.constant.Constants;
import com.ff.base.core.domain.model.LoginUser;
import com.ff.base.enums.LoginType;
import com.ff.base.exception.ServiceException;
import com.ff.base.system.domain.SysRole;
import com.ff.base.system.domain.SysUser;
import com.ff.base.system.domain.TenantAgent;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.service.ISysMenuService;
import com.ff.base.system.service.ISysRoleService;
import com.ff.base.system.service.ITenantAgentService;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.utils.MessageUtils;
import com.ff.base.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
/**
*
*
* @author ff
*/
@Service
public class AgentDetailsServiceImpl implements UserDetailsService
{
private static final Logger log = LoggerFactory.getLogger(AgentDetailsServiceImpl.class);
@Resource
private ITenantAgentService tenantAgentService;
@Resource
private SysPasswordService passwordService;
@Resource
private ISysMenuService menuService;
@Resource
private SysPermissionService permissionService;
@Resource
private ISysRoleService roleService;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
{
TenantAgent tenantAgent = tenantAgentService.selectTenantAgentByAccount(username);
if (StringUtils.isNull(tenantAgent))
{
log.info("登录用户:{} 不存在.", username);
throw new ServiceException(MessageUtils.message("user.not.exists"));
}
else if (!tenantAgent.getTenantStatus())
{
log.info("登录用户:{} 已被停用.", username);
throw new ServiceException(MessageUtils.message("user.blocked"));
}
passwordService.validate(tenantAgent.getPassword());
return createLoginUser(tenantAgent);
}
public UserDetails createLoginUser(TenantAgent tenantAgent)
{
SysRole sysRole = roleService.selectRoleByRoleKey(Constants.AGENT_ROLE);
SysUser sysUser=new SysUser();
sysUser.setUserId(tenantAgent.getId());
sysUser.setUserName(tenantAgent.getAccount());
sysUser.setNickName(tenantAgent.getAccount());
sysUser.setPassword(tenantAgent.getPassword());
sysUser.setLoginType(LoginType.AGENT.getValue());
sysUser.setLoginIp(tenantAgent.getLoginIp());
sysUser.setLoginDate(tenantAgent.getLoginData());
ArrayList<SysRole> sysRoles = new ArrayList<>();
sysRoles.add(sysRole);
sysUser.setRoles(sysRoles);
sysUser.setRoleId(sysRole.getRoleId());
sysUser.setRoleIds(new Long[]{sysRole.getRoleId()});
return new LoginUser(tenantAgent.getId(),null, sysUser, menuService.selectMenuPermsByRoleId(sysRole.getRoleId()));
}
}

View File

@ -0,0 +1,122 @@
<?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">
<mapper namespace="com.ff.base.system.mapper.TenantAgentMapper">
<resultMap type="TenantAgent" id="TenantAgentResult">
<result property="id" column="id" />
<result property="account" column="account" />
<result property="password" column="password" />
<result property="registerTime" column="register_time" />
<result property="registerIp" column="register_ip" />
<result property="registerIpCity" column="register_ip_city" />
<result property="loginIp" column="login_ip" />
<result property="loginData" column="login_data" />
<result property="tenantStatus" column="tenant_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="currencyAgreement" column="currency_agreement" />
<result property="walletAddress" column="wallet_address" />
</resultMap>
<sql id="selectTenantAgentVo">
select id,currency_agreement,wallet_address, account, password, register_time, register_ip, register_ip_city, login_ip, login_data, tenant_status, create_by, create_time, update_by, update_time from ff_tenant_agent
</sql>
<select id="selectTenantAgentList" parameterType="TenantAgent" resultMap="TenantAgentResult">
<include refid="selectTenantAgentVo"/>
<where>
<if test="account != null and account != ''"> and account = #{account}</if>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="registerTime != null "> and register_time = #{registerTime}</if>
<if test="registerIp != null and registerIp != ''"> and register_ip = #{registerIp}</if>
<if test="registerIpCity != null and registerIpCity != ''"> and register_ip_city = #{registerIpCity}</if>
<if test="loginIp != null and loginIp != ''"> and login_ip = #{loginIp}</if>
<if test="loginData != null "> and login_data = #{loginData}</if>
<if test="tenantStatus != null "> and tenant_status = #{tenantStatus}</if>
<if test="currencyAgreement != null and currencyAgreement != ''"> and currency_agreement = #{currencyAgreement}</if>
<if test="walletAddress != null and walletAddress != ''"> and wallet_address = #{walletAddress}</if>
</where>
</select>
<select id="selectTenantAgentById" parameterType="Long" resultMap="TenantAgentResult">
<include refid="selectTenantAgentVo"/>
where id = #{id}
</select>
<select id="selectTenantAgentByAccount" parameterType="String" resultMap="TenantAgentResult">
<include refid="selectTenantAgentVo"/>
where account = #{account}
</select>
<insert id="insertTenantAgent" parameterType="TenantAgent" useGeneratedKeys="true" keyProperty="id">
insert into ff_tenant_agent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="account != null">account,</if>
<if test="password != null">password,</if>
<if test="registerTime != null">register_time,</if>
<if test="registerIp != null">register_ip,</if>
<if test="registerIpCity != null">register_ip_city,</if>
<if test="loginIp != null">login_ip,</if>
<if test="loginData != null">login_data,</if>
<if test="tenantStatus != null">tenant_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="currencyAgreement != null">currency_agreement,</if>
<if test="walletAddress != null">wallet_address,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="account != null">#{account},</if>
<if test="password != null">#{password},</if>
<if test="registerTime != null">#{registerTime},</if>
<if test="registerIp != null">#{registerIp},</if>
<if test="registerIpCity != null">#{registerIpCity},</if>
<if test="loginIp != null">#{loginIp},</if>
<if test="loginData != null">#{loginData},</if>
<if test="tenantStatus != null">#{tenantStatus},</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="currencyAgreement != null">#{currencyAgreement},</if>
<if test="walletAddress != null">#{walletAddress},</if>
</trim>
</insert>
<update id="updateTenantAgent" parameterType="TenantAgent">
update ff_tenant_agent
<trim prefix="SET" suffixOverrides=",">
<if test="account != null">account = #{account},</if>
<if test="password != null">password = #{password},</if>
<if test="registerTime != null">register_time = #{registerTime},</if>
<if test="registerIp != null">register_ip = #{registerIp},</if>
<if test="registerIpCity != null">register_ip_city = #{registerIpCity},</if>
<if test="loginIp != null">login_ip = #{loginIp},</if>
<if test="loginData != null">login_data = #{loginData},</if>
<if test="tenantStatus != null">tenant_status = #{tenantStatus},</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="currencyAgreement != null">currency_agreement = #{currencyAgreement},</if>
<if test="walletAddress != null">wallet_address = #{walletAddress},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTenantAgentById" parameterType="Long">
delete from ff_tenant_agent where id = #{id}
</delete>
<delete id="deleteTenantAgentByIds" parameterType="String">
delete from ff_tenant_agent where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,113 @@
<?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">
<mapper namespace="com.ff.base.system.mapper.TenantPlatformMapper">
<resultMap type="TenantPlatform" id="TenantPlatformResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="platformCode" column="platform_code" />
<result property="currencyCode" column="currency_code" />
<result property="cost" column="cost" />
<result property="useCost" column="use_cost" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTenantPlatformVo">
select id, tenant_id, platform_code, currency_code, cost, use_cost, create_by, create_time, update_by, update_time from ff_tenant_platform
</sql>
<select id="selectTenantPlatformList" parameterType="TenantPlatform" resultMap="TenantPlatformResult">
<include refid="selectTenantPlatformVo"/>
<where>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="platformCode != null and platformCode != ''"> and platform_code = #{platformCode}</if>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="cost != null "> and cost = #{cost}</if>
<if test="useCost != null "> and use_cost = #{useCost}</if>
</where>
</select>
<select id="selectTenantPlatformById" parameterType="Long" resultMap="TenantPlatformResult">
<include refid="selectTenantPlatformVo"/>
where id = #{id}
</select>
<select id="findTenantPlatform" parameterType="TenantPlatform" resultMap="TenantPlatformResult">
<include refid="selectTenantPlatformVo"/>
<where>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="platformCode != null and platformCode != ''"> and platform_code = #{platformCode}</if>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="cost != null "> and cost = #{cost}</if>
<if test="useCost != null "> and use_cost = #{useCost}</if>
</where>
limit 1
</select>
<select id="selectCurrencyCodeByTenantId" >
select currency_code from ff_tenant_platform
where tenant_id = #{tenantId} group by currency_code
</select>
<insert id="insertTenantPlatform" parameterType="TenantPlatform">
insert into ff_tenant_platform
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="platformCode != null and platformCode != ''">platform_code,</if>
<if test="currencyCode != null and currencyCode != ''">currency_code,</if>
<if test="cost != null">cost,</if>
<if test="useCost != null">use_cost,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="platformCode != null and platformCode != ''">#{platformCode},</if>
<if test="currencyCode != null and currencyCode != ''">#{currencyCode},</if>
<if test="cost != null">#{cost},</if>
<if test="useCost != null">#{useCost},</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>
</trim>
</insert>
<update id="updateTenantPlatform" parameterType="TenantPlatform">
update ff_tenant_platform
<trim prefix="SET" suffixOverrides=",">
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="platformCode != null and platformCode != ''">platform_code = #{platformCode},</if>
<if test="currencyCode != null and currencyCode != ''">currency_code = #{currencyCode},</if>
<if test="cost != null">cost = #{cost},</if>
<if test="useCost != null">use_cost = #{useCost},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteTenantPlatformById" parameterType="Long">
delete from ff_tenant_platform where id = #{id}
</delete>
<delete id="deleteTenantPlatformByIds" parameterType="String">
delete from ff_tenant_platform where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -6,10 +6,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="TenantSecretKey" id="TenantSecretKeyResult">
<result property="id" column="id" />
<result property="tenantKey" column="tenant_key" />
<result property="password" column="password" />
<result property="registerTime" column="register_time" />
<result property="registerIp" column="register_ip" />
<result property="registerIpCity" column="register_ip_city" />
<result property="loginIp" column="login_ip" />
<result property="loginData" column="login_data" />
<result property="tenantKey" column="tenant_key" />
<result property="agentId" column="agent_id" />
<result property="tenantSn" column="tenant_sn" />
<result property="tenantSecret" column="tenant_secret" />
@ -25,34 +28,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTenantSecretKeyVo">
select id, password, login_ip, login_data, tenant_key, agent_id, tenant_sn, tenant_secret, tenant_status, quota_type, score_ratio, tenant_type, deposit_ratio, create_by, create_time, update_by, update_time from ff_tenant_secret_key
select id, tenant_key, password, register_time, register_ip, register_ip_city, login_ip, login_data, agent_id, tenant_sn, tenant_secret, tenant_status, quota_type, score_ratio, tenant_type, deposit_ratio, create_by, create_time, update_by, update_time from ff_tenant_secret_key
</sql>
<select id="selectTenantSecretKeyList" parameterType="TenantSecretKey" resultMap="TenantSecretKeyResult">
<include refid="selectTenantSecretKeyVo"/>
<where>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="loginIp != null and loginIp != ''"> and login_ip = #{loginIp}</if>
<if test="loginData != null "> and login_data = #{loginData}</if>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="agentId != null "> and agent_id = #{agentId}</if>
<if test="tenantSn != null and tenantSn != ''"> and tenant_sn = #{tenantSn}</if>
<if test="tenantSecret != null and tenantSecret != ''"> and tenant_secret = #{tenantSecret}</if>
<if test="tenantStatus != null "> and tenant_status = #{tenantStatus}</if>
<if test="quotaType != null "> and quota_type = #{quotaType}</if>
<if test="scoreRatio != null "> and score_ratio = #{scoreRatio}</if>
<if test="tenantType != null "> and tenant_type = #{tenantType}</if>
<if test="depositRatio != null "> and deposit_ratio = #{depositRatio}</if>
</where>
</select>
<select id="selectTenantSecretKeyDTOList" parameterType="com.ff.base.system.dto.TenantSecretKeyDTO" resultMap="TenantSecretKeyResult">
<include refid="selectTenantSecretKeyVo"/>
<where>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="registerTime != null "> and register_time = #{registerTime}</if>
<if test="registerIp != null and registerIp != ''"> and register_ip = #{registerIp}</if>
<if test="registerIpCity != null and registerIpCity != ''"> and register_ip_city = #{registerIpCity}</if>
<if test="loginIp != null and loginIp != ''"> and login_ip = #{loginIp}</if>
<if test="loginData != null "> and login_data = #{loginData}</if>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key like concat('%',#{tenantKey},'%') </if>
<if test="agentId != null "> and agent_id = #{agentId}</if>
<if test="tenantSn != null and tenantSn != ''"> and tenant_sn = #{tenantSn}</if>
<if test="tenantSecret != null and tenantSecret != ''"> and tenant_secret = #{tenantSecret}</if>
@ -71,12 +59,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertTenantSecretKey" parameterType="TenantSecretKey" useGeneratedKeys="true" keyProperty="id">
insert into ff_tenant_secret_key
<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tenantKey != null and tenantKey != ''">tenant_key,</if>
<if test="password != null">password,</if>
<if test="registerTime != null">register_time,</if>
<if test="registerIp != null">register_ip,</if>
<if test="registerIpCity != null">register_ip_city,</if>
<if test="loginIp != null">login_ip,</if>
<if test="loginData != null">login_data,</if>
<if test="tenantKey != null and tenantKey != ''">tenant_key,</if>
<if test="agentId != null">agent_id,</if>
<if test="tenantSn != null">tenant_sn,</if>
<if test="tenantSecret != null and tenantSecret != ''">tenant_secret,</if>
@ -90,12 +81,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="tenantKey != null and tenantKey != ''">#{tenantKey},</if>
<if test="password != null">#{password},</if>
<if test="registerTime != null">#{registerTime},</if>
<if test="registerIp != null">#{registerIp},</if>
<if test="registerIpCity != null">#{registerIpCity},</if>
<if test="loginIp != null">#{loginIp},</if>
<if test="loginData != null">#{loginData},</if>
<if test="tenantKey != null and tenantKey != ''">#{tenantKey},</if>
<if test="agentId != null">#{agentId},</if>
<if test="tenantSn != null">#{tenantSn},</if>
<if test="tenantSecret != null and tenantSecret != ''">#{tenantSecret},</if>
@ -114,10 +108,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateTenantSecretKey" parameterType="TenantSecretKey">
update ff_tenant_secret_key
<trim prefix="SET" suffixOverrides=",">
<if test="tenantKey != null and tenantKey != ''">tenant_key = #{tenantKey},</if>
<if test="password != null">password = #{password},</if>
<if test="registerTime != null">register_time = #{registerTime},</if>
<if test="registerIp != null">register_ip = #{registerIp},</if>
<if test="registerIpCity != null">register_ip_city = #{registerIpCity},</if>
<if test="loginIp != null">login_ip = #{loginIp},</if>
<if test="loginData != null">login_data = #{loginData},</if>
<if test="tenantKey != null and tenantKey != ''">tenant_key = #{tenantKey},</if>
<if test="agentId != null">agent_id = #{agentId},</if>
<if test="tenantSn != null">tenant_sn = #{tenantSn},</if>
<if test="tenantSecret != null and tenantSecret != ''">tenant_secret = #{tenantSecret},</if>
@ -145,6 +142,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from ff_tenant_secret_key where id = #{id}
</delete>
<select id="selectTenantSecretKeyDTOList" parameterType="com.ff.base.system.dto.TenantSecretKeyDTO" resultMap="TenantSecretKeyResult">
<include refid="selectTenantSecretKeyVo"/>
<where>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="loginIp != null and loginIp != ''"> and login_ip = #{loginIp}</if>
<if test="loginData != null "> and login_data = #{loginData}</if>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key like concat('%',#{tenantKey},'%') </if>
<if test="agentId != null "> and agent_id = #{agentId}</if>
<if test="tenantSn != null and tenantSn != ''"> and tenant_sn = #{tenantSn}</if>
<if test="tenantSecret != null and tenantSecret != ''"> and tenant_secret = #{tenantSecret}</if>
<if test="tenantStatus != null "> and tenant_status = #{tenantStatus}</if>
<if test="quotaType != null "> and quota_type = #{quotaType}</if>
<if test="scoreRatio != null "> and score_ratio = #{scoreRatio}</if>
<if test="tenantType != null "> and tenant_type = #{tenantType}</if>
<if test="depositRatio != null "> and deposit_ratio = #{depositRatio}</if>
</where>
</select>
<delete id="deleteTenantSecretKeyByIds" parameterType="String">
delete from ff_tenant_secret_key where id in
<foreach item="id" collection="array" open="(" separator="," close=")">

View File

@ -0,0 +1,79 @@
<?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">
<mapper namespace="com.ff.base.system.mapper.TenantWhiteMapper">
<resultMap type="TenantWhite" id="TenantWhiteResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="whiteIp" column="white_ip" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTenantWhiteVo">
select id, tenant_id, white_ip, create_by, create_time, update_by, update_time from ff_tenant_white
</sql>
<select id="selectTenantWhiteList" parameterType="TenantWhite" resultMap="TenantWhiteResult">
<include refid="selectTenantWhiteVo"/>
<where>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="whiteIp != null and whiteIp != ''"> and white_ip = #{whiteIp}</if>
</where>
</select>
<select id="selectTenantWhiteById" parameterType="Long" resultMap="TenantWhiteResult">
<include refid="selectTenantWhiteVo"/>
where id = #{id}
</select>
<insert id="insertTenantWhite" parameterType="TenantWhite">
insert into ff_tenant_white
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="whiteIp != null">white_ip,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="whiteIp != null">#{whiteIp},</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>
</trim>
</insert>
<update id="updateTenantWhite" parameterType="TenantWhite">
update ff_tenant_white
<trim prefix="SET" suffixOverrides=",">
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="whiteIp != null">white_ip = #{whiteIp},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteTenantWhiteById" parameterType="Long">
delete from ff_tenant_white where id = #{id}
</delete>
<delete id="deleteTenantWhiteByIds" parameterType="String">
delete from ff_tenant_white where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -9,7 +9,7 @@
</parent>
<groupId>com.ff</groupId>
<artifactId>ff-admin</artifactId>
<artifactId>ff-game</artifactId>
<version>0.0.1</version>
<name>ff-admin</name>
<description>ff-admin</description>

View File

@ -0,0 +1,137 @@
package com.ff.agent.controller;
import
com.ff.agent.dto.AgentTenantSecretKeyDTO;
import com.ff.agent.dto.AgentCreateTenantDTO;
import com.ff.base.constant.Constants;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.core.page.TableDataInfo;
import com.ff.base.enums.OperationType;
import com.ff.base.enums.QuotaType;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.dto.CreateTenantDTO;
import com.ff.base.system.dto.TenantSecretKeyDTO;
import com.ff.base.system.service.ISysDeptService;
import com.ff.base.system.service.ISysRoleService;
import com.ff.base.system.service.ISysUserService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.base.utils.ip.IpUtils;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.common.domain.TenantAgentPlatform;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.system.service.ITenantPlatformService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* api
*
* @author shi
* @date 2025/02/10
*/
@RestController
@RequestMapping("/agent/tenant")
@Slf4j
public class AgentController extends BaseController {
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
/**
*
*
* @param tenantSecretKeyDTO
* @return {@link TableDataInfo }
*/
@GetMapping("/list")
@Transactional
@PreAuthorize("@ss.hasPermi('agent:tenant:list')")
public TableDataInfo list(TenantSecretKeyDTO tenantSecretKeyDTO) {
startPage();
tenantSecretKeyDTO.setAgentId(getUserId());
List<TenantSecretKey> tenantSecretKeys = tenantSecretKeyService.selectTenantSecretKeyDTOList(tenantSecretKeyDTO);
TableDataInfo dataTable = getDataTable(tenantSecretKeys);
List<AgentTenantSecretKeyDTO> list = new ArrayList<>();
for (TenantSecretKey row : (List<TenantSecretKey>) dataTable.getRows()) {
AgentTenantSecretKeyDTO agentTenantSecretKeyDTO = new AgentTenantSecretKeyDTO();
BeanUtils.copyProperties(row, agentTenantSecretKeyDTO);
list.add(agentTenantSecretKeyDTO);
}
dataTable.setRows(list);
return dataTable;
}
/**
*
*
* @return {@link AjaxResult }
*/
@PostMapping("/create")
@Transactional
@PreAuthorize("@ss.hasPermi('agent:tenant:create')")
public AjaxResult createTenant(@Validated @RequestBody AgentCreateTenantDTO agentCreateTenantDTO) {
//构造租户的充值信息
List<TenantPlatform> tenantPlatforms = new ArrayList<>();
for (TenantAgentPlatform tenantAgentPlatform : agentCreateTenantDTO.getTenantAgentPlatforms()) {
TenantPlatform tenantPlatform = new TenantPlatform();
BeanUtils.copyProperties(tenantAgentPlatform, tenantPlatform);
tenantPlatforms.add(tenantPlatform);
}
//创建租户
Integer tenant = tenantSecretKeyService.createTenant(CreateTenantDTO.builder()
.registerTime(DateUtils.getNowDate())
.registerIp(IpUtils.getIpAddr())
.agentId(getUserId())
.account(agentCreateTenantDTO.getAccount())
.password(agentCreateTenantDTO.getPassword())
.scoreRatio(agentCreateTenantDTO.getScoreRatio())
.tenantType(agentCreateTenantDTO.getTenantType())
.depositRatio(agentCreateTenantDTO.getDepositRatio())
.tenantPlatforms(tenantPlatforms)
.build());
if (tenant > 0) {
//信誉额度
if (!ObjectUtils.isEmpty(agentCreateTenantDTO.getRealBalance())) {
tenantGameQuotaService.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.TRUE)
.currencyCode(Constants.USDT)
.tenantKey(agentCreateTenantDTO.getAccount())
.balance(agentCreateTenantDTO.getRealBalance())
.operationType(OperationType.TENANT_RECHARGE.getCode())
.quotaType(QuotaType.REPUTATION.getCode())
.remark(OperationType.TENANT_RECHARGE.getDescription())
.build());
}
}
return toAjax(tenant);
}
}

View File

@ -0,0 +1,150 @@
package com.ff.agent.controller;
import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.NumberUtil;
import com.ff.agent.domain.TenantAgentWithdrawal;
import com.ff.agent.service.ITenantAgentInviteService;
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;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.agent.domain.TenantAgentCommission;
import com.ff.agent.service.ITenantAgentCommissionService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-26
*/
@RestController
@RequestMapping("/agent/commission")
public class TenantAgentCommissionController extends BaseController {
@Autowired
private ITenantAgentCommissionService tenantAgentCommissionService;
@Resource
private ITenantAgentWithdrawalService tenantAgentWithdrawalService;
@Resource
private ITenantAgentService tenantAgentService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:commission:list')")
@GetMapping("/list")
public AjaxResult list(TenantAgentCommission tenantAgentCommission) {
startPage();
tenantAgentCommission.setAgentId(getUserId());
List<TenantAgentCommission> list = tenantAgentCommissionService.selectTenantAgentCommissionList(tenantAgentCommission);
//未提现佣金
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;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:commission:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tenantAgentCommissionService.selectTenantAgentCommissionById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:commission:edit')")
@Log(title = "代理佣金管理 ", businessType = BusinessType.UPDATE)
@PutMapping
@Transactional
public synchronized AjaxResult edit() {
//查询钱包
TenantAgent tenantAgent = tenantAgentService.selectTenantAgentById(getUserId());
Assert.isTrue(tenantAgent.getTenantStatus(), "当前租户已被停用");
Assert.isTrue(!StringUtil.isEmpty(tenantAgent.getWalletAddress()) &&
!StringUtil.isEmpty(tenantAgent.getCurrencyAgreement()), "钱包地址为空");
//查询代理佣金信息
TenantAgentCommission agentCommission = new TenantAgentCommission();
agentCommission.setAgentId(getUserId());
agentCommission.setApprovalStatus(CommissionApprovalStatus.UNWITHDRAWN.getValue());
List<TenantAgentCommission> list = tenantAgentCommissionService.selectTenantAgentCommissionList(agentCommission);
BigDecimal usdtBalance = list.stream().map(TenantAgentCommission::getUsdtBalance).reduce(NumberUtil::add).get();
Assert.isTrue(usdtBalance.compareTo(BigDecimal.ZERO) > 0, "佣金待提现余额为0");
TenantAgentWithdrawal tenantAgentWithdrawal = TenantAgentWithdrawal.builder()
.agentId(getUserId())
.commissionBalance(usdtBalance)
.currencyAgreement(tenantAgent.getWalletAddress())
.walletAddress(tenantAgent.getWalletAddress())
.build();
tenantAgentWithdrawalService.insertTenantAgentWithdrawal(tenantAgentWithdrawal);
for (TenantAgentCommission commission : list) {
commission.setAgentWithdrawalId(tenantAgentWithdrawal.getId());
commission.setUpdateBy(getUsername());
commission.setApprovalStatus(CommissionApprovalStatus.WITHDRAWING.getValue());
tenantAgentCommissionService.updateTenantAgentCommission(commission);
}
return toAjax(1);
}
}

View File

@ -0,0 +1,114 @@
package com.ff.agent.controller;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.dto.TenantAgentInviteDTO;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import com.ff.base.annotation.Anonymous;
import com.ff.base.constant.ConfigConstants;
import com.ff.base.enums.InviteType;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.service.ISysConfigService;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.common.domain.TenantAgentPlatform;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.agent.domain.TenantAgentInvite;
import com.ff.agent.service.ITenantAgentInviteService;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-25
*/
@RestController
@RequestMapping("/agent/invite")
public class TenantAgentInviteController extends BaseController {
@Autowired
private ITenantAgentInviteService tenantAgentInviteService;
@Resource
private ISysConfigService sysConfigService;
@Resource
private ITenantAgentInvitePlatformService tenantAgentInvitePlatformService;
/**
*
*/
@Anonymous
@GetMapping(value = "/code/{inviteCode}")
public AjaxResult getInfo(@PathVariable("inviteCode") String inviteCode) {
return success(tenantAgentInviteService.selectTenantAgentInviteByInviteCode(inviteCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:invite:list')")
@GetMapping("/list")
public TableDataInfo list(TenantAgentInvite tenantAgentInvite) {
startPage();
tenantAgentInvite.setAgentId(getUserId());
List<TenantAgentInvite> list = tenantAgentInviteService.selectTenantAgentInviteList(tenantAgentInvite);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:invite:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tenantAgentInviteService.selectTenantAgentInviteById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:invite:add')")
@Log(title = "代理邀请链接", businessType = BusinessType.INSERT)
@PostMapping
@Transactional
public AjaxResult add(@Validated @RequestBody TenantAgentInviteDTO tenantAgentInvite) {
tenantAgentInvite.setAgentId(getUserId());
String inviteUrl = sysConfigService.selectConfigByKey(ConfigConstants.INVITE_URL);
tenantAgentInvite.setInviteCode(tenantAgentInviteService.getInviteCode());
tenantAgentInvite.setInviteUrl(inviteUrl + "?code=" + tenantAgentInvite.getInviteCode());
tenantAgentInvite.setCreateBy(getUsername());
int result = tenantAgentInviteService.insertTenantAgentInvite(tenantAgentInvite);
if (result > 0 && InviteType.TENANT.getValue().equals(tenantAgentInvite.getInviteType())) {
// 保存平台注册利润信息
List<TenantAgentInvitePlatform> tenantAgentInvitePlatforms = tenantAgentInvite.getTenantAgentInvitePlatforms();
for (TenantAgentInvitePlatform tenantAgentInvitePlatform : tenantAgentInvitePlatforms) {
tenantAgentInvitePlatform.setInviteId(tenantAgentInvite.getId());
tenantAgentInvitePlatform.setCreateBy(getUsername());
tenantAgentInvitePlatformService.insertTenantAgentInvitePlatform(tenantAgentInvitePlatform);
}
}
return toAjax(result);
}
}

View File

@ -0,0 +1,48 @@
package com.ff.agent.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-27
*/
@RestController
@RequestMapping("/agent/invite/platform")
public class TenantAgentInvitePlatformController extends BaseController
{
@Autowired
private ITenantAgentInvitePlatformService tenantAgentInvitePlatformService;
/**
*
*/
@GetMapping("/select")
public AjaxResult select(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
List<TenantAgentInvitePlatform> list = tenantAgentInvitePlatformService.selectTenantAgentInvitePlatformList(tenantAgentInvitePlatform);
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,236 @@
package com.ff.agent.controller;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.IdUtil;
import com.ff.agent.domain.TenantAgentCommission;
import com.ff.agent.domain.TenantAgentInvite;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterAddDTO;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import com.ff.agent.service.ITenantAgentCommissionService;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import com.ff.agent.service.ITenantAgentInviteRegisterService;
import com.ff.agent.service.ITenantAgentInviteService;
import com.ff.base.annotation.Anonymous;
import com.ff.base.annotation.Excel;
import com.ff.base.constant.Constants;
import com.ff.base.enums.*;
import com.ff.base.system.domain.TenantAgent;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.dto.CreateTenantDTO;
import com.ff.base.system.dto.TenantSecretKeyDTO;
import com.ff.base.system.service.ITenantAgentService;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.MessageUtils;
import com.ff.base.utils.SecurityUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.base.utils.ip.IpUtils;
import com.ff.base.utils.uuid.IdUtils;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.service.ITenantGameQuotaService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-25
*/
@RestController
@RequestMapping("/agent/invite/register")
public class TenantAgentInviteRegisterController extends BaseController {
@Autowired
private ITenantAgentInviteRegisterService tenantAgentInviteRegisterService;
@Resource
private ITenantAgentInviteService tenantAgentInviteService;
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
@Resource
private ITenantAgentCommissionService tenantAgentCommissionService;
@Resource
private ITenantAgentService tenantAgentService;
@Resource
private ITenantAgentInvitePlatformService tenantAgentInvitePlatformService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('operation:register:list')")
@GetMapping("/list")
public TableDataInfo list(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO) {
startPage();
tenantAgentInviteRegisterDTO.setAgentId(getUserId());
List<TenantAgentInviteRegisterDTO> list = tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterListDTO(tenantAgentInviteRegisterDTO);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('operation:register:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterById(id));
}
/**
*
*/
@Anonymous
@PostMapping
public AjaxResult add(@RequestBody TenantAgentInviteRegisterAddDTO tenantAgentInviteRegisterAddDTO) {
Assert.isTrue(tenantAgentInviteRegisterAddDTO.getPassword().equals(tenantAgentInviteRegisterAddDTO.getConfirmPassword()), "两次密码不一致");
List<TenantAgentInvite> tenantAgentInvites = tenantAgentInviteService.selectTenantAgentInviteList(TenantAgentInvite.builder()
.inviteCode(tenantAgentInviteRegisterAddDTO.getInviteCode())
.build());
Assert.isTrue(!CollectionUtils.isEmpty(tenantAgentInvites), "邀请码错误");
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(tenantAgentInviteRegisterAddDTO.getAccount());
Assert.isTrue(ObjectUtils.isEmpty(tenantSecretKey), MessageUtils.message("operation.tenant.account.already.used"));
List<TenantAgentInviteRegister> tenantAgentInviteRegisters = tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterList(TenantAgentInviteRegister.builder()
.account(tenantAgentInviteRegisterAddDTO.getAccount())
.build());
Assert.isTrue(CollectionUtils.isEmpty(tenantAgentInviteRegisters), MessageUtils.message("operation.tenant.account.already.used"));
TenantAgentInviteRegister tenantAgentInviteRegister = new TenantAgentInviteRegister();
tenantAgentInviteRegister.setAgentId(tenantAgentInvites.get(0).getAgentId());
tenantAgentInviteRegister.setRegisterTime(DateUtils.getNowDate());
tenantAgentInviteRegister.setRegisterIp(IpUtils.getIpAddr());
tenantAgentInviteRegister.setAccount(tenantAgentInviteRegisterAddDTO.getAccount());
tenantAgentInviteRegister.setPassword(tenantAgentInviteRegisterAddDTO.getPassword());
tenantAgentInviteRegister.setBalance(tenantAgentInvites.get(0).getBalance());
tenantAgentInviteRegister.setInviteCode(tenantAgentInviteRegisterAddDTO.getInviteCode());
tenantAgentInviteRegister.setOrderId(IdUtil.getSnowflakeNextIdStr());
return toAjax(tenantAgentInviteRegisterService.insertTenantAgentInviteRegister(tenantAgentInviteRegister));
}
/**
*
*
* @param dto
*/
@Anonymous
@PutMapping
@Transactional
public void edit(@RequestBody TenantAgentInviteRegisterAddDTO dto) {
TenantAgentInviteRegister tenantAgentInviteRegister = tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterById(dto.getId());
Assert.isTrue(tenantAgentInviteRegister.getStatus().equals(InviterRegisterStatus.PENDING.getValue()), "该账号已激活");
//查询注册配置信息
TenantAgentInvite tenantAgentInvite = tenantAgentInviteService.selectTenantAgentInviteByInviteCode(tenantAgentInviteRegister.getInviteCode());
List<TenantAgentInvitePlatform> tenantAgentInvitePlatforms = tenantAgentInvitePlatformService.selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform.builder()
.inviteId(tenantAgentInvite.getId())
.build());
Integer result = 0;
if (tenantAgentInvite.getInviteType().equals(InviteType.TENANT.getValue())) {
List<TenantPlatform> tenantPlatforms = new ArrayList<>();
for (TenantAgentInvitePlatform tenantAgentInvitePlatform : tenantAgentInvitePlatforms) {
TenantPlatform tenantPlatform = new TenantPlatform();
BeanUtils.copyProperties(tenantAgentInvitePlatform, tenantPlatform);
tenantPlatforms.add(tenantPlatform);
}
//创建租户
result = tenantSecretKeyService.createTenant(CreateTenantDTO.builder()
.registerTime(tenantAgentInviteRegister.getRegisterTime())
.registerIp(tenantAgentInviteRegister.getRegisterIp())
.agentId(tenantAgentInvite.getAgentId())
.account(tenantAgentInviteRegister.getAccount())
.password(tenantAgentInviteRegister.getPassword())
.scoreRatio(tenantAgentInvite.getScoreRatio())
.tenantType(tenantAgentInvite.getTenantType())
.depositRatio(tenantAgentInvite.getDepositRatio())
.tenantPlatforms(tenantPlatforms)
.build());
//信誉额度
if (result > 0 & !ObjectUtils.isEmpty(tenantAgentInvite.getRealBalance())) {
tenantGameQuotaService.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.TRUE)
.currencyCode(Constants.USDT)
.tenantKey(tenantAgentInviteRegister.getAccount())
.balance(tenantAgentInvite.getRealBalance())
.operationType(OperationType.TENANT_RECHARGE.getCode())
.quotaType(QuotaType.REPUTATION.getCode())
.remark(OperationType.TENANT_RECHARGE.getDescription())
.build());
}
} else {
result = tenantAgentService.createTenantAgent(TenantAgent.builder()
.account(tenantAgentInviteRegister.getAccount())
.password(tenantAgentInviteRegister.getPassword())
.registerTime(tenantAgentInviteRegister.getRegisterTime())
.registerIp(tenantAgentInviteRegister.getRegisterIp())
.registerIpCity(tenantAgentInviteRegister.getRegisterIpCity())
.tenantStatus(Boolean.TRUE)
.build());
}
if (result > 0) {
//添加佣金信息
TenantAgentCommission tenantAgentCommission = TenantAgentCommission.builder()
.agentId(tenantAgentInvite.getAgentId())
.sourceId(tenantAgentInviteRegister.getId())
.sourceType(CommissionSourceType.AGENT_TENANT_REGISTER.getValue())
.commissionType(CommissionType.INVITE.getValue())
.currencyCode(Constants.USDT)
.balance(tenantAgentInviteRegister.getBalance())
.costBalance(BigDecimal.ZERO)
.merchantBalance(BigDecimal.ZERO)
.commissionBalance(tenantAgentInviteRegister.getBalance())
.usdtBalance(tenantAgentInviteRegister.getBalance())
.build();
tenantAgentCommission.setCreateBy(tenantAgentInviteRegister.getAccount());
tenantAgentCommissionService.insertTenantAgentCommission(tenantAgentCommission);
//更新激活状态
tenantAgentInviteRegister.setStatus(InviterRegisterStatus.ACTIVATED.getValue());
tenantAgentInviteRegisterService.updateTenantAgentInviteRegister(tenantAgentInviteRegister);
}
}
}

View File

@ -0,0 +1,42 @@
package com.ff.agent.controller;
import java.util.List;
import com.ff.base.core.page.PageDomain;
import com.ff.common.domain.TenantAgentPlatform;
import com.ff.common.service.ITenantAgentPlatformService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
/**
* Controller
*
* @author shi
* @date 2025-02-27
*/
@RestController
@RequestMapping("/agent/platform")
public class TenantAgentPlatformController extends BaseController
{
@Autowired
private ITenantAgentPlatformService tenantAgentPlatformService;
/**
*
*/
@GetMapping("/select")
public AjaxResult select( )
{
PageHelper.orderBy("platform_code desc,currency_code desc");
List<TenantAgentPlatform> list = tenantAgentPlatformService.selectTenantAgentPlatformList(TenantAgentPlatform.builder().build());
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,73 @@
package com.ff.agent.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.agent.domain.TenantAgentWithdrawal;
import com.ff.agent.service.ITenantAgentWithdrawalService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-26
*/
@RestController
@RequestMapping("/agent/withdrawal")
public class TenantAgentWithdrawalController extends BaseController
{
@Autowired
private ITenantAgentWithdrawalService tenantAgentWithdrawalService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:withdrawal:list')")
@GetMapping("/list")
public TableDataInfo list(TenantAgentWithdrawal tenantAgentWithdrawal)
{
startPage();
tenantAgentWithdrawal.setAgentId(getUserId());
List<TenantAgentWithdrawal> list = tenantAgentWithdrawalService.selectTenantAgentWithdrawalList(tenantAgentWithdrawal);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:withdrawal:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tenantAgentWithdrawalService.selectTenantAgentWithdrawalById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:withdrawal:edit')")
@Log(title = "代理申请提现审批管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TenantAgentWithdrawal tenantAgentWithdrawal)
{
return toAjax(tenantAgentWithdrawalService.updateTenantAgentWithdrawal(tenantAgentWithdrawal));
}
}

View File

@ -0,0 +1,87 @@
package com.ff.agent.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.*;
/**
* ff_tenant_agent_commission
*
* @author shi
* @date 2025-02-26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantAgentCommission extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long agentId;
/** 来源id */
@Excel(name = "来源id")
@JsonSerialize(using = ToStringSerializer.class)
private Long sourceId;
/** 来源类型 CommissionSourceType */
@Excel(name = "来源类型 CommissionSourceType")
private Integer sourceType;
/** 佣金类型 ff_tenant_agent_commission_type commissionType */
@Excel(name = "佣金类型 commissionType")
private Integer commissionType;
/** 币种 */
@Excel(name = "币种")
private String currencyCode;
/** 平台代码 */
@Excel(name = "平台代码")
private String platformCode;
/** 成本比例 */
@Excel(name = "成本比例")
private BigDecimal costBalance;
/** 商户比例 */
@Excel(name = "商户比例")
private BigDecimal merchantBalance;
/** 充值金额 */
@Excel(name = "充值金额")
private BigDecimal balance;
/** 佣金金额 */
@Excel(name = "佣金金额")
private BigDecimal commissionBalance;
/** USDT金额 */
@Excel(name = "USDT金额")
private BigDecimal usdtBalance;
/** 佣金审批状态 ff_tenant_agent_approval_status 0 未提现 1 提现中 1 已提现 */
@Excel(name = "佣金审批状态 0 未提现 1 提现中 1 已提现")
private Integer approvalStatus;
/**
* id
*/
private Long agentWithdrawalId;
}

View File

@ -0,0 +1,73 @@
package com.ff.agent.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_agent_invite
*
* @author shi
* @date 2025-02-25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantAgentInvite extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 代理id */
@Excel(name = "代理id")
@JsonSerialize(using = ToStringSerializer.class)
private Long agentId;
/** 缴费金额 */
@Excel(name = "缴费金额")
private BigDecimal balance;
/** 邀请类型 1 租户 2代理 ff_agent_invite_type */
@Excel(name = "邀请类型 1 租户 2代理 ")
private Integer inviteType;
/** 额度类型 TenantQuotaType 枚举 */
@Excel(name = "额度类型 TenantQuotaType 枚举")
private Integer quotaType;
/** 买分比例 */
@Excel(name = "买分比例")
private BigDecimal scoreRatio;
/** 租户类型 TenantType 枚举 */
@Excel(name = "租户类型 TenantType 枚举")
private Integer tenantType;
/** 透支比例 */
@Excel(name = "透支比例")
private BigDecimal depositRatio;
/** 信誉额度 */
@Excel(name = "信誉额度")
private BigDecimal realBalance;
/** 邀请码 */
@Excel(name = "邀请码")
private String inviteCode;
/** 邀请链接 */
@Excel(name = "邀请链接")
private String inviteUrl;
}

View File

@ -0,0 +1,53 @@
package com.ff.agent.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_agent_invite_platform
*
* @author shi
* @date 2025-02-27
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantAgentInvitePlatform extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 邀请码id */
@JsonSerialize(using = ToStringSerializer.class)
@Excel(name = "邀请码id", width = 30, dateFormat = "yyyy-MM-dd")
private Long inviteId;
/** 平台编码 */
@Excel(name = "平台编码")
private String platformCode;
/** 币种编码 */
@Excel(name = "币种编码")
private String currencyCode;
/** 成本 */
@Excel(name = "成本")
private BigDecimal cost;
/** 使用成本 */
@Excel(name = "使用成本")
private BigDecimal useCost;
}

View File

@ -0,0 +1,76 @@
package com.ff.agent.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_agent_invite_register
*
* @author shi
* @date 2025-02-25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantAgentInviteRegister extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 代理id */
@Excel(name = "代理id")
@JsonSerialize(using = ToStringSerializer.class)
private Long agentId;
/** 邀请码 */
@Excel(name = "邀请码")
private String inviteCode;
/** 账号 */
@Excel(name = "账号")
private String account;
/** 密码 */
@Excel(name = "密码")
private String password;
/** 缴费金额 */
@Excel(name = "缴费金额")
private BigDecimal balance;
/** 注册时间 */
@Excel(name = "注册时间")
@JsonSerialize(using = ToStringSerializer.class)
private Long registerTime;
/** 注册IP */
@Excel(name = "注册IP")
private String registerIp;
/** 注册ip的城市 */
@Excel(name = "注册ip的城市")
private String registerIpCity;
/** 状态 1 待激活 2已激活 InviterRegisterStatus 枚举*/
@Excel(name = "状态 1 待激活 2已激活")
private Integer status;
/**
* id
*/
private String orderId;
}

View File

@ -0,0 +1,54 @@
package com.ff.agent.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_agent_withdrawal
*
* @author shi
* @date 2025-02-26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantAgentWithdrawal extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long agentId;
/** 佣金余额 */
@Excel(name = "佣金余额")
private BigDecimal commissionBalance;
/** 币种协议 */
@Excel(name = "币种协议")
private String currencyAgreement;
/** 钱包地址 */
@Excel(name = "钱包地址")
private String walletAddress;
/** 0 未提现 1 提现中 1 已提现 3 已拒绝 */
@Excel(name = " 0 未提现 1 提现中 1 已提现 3 已拒绝")
private Integer approvalStatus;
}

View File

@ -1,7 +1,8 @@
package com.ff.agent.request;
package com.ff.agent.dto;
import com.ff.base.xss.Xss;
import com.ff.common.domain.TenantAgentPlatform;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -9,6 +10,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
*
@ -17,7 +19,7 @@ import java.math.BigDecimal;
* @date 2025/02/20
*/
@Data
public class AgentCreateTenantRequest implements Serializable {
public class AgentCreateTenantDTO implements Serializable {
private static final long serialVersionUID = -5561068216486978354L;
@ -34,12 +36,12 @@ public class AgentCreateTenantRequest implements Serializable {
@NotBlank(message = "密码不能为空")
@Size(min = 5, max = 20, message = "密码长度不能超过25个字符")
private String password;
/**
*
*/
@NotBlank(message = "确认密码不能为空")
@Size(min = 5, max = 20, message = "密码长度不能超过25个字符")
private String confirmPassword;
/** 买分比例 */
@NotNull(message = "买分比例不能为空")
private BigDecimal scoreRatio;
/** 租户类型 TenantType 枚举 */
@ -52,6 +54,13 @@ public class AgentCreateTenantRequest implements Serializable {
/** 透支比例 */
private BigDecimal depositRatio;
/**
*
*/
@NotNull(message = "租户代理平台列表不能为空")
@Size(min = 1, message = "租户代理平台列表必须包含至少一个元素")
private List<TenantAgentPlatform> tenantAgentPlatforms;

View File

@ -1,6 +1,8 @@
package com.ff.agent.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
@ -25,6 +27,7 @@ public class AgentTenantSecretKeyDTO extends BaseEntity
private static final long serialVersionUID = 1L;
/** 主键id */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@ -41,6 +44,7 @@ public class AgentTenantSecretKeyDTO extends BaseEntity
/** 最后登录时间 */
@Excel(name = "最后登录时间")
@JsonSerialize(using = ToStringSerializer.class)
private Long loginData;
@ -51,6 +55,7 @@ public class AgentTenantSecretKeyDTO extends BaseEntity
/** 代理id */
@Excel(name = "代理id")
@JsonSerialize(using = ToStringSerializer.class)
private Long agentId;

View File

@ -0,0 +1,28 @@
package com.ff.agent.dto;
import com.ff.agent.domain.TenantAgentInvite;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.common.domain.TenantAgentPlatform;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
* dto
*
* @author shi
* @date 2025/02/27
*/
@Data
public class TenantAgentInviteDTO extends TenantAgentInvite {
/**
*
*/
@NotNull(message = "租户代理平台列表不能为空")
@Size(min = 1, message = "租户代理平台列表必须包含至少一个元素")
private List<TenantAgentInvitePlatform> tenantAgentInvitePlatforms;
}

View File

@ -0,0 +1,34 @@
package com.ff.agent.dto;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/25
*/
@Data
public class TenantAgentInviteRegisterAddDTO extends BaseEntity {
/** 邀请码 */
private String inviteCode;
/** 账号 */
private String account;
/** 密码 */
private String password;
/**
*
*/
private String confirmPassword;
}

View File

@ -0,0 +1,19 @@
package com.ff.agent.dto;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.base.core.domain.BaseEntity;
import lombok.Data;
/**
* dto
*
* @author shi
* @date 2025/02/26
*/
@Data
public class TenantAgentInviteRegisterDTO extends TenantAgentInviteRegister {
/**
*
*/
private Integer inviteType;
}

View File

@ -0,0 +1,72 @@
package com.ff.agent.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.ff.agent.domain.TenantAgentCommission;
/**
* Mapper
*
* @author shi
* @date 2025-02-26
*/
public interface TenantAgentCommissionMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentCommission selectTenantAgentCommissionById(Long id);
/**
*
*
* @param tenantAgentCommission
* @return
*/
List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int insertTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int updateTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentCommissionById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentCommissionByIds(Long[] ids);
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission);
}

View File

@ -0,0 +1,70 @@
package com.ff.agent.mapper;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvite;
/**
* Mapper
*
* @author shi
* @date 2025-02-25
*/
public interface TenantAgentInviteMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvite selectTenantAgentInviteById(Long id);
/**
*
*
* @param inviteCode
* @return {@link TenantAgentInvite }
*/
TenantAgentInvite selectTenantAgentInviteByInviteCode(String inviteCode);
/**
*
*
* @param tenantAgentInvite
* @return
*/
List<TenantAgentInvite> selectTenantAgentInviteList(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param tenantAgentInvite
* @return
*/
int insertTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param tenantAgentInvite
* @return
*/
int updateTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ff.agent.mapper;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvitePlatform;
/**
* Mapper
*
* @author shi
* @date 2025-02-27
*/
public interface TenantAgentInvitePlatformMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvitePlatform selectTenantAgentInvitePlatformById(Long id);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
List<TenantAgentInvitePlatform> selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int insertTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int updateTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInvitePlatformById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInvitePlatformByIds(Long[] ids);
}

View File

@ -0,0 +1,72 @@
package com.ff.agent.mapper;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import java.util.List;
/**
* Mapper
*
* @author shi
* @date 2025-02-25
*/
public interface TenantAgentInviteRegisterMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentInviteRegister selectTenantAgentInviteRegisterById(Long id);
/**
* dto
*
* @param tenantAgentInviteRegisterDTO dto
* @return {@link List }<{@link TenantAgentInviteRegisterDTO }>
*/
List<TenantAgentInviteRegisterDTO> selectTenantAgentInviteRegisterListDTO(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
List<TenantAgentInviteRegister> selectTenantAgentInviteRegisterList(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int insertTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int updateTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteRegisterById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteRegisterByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ff.agent.mapper;
import java.util.List;
import com.ff.agent.domain.TenantAgentWithdrawal;
/**
* Mapper
*
* @author shi
* @date 2025-02-26
*/
public interface TenantAgentWithdrawalMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentWithdrawal selectTenantAgentWithdrawalById(Long id);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
List<TenantAgentWithdrawal> selectTenantAgentWithdrawalList(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int insertTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int updateTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentWithdrawalById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentWithdrawalByIds(Long[] ids);
}

View File

@ -0,0 +1,71 @@
package com.ff.agent.service;
import java.math.BigDecimal;
import java.util.List;
import com.ff.agent.domain.TenantAgentCommission;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
public interface ITenantAgentCommissionService
{
/**
*
*
* @param id
* @return
*/
TenantAgentCommission selectTenantAgentCommissionById(Long id);
/**
*
*
* @param tenantAgentCommission
* @return
*/
List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int insertTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int updateTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentCommissionByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentCommissionById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.ff.agent.service;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvitePlatform;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
public interface ITenantAgentInvitePlatformService
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvitePlatform selectTenantAgentInvitePlatformById(Long id);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
List<TenantAgentInvitePlatform> selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int insertTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int updateTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInvitePlatformByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInvitePlatformById(Long id);
}

View File

@ -0,0 +1,73 @@
package com.ff.agent.service;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import java.util.List;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
public interface ITenantAgentInviteRegisterService
{
/**
*
*
* @param id
* @return
*/
TenantAgentInviteRegister selectTenantAgentInviteRegisterById(Long id);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
List<TenantAgentInviteRegister> selectTenantAgentInviteRegisterList(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
* dto
*
* @param tenantAgentInviteRegisterDTO dto
* @return {@link List }<{@link TenantAgentInviteRegisterDTO }>
*/
List<TenantAgentInviteRegisterDTO> selectTenantAgentInviteRegisterListDTO(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int insertTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int updateTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteRegisterByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteRegisterById(Long id);
}

View File

@ -0,0 +1,77 @@
package com.ff.agent.service;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvite;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
public interface ITenantAgentInviteService
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvite selectTenantAgentInviteById(Long id);
/**
*
*
* @param inviteCode
* @return {@link TenantAgentInvite }
*/
TenantAgentInvite selectTenantAgentInviteByInviteCode(String inviteCode);
/**
*
*
* @param tenantAgentInvite
* @return
*/
List<TenantAgentInvite> selectTenantAgentInviteList(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param tenantAgentInvite
* @return
*/
int insertTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @return {@link String }
*/
String getInviteCode();
/**
*
*
* @param tenantAgentInvite
* @return
*/
int updateTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.ff.agent.service;
import java.util.List;
import com.ff.agent.domain.TenantAgentWithdrawal;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
public interface ITenantAgentWithdrawalService
{
/**
*
*
* @param id
* @return
*/
TenantAgentWithdrawal selectTenantAgentWithdrawalById(Long id);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
List<TenantAgentWithdrawal> selectTenantAgentWithdrawalList(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int insertTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int updateTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentWithdrawalByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentWithdrawalById(Long id);
}

View File

@ -0,0 +1,111 @@
package com.ff.agent.service.impl;
import java.math.BigDecimal;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.agent.mapper.TenantAgentCommissionMapper;
import com.ff.agent.domain.TenantAgentCommission;
import com.ff.agent.service.ITenantAgentCommissionService;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
@Service
public class TenantAgentCommissionServiceImpl implements ITenantAgentCommissionService
{
@Autowired
private TenantAgentCommissionMapper tenantAgentCommissionMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentCommission selectTenantAgentCommissionById(Long id)
{
return tenantAgentCommissionMapper.selectTenantAgentCommissionById(id);
}
/**
*
*
* @param tenantAgentCommission
* @return
*/
@Override
public List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission)
{
return tenantAgentCommissionMapper.selectTenantAgentCommissionList(tenantAgentCommission);
}
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
@Override
public BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission) {
return tenantAgentCommissionMapper.getAgentCommissionSum(tenantAgentCommission);
}
/**
*
*
* @param tenantAgentCommission
* @return
*/
@Override
public int insertTenantAgentCommission(TenantAgentCommission tenantAgentCommission)
{
tenantAgentCommission.setCreateTime(DateUtils.getNowDate());
tenantAgentCommission.setId(IdUtil.getSnowflakeNextId());
return tenantAgentCommissionMapper.insertTenantAgentCommission(tenantAgentCommission);
}
/**
*
*
* @param tenantAgentCommission
* @return
*/
@Override
public int updateTenantAgentCommission(TenantAgentCommission tenantAgentCommission)
{
tenantAgentCommission.setUpdateTime(DateUtils.getNowDate());
return tenantAgentCommissionMapper.updateTenantAgentCommission(tenantAgentCommission);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentCommissionByIds(Long[] ids)
{
return tenantAgentCommissionMapper.deleteTenantAgentCommissionByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentCommissionById(Long id)
{
return tenantAgentCommissionMapper.deleteTenantAgentCommissionById(id);
}
}

View File

@ -0,0 +1,99 @@
package com.ff.agent.service.impl;
import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.agent.mapper.TenantAgentInvitePlatformMapper;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
@Service
public class TenantAgentInvitePlatformServiceImpl implements ITenantAgentInvitePlatformService
{
@Autowired
private TenantAgentInvitePlatformMapper tenantAgentInvitePlatformMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentInvitePlatform selectTenantAgentInvitePlatformById(Long id)
{
return tenantAgentInvitePlatformMapper.selectTenantAgentInvitePlatformById(id);
}
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
@Override
public List<TenantAgentInvitePlatform> selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
return tenantAgentInvitePlatformMapper.selectTenantAgentInvitePlatformList(tenantAgentInvitePlatform);
}
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
@Override
public int insertTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
tenantAgentInvitePlatform.setId(IdUtil.getSnowflakeNextId());
tenantAgentInvitePlatform.setCreateTime(DateUtils.getNowDate());
return tenantAgentInvitePlatformMapper.insertTenantAgentInvitePlatform(tenantAgentInvitePlatform);
}
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
@Override
public int updateTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
tenantAgentInvitePlatform.setUpdateTime(DateUtils.getNowDate());
return tenantAgentInvitePlatformMapper.updateTenantAgentInvitePlatform(tenantAgentInvitePlatform);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentInvitePlatformByIds(Long[] ids)
{
return tenantAgentInvitePlatformMapper.deleteTenantAgentInvitePlatformByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentInvitePlatformById(Long id)
{
return tenantAgentInvitePlatformMapper.deleteTenantAgentInvitePlatformById(id);
}
}

View File

@ -0,0 +1,113 @@
package com.ff.agent.service.impl;
import java.util.Collections;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import com.ff.agent.mapper.TenantAgentInviteRegisterMapper;
import com.ff.agent.service.ITenantAgentInviteRegisterService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
@Service
public class TenantAgentInviteRegisterServiceImpl implements ITenantAgentInviteRegisterService
{
@Autowired
private TenantAgentInviteRegisterMapper tenantAgentInviteRegisterMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentInviteRegister selectTenantAgentInviteRegisterById(Long id)
{
return tenantAgentInviteRegisterMapper.selectTenantAgentInviteRegisterById(id);
}
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
@Override
public List<TenantAgentInviteRegister> selectTenantAgentInviteRegisterList(TenantAgentInviteRegister tenantAgentInviteRegister)
{
return tenantAgentInviteRegisterMapper.selectTenantAgentInviteRegisterList(tenantAgentInviteRegister);
}
/**
* dto
*
* @param tenantAgentInviteRegisterDTO dto
* @return {@link List }<{@link TenantAgentInviteRegisterDTO }>
*/
@Override
public List<TenantAgentInviteRegisterDTO> selectTenantAgentInviteRegisterListDTO(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO) {
return tenantAgentInviteRegisterMapper.selectTenantAgentInviteRegisterListDTO(tenantAgentInviteRegisterDTO);
}
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
@Override
public int insertTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister)
{
tenantAgentInviteRegister.setId(IdUtil.getSnowflakeNextId());
tenantAgentInviteRegister.setCreateTime(DateUtils.getNowDate());
return tenantAgentInviteRegisterMapper.insertTenantAgentInviteRegister(tenantAgentInviteRegister);
}
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
@Override
public int updateTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister)
{
tenantAgentInviteRegister.setUpdateTime(DateUtils.getNowDate());
return tenantAgentInviteRegisterMapper.updateTenantAgentInviteRegister(tenantAgentInviteRegister);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentInviteRegisterByIds(Long[] ids)
{
return tenantAgentInviteRegisterMapper.deleteTenantAgentInviteRegisterByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentInviteRegisterById(Long id)
{
return tenantAgentInviteRegisterMapper.deleteTenantAgentInviteRegisterById(id);
}
}

View File

@ -0,0 +1,128 @@
package com.ff.agent.service.impl;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.agent.mapper.TenantAgentInviteMapper;
import com.ff.agent.domain.TenantAgentInvite;
import com.ff.agent.service.ITenantAgentInviteService;
import org.springframework.util.CollectionUtils;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
@Service
public class TenantAgentInviteServiceImpl implements ITenantAgentInviteService
{
@Autowired
private TenantAgentInviteMapper tenantAgentInviteMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentInvite selectTenantAgentInviteById(Long id)
{
return tenantAgentInviteMapper.selectTenantAgentInviteById(id);
}
/**
*
*
* @param inviteCode
* @return {@link TenantAgentInvite }
*/
@Override
public TenantAgentInvite selectTenantAgentInviteByInviteCode(String inviteCode) {
return tenantAgentInviteMapper.selectTenantAgentInviteByInviteCode( inviteCode);
}
/**
*
*
* @param tenantAgentInvite
* @return
*/
@Override
public List<TenantAgentInvite> selectTenantAgentInviteList(TenantAgentInvite tenantAgentInvite)
{
return tenantAgentInviteMapper.selectTenantAgentInviteList(tenantAgentInvite);
}
/**
*
*
* @param tenantAgentInvite
* @return
*/
@Override
public int insertTenantAgentInvite(TenantAgentInvite tenantAgentInvite)
{
tenantAgentInvite.setId(IdUtil.getSnowflakeNextId());
tenantAgentInvite.setCreateTime(DateUtils.getNowDate());
return tenantAgentInviteMapper.insertTenantAgentInvite(tenantAgentInvite);
}
/**
*
*
* @return {@link String }
*/
@Override
public synchronized String getInviteCode() {
String inviteCode = NumberUtils.generateRandomCode(12);
while (!CollectionUtils.isEmpty(tenantAgentInviteMapper.selectTenantAgentInviteList(TenantAgentInvite.builder()
.inviteCode(inviteCode)
.build()))) {
inviteCode = NumberUtils.generateRandomCode(12);
}
return inviteCode;
}
/**3
*
*
* @param tenantAgentInvite
* @return
*/
@Override
public int updateTenantAgentInvite(TenantAgentInvite tenantAgentInvite)
{
tenantAgentInvite.setUpdateTime(DateUtils.getNowDate());
return tenantAgentInviteMapper.updateTenantAgentInvite(tenantAgentInvite);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentInviteByIds(Long[] ids)
{
return tenantAgentInviteMapper.deleteTenantAgentInviteByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentInviteById(Long id)
{
return tenantAgentInviteMapper.deleteTenantAgentInviteById(id);
}
}

View File

@ -0,0 +1,99 @@
package com.ff.agent.service.impl;
import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.agent.mapper.TenantAgentWithdrawalMapper;
import com.ff.agent.domain.TenantAgentWithdrawal;
import com.ff.agent.service.ITenantAgentWithdrawalService;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
@Service
public class TenantAgentWithdrawalServiceImpl implements ITenantAgentWithdrawalService
{
@Autowired
private TenantAgentWithdrawalMapper tenantAgentWithdrawalMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentWithdrawal selectTenantAgentWithdrawalById(Long id)
{
return tenantAgentWithdrawalMapper.selectTenantAgentWithdrawalById(id);
}
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
@Override
public List<TenantAgentWithdrawal> selectTenantAgentWithdrawalList(TenantAgentWithdrawal tenantAgentWithdrawal)
{
return tenantAgentWithdrawalMapper.selectTenantAgentWithdrawalList(tenantAgentWithdrawal);
}
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
@Override
public int insertTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal)
{
tenantAgentWithdrawal.setId(IdUtil.getSnowflakeNextId());
tenantAgentWithdrawal.setCreateTime(DateUtils.getNowDate());
return tenantAgentWithdrawalMapper.insertTenantAgentWithdrawal(tenantAgentWithdrawal);
}
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
@Override
public int updateTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal)
{
tenantAgentWithdrawal.setUpdateTime(DateUtils.getNowDate());
return tenantAgentWithdrawalMapper.updateTenantAgentWithdrawal(tenantAgentWithdrawal);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentWithdrawalByIds(Long[] ids)
{
return tenantAgentWithdrawalMapper.deleteTenantAgentWithdrawalByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentWithdrawalById(Long id)
{
return tenantAgentWithdrawalMapper.deleteTenantAgentWithdrawalById(id);
}
}

View File

@ -1,6 +1,11 @@
package com.ff.annotation;
import cn.hutool.core.util.IdUtil;
import com.ff.base.constant.Constants;
import com.ff.base.system.domain.TenantWhite;
import com.ff.base.system.service.ITenantWhiteService;
import com.ff.base.utils.ip.IpUtils;
import com.ff.base.utils.uuid.IdUtils;
import com.ff.config.KeyConfig;
import com.ff.base.utils.sign.Md5Utils;
import com.ff.base.system.domain.TenantSecretKey;
@ -15,6 +20,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
*
@ -29,6 +35,9 @@ public class HeaderCheckAspect {
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private ITenantWhiteService tenantWhiteService;
@Resource
private KeyConfig keyUtils;
@ -59,10 +68,16 @@ public class HeaderCheckAspect {
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(key);
Assert.notNull(tenantSecretKey, "key不存在");
Assert.notNull(tenantSecretKey, key+"key不存在");
Assert.isTrue(tenantSecretKey.getTenantStatus(), "当前租户已停用");
List<TenantWhite> tenantWhites = tenantWhiteService.selectTenantWhiteList(TenantWhite.builder()
.tenantId(tenantSecretKey.getId())
.whiteIp(IpUtils.getIpAddr())
.build());
Assert.isTrue(!tenantWhites.isEmpty(), "当前"+IpUtils.getIpAddr()+"不在白名单内");
String keyG = Md5Utils.md5New(random + key + tenantSecretKey.getTenantSecret());
Assert.isTrue(keyG.equals(sign), "签名错误");
//保存

View File

@ -185,6 +185,7 @@ public class ApiGameController extends BaseController {
BigDecimal quota = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
.sourceId(gameExchangeBalanceRequest.getOrderId())
.currencyCode(gameExchangeBalanceRequest.getCurrencyCode())
.transferType(gameExchangeBalanceRequest.getTransferType())
.amount(gameExchangeBalanceRequest.getAmount())
@ -494,6 +495,7 @@ public class ApiGameController extends BaseController {
tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
.platformCode(gameExchangeMoney.getPlatformCode())
.currencyCode(gameExchangeMoney.getCurrencyCode())
.sourceId(gameExchangeBalanceAllRequest.getOrderId())
.transferType(TransferType.ALL.getCode())
.amount(gameExchangeMoney.getBalance())
.account(member.getMemberAccount())

View File

@ -46,7 +46,7 @@ public class GameExchangeBalanceRequest implements Serializable {
*
*/
@NotNull(message = "amount不能为空")
@Min(value = 0, message = "amount最小值为0")
@Min(value = 1, message = "amount最小值为1")
@Max(value = 999999999, message = "amount最大值为999999999")
private BigDecimal amount;

Some files were not shown because too many files have changed in this diff Show More