refactor(xk-dbsports): 重构项目依赖和目录结构- 新增 ff-util 模块,包含通用工具类
-将 GamePlatforms 枚举移动到新模块中 - 更新项目依赖关系 - 调整包名和类名以适应新结构main-pp
parent
af1253e96a
commit
e566053cb7
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ff</artifactId>
|
||||
<groupId>com.ff</groupId>
|
||||
<version>0.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ff-util</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<name>ff-util</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
</dependency>
|
||||
<!-- io常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.5.15</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>ff-util</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,36 @@
|
|||
package com.ff.utils;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
public class Md5Utils {
|
||||
|
||||
public static String md5New(String input) {
|
||||
try {
|
||||
// 创建 MD5 消息摘要对象
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
// 更新输入数据
|
||||
md.update(input.getBytes());
|
||||
// 获取 MD5 哈希值
|
||||
byte[] hashBytes = md.digest();
|
||||
|
||||
// 将字节数组转为十六进制字符串
|
||||
StringBuilder hexString = new StringBuilder();
|
||||
for (byte b : hashBytes) {
|
||||
// 将每个字节转换为两位十六进制数字
|
||||
String hex = Integer.toHexString(0xFF & b);
|
||||
if (hex.length() == 1) {
|
||||
hexString.append('0'); // 保证是两位
|
||||
}
|
||||
hexString.append(hex);
|
||||
}
|
||||
|
||||
return hexString.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
return null; // 或者抛出异常
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,6 +20,11 @@
|
|||
<groupId>com.ff</groupId>
|
||||
<artifactId>ff-domain</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ff</groupId>
|
||||
<artifactId>comp-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
@ -54,10 +59,6 @@
|
|||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.ff.enums;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum GamePlatforms {
|
||||
JILI("JILI", "JILI"),
|
||||
XK("XK", "XK"),
|
||||
PG("PG", "PG"),
|
||||
PGX("PGX", "PGX"),
|
||||
FC("FC", "FC"),
|
||||
SA("SA", "SA"),
|
||||
DG("DG", "DG"),
|
||||
MT("MT", "美天棋牌"),
|
||||
AE("AE", "AE"),
|
||||
KM("KM", "KM"),
|
||||
PGT("PGT", "PGT"),
|
||||
FBSports("FBSports", "FB体育"),
|
||||
SV388("SV388", "SV388真人"),
|
||||
DBSports("DBSports", "DB体育");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
GamePlatforms(String code, String info) {
|
||||
this.code = code;
|
||||
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;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.ff.service;
|
||||
|
||||
import com.ff.game.domain.Platform;
|
||||
import com.ff.redis.GRedisCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
@Service
|
||||
public class PlatformManager {
|
||||
|
||||
@Autowired
|
||||
GRedisCache gRedisCache;
|
||||
|
||||
public Platform get(String platformCode) {
|
||||
return gRedisCache.getCacheObject(getCacheKey(platformCode));
|
||||
}
|
||||
|
||||
private String getCacheKey(String configKey) {
|
||||
return "platform:" + configKey;
|
||||
}
|
||||
}
|
|
@ -19,10 +19,6 @@
|
|||
<groupId>com.ff</groupId>
|
||||
<artifactId>xk-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ff</groupId>
|
||||
<artifactId>comp-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
|
|
|
@ -16,7 +16,15 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ff</groupId>
|
||||
<artifactId>ff-util</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ff</groupId>
|
||||
<artifactId>xk-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
@ -50,7 +58,10 @@
|
|||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.ff.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.sun.media.jfxmediaimpl.platform.PlatformManager;
|
||||
import com.ff.enums.GamePlatforms;
|
||||
import com.ff.service.PlatformManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.ff.client;
|
||||
|
||||
import com.ff.dto.CreateUserResponse;
|
||||
import com.ff.dto.TransferResponse;
|
||||
import com.ff.sports.db.address.DBSportsAddress;
|
||||
import com.dtflys.forest.annotation.Address;
|
||||
import com.dtflys.forest.annotation.Body;
|
||||
import com.dtflys.forest.annotation.Header;
|
||||
import com.dtflys.forest.annotation.Post;
|
||||
import com.ff.address.DBSportsAddress;
|
||||
import com.ff.dto.*;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
|
@ -20,7 +23,7 @@ public interface DBSportsClient {
|
|||
}
|
||||
)
|
||||
CreateUserResponse createMember(@Body CreateUserRequest request,
|
||||
@Header("requestId") @Var("requestId") String requestId);
|
||||
@Header("requestId") String requestId);
|
||||
|
||||
/**
|
||||
* 用户登录接口(注册和登录合并为一个接口)
|
||||
|
@ -49,7 +52,7 @@ public interface DBSportsClient {
|
|||
}
|
||||
)
|
||||
TransferResponse transferIn(@Body TransferRequest request,
|
||||
@Header("requestId") @Var("requestId") String requestId
|
||||
@Header("requestId") String requestId
|
||||
);
|
||||
|
||||
@Post(url = "/api/fund/transfer",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.ff.dto;
|
||||
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.utils.Md5Utils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package com.ff.dto;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
public class Enums {
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.ff.dto;
|
||||
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.utils.Md5Utils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.ff.dto;
|
||||
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.utils.Md5Utils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.ff.dto;
|
||||
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.utils.Md5Utils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.ff.dto;
|
||||
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.utils.Md5Utils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.ff.dto;
|
||||
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.utils.Md5Utils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.ff.dto;
|
||||
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.utils.Md5Utils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -222,6 +222,11 @@
|
|||
<artifactId>xk-client</artifactId>
|
||||
<version>${ff.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ff</groupId>
|
||||
<artifactId>ff-util</artifactId>
|
||||
<version>${ff.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
@ -231,6 +236,7 @@
|
|||
<module>ff-bean/ff-domain</module>
|
||||
<module>ff-bean/comp-redis</module>
|
||||
<module>ff-bean/xk-client</module>
|
||||
<module>ff-bean/ff-util</module>
|
||||
|
||||
<!-- platform module -->
|
||||
<module>ff-platform/xk-dbsports</module>
|
||||
|
|
Loading…
Reference in New Issue