feat(game): 添加 PGX 游戏平台支持

- 新增 PGX 游戏平台的 API接口实现类 GamesPGXServiceImpl
- 添加 PGX 游戏类型枚举类 GPXGameType
- 在 GamePlatforms 枚举中添加 PGX 游戏平台
- 更新相关服务和 Mapper 类以支持 PGX 游戏平台
main-fb
shi 2025-03-28 18:17:30 +08:00
parent de4a7e9286
commit 7a5a30ebdd
9 changed files with 496 additions and 0 deletions

View File

@ -0,0 +1,105 @@
package com.ff.base.table.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ff.base.table.domain.Table;
import com.ff.base.table.service.ITableService;
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.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-03-28
*/
@RestController
@RequestMapping("/table/table")
public class TableController extends BaseController
{
@Autowired
private ITableService tableService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('table:table:list')")
@GetMapping("/list")
public TableDataInfo list(Table table)
{
startPage();
List<Table> list = tableService.selectTableList(table);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('table:table:export')")
@Log(title = "分", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Table table)
{
List<Table> list = tableService.selectTableList(table);
ExcelUtil<Table> util = new ExcelUtil<Table>(Table.class);
util.exportExcel(response, list, "分数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('table:table:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tableService.selectTableById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('table:table:add')")
@Log(title = "分", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Table table)
{
return toAjax(tableService.insertTable(table));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('table:table:edit')")
@Log(title = "分", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Table table)
{
return toAjax(tableService.updateTable(table));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('table:table:remove')")
@Log(title = "分", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tableService.deleteTableByIds(ids));
}
}

View File

@ -0,0 +1,33 @@
package com.ff.base.table.domain;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.Data;
/**
* ff_table
*
* @author shi
* @date 2025-03-28
*/
@Data
public class Table extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 表名 */
@Excel(name = "表名")
private String tableName;
/** 分表字段 */
@Excel(name = "分表字段")
private String tableField;
/** 分表类型 day天分表 */
@Excel(name = " 分表类型 day天分表 ")
private String type;
}

View File

@ -0,0 +1,62 @@
package com.ff.base.table.mapper;
import com.ff.base.table.domain.Table;
import java.util.List;
/**
* Mapper
*
* @author shi
* @date 2025-03-28
*/
public interface TableMapper
{
/**
*
*
* @param id
* @return
*/
Table selectTableById(Long id);
/**
*
*
* @param table
* @return
*/
List<Table> selectTableList(Table table);
/**
*
*
* @param table
* @return
*/
int insertTable(Table table);
/**
*
*
* @param table
* @return
*/
int updateTable(Table table);
/**
*
*
* @param id
* @return
*/
int deleteTableById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTableByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.ff.base.table.service;
import com.ff.base.table.domain.Table;
import java.util.List;
/**
* Service
*
* @author shi
* @date 2025-03-28
*/
public interface ITableService
{
/**
*
*
* @param id
* @return
*/
Table selectTableById(Long id);
/**
*
*
* @param table
* @return
*/
List<Table> selectTableList(Table table);
/**
*
*
* @param table
* @return
*/
int insertTable(Table table);
/**
*
*
* @param table
* @return
*/
int updateTable(Table table);
/**
*
*
* @param ids
* @return
*/
int deleteTableByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTableById(Long id);
}

View File

@ -0,0 +1,100 @@
package com.ff.base.table.service.impl;
import java.util.List;
import com.ff.base.table.domain.Table;
import com.ff.base.table.mapper.TableMapper;
import com.ff.base.table.service.ITableService;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-03-28
*/
@Service
public class TableServiceImpl implements ITableService
{
@Autowired
private TableMapper tableMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Table selectTableById(Long id)
{
return tableMapper.selectTableById(id);
}
/**
*
*
* @param table
* @return
*/
@Override
public List<Table> selectTableList(Table table)
{
return tableMapper.selectTableList(table);
}
/**
*
*
* @param table
* @return
*/
@Override
public int insertTable(Table table)
{
table.setId(IdUtil.getSnowflakeNextId());
table.setCreateTime(DateUtils.getNowDate());
return tableMapper.insertTable(table);
}
/**
*
*
* @param table
* @return
*/
@Override
public int updateTable(Table table)
{
table.setUpdateTime(DateUtils.getNowDate());
return tableMapper.updateTable(table);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTableByIds(Long[] ids)
{
return tableMapper.deleteTableByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTableById(Long id)
{
return tableMapper.deleteTableById(id);
}
}

View File

@ -17,6 +17,14 @@
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-spring-boot-starter</artifactId>
<version>5.0.1</version>
</dependency>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -0,0 +1,40 @@
package com.ff.quartz.task;
import com.ff.base.table.service.ITableService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
*
*
* @author shi
* @date 2025/03/28
*/
@Slf4j
@Component("tablesJob")
public class TablesJob {
@Autowired
private ITableService tableService;
public void checkTablesJob() {
LocalDateTime now = LocalDateTime.now();
// 检查当前小时表
checkAndCreateTable(now);
// 检查前一小时表(处理跨天情况)
checkAndCreateTable(now.minusHours(1));
}
private void checkAndCreateTable(LocalDateTime time) {
String tableSuffix = time.format(DateTimeFormatter.ofPattern("yyyyMMddHH"));
String tableName = "ff_game_betting_details_" + tableSuffix;
if (!tableManager.isTableExists(tableName)) {
tableManager.createHourTable(tableName);
}
}
}

View File

@ -76,6 +76,8 @@ spring:
config:
multi-statement-allow: true
forest:
backend: okhttp3 # 后端HTTP框架默认为 okhttp3
max-connections: 1000 # 连接池最大连接数(默认为 500

View File

@ -0,0 +1,84 @@
<?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.table.mapper.TableMapper">
<resultMap type="Table" id="TableResult">
<result property="id" column="id" />
<result property="tableName" column="table_name" />
<result property="tableField" column="table_field" />
<result property="type" column="type" />
<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="selectTableVo">
select id, table_name, table_field, type, create_by, create_time, update_by, update_time from ff_table
</sql>
<select id="selectTableList" parameterType="Table" resultMap="TableResult">
<include refid="selectTableVo"/>
<where>
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
<if test="tableField != null and tableField != ''"> and table_field = #{tableField}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
</where>
</select>
<select id="selectTableById" parameterType="Long" resultMap="TableResult">
<include refid="selectTableVo"/>
where id = #{id}
</select>
<insert id="insertTable" parameterType="Table">
insert into ff_table
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tableName != null">table_name,</if>
<if test="tableField != null">table_field,</if>
<if test="type != null">type,</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="tableName != null">#{tableName},</if>
<if test="tableField != null">#{tableField},</if>
<if test="type != null">#{type},</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="updateTable" parameterType="Table">
update ff_table
<trim prefix="SET" suffixOverrides=",">
<if test="tableName != null">table_name = #{tableName},</if>
<if test="tableField != null">table_field = #{tableField},</if>
<if test="type != null">type = #{type},</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="deleteTableById" parameterType="Long">
delete from ff_table where id = #{id}
</delete>
<delete id="deleteTableByIds" parameterType="String">
delete from ff_table where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>