Procházet zdrojové kódy

feat : 依赖关系修改, 项目架构整理

bilingfeng před 2 roky
rodič
revize
ee606a43ca
46 změnil soubory, kde provedl 140 přidání a 2782 odebrání
  1. 0 50
      game-module/game-common-redis/pom.xml
  2. 0 60
      game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/annotation/Lock.java
  3. 0 89
      game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/aspect/LockAspect.java
  4. 0 123
      game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/configure/RedisConfig.java
  5. 0 46
      game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/configure/RedissonConfig.java
  6. 0 25
      game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/exception/LockException.java
  7. 0 232
      game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/utils/DistributedLockUtil.java
  8. 0 6
      game-module/game-common-redis/src/main/resources/META-INF/spring.factories
  9. 5 61
      game-module/game-common/pom.xml
  10. 0 9
      game-module/game-common/src/main/java/com/zanxiang/common/domain/MiPayConfig.java
  11. 1 1
      game-module/game-common/src/main/java/com/zanxiang/common/text/Convert.java
  12. 0 62
      game-module/game-common/src/main/java/com/zanxiang/common/utils/CronUtil.java
  13. 6 390
      game-module/game-common/src/main/java/com/zanxiang/common/utils/DateUtils.java
  14. 0 35
      game-module/game-common/src/main/java/com/zanxiang/common/utils/ExceptionUtil.java
  15. 0 173
      game-module/game-common/src/main/java/com/zanxiang/common/utils/FileUtils.java
  16. 0 59
      game-module/game-common/src/main/java/com/zanxiang/common/utils/GameSignUtil.java
  17. 0 299
      game-module/game-common/src/main/java/com/zanxiang/common/utils/HttpUtils.java
  18. 0 47
      game-module/game-common/src/main/java/com/zanxiang/common/utils/IdUtils.java
  19. 0 55
      game-module/game-common/src/main/java/com/zanxiang/common/utils/IpUtils.java
  20. 0 172
      game-module/game-common/src/main/java/com/zanxiang/common/utils/JsonUtil.java
  21. 0 21
      game-module/game-common/src/main/java/com/zanxiang/common/utils/KeyBuilder.java
  22. 0 32
      game-module/game-common/src/main/java/com/zanxiang/common/utils/MathUtil.java
  23. 0 73
      game-module/game-common/src/main/java/com/zanxiang/common/utils/MimeMapUtil.java
  24. 0 60
      game-module/game-common/src/main/java/com/zanxiang/common/utils/MoneyUtil.java
  25. 0 102
      game-module/game-common/src/main/java/com/zanxiang/common/utils/NumberUtil.java
  26. 0 13
      game-module/game-common/src/main/java/com/zanxiang/common/utils/ObjectUtil.java
  27. 0 57
      game-module/game-common/src/main/java/com/zanxiang/common/utils/RandomStringUtil.java
  28. 0 348
      game-module/game-common/src/main/java/com/zanxiang/common/utils/RegexUtil.java
  29. 1 6
      game-module/game-common/src/main/java/com/zanxiang/common/utils/StringUtils.java
  30. 49 9
      game-module/game-manage/pom.xml
  31. 1 1
      game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GamePayWayServiceImpl.java
  32. 1 1
      game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GameStrategyServiceImpl.java
  33. 1 1
      game-module/game-manage/src/main/java/com/zanxiang/manage/service/api/MiniAppletApiService.java
  34. 0 6
      game-module/game-mybatis/pom.xml
  35. 55 13
      game-module/game-sdk/pom.xml
  36. 2 2
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/adapter/ArgumentAdapter.java
  37. 4 4
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/LoginServiceImpl.java
  38. 2 2
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/PlatformOrderServiceImpl.java
  39. 0 1
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/UserCardServiceImpl.java
  40. 1 1
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/auth/QqApiServiceImpl.java
  41. 1 1
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/auth/VxApiServiceImpl.java
  42. 1 1
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/pay/AliPayService.java
  43. 1 1
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/pay/MiPayService.java
  44. 1 1
      game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/pay/WxPayService.java
  45. 5 21
      game-module/pom.xml
  46. 2 10
      pom.xml

+ 0 - 50
game-module/game-common-redis/pom.xml

@@ -1,50 +0,0 @@
-<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>game-module</artifactId>
-        <groupId>com.zanxiang.game</groupId>
-        <version>0.0.1-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>game-common-redis</artifactId>
-    <description>redis相关</description>
-
-    <dependencies>
-        <!-- SpringBoot Boot aspectj -->
-        <dependency>
-            <groupId>org.aspectj</groupId>
-            <artifactId>aspectjweaver</artifactId>
-            <version>1.9.6</version>
-        </dependency>
-        <!-- SpringBoot Boot Redis -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-redis</artifactId>
-        </dependency>
-        <!--缓存支持-->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-cache</artifactId>
-        </dependency>
-        <!-- redis分布式锁 -->
-        <dependency>
-            <groupId>org.redisson</groupId>
-            <artifactId>redisson</artifactId>
-            <version>3.13.6</version>
-        </dependency>
-        <!-- Apache Commons Pool2 -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-pool2</artifactId>
-        </dependency>
-        <!-- 工具包 -->
-        <dependency>
-            <groupId>com.zanxiang.game</groupId>
-            <artifactId>game-common</artifactId>
-            <version>${game-common.vertion}</version>
-        </dependency>
-    </dependencies>
-
-</project>

+ 0 - 60
game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/annotation/Lock.java

@@ -1,60 +0,0 @@
-package com.zanxiang.common.redis.annotation;
-
-import java.lang.annotation.*;
-import java.util.concurrent.TimeUnit;
-
-/**
- * <p>
- * 分布式锁注解
- * </p>
- *
- * @author zhengwangeng
- * @since 2020/10/19
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-@Inherited
-public @interface Lock {
-
-    /**
-     * 锁前缀
-     *
-     * @return
-     */
-    String prefix();
-
-    /**
-     * 锁的 key值(SpringEL表达式)
-     *
-     * @return
-     */
-    String key() default "";
-
-    /**
-     * 持锁时间,超时将丢失锁, 0标识永久持有锁
-     *
-     * @return
-     */
-    long keepLockTime() default 0L;
-
-    /**
-     * 获取锁的耗时, 超时返回失败,默认最0s,不等待
-     *
-     * @return
-     */
-    long tryLockWaitTime() default 0L;
-
-    /**
-     * 时间单位, 默认秒
-     *
-     * @return
-     */
-    TimeUnit timeUnit() default TimeUnit.SECONDS;
-
-    /**
-     * 执行完成是否释放锁
-     *
-     * @return
-     */
-    boolean autoUnLock() default true;
-}

+ 0 - 89
game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/aspect/LockAspect.java

@@ -1,89 +0,0 @@
-package com.zanxiang.common.redis.aspect;
-
-import com.zanxiang.common.redis.annotation.Lock;
-import com.zanxiang.common.redis.exception.LockException;
-import com.zanxiang.common.redis.utils.DistributedLockUtil;
-import com.zanxiang.common.utils.StringUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.springframework.context.expression.MethodBasedEvaluationContext;
-import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
-import org.springframework.expression.ExpressionParser;
-import org.springframework.expression.spel.standard.SpelExpressionParser;
-import org.springframework.expression.spel.support.StandardEvaluationContext;
-import org.springframework.stereotype.Component;
-
-import java.lang.reflect.Method;
-
-/**
- * <p>
- * 锁切面
- * </p>
- *
- * @author zhengwangeng
- * @since 2020/10/19
- */
-@Slf4j
-@Aspect
-@Component
-public class LockAspect {
-    private static final ExpressionParser EL_PARSER = new SpelExpressionParser();
-
-    @Around("@annotation(com.zanxiang.common.redis.annotation.Lock)")
-    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
-        // 获取切入点方法对象
-        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
-        // 从方法上获取自定义注解 Lock, 获取key值, 锁配置等信息
-        Lock lockInfo = method.getAnnotation(Lock.class);
-        // 获得锁的key
-        String lockKey = this.getLockKey(joinPoint, method, lockInfo);
-        // 获得锁
-        boolean lockResult = DistributedLockUtil.tryLock(lockKey, lockInfo.keepLockTime(), lockInfo.tryLockWaitTime(), lockInfo.timeUnit());
-        if (!lockResult) {
-            throw new LockException("加锁失败!");
-        }
-        try {
-            return joinPoint.proceed();
-        } finally {
-            if (lockInfo.autoUnLock()) {
-                DistributedLockUtil.unlock(lockKey);
-            }
-        }
-    }
-
-
-    /**
-     * 获取锁的key值
-     *
-     * @param joinPoint 请求上下文
-     * @param method    方法
-     * @param lockInfo  锁设置信息
-     * @return
-     */
-    private String getLockKey(ProceedingJoinPoint joinPoint, Method method, Lock lockInfo) {
-        if (StringUtils.isBlank(lockInfo.prefix())) {
-            throw new LockException("加锁失败!锁前缀不能为空");
-        }
-        if (StringUtils.isBlank(lockInfo.key())) {
-            return lockInfo.prefix();
-        }
-        // 通过解析字节码文件读取方法的参数名
-        LocalVariableTableParameterNameDiscoverer methodParamsDiscover = new LocalVariableTableParameterNameDiscoverer();
-        // 实例化spring el上下文
-        StandardEvaluationContext context = new MethodBasedEvaluationContext(joinPoint.getTarget(), method, joinPoint.getArgs(), methodParamsDiscover);
-        // 获取切入点方法中所有的参数
-        String[] params = methodParamsDiscover.getParameterNames(method);
-        if (params != null && params.length > 0) {
-            // 将切入点方法参数值按顺序放入 el上下文
-            for (int i = 0; i < params.length; i++) {
-                context.setVariable(params[i], joinPoint.getArgs()[i]);
-            }
-        }
-        String lockKey = EL_PARSER.parseExpression(lockInfo.key()).getValue(context, String.class);
-        return lockInfo.prefix() + lockKey;
-    }
-
-}

+ 0 - 123
game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/configure/RedisConfig.java

@@ -1,123 +0,0 @@
-package com.zanxiang.common.redis.configure;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import com.zanxiang.common.constant.Constants;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
-import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.redis.cache.RedisCacheConfiguration;
-import org.springframework.data.redis.cache.RedisCacheManager;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
-import org.springframework.data.redis.serializer.RedisSerializationContext;
-import org.springframework.data.redis.serializer.RedisSerializer;
-import org.springframework.data.redis.serializer.StringRedisSerializer;
-
-import java.time.Duration;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-
-/**
- * redis配置
- *
- * @author ruoyi
- */
-@Configuration
-@EnableCaching
-public class RedisConfig extends CachingConfigurerSupport {
-
-    @Bean
-    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
-        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
-        redisTemplate.setConnectionFactory(connectionFactory);
-        // 值采用json序列化
-        redisTemplate.setValueSerializer(valueSerializer());
-        redisTemplate.setKeySerializer(keySerializer());
-        // 设置hash key 和value序列化模式
-        redisTemplate.setHashKeySerializer(keySerializer());
-        redisTemplate.setHashValueSerializer(valueSerializer());
-        redisTemplate.afterPropertiesSet();
-        return redisTemplate;
-    }
-
-    @Bean
-    public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory factory) {
-        return new StringRedisTemplate(factory);
-    }
-
-    @Bean
-    public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) {
-        // 生成一个默认配置,通过config对象即可对缓存进行自定义配置
-        RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()
-                // 默认缓存一小时
-                .entryTtl(Duration.ofHours(2))
-                .computePrefixWith(cacheName -> Constants.REDIS_CACHE_PREFIX + cacheName)
-                .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(keySerializer()))
-                .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(valueSerializer()))
-                //.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer()))
-                // 不缓存空值
-                .disableCachingNullValues();
-
-        // 使用自定义的缓存配置初始化一个cacheManager
-        return RedisCacheManager.builder(connectionFactory)
-                .cacheDefaults(config)
-                // 对指定 key运用特殊配置
-                .transactionAware()
-                .build();
-    }
-
-    @Bean
-    public RedisSerializer<String> keySerializer() {
-        return new StringRedisSerializer();
-    }
-
-    @Bean
-    public Jackson2JsonRedisSerializer<Object> valueSerializer() {
-        //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
-        Jackson2JsonRedisSerializer<Object> jsonSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
-        ObjectMapper om = new ObjectMapper();
-        // json里面有多余字段序列化时不会失败
-        om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-        // 指定要序列化的域,只序列化字段(包括 private字段),不对 get、set及 isXxx进行序列化。ANY指所有作用域的字段,包括 private
-        om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
-                .setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE)
-                .setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE)
-                .setVisibility(PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE);
-
-        // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
-        //om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
-        om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance,
-                ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
-
-        // 解决 java.time包里面的类的序列化问题
-        om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-        JavaTimeModule timeModule = new JavaTimeModule();
-        timeModule.addDeserializer(LocalDate.class,
-                new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-        timeModule.addDeserializer(LocalDateTime.class,
-                new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-        timeModule.addSerializer(LocalDate.class,
-                new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-        timeModule.addSerializer(LocalDateTime.class,
-                new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-        om.registerModule(timeModule);
-        jsonSerializer.setObjectMapper(om);
-
-        return jsonSerializer;
-    }
-}

+ 0 - 46
game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/configure/RedissonConfig.java

@@ -1,46 +0,0 @@
-package com.zanxiang.common.redis.configure;
-
-import com.zanxiang.common.redis.utils.DistributedLockUtil;
-import org.redisson.Redisson;
-import org.redisson.api.RedissonClient;
-import org.redisson.config.Config;
-import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * <p>
- * Redisson配置
- * </p>
- *
- * @author zhengwangeng
- * @since 2020/10/19
- */
-@Configuration
-@EnableConfigurationProperties(RedisProperties.class)
-public class RedissonConfig {
-
-    @Bean
-    public RedissonClient init(RedisProperties redisProperties) {
-        Config config = new Config();
-        // 使用单节点模式
-        config.useSingleServer()
-                // 节点地址 -》可以通过host:port的格式来指定节点地址。
-                .setAddress("redis://" + redisProperties.getHost() + ":" + redisProperties.getPort())
-//                .setAddress("redis://127.0.0.1:6379")
-                // 连接池 默认 64
-//                .setConnectionPoolSize()
-                // 用于发布和订阅连接的连接池最大容量。连接池的连接数量自动弹性伸缩。 默认60
-//                .setSubscriptionConnectionPoolSize(0)
-                // 最小空闲连接数, 最小保持连接数(长连接)。长期保持一定数量的连接有利于提高瞬时写入反应速度。 默认32
-//                .setConnectionMinimumIdleSize(0)
-                // 默认1库
-                .setDatabase(1)
-                .setPassword(redisProperties.getPassword());
-        RedissonClient redissonClient = Redisson.create(config);
-        DistributedLockUtil.setRedissonClient(redissonClient);
-        return redissonClient;
-    }
-
-}

+ 0 - 25
game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/exception/LockException.java

@@ -1,25 +0,0 @@
-package com.zanxiang.common.redis.exception;
-
-/**
- * <p>
- * 锁异常
- * </p>
- *
- * @author zhengwangeng
- * @since 2020/10/19
- */
-public class LockException extends RuntimeException {
-    private static final long serialVersionUID = 8247610319171014183L;
-
-    public LockException(Throwable e) {
-        super(e.getMessage(), e);
-    }
-
-    public LockException(String message) {
-        super(message);
-    }
-
-    public LockException(String message, Throwable throwable) {
-        super(message, throwable);
-    }
-}

+ 0 - 232
game-module/game-common-redis/src/main/java/com/zanxiang/common/redis/utils/DistributedLockUtil.java

@@ -1,232 +0,0 @@
-package com.zanxiang.common.redis.utils;
-
-import com.zanxiang.common.utils.KeyBuilder;
-import com.zanxiang.common.utils.StringUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.redisson.RedissonMultiLock;
-import org.redisson.api.RLock;
-import org.redisson.api.RedissonClient;
-import org.springframework.util.CollectionUtils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * <p>
- * 分布式锁帮助类
- * </p>
- *
- * @author zhengwangeng
- * @since 2020/10/19
- */
-@Slf4j
-public final class DistributedLockUtil {
-
-    private static RedissonClient redissonClient;
-
-    private static AtomicBoolean initFlag = new AtomicBoolean(false);
-
-    private static final String KEY_PREFIX = KeyBuilder.build("ZX-GAME", "DISTRIBUTE", "LOCK");
-
-    private DistributedLockUtil() {
-
-    }
-
-    public static void setRedissonClient(RedissonClient client) {
-        if (initFlag.compareAndSet(false, true)) {
-            redissonClient = client;
-        }
-    }
-
-    /**
-     * 非过期锁
-     *
-     * @param key key
-     * @return
-     */
-    public static void lock(String key) {
-        RLock rLock = getLock(key);
-        rLock.lock();
-    }
-
-    /**
-     * 过期锁
-     *
-     * @param key          key
-     * @param keepLockTime 持锁时间
-     * @param timeUnit     时间单位
-     * @return
-     */
-    public static void lock(String key, Long keepLockTime, TimeUnit timeUnit) {
-        if (null == timeUnit) {
-            throw new NullPointerException("timeUnit cant be null!");
-        }
-        RLock rLock = getLock(key);
-        rLock.lock(keepLockTime, timeUnit);
-    }
-
-    /**
-     * 尝试获取一次非过期锁
-     *
-     * @param key key
-     * @return
-     */
-    public static Boolean tryLock(String key) {
-        RLock rLock = getLock(key);
-        return rLock.tryLock();
-    }
-
-
-    /**
-     * 尝试在一段时间内,持续的去获取非过期锁
-     *
-     * @param key             key
-     * @param tryLockWaitTime 尝试等待时间
-     * @param timeUnit        时间单位
-     * @return
-     */
-    public static Boolean tryLock(String key, Long tryLockWaitTime, TimeUnit timeUnit) {
-        if (null == timeUnit) {
-            throw new NullPointerException("timeUnit cant be null!");
-        }
-        RLock rLock = getLock(key);
-        try {
-            if (null != tryLockWaitTime && tryLockWaitTime > 0) {
-                return rLock.tryLock(tryLockWaitTime, timeUnit);
-            } else {
-                return rLock.tryLock();
-            }
-        } catch (InterruptedException e) {
-            log.error("在为key:{}尝试获取锁的时候,未知异常!", key, e);
-            log.error(e.getMessage(), e);
-        }
-        return false;
-    }
-
-    /**
-     * 尝试在一段时间内,持续的去获取过期锁
-     *
-     * @param key             key
-     * @param leaseTime       锁过期时间
-     * @param tryLockWaitTime 尝试等待时间
-     * @param timeUnit        时间单位
-     * @return
-     */
-    public static Boolean tryLock(String key, Long leaseTime, Long tryLockWaitTime, TimeUnit timeUnit) {
-        if (null == timeUnit) {
-            throw new NullPointerException("timeUnit cant be null!");
-        }
-        RLock rLock = getLock(key);
-        try {
-            if (null != tryLockWaitTime && tryLockWaitTime > 0) {
-                if (null != leaseTime && leaseTime > 0) {
-                    return rLock.tryLock(tryLockWaitTime, leaseTime, timeUnit);
-                } else {
-                    return rLock.tryLock(tryLockWaitTime, timeUnit);
-                }
-            } else {
-                if (null != leaseTime && leaseTime > 0) {
-                    return rLock.tryLock(0, leaseTime, timeUnit);
-                } else {
-                    return rLock.tryLock();
-                }
-            }
-        } catch (InterruptedException e) {
-            log.error("在为key:{}尝试获取锁的时候,未知异常!", key, e);
-            log.error(e.getMessage(), e);
-        }
-        return false;
-    }
-
-    /**
-     * 释放锁
-     *
-     * @param key
-     */
-    public static void unlock(String key) {
-        RLock rLock = getLock(key);
-        if (rLock.isLocked()) {// 先判断要解锁的 key是否已被锁定(防止锁到期自动消除)
-            if (rLock.isHeldByCurrentThread()) {// 是否被当前线程保持(防止锁到期自动消除后被其它实例或线程加锁)
-                rLock.unlock();
-            }
-        }
-    }
-
-
-    /**
-     * 获取RLock对象
-     *
-     * @param key
-     * @return
-     */
-    private static RLock getLock(String key) {
-        if (StringUtils.isBlank(key)) {
-            throw new NullPointerException("key can't be null!");
-        }
-        return redissonClient.getLock(KEY_PREFIX + key);
-//        return redissonClient.getLock(KeyBuilder.build(KEY_PREFIX, key));
-    }
-
-    /**
-     * 联锁, 当keys中的每个key都上锁,才说明被锁
-     *
-     * @param keys      锁key值集合
-     * @param leaseTime 锁过期时间
-     * @param waitTime  尝试等待时间
-     * @param timeUnit  时间单位
-     * @return
-     */
-    public static Boolean multiLock(Collection<String> keys, Long waitTime, Long leaseTime, TimeUnit timeUnit) {
-        if (CollectionUtils.isEmpty(keys)) {
-            throw new NullPointerException("keys cant be null!");
-        }
-        if (null == timeUnit) {
-            throw new NullPointerException("timeUnit cant be null!");
-        }
-        List<RLock> rLocks = new ArrayList<>(keys.size());
-        for (String key : keys) {
-            rLocks.add(getLock(key));
-        }
-        RedissonMultiLock redissonMultiLock = new RedissonMultiLock(rLocks.toArray(new RLock[keys.size()]));
-        try {
-            if (null != waitTime && waitTime > 0) {
-                if (null != leaseTime && leaseTime > 0) {
-                    return redissonMultiLock.tryLock(waitTime, leaseTime, timeUnit);
-                } else {
-                    return redissonMultiLock.tryLock(waitTime, timeUnit);
-                }
-            } else {
-                if (null != leaseTime && leaseTime > 0) {
-                    return redissonMultiLock.tryLock(0, leaseTime, timeUnit);
-                } else {
-                    return redissonMultiLock.tryLock();
-                }
-            }
-        } catch (InterruptedException e) {
-            log.error("在为keys:{}尝试获取联锁的时候,未知异常!", keys, e);
-            log.error(e.getMessage(), e);
-        }
-        return false;
-    }
-
-    /**
-     * 解联锁
-     *
-     * @param keys 锁key值集合
-     * @return
-     */
-    public static void multiUnLock(Collection<String> keys) {
-        if (CollectionUtils.isEmpty(keys)) {
-            throw new NullPointerException("keys cant be null!");
-        }
-        List<RLock> rLocks = new ArrayList<>(keys.size());
-        for (String key : keys) {
-            rLocks.add(getLock(key));
-        }
-        RedissonMultiLock redissonMultiLock = new RedissonMultiLock(rLocks.toArray(new RLock[keys.size()]));
-        redissonMultiLock.unlock();
-    }
-}

+ 0 - 6
game-module/game-common-redis/src/main/resources/META-INF/spring.factories

@@ -1,6 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  com.zanxiang.common.redis.configure.RedisConfig,\
-  com.zanxiang.common.redis.configure.RedissonConfig,\
-  com.zanxiang.common.redis.aspect.LockAspect
-
-  

+ 5 - 61
game-module/game-common/pom.xml

@@ -13,80 +13,24 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
+            <artifactId>game-mybatis</artifactId>
+            <groupId>com.zanxiang.game</groupId>
+            <version>${project.version}</version>
         </dependency>
-        <!-- nacos配置中心 默认的 nacos-client 2.0.3有 bug -->
         <dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.alibaba.nacos</groupId>
-                    <artifactId>nacos-client</artifactId>
-                </exclusion>
-            </exclusions>
+            <groupId>com.zanxiang.module</groupId>
+            <artifactId>zx-web</artifactId>
         </dependency>
-        <!-- nacos注册中心 -->
-        <dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.alibaba.nacos</groupId>
-                    <artifactId>nacos-client</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba.nacos</groupId>
-            <artifactId>nacos-client</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <!-- Mybatis Plus -->
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>${mybatis-plus.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-jdbc</artifactId>
-        </dependency>
-        <!-- Mysql Connector -->
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-        </dependency>
-        <!-- 解决validated不生效的依赖问题 -->
-        <dependency>
-            <groupId>org.hibernate.validator</groupId>
-            <artifactId>hibernate-validator</artifactId>
-            <version>6.0.17.Final</version>
-            <scope>compile</scope>
-        </dependency>
-        <!--swagger2 的集成-->
         <dependency>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger2</artifactId>
             <version>${swagger2.version}</version>
         </dependency>
-        <!--swagger样式 的集成-->
         <dependency>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger-ui</artifactId>
             <version>${swagger2.ui.version}</version>
         </dependency>
-
-        <dependency>
-            <groupId>com.zanxiangnet.module</groupId>
-            <artifactId>zx-util</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
     </dependencies>
 
 </project>

+ 0 - 9
game-module/game-common/src/main/java/com/zanxiang/common/domain/MiPayConfig.java

@@ -1,17 +1,14 @@
 package com.zanxiang.common.domain;
 
-import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
-import org.springframework.stereotype.Component;
 
 /**
  * @author xufeng
  * @date 2022/7/15 12:00
  */
-@Component
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
@@ -21,36 +18,30 @@ public class MiPayConfig {
     /**
      * 微信小程序appId
      */
-    @ApiModelProperty(notes = "微信小程序appId")
     private String wxAppId;
 
     /**
      * 米大师支付应用id
      */
-    @ApiModelProperty(notes = "米大师支付应用id")
     private String appId;
 
     /**
      * 米大师现网AppKey
      */
-    @ApiModelProperty(notes = "米大师现网AppKey")
     private String appKey;
 
     /**
      * 米大师沙箱AppKey
      */
-    @ApiModelProperty(notes = "米大师沙箱AppKey")
     private String appKeyDev;
 
     /**
      * 人民币元宝比例
      */
-    @ApiModelProperty(notes = "人民币元宝比例")
     private String exchangeRate;
 
     /**
      * IOS充值提示
      */
-    @ApiModelProperty(notes = "IOS充值提示")
     private String iosTips;
 }

+ 1 - 1
game-module/game-common/src/main/java/com/zanxiang/common/text/Convert.java

@@ -1,8 +1,8 @@
 package com.zanxiang.common.text;
 
 
-import com.zanxiang.common.utils.JsonUtil;
 import com.zanxiang.common.utils.StringUtils;
+import com.zanxiang.module.util.JsonUtil;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;

+ 0 - 62
game-module/game-common/src/main/java/com/zanxiang/common/utils/CronUtil.java

@@ -1,62 +0,0 @@
-package com.zanxiang.common.utils;
-
-import org.springframework.scheduling.support.CronSequenceGenerator;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @Author wcc
- * @Date 2020/11/17 20:37
- * @Version 1.0
- * @Description
- */
-public class CronUtil {
-    /**
-     * 计算指定时间之后的下次执行时间
-     *
-     * @param cron
-     * @param date 时间节点
-     * @return
-     */
-    public static Date getExecuteTime(String cron, Date date) {
-        if (StringUtils.isEmpty(cron)) {
-            throw new IllegalArgumentException("cron表达式不可为空");
-        }
-        return new CronSequenceGenerator(cron).next(date);
-    }
-
-    /**
-     * 根据当前计算下次执行时间
-     *
-     * @param cron
-     * @return
-     */
-    public static Date getExecuteTime(String cron) {
-        return getExecuteTime(cron, new Date());
-    }
-
-    /**
-     * 计算多个执行时间
-     *
-     * @param cron  表达式
-     * @param count 执行时间个数
-     * @return
-     */
-    public static List<Date> getExecuteTime(String cron, Integer count) {
-        if (StringUtils.isEmpty(cron)) {
-            throw new IllegalArgumentException("cron表达式不可为空");
-        }
-        count = count == null || count < 1 ? 1 : count;
-        CronSequenceGenerator cronSequenceGenerator = new CronSequenceGenerator(cron);
-        List<Date> list = new ArrayList<>(count);
-        Date nextTimePoint = new Date();
-        for (int i = 0; i < count; i++) {
-            // 计算下次时间点的开始时间
-            nextTimePoint = cronSequenceGenerator.next(nextTimePoint);
-            list.add(nextTimePoint);
-        }
-        return list;
-    }
-}

+ 6 - 390
game-module/game-common/src/main/java/com/zanxiang/common/utils/DateUtils.java

@@ -1,401 +1,17 @@
 package com.zanxiang.common.utils;
 
-import org.apache.commons.lang3.time.DateFormatUtils;
+import com.zanxiang.module.util.DateUtil;
 
-import java.lang.management.ManagementFactory;
-import java.text.DateFormat;
-import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.*;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
-import java.time.temporal.TemporalAccessor;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
 
 /**
  * 时间工具类
  *
  * @author ruoyi
  */
-public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
-    public static String YYYY_MM_DD = "yyyy-MM-dd";
-
-    public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
-
-    public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
-
-    private static String[] parsePatterns = {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
-
-    public static final DateTimeFormatter FORMAT_DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-    public static final DateTimeFormatter FORMAT_FOR_KEY = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH:mm");
-    public static final DateTimeFormatter FORMAT_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-    public static final DateTimeFormatter FORMAT_TIME = DateTimeFormatter.ofPattern("HH:mm:ss");
-
-    public static long localDateToSecond(LocalDate localDate) {
-        return localDate.atStartOfDay(ZoneOffset.ofHours(8)).toEpochSecond();
-    }
-
-    public static long localDateToMilli(LocalDate localDate) {
-        return localDate.atStartOfDay(ZoneOffset.ofHours(8)).toInstant().toEpochMilli();
-    }
-
-    public static Date localDateToDate(LocalDate localDate) {
-        return Date.from(localDate.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
-    }
-
-    public static LocalDateTime localDateToLocalDateTime(LocalDate localDate) {
-        return LocalDateTime.of(localDate, LocalTime.MIN);
-    }
-
-    public static long localDateTimeToSecond(LocalDateTime localDateTime) {
-        return localDateTime.toEpochSecond(ZoneOffset.ofHours(8));
-    }
-
-    public static long localDateTimeToMilli(LocalDateTime localDateTime) {
-        return localDateTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
-    }
-
-    public static Date localDateTimeToDate(LocalDateTime localDateTime) {
-        return Date.from(localDateTime.atZone(ZoneOffset.ofHours(8)).toInstant());
-    }
-
-    public static LocalDate secondToLocalDate(long second) {
-        return Instant.ofEpochSecond(second).atZone(ZoneOffset.ofHours(8)).toLocalDate();
-    }
-
-    public static LocalDate milliToLocalDate(long milli) {
-        return Instant.ofEpochMilli(milli).atZone(ZoneOffset.ofHours(8)).toLocalDate();
-    }
-
-    public static long milliToSecond(long milli) {
-        return milli / 1000;
-    }
-
-    public static int milliToSecond2(long milli) {
-        return ((Long) (milli / 1000)).intValue();
-    }
-
-    public static boolean equals(LocalDateTime date1, LocalDateTime date2) {
-        if (date1 == null && date2 == null) {
-            return true;
-        }
-        if (date1 == null || date2 == null) {
-            return false;
-        }
-        return date1.compareTo(date2) == 0;
-    }
-
-    public static boolean equals(LocalDate date1, LocalDate date2) {
-        if (date1 == null && date2 == null) {
-            return true;
-        }
-        if (date1 == null || date2 == null) {
-            return false;
-        }
-        return date1.compareTo(date2) == 0;
-    }
-
-    public static LocalDateTime secondToLocalDateTime(long second) {
-        return Instant.ofEpochSecond(second).atZone(ZoneOffset.ofHours(8)).toLocalDateTime();
-    }
-
-    public static long secondToMilli(int second) {
-        return second * 1000;
-    }
-
-    public static long secondToMilli(long second) {
-        return second * 1000;
-    }
-
-    public static LocalDateTime milliToLocalDateTime(long milli) {
-        return Instant.ofEpochMilli(milli).atZone(ZoneOffset.ofHours(8)).toLocalDateTime();
-    }
-
-    public static LocalDate dateToLocalDate(Date date) {
-        return date.toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDate();
-    }
-
-    public static LocalDateTime dateToLocalDateTime(Date date) {
-        return date.toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime();
-    }
-
-    public static String format(TemporalAccessor temporal, DateTimeFormatter formatter) {
-        return formatter.format(temporal);
-    }
-
-    public static String formatLocalDate(LocalDate localDate) {
-        return FORMAT_DATE.format(localDate);
-    }
-
-    public static String formatLocalDateTime(LocalDateTime localDateTime) {
-        return FORMAT_DATETIME.format(localDateTime);
-    }
-
-    /**
-     * 2个日期的时间间隔
-     *
-     * @param beginDate
-     * @param endDate
-     * @return
-     */
-    public static long intervalOfDays(LocalDate beginDate, LocalDate endDate) {
-        return endDate.toEpochDay() - beginDate.toEpochDay();
-    }
-
-    /**
-     * 2个日期的时间间隔
-     *
-     * @param beginDate
-     * @param endDate
-     * @return
-     */
-    public static long intervalOfHour(LocalDateTime beginDate, LocalDateTime endDate) {
-        return ChronoUnit.HOURS.between(beginDate, endDate);
-    }
-
-    /**
-     * 2个日期的时间间隔
-     *
-     * @param beginDate
-     * @param endDate
-     * @return
-     */
-    public static long intervalOfMinute(LocalDateTime beginDate, LocalDateTime endDate) {
-        return ChronoUnit.MINUTES.between(beginDate, endDate);
-    }
-
-    public static List<LocalDate> splitByWeek(LocalDate startLocalDate, LocalDate endLocalDate) {
-        if (startLocalDate.compareTo(endLocalDate) > 0) {
-            throw new RuntimeException("startLocalDate must be less than endLocalDate");
-        }
-        List<LocalDate> localDates = new ArrayList<>();
-        LocalDate lastMonday = startLocalDate.with(DayOfWeek.MONDAY).plusDays(7);// 下周一
-        do {
-            localDates.add(startLocalDate);
-            startLocalDate = lastMonday;
-            lastMonday = lastMonday.plusDays(7);
-        } while (startLocalDate.compareTo(endLocalDate) < 0);
-        localDates.add(endLocalDate);
-        return localDates;
-    }
-
-    /**
-     * 将时间段按照月份切割
-     * <p>
-     * ex:2020-01-30  ~  2020-01-30   =>   ["2020-01-30","2020-01-30"]
-     * ex:2020-01-30  ~  2020-02-01   =>   ["2020-01-30","2020-02-01"]
-     * ex:2020-01-30  ~  2020-03-03   =>   ["2020-01-30","2020-02-01","2020-03-01","2020-03-03"]
-     *
-     * @param startLocalDate
-     * @param endLocalDate
-     * @return
-     */
-    public static List<LocalDate> splitByMonth(LocalDate startLocalDate, LocalDate endLocalDate) {
-        if (startLocalDate.compareTo(endLocalDate) > 0) {
-            throw new RuntimeException("startLocalDate must be less than endLocalDate");
-        }
-        List<LocalDate> localDates = new ArrayList<>();
-        LocalDate lastMonth = startLocalDate.withDayOfMonth(1).plusMonths(1);// 下月 1号
-        do {
-            localDates.add(startLocalDate);
-            startLocalDate = lastMonth;
-            lastMonth = startLocalDate.plusMonths(1);
-        } while (startLocalDate.compareTo(endLocalDate) < 0);
-        localDates.add(endLocalDate);
-        return localDates;
-    }
-
-    /**
-     * 将时间段按天切割
-     *
-     * @param startLocalDate
-     * @param endLocalDate
-     * @return
-     */
-    public static List<LocalDate> splitByDay(LocalDate startLocalDate, LocalDate endLocalDate) {
-        if (startLocalDate.compareTo(endLocalDate) > 0) {
-            throw new RuntimeException("startLocalDate must be less than endLocalDate");
-        }
-        List<LocalDate> localDates = new ArrayList<>();
-        long day = endLocalDate.toEpochDay() - startLocalDate.toEpochDay();
-        for (int i = 0; i <= day; i++) {
-            localDates.add(startLocalDate.plusDays(i));
-        }
-        return localDates;
-    }
-
-    /**
-     * 获取指定年月的天数
-     *
-     * @param year
-     * @param month
-     * @return
-     */
-    public static long daysOfYearMonth(int year, int month) {
-        LocalDate start = LocalDate.of(year, month, 1);
-        if (month == 12) {
-            year += 1;
-            month = 1;
-        } else {
-            month += 1;
-        }
-        LocalDate end = LocalDate.of(year, month, 1);
-        return intervalOfDays(start, end);
-    }
-
-    public String localDateFormat(LocalDate localDate, String formatStr) {
-        return localDate.format(DateTimeFormatter.ofPattern(formatStr));
-    }
-
-    public String localDateFormat(LocalDate localDate, DateTimeFormatter formatter) {
-        return localDate.format(formatter);
-    }
-
-    /**
-     * 获取当前日期, 默认格式为yyyy-MM-dd
-     *
-     * @return String
-     */
-    public static String getDate() {
-        return dateTimeNow(YYYY_MM_DD);
-    }
-
-    public static final String getTime() {
-        return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
-    }
-
-    public static final String dateTimeNow() {
-        return dateTimeNow(YYYYMMDDHHMMSS);
-    }
-
-    public static final String dateTimeNow(final String format) {
-        return parseDateToStr(format, new Date());
-    }
-
-    public static final String dateTime(final Date date) {
-        return parseDateToStr(YYYY_MM_DD, date);
-    }
-
-    public static final String parseDateToStr(final String format, final Date date) {
-        return new SimpleDateFormat(format).format(date);
-    }
-
-    public static final Date dateTime(final String format, final String ts) {
-        try {
-            return new SimpleDateFormat(format).parse(ts);
-        } catch (ParseException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    /**
-     * 日期路径 即年/月/日 如2018/08/08
-     */
-    public static final String datePath() {
-        Date now = new Date();
-        return DateFormatUtils.format(now, "yyyy/MM/dd");
-    }
-
-    /**
-     * 日期路径 即年/月/日 如20180808
-     */
-    public static final String dateTime() {
-        Date now = new Date();
-        return DateFormatUtils.format(now, "yyyyMMdd");
-    }
-
-    /**
-     * 日期型字符串转化为日期 格式
-     */
-    public static Date parseDate(Object str) {
-        if (str == null) {
-            return null;
-        }
-        try {
-            return parseDate(str.toString(), parsePatterns);
-        } catch (ParseException e) {
-            return null;
-        }
-    }
-
-    /**
-     * 获取服务器启动时间
-     */
-    public static Date getServerStartDate() {
-        long time = ManagementFactory.getRuntimeMXBean().getStartTime();
-        return new Date(time);
-    }
-
-    /**
-     * 计算两个时间差
-     */
-    public static String getDatePoor(Date endDate, Date nowDate) {
-        long nd = 1000 * 24 * 60 * 60;
-        long nh = 1000 * 60 * 60;
-        long nm = 1000 * 60;
-        // long ns = 1000;
-        // 获得两个时间的毫秒时间差异
-        long diff = endDate.getTime() - nowDate.getTime();
-        // 计算差多少天
-        long day = diff / nd;
-        // 计算差多少小时
-        long hour = diff % nd / nh;
-        // 计算差多少分钟
-        long min = diff % nd % nh / nm;
-        // 计算差多少秒//输出结果
-        // long sec = diff % nd % nh % nm / ns;
-        return day + "天" + hour + "小时" + min + "分钟";
-    }
-
-    /**
-     * String转换成LocalDate,标准时间字符串
-     *
-     * @param date "2021-01-01"
-     * @return
-     */
-    public static LocalDateTime string2LocalDate(String date) {
-        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        return LocalDateTime.parse(date, fmt);
-    }
-
-    /**
-     * 特殊日期字符串处理
-     *
-     * @param dateTime “2021-01-01T00:00:00+08:00”
-     * @return
-     */
-    public static LocalDateTime string2LocalDateTime(String dateTime) throws ParseException {
-        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
-        Date date = df.parse(dateTime);
-        SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
-        date = sdf.parse(date.toString());
-        df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        return string2LocalDate(df.format(date));
-    }
-
-    /**
-     * 获得某天最小时间 2020-08-19 00:00:00
-     *
-     * @param oneDayTime : 某天的时间
-     * @return : 返回某天零点时间13位时间戳
-     */
-    public static long getStartOfDay(Long oneDayTime) {
-        LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(oneDayTime), ZoneId.systemDefault());
-        LocalDateTime startOfDay = localDateTime.with(LocalTime.MIN);
-        return Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()).getTime();
-    }
-
-    /**
-     * 获得某天最大时间 2021-08-19 23:59:59
-     *
-     * @param oneDayTime : 某天的时间
-     * @return : 返回某天23:59:59的13位时间戳
-     */
-    public static long getEndOfDay(Long oneDayTime) {
-        LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(oneDayTime), ZoneId.systemDefault());
-        LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX);
-        return Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()).getTime();
-    }
+public class DateUtils extends DateUtil {
 
     /**
      * 验证当前时间是否为当天
@@ -443,8 +59,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
      */
     private static boolean isThisTime(Date date, String pattern) {
         SimpleDateFormat sdf = new SimpleDateFormat(pattern);
-        String param = sdf.format(date);//参数时间
-        String now = sdf.format(new Date());//当前时间
+        String param = sdf.format(date);
+        String now = sdf.format(new Date());
         if (param.equals(now)) {
             return true;
         }

+ 0 - 35
game-module/game-common/src/main/java/com/zanxiang/common/utils/ExceptionUtil.java

@@ -1,35 +0,0 @@
-package com.zanxiang.common.utils;
-
-import org.apache.commons.lang3.exception.ExceptionUtils;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-/**
- * 错误信息处理类。
- *
- * @author ruoyi
- */
-public class ExceptionUtil {
-    /**
-     * 获取exception的详细错误信息。
-     */
-    public static String getExceptionMessage(Throwable e) {
-        StringWriter sw = new StringWriter();
-        e.printStackTrace(new PrintWriter(sw, true));
-        return sw.toString();
-    }
-
-    public static String getRootErrorMessage(Exception e) {
-        Throwable root = ExceptionUtils.getRootCause(e);
-        root = (root == null ? e : root);
-        if (root == null) {
-            return "";
-        }
-        String msg = root.getMessage();
-        if (msg == null) {
-            return "null";
-        }
-        return StringUtils.defaultString(msg);
-    }
-}

+ 0 - 173
game-module/game-common/src/main/java/com/zanxiang/common/utils/FileUtils.java

@@ -1,173 +0,0 @@
-package com.zanxiang.common.utils;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.io.IOUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.*;
-import java.net.URL;
-import java.net.URLEncoder;
-
-/**
- * 文件处理工具类
- *
- * @author ruoyi
- */
-@Slf4j
-public class FileUtils extends org.apache.commons.io.FileUtils {
-    public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
-
-    public static String getTmpPath() {
-        return System.getProperty("java.io.tmpdir") + File.separator;
-    }
-
-    /**
-     * 通过 url下载文件
-     *
-     * @param url
-     * @param path
-     * @param filename
-     * @return
-     * @throws IOException
-     */
-    public static File downloadFileByUrl(String url, String path, String filename) throws IOException {
-        try (InputStream in = new URL(url).openConnection().getInputStream()) {
-            return saveFile(in, path, filename, true);
-        }
-    }
-
-    /**
-     * 将输入流写入文件
-     *
-     * @param in
-     * @param path
-     * @param filename
-     * @return
-     * @throws IOException
-     */
-    public static File saveFile(InputStream in, String path, String filename, boolean close) throws IOException {
-        File file = createFile(path, filename);
-        file.delete();
-        try (OutputStream out = new FileOutputStream(file)) {
-            IOUtils.copy(in, out);
-            return file;
-        } finally {
-            if (close) {
-                in.close();
-            }
-        }
-    }
-
-    /**
-     * 输出指定文件的byte数组
-     *
-     * @param filePath 文件路径
-     * @param os       输出流
-     * @return
-     */
-    public static void writeBytes(String filePath, OutputStream os) throws IOException {
-        FileInputStream fis = null;
-        try {
-            File file = new File(filePath);
-            if (!file.exists()) {
-                throw new FileNotFoundException(filePath);
-            }
-            fis = new FileInputStream(file);
-            byte[] b = new byte[1024];
-            int length;
-            while ((length = fis.read(b)) > 0) {
-                os.write(b, 0, length);
-            }
-        } catch (IOException e) {
-            throw e;
-        } finally {
-            if (os != null) {
-                try {
-                    os.close();
-                } catch (IOException e1) {
-                    e1.printStackTrace();
-                }
-            }
-            if (fis != null) {
-                try {
-                    fis.close();
-                } catch (IOException e1) {
-                    e1.printStackTrace();
-                }
-            }
-        }
-    }
-
-    /**
-     * 删除文件
-     *
-     * @param filePath 文件
-     * @return
-     */
-    public static boolean deleteFile(String filePath) {
-        boolean flag = false;
-        File file = new File(filePath);
-        // 路径为文件且不为空则进行删除
-        if (file.isFile() && file.exists()) {
-            file.delete();
-            flag = true;
-        }
-        return flag;
-    }
-
-    /**
-     * 文件名称验证
-     *
-     * @param filename 文件名称
-     * @return true 正常 false 非法
-     */
-    public static boolean isValidFilename(String filename) {
-        return filename.matches(FILENAME_PATTERN);
-    }
-
-    /**
-     * 下载文件名重新编码
-     *
-     * @param request  请求对象
-     * @param fileName 文件名
-     * @return 编码后的文件名
-     */
-    public static String setFileDownloadHeader(HttpServletRequest request, String fileName)
-            throws UnsupportedEncodingException {
-        final String agent = request.getHeader("USER-AGENT");
-        String filename = fileName;
-        if (agent.contains("MSIE")) {
-            // IE浏览器
-            filename = URLEncoder.encode(filename, "utf-8");
-            filename = filename.replace("+", " ");
-        } else if (agent.contains("Firefox")) {
-            // 火狐浏览器
-            filename = new String(fileName.getBytes(), "ISO8859-1");
-        } else if (agent.contains("Chrome")) {
-            // google浏览器
-            filename = URLEncoder.encode(filename, "utf-8");
-        } else {
-            // 其它浏览器
-            filename = URLEncoder.encode(filename, "utf-8");
-        }
-        return filename;
-    }
-
-    /**
-     * 创建文件
-     *
-     * @param path
-     * @param fileName
-     * @return
-     */
-    public static File createFile(String path, String fileName) {
-        if (!path.endsWith("/") && !path.endsWith("\\")) {
-            path += File.separator;
-        }
-        File pathFile = new File(path);
-        if (!pathFile.exists()) {
-            pathFile.mkdirs();
-        }
-        return new File(path + fileName);
-    }
-}

+ 0 - 59
game-module/game-common/src/main/java/com/zanxiang/common/utils/GameSignUtil.java

@@ -1,59 +0,0 @@
-package com.zanxiang.common.utils;
-
-import com.zanxiang.common.constant.Constants;
-import lombok.extern.slf4j.Slf4j;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-/**
- * @author xufeng
- * @date 2022/7/21 19:35
- */
-@Slf4j
-public class GameSignUtil {
-    protected static final Logger logger = LoggerFactory.getLogger(GameSignUtil.class);
-
-    /**
-     * 验证sign
-     *
-     * @param param  参数
-     * @param appKey 密钥
-     * @return
-     */
-    public static Boolean verify(SortedMap<String, String> param, String appKey) {
-        if (param.isEmpty() || param.get("sign").isEmpty()) {
-            return false;
-        }
-        if (sign(param, appKey).equals(param.get("sign"))) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 生成密钥
-     *
-     * @param param  参数
-     * @param appKey 密钥
-     * @return
-     */
-    public static String sign(SortedMap<String, String> param, String appKey) {
-        StringBuffer sb = new StringBuffer();
-        Set es = param.entrySet();
-        Iterator it = es.iterator();
-        while (it.hasNext()) {
-            Map.Entry entry = (Map.Entry) it.next();
-            String k = (String) entry.getKey();
-            String v = entry.getValue() == null ? "" : (String) entry.getValue();
-            if (null != v && !"".equals(v) && !"sign".equals(k)) {
-                sb.append(k + "=" + v + "&");
-            }
-        }
-        sb.append("appKey=" + appKey);
-        String sign = MD5Util.MD5Encode(sb.toString(), Constants.UTF8).toUpperCase();
-        logger.info("param:{}, appKey:{}, sign:{}, 加密原始串:{}", param, appKey, sign, sb);
-        return sign;
-    }
-}

+ 0 - 299
game-module/game-common/src/main/java/com/zanxiang/common/utils/HttpUtils.java

@@ -1,299 +0,0 @@
-package com.zanxiang.common.utils;
-
-import org.springframework.util.StringUtils;
-
-import javax.net.ssl.*;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * http、https 请求工具类
- */
-public class HttpUtils {
-
-    private static final String DEFAULT_CHARSET = "UTF-8";
-
-    private static final String _GET = "GET"; // GET
-    private static final String _POST = "POST";// POST
-    public static final int DEF_CONN_TIMEOUT = 30000;
-    public static final int DEF_READ_TIMEOUT = 30000;
-
-    /**
-     * 初始化http请求参数
-     *
-     * @param url
-     * @param method
-     * @param headers
-     * @return
-     * @throws Exception
-     */
-    private static HttpURLConnection initHttp(String url, String method,
-                                              Map<String, String> headers) throws Exception {
-        URL _url = new URL(url);
-        HttpURLConnection http = (HttpURLConnection) _url.openConnection();
-        // 连接超时
-        http.setConnectTimeout(DEF_CONN_TIMEOUT);
-        // 读取超时 --服务器响应比较慢,增大时间
-        http.setReadTimeout(DEF_READ_TIMEOUT);
-        http.setUseCaches(false);
-        http.setRequestMethod(method);
-        http.setRequestProperty("Content-Type",
-                "application/x-www-form-urlencoded");
-        http.setRequestProperty(
-                "User-Agent",
-                "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
-        if (null != headers && !headers.isEmpty()) {
-            for (Entry<String, String> entry : headers.entrySet()) {
-                http.setRequestProperty(entry.getKey(), entry.getValue());
-            }
-        }
-        http.setDoOutput(true);
-        http.setDoInput(true);
-        http.connect();
-        return http;
-    }
-
-    /**
-     * 初始化http请求参数
-     *
-     * @param url
-     * @param method
-     * @return
-     * @throws Exception
-     */
-    private static HttpsURLConnection initHttps(String url, String method,
-                                                Map<String, String> headers) throws Exception {
-        TrustManager[] tm = {new MyX509TrustManager()};
-//        System.setProperty("https.protocols", "TLSv1");
-        SSLContext sslContext = SSLContext.getInstance("TLS");
-        sslContext.init(null, tm, new java.security.SecureRandom());
-        // 从上述SSLContext对象中得到SSLSocketFactory对象
-        SSLSocketFactory ssf = sslContext.getSocketFactory();
-        URL _url = new URL(url);
-        HttpsURLConnection http = (HttpsURLConnection) _url.openConnection();
-        // 设置域名校验
-        http.setHostnameVerifier(new HttpUtils().new TrustAnyHostnameVerifier());
-        // 连接超时
-        http.setConnectTimeout(DEF_CONN_TIMEOUT);
-        // 读取超时 --服务器响应比较慢,增大时间
-        http.setReadTimeout(DEF_READ_TIMEOUT);
-        http.setUseCaches(false);
-        http.setRequestMethod(method);
-        http.setRequestProperty("Content-Type",
-                "application/x-www-form-urlencoded");
-        http.setRequestProperty(
-                "User-Agent",
-                "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
-        if (null != headers && !headers.isEmpty()) {
-            for (Entry<String, String> entry : headers.entrySet()) {
-                http.setRequestProperty(entry.getKey(), entry.getValue());
-            }
-        }
-        http.setSSLSocketFactory(ssf);
-        http.setDoOutput(true);
-        http.setDoInput(true);
-        http.connect();
-        return http;
-    }
-
-    /**
-     * @return 返回类型:
-     * @throws Exception
-     * @description 功能描述: get 请求
-     */
-    public static String get(String url, Map<String, String> params,
-                             Map<String, String> headers) throws Exception {
-        HttpURLConnection http = null;
-        if (isHttps(url)) {
-            http = initHttps(initParams(url, params), _GET, headers);
-        } else {
-            http = initHttp(initParams(url, params), _GET, headers);
-        }
-        InputStream in = http.getInputStream();
-        BufferedReader read = new BufferedReader(new InputStreamReader(in,
-                DEFAULT_CHARSET));
-        String valueString = null;
-        StringBuffer bufferRes = new StringBuffer();
-        // 优化,不能光使用!=null做判断。有为""的情况,防止多次空循环
-        while (!StringUtils.isEmpty(valueString = read.readLine())) {
-            bufferRes.append(valueString);
-        }
-        in.close();
-        if (http != null) {
-            http.disconnect();// 关闭连接
-        }
-        return bufferRes.toString();
-    }
-
-    public static String get(String url) throws Exception {
-        return get(url, null);
-    }
-
-    public static String get(String url, Map<String, String> params)
-            throws Exception {
-        return get(url, params, null);
-    }
-
-    public static String post(String url, String params) throws Exception {
-        HttpURLConnection http = null;
-        if (isHttps(url)) {
-            http = initHttps(url, _POST, null);
-        } else {
-            http = initHttp(url, _POST, null);
-        }
-        OutputStream out = http.getOutputStream();
-        out.write(params.getBytes(DEFAULT_CHARSET));
-        out.flush();
-        out.close();
-
-        InputStream in = http.getInputStream();
-        BufferedReader read = new BufferedReader(new InputStreamReader(in,
-                DEFAULT_CHARSET));
-        String valueString = null;
-        StringBuffer bufferRes = new StringBuffer();
-        while ((valueString = read.readLine()) != null) {
-            bufferRes.append(valueString);
-        }
-        in.close();
-        if (http != null) {
-            http.disconnect();// 关闭连接
-        }
-        return bufferRes.toString();
-    }
-
-    public static String post(String url, String params, Map<String, String> headers) throws Exception {
-        HttpURLConnection http = null;
-        if (isHttps(url)) {
-            http = initHttps(url, _POST, headers);
-        } else {
-            http = initHttp(url, _POST, headers);
-        }
-        OutputStream out = http.getOutputStream();
-        out.write(params.getBytes(DEFAULT_CHARSET));
-        out.flush();
-        out.close();
-
-        InputStream in = http.getInputStream();
-        BufferedReader read = new BufferedReader(new InputStreamReader(in,
-                DEFAULT_CHARSET));
-        String valueString = null;
-        StringBuffer bufferRes = new StringBuffer();
-        while ((valueString = read.readLine()) != null) {
-            bufferRes.append(valueString);
-        }
-        in.close();
-        if (http != null) {
-            http.disconnect();// 关闭连接
-        }
-        return bufferRes.toString();
-    }
-
-    /**
-     * 功能描述: 构造请求参数
-     *
-     * @return 返回类型:
-     * @throws Exception
-     */
-    public static String initParams(String url, Map<String, String> params)
-            throws Exception {
-        if (null == params || params.isEmpty()) {
-            return url;
-        }
-        StringBuilder sb = new StringBuilder(url);
-        if (url.indexOf("?") == -1) {
-            sb.append("?");
-        }
-        sb.append(map2Url(params));
-        return sb.toString();
-    }
-
-    /**
-     * map构造url
-     *
-     * @return 返回类型:
-     * @throws Exception
-     */
-    public static String map2Url(Map<String, String> paramToMap)
-            throws Exception {
-        if (null == paramToMap || paramToMap.isEmpty()) {
-            return null;
-        }
-        StringBuffer url = new StringBuffer();
-        boolean isfist = true;
-        for (Entry<String, String> entry : paramToMap.entrySet()) {
-            if (isfist) {
-                isfist = false;
-            } else {
-                url.append("&");
-            }
-            url.append(entry.getKey()).append("=");
-            String value = entry.getValue();
-            if (!StringUtils.isEmpty(value)) {
-                url.append(URLEncoder.encode(value, DEFAULT_CHARSET));
-            }
-        }
-        return url.toString();
-    }
-
-    /**
-     * 检测是否https
-     *
-     * @param url
-     */
-    private static boolean isHttps(String url) {
-        return url.startsWith("https");
-    }
-
-    /**
-     * https 域名校验
-     *
-     * @return
-     */
-    public class TrustAnyHostnameVerifier implements HostnameVerifier {
-        @Override
-        public boolean verify(String hostname, SSLSession session) {
-            return true;// 直接返回true
-        }
-    }
-
-    private static class MyX509TrustManager implements X509TrustManager {
-        @Override
-        public X509Certificate[] getAcceptedIssuers() {
-            return null;
-        }
-
-        @Override
-        public void checkServerTrusted(X509Certificate[] chain, String authType)
-                throws CertificateException {
-        }
-
-        @Override
-        public void checkClientTrusted(X509Certificate[] chain, String authType)
-                throws CertificateException {
-        }
-    }
-
-    ;
-
-    public static void main(String[] args) {
-        String str = "";
-        try {
-            str = get("https://www.baidu.com");
-        } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        System.out.println(str);
-    }
-
-}

+ 0 - 47
game-module/game-common/src/main/java/com/zanxiang/common/utils/IdUtils.java

@@ -1,47 +0,0 @@
-package com.zanxiang.common.utils;
-
-
-import com.zanxiang.common.text.UUID;
-
-/**
- * ID生成器工具类
- *
- * @author ruoyi
- */
-public class IdUtils {
-    /**
-     * 获取随机UUID
-     *
-     * @return 随机UUID
-     */
-    public static String randomUUID() {
-        return UUID.randomUUID().toString();
-    }
-
-    /**
-     * 简化的UUID,去掉了横线
-     *
-     * @return 简化的UUID,去掉了横线
-     */
-    public static String simpleUUID() {
-        return UUID.randomUUID().toString(true);
-    }
-
-    /**
-     * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID
-     *
-     * @return 随机UUID
-     */
-    public static String fastUUID() {
-        return UUID.fastUUID().toString();
-    }
-
-    /**
-     * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID
-     *
-     * @return 简化的UUID,去掉了横线
-     */
-    public static String fastSimpleUUID() {
-        return UUID.fastUUID().toString(true);
-    }
-}

+ 0 - 55
game-module/game-common/src/main/java/com/zanxiang/common/utils/IpUtils.java

@@ -1,55 +0,0 @@
-package com.zanxiang.common.utils;
-
-import lombok.extern.slf4j.Slf4j;
-
-import javax.servlet.http.HttpServletRequest;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-@Slf4j
-public class IpUtils {
-    private static final String UNKNOWN = "unknown";
-    private static final String LOCAL_IP = "127.0.0.1";
-
-    public static String getRealIp(HttpServletRequest request) {
-        String ipAddress = request.getHeader("x-forwarded-for");
-        if (StringUtils.isBlank(ipAddress) || UNKNOWN.equalsIgnoreCase(ipAddress)) {
-            ipAddress = request.getHeader("Proxy-Client-IP");
-        }
-        if (StringUtils.isBlank(ipAddress) || UNKNOWN.equalsIgnoreCase(ipAddress)) {
-            ipAddress = request.getHeader("WL-Proxy-Client-IP");
-        }
-        if (StringUtils.isBlank(ipAddress) || UNKNOWN.equalsIgnoreCase(ipAddress)) {
-            ipAddress = request.getRemoteAddr();
-            if (LOCAL_IP.equals(ipAddress) || "0:0:0:0:0:0:0:1".equals(ipAddress)) {
-                //根据网卡取本机配置的IP
-                try {
-                    ipAddress = InetAddress.getLocalHost().getHostAddress();
-                } catch (UnknownHostException e) {
-                    log.error(e.getMessage(), e);
-                }
-            }
-        }
-        //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
-        if (StringUtils.isNotBlank(ipAddress) && ipAddress.contains(",")) { //"***.***.***.***".length() = 15
-            ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
-        }
-        return ipAddress;
-    }
-
-    public static String getHostIp() {
-        try {
-            return InetAddress.getLocalHost().getHostAddress();
-        } catch (UnknownHostException e) {
-        }
-        return "127.0.0.1";
-    }
-
-    public static String getHostName() {
-        try {
-            return InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException e) {
-        }
-        return "未知";
-    }
-}

+ 0 - 172
game-module/game-common/src/main/java/com/zanxiang/common/utils/JsonUtil.java

@@ -1,172 +0,0 @@
-package com.zanxiang.common.utils;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * @Author wcc
- * @Date 2020/11/17 20:37
- * @Version 1.0
- * @Description
- */
-public class JsonUtil {
-    private static final Logger log = LoggerFactory.getLogger(JsonUtil.class);
-
-    /**
-     * 序列化和反序列化不带 @class属性
-     */
-    public static final ObjectMapper JACKSON = new ObjectMapper()
-            // json字符串转对象多余属性不报错
-            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
-            // 对象转 json为 null不显示
-            .setSerializationInclusion(JsonInclude.Include.NON_NULL)
-            // 指定要序列化的域,只序列化字段(包括 private字段),不对 get、set及 isXxx进行序列化。ANY指所有作用域的字段,包括 private
-            .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
-            .setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE)
-            .setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE)
-            .setVisibility(PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE)
-            .setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
-
-    /**
-     * 序列化和反序列化带 @class属性
-     */
-    public static final ObjectMapper JACKSON_WITH_CLASS = new ObjectMapper()
-            // json字符串转对象多余属性不报错
-            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
-            // 对象转 json为 null不显示
-            .setSerializationInclusion(JsonInclude.Include.NON_NULL)
-            // 指定要序列化的域,只序列化字段(包括 private字段),不对 get、set及 isXxx进行序列化。ANY指所有作用域的字段,包括 private
-            .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
-            .setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE)
-            .setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE)
-            .setVisibility(PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE)
-            // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
-            .activateDefaultTyping(LaissezFaireSubTypeValidator.instance,
-                    ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY)
-            .setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
-
-    static {// 解决 java.time包里面的类的序列化问题
-        JACKSON.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-        JACKSON_WITH_CLASS.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-        JavaTimeModule timeModule = new JavaTimeModule();
-        timeModule.addDeserializer(LocalDate.class,
-                new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-        timeModule.addDeserializer(LocalDateTime.class,
-                new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-        timeModule.addSerializer(LocalDate.class,
-                new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-        timeModule.addSerializer(LocalDateTime.class,
-                new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-        JACKSON.registerModule(timeModule);
-        JACKSON_WITH_CLASS.registerModule(timeModule);
-    }
-
-    public static String toString(Object obj) {
-        if (obj == null) {
-            return null;
-        }
-        try {
-            return JACKSON.writeValueAsString(obj);
-        } catch (JsonProcessingException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static String toStringWithClass(Object obj) {
-        if (obj == null) {
-            return null;
-        }
-        try {
-            return JACKSON_WITH_CLASS.writeValueAsString(obj);
-        } catch (JsonProcessingException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static <T> T toObj(String json, Class<T> clazz) {
-        try {
-            return JACKSON.readValue(json, clazz);
-        } catch (IOException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static Object toObjWithClass(String json) {
-        try {
-            return JACKSON_WITH_CLASS.readValue(json, Object.class);
-        } catch (IOException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static <T> Collection<T> toList(String json, Class<? extends Collection> collectionClazz, Class<T> tClass) {
-        try {
-            return JACKSON.readValue(json, JACKSON.getTypeFactory().constructCollectionType(collectionClazz, tClass));
-        } catch (JsonProcessingException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static Collection<Object> toListWithClass(String json, Class<? extends Collection> collectionClazz) {
-        try {
-            return JACKSON_WITH_CLASS.readValue(json, JACKSON_WITH_CLASS.getTypeFactory().constructCollectionType(collectionClazz, Object.class));
-        } catch (JsonProcessingException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static <V> Map<String, V> toMap(String json, Class<? extends Map> mapClazz, Class<V> vClass) {
-        try {
-            return JACKSON.readValue(json, JACKSON.getTypeFactory().constructMapType(mapClazz, String.class, vClass));
-        } catch (JsonProcessingException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static Map<String, Object> toMapWithClass(String json, Class<? extends Map> mapClazz) {
-        try {
-            return JACKSON_WITH_CLASS.readValue(json, JACKSON_WITH_CLASS.getTypeFactory().constructMapType(mapClazz, String.class, Object.class));
-        } catch (JsonProcessingException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    public static <K, V> Map<K, V> toMap(String json, Class<? extends Map> mapClazz, Class<K> kClass, Class<V> vClass) {
-        try {
-            return JACKSON.readValue(json, JACKSON.getTypeFactory().constructMapType(mapClazz, kClass, vClass));
-        } catch (JsonProcessingException e) {
-            log.error(e.getMessage(), e);
-        }
-        return null;
-    }
-}

+ 0 - 21
game-module/game-common/src/main/java/com/zanxiang/common/utils/KeyBuilder.java

@@ -1,21 +0,0 @@
-package com.zanxiang.common.utils;
-
-/**
- * <p>
- * Key生成器
- * </p>
- *
- * @author zhengwangeng
- * @since 2020/10/19 18:29
- */
-public final class KeyBuilder {
-
-    public static final char SPLIT = ':';
-
-    private KeyBuilder() {
-    }
-
-    public static String build(Object... array) {
-        return StringUtils.join(array, SPLIT);
-    }
-}

+ 0 - 32
game-module/game-common/src/main/java/com/zanxiang/common/utils/MathUtil.java

@@ -1,32 +0,0 @@
-package com.zanxiang.common.utils;
-
-import java.math.BigDecimal;
-
-/**
- * @Author wcc
- * @Date 2021/1/4 11:47
- * @Version 1.0
- * @Description
- */
-public class MathUtil {
-
-    public static int add(Integer num1, Integer num2) {
-        num1 = num1 == null ? 0 : num1;
-        num2 = num2 == null ? 0 : num2;
-        return num1 + num2;
-    }
-
-    /**
-     * 除法保留 2位小数,多余位删除(除 0返回 0)
-     *
-     * @param dividend 被除数
-     * @param divisor  除数
-     * @return
-     */
-    public static BigDecimal division(BigDecimal dividend, BigDecimal divisor) {
-        if (divisor.compareTo(BigDecimal.ZERO) == 0) {
-            return BigDecimal.ZERO;
-        }
-        return dividend.divide(divisor, 2, BigDecimal.ROUND_DOWN);
-    }
-}

+ 0 - 73
game-module/game-common/src/main/java/com/zanxiang/common/utils/MimeMapUtil.java

@@ -1,73 +0,0 @@
-package com.zanxiang.common.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @Author wcc
- * @Date 2021/3/31 18:29
- * @Version 1.0
- * @Description
- */
-public class MimeMapUtil {
-    private static final Map<String, String> MIME_MAPPING = new HashMap<>();
-
-    static {
-        // 文档
-        MIME_MAPPING.put("application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx");
-        MIME_MAPPING.put("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx");
-        MIME_MAPPING.put("application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx");
-        MIME_MAPPING.put("application/msword", "doc");
-        MIME_MAPPING.put("application/vnd.ms-excel", "xls");
-        MIME_MAPPING.put("application/vnd.ms-powerpoint", "ppt");
-        MIME_MAPPING.put("application/pdf", "pdf");
-
-        // 视频
-        MIME_MAPPING.put("video/mp4", "mp4");
-        MIME_MAPPING.put("video/3gpp", "3gp");
-        MIME_MAPPING.put("video/mpeg", "mpeg");
-        MIME_MAPPING.put("video/webm", "webm");
-        MIME_MAPPING.put("video/x-flv", "flv");
-        MIME_MAPPING.put("video/x-m4v", "m4v");
-        MIME_MAPPING.put("video/x-ms-wmv", "wmv");
-        MIME_MAPPING.put("video/x-msvideo", "avi");
-
-        // 音频
-        MIME_MAPPING.put("audio/mp3", "mp3");
-        MIME_MAPPING.put("audio/midi", "mid");
-        MIME_MAPPING.put("audio/ogg", "ogg");
-        MIME_MAPPING.put("audio/x-m4a", "m4a");
-        MIME_MAPPING.put("audio/m4a", "m4a");
-        MIME_MAPPING.put("audio/mpeg", "mp3");
-        MIME_MAPPING.put("audio/x-realaudio", "ra");
-
-        // 文本
-        MIME_MAPPING.put("text/html", "html");
-        MIME_MAPPING.put("text/plain", "txt");
-        MIME_MAPPING.put("application/rtf", "rtf");
-
-        // 压缩文件
-        MIME_MAPPING.put("application/x-7z-compressed", "7z");
-        MIME_MAPPING.put("application/x-rar-compressed", "rar");
-        MIME_MAPPING.put("application/zip", "zip");
-        MIME_MAPPING.put("application/x-zip-compressed", "zip");
-        MIME_MAPPING.put("application/x-gzip", "gz");
-
-        // 图片
-        MIME_MAPPING.put("image/jpeg", "jpg");
-        MIME_MAPPING.put("image/jpg", "jpg");
-        MIME_MAPPING.put("image/png", "png");
-        MIME_MAPPING.put("image/gif", "gif");
-        MIME_MAPPING.put("image/tiff", "tif");
-        MIME_MAPPING.put("image/vnd.wap.wbmp", "wbmp");
-        MIME_MAPPING.put("image/x-icon", "ico");
-        MIME_MAPPING.put("image/x-jng", "jng");
-        MIME_MAPPING.put("image/x-ms-bmp", "bmp");
-        MIME_MAPPING.put("image/svg+xml", "svg");
-        MIME_MAPPING.put("image/webp", "webp");
-    }
-
-    public static String getSuffixByMime(String mime) {
-        return MIME_MAPPING.get(mime);
-    }
-}

+ 0 - 60
game-module/game-common/src/main/java/com/zanxiang/common/utils/MoneyUtil.java

@@ -1,60 +0,0 @@
-package com.zanxiang.common.utils;
-
-import org.springframework.util.Assert;
-
-import java.math.BigDecimal;
-
-/**
- * @author xufeng
- * @date 2022/6/13 10:57
- */
-public abstract class MoneyUtil {
-
-    /**
-     * 将单位为元的金额转换为单位为分
-     *
-     * @param yuan 单位为元的字符型值
-     * @return
-     */
-    public static int yuan2Fen(BigDecimal yuan) {
-        int value = 0;
-
-        try {
-            BigDecimal var2 = new BigDecimal(100);
-            BigDecimal var3 = yuan.multiply(var2);
-            value = Integer.parseInt(var3.stripTrailingZeros().toPlainString());
-        } catch (Exception e) {
-            throw new IllegalArgumentException(String.format("非法金额[%s]", yuan));
-        }
-
-        Assert.isTrue(value >= 0, String.format("非法金额[%s]", yuan));
-        return value;
-    }
-
-    /**
-     * 将单位为分的金额转换为单位为元
-     *
-     * @param fen 单位为分的字符型值
-     * @return
-     */
-    public static String fen2Yuan(int fen) {
-        BigDecimal var1 = new BigDecimal(fen);
-        BigDecimal var2 = new BigDecimal(100);
-        BigDecimal var3 = var1.divide(var2);
-        return var3.stripTrailingZeros().toPlainString();
-    }
-
-    /**
-     * 将单位为分的金额转换为单位为元
-     *
-     * @param fen 单位为分的字符型值
-     * @return
-     */
-    public static BigDecimal fen2YuanDecimal(int fen) {
-        BigDecimal var1 = new BigDecimal(fen);
-        BigDecimal var2 = new BigDecimal(100);
-        BigDecimal var3 = var1.divide(var2);
-        return var3;
-    }
-}
-

+ 0 - 102
game-module/game-common/src/main/java/com/zanxiang/common/utils/NumberUtil.java

@@ -1,102 +0,0 @@
-package com.zanxiang.common.utils;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.util.Date;
-
-/**
- * @Author wcc
- * @Date 2020/9/17 19:54
- * @Version 1.0
- * @Description
- */
-public class NumberUtil {
-
-    public static Long toLong(Object obj) {
-        if (obj == null) {
-            return null;
-        }
-        if (obj instanceof Integer) {
-            return ((Integer) obj).longValue();
-        }
-        if (obj instanceof Long) {
-            return (Long) obj;
-        }
-        if (obj instanceof String) {
-            return new BigDecimal((String) obj).longValue();
-        }
-        if (obj instanceof BigDecimal) {
-            return ((BigDecimal) obj).longValue();
-        }
-        if (obj instanceof BigInteger) {
-            return ((BigInteger) obj).longValue();
-        }
-        throw new RuntimeException("unknown data type! Class: " + obj.getClass());
-    }
-
-    public static Integer toInt(Object obj) {
-        if (obj == null) {
-            return null;
-        }
-        if (obj instanceof Integer) {
-            return (Integer) obj;
-        }
-        if (obj instanceof Long) {
-            return ((Long) obj).intValue();
-        }
-        if (obj instanceof String) {
-            return new BigDecimal((String) obj).intValue();
-        }
-        if (obj instanceof BigDecimal) {
-            return ((BigDecimal) obj).intValue();
-        }
-        if (obj instanceof BigInteger) {
-            return ((BigInteger) obj).intValue();
-        }
-        throw new RuntimeException("unknown data type! Class: " + obj.getClass());
-    }
-
-    public static Boolean toBool(Object obj) {
-        if (obj == null) {
-            return null;
-        }
-        if (obj instanceof Boolean) {
-            return (Boolean) obj;
-        }
-        if (obj instanceof String) {
-            String temp = (String) obj;
-            temp = temp.toLowerCase();
-            if (temp.equals("true")) {
-                return true;
-            }
-            if (temp.equals("false")) {
-                return false;
-            }
-            try {
-                return new BigDecimal(temp).compareTo(BigDecimal.ZERO) != 0;
-            } catch (Exception e) {
-                throw new RuntimeException("Failed transform String to Boolean! value: " + temp);
-            }
-        }
-        return toLong(obj) != 0;
-    }
-
-    public static LocalDateTime toLocalDateTime(Object obj) {
-        if (obj == null) {
-            return null;
-        }
-        if (obj instanceof Date) {
-            return DateUtils.dateToLocalDateTime((Date) obj);
-        }
-        if (obj instanceof LocalDateTime) {
-            return (LocalDateTime) obj;
-        }
-        if (obj instanceof LocalDate) {
-            return LocalDateTime.of((LocalDate) obj, LocalTime.MIDNIGHT);
-        }
-        throw new RuntimeException("unknown data type! Class: " + obj.getClass());
-    }
-}

+ 0 - 13
game-module/game-common/src/main/java/com/zanxiang/common/utils/ObjectUtil.java

@@ -1,13 +0,0 @@
-package com.zanxiang.common.utils;
-
-public class ObjectUtil {
-    public static <T> boolean objEquals(T t1, T t2) {
-        if (t1 == null && t2 == null) {
-            return true;
-        }
-        if (t1 == null || t2 == null) {
-            return false;
-        }
-        return t1.equals(t2);
-    }
-}

+ 0 - 57
game-module/game-common/src/main/java/com/zanxiang/common/utils/RandomStringUtil.java

@@ -1,57 +0,0 @@
-package com.zanxiang.common.utils;
-
-import java.util.Random;
-import java.util.concurrent.ThreadLocalRandom;
-
-public class RandomStringUtil {
-    public static final Random RANDOM = ThreadLocalRandom.current();
-    private static final char[] numChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
-    private static final char[] abcChars = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
-    private static final char[] ABCChars = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
-    private static final char[] abcNumChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
-
-    public static String randomAbcNumStr(int length, boolean firstNum) {
-        if (length <= 0) {
-            throw new RuntimeException("Random string, length cannot be less than 0");
-        }
-        char[] chars = new char[length];
-        if (firstNum) {
-            for (int i = 0; i < length; i++) {
-                chars[i] = randomChar(abcNumChars);
-            }
-        } else {
-            chars[0] = randomChar(abcChars);
-            for (int i = 1; i < length; i++) {
-                chars[i] = randomChar(abcNumChars);
-            }
-        }
-        return new String(chars);
-    }
-
-    public static String randomNumStr(int length) {
-        if (length <= 0) {
-            throw new RuntimeException("Random string, length cannot be less than 0");
-        }
-        char[] chars = new char[length];
-        for (int i = 0; i < length; i++) {
-            chars[i] = randomChar(numChars);
-        }
-        return new String(chars);
-    }
-
-    public static String randomStr(char[] chars, int length) {
-        if (length <= 0) {
-            throw new RuntimeException("Random string, length cannot be less than 0");
-        }
-        char[] result = new char[length];
-        for (int i = 0; i < length; i++) {
-            result[i] = randomChar(chars);
-        }
-        return new String(result);
-    }
-
-
-    private static char randomChar(char[] chars) {
-        return chars[RANDOM.nextInt(chars.length)];
-    }
-}

+ 0 - 348
game-module/game-common/src/main/java/com/zanxiang/common/utils/RegexUtil.java

@@ -1,348 +0,0 @@
-package com.zanxiang.common.utils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author yj
- * @date 2020/9/22 5:43 下午
- */
-public class RegexUtil {
-
-
-    /**
-     * Regex of simple mobile.
-     */
-    public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
-    /**
-     * Regex of exact mobile.
-     * <p>china mobile: 134(0-8), 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 178, 182, 183, 184, 187, 188, 198</p>
-     * <p>china unicom: 130, 131, 132, 145, 155, 156, 166, 171, 175, 176, 185, 186</p>
-     * <p>china telecom: 133, 153, 173, 177, 180, 181, 189, 199</p>
-     * <p>global star: 1349</p>
-     * <p>virtual operator: 170</p>
-     */
-    public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(16[6])|(17[0,1,3,5-8])|(18[0-9])|(19[0,2,6-9]))\\d{8}$";
-    /**
-     * Regex of telephone number.
-     */
-    public static final String REGEX_TEL = "^0\\d{2,3}[- ]?\\d{7,8}";
-    /**
-     * Regex of id card number which length is 15.
-     */
-    public static final String REGEX_ID_CARD15 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
-    /**
-     * Regex of id card number which length is 18.
-     */
-    public static final String REGEX_ID_CARD18 = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])$";
-    /**
-     * Regex of email.
-     */
-    public static final String REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
-    /**
-     * Regex of url.
-     */
-    public static final String REGEX_URL = "[a-zA-z]+://[^\\s]*";
-    /**
-     * Regex of Chinese character.
-     */
-    public static final String REGEX_ZH = "^[\\u4e00-\\u9fa5]+$";
-    /**
-     * Regex of username.
-     * <p>scope for "a-z", "A-Z", "0-9", "_", "Chinese character"</p>
-     * <p>can't end with "_"</p>
-     * <p>length is between 6 to 20</p>
-     */
-    public static final String REGEX_USERNAME = "^[\\w\\u4e00-\\u9fa5]{6,20}(?<!_)$";
-    /**
-     * Regex of date which pattern is "yyyy-MM-dd".
-     */
-    public static final String REGEX_DATE = "^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$";
-    /**
-     * Regex of ip address.
-     */
-    public static final String REGEX_IP = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";
-
-    ///////////////////////////////////////////////////////////////////////////
-    // The following come from http://tool.oschina.net/regex
-    ///////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Regex of double-byte characters.
-     */
-    public static final String REGEX_DOUBLE_BYTE_CHAR = "[^\\x00-\\xff]";
-    /**
-     * Regex of blank line.
-     */
-    public static final String REGEX_BLANK_LINE = "\\n\\s*\\r";
-    /**
-     * Regex of QQ number.
-     */
-    public static final String REGEX_QQ_NUM = "[1-9][0-9]{4,}";
-    /**
-     * Regex of postal code in China.
-     */
-    public static final String REGEX_CHINA_POSTAL_CODE = "[1-9]\\d{5}(?!\\d)";
-    /**
-     * Regex of positive integer.
-     */
-    public static final String REGEX_POSITIVE_INTEGER = "^[1-9]\\d*$";
-    /**
-     * Regex of negative integer.
-     */
-    public static final String REGEX_NEGATIVE_INTEGER = "^-[1-9]\\d*$";
-    /**
-     * Regex of integer.
-     */
-    public static final String REGEX_INTEGER = "^-?[1-9]\\d*$";
-    /**
-     * Regex of non-negative integer.
-     */
-    public static final String REGEX_NOT_NEGATIVE_INTEGER = "^[1-9]\\d*|0$";
-    /**
-     * Regex of non-positive integer.
-     */
-    public static final String REGEX_NOT_POSITIVE_INTEGER = "^-[1-9]\\d*|0$";
-    /**
-     * Regex of positive float.
-     */
-    public static final String REGEX_POSITIVE_FLOAT = "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
-    /**
-     * Regex of negative float.
-     */
-    public static final String REGEX_NEGATIVE_FLOAT = "^-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*$";
-
-    public static final String REGEX_BLANK_CHARACTER = "\\s*";
-
-
-    private RegexUtil() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    // If u want more please visit http://toutiao.com/i6231678548520731137
-    ///////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Return whether input matches regex of simple mobile.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isMobileSimple(final CharSequence input) {
-        return isMatch(REGEX_MOBILE_SIMPLE, input);
-    }
-
-    /**
-     * Return whether input matches regex of exact mobile.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isMobileExact(final CharSequence input) {
-        return isMatch(REGEX_MOBILE_EXACT, input);
-    }
-
-    /**
-     * Return whether input matches regex of telephone number.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isTel(final CharSequence input) {
-        return isMatch(REGEX_TEL, input);
-    }
-
-    /**
-     * Return whether input matches regex of id card number which length is 15.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isIDCard15(final CharSequence input) {
-        return isMatch(REGEX_ID_CARD15, input);
-    }
-
-    /**
-     * Return whether input matches regex of id card number which length is 18.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isIDCard18(final CharSequence input) {
-        return isMatch(REGEX_ID_CARD18, input);
-    }
-
-    /**
-     * Return whether input matches regex of email.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isEmail(final CharSequence input) {
-        return isMatch(REGEX_EMAIL, input);
-    }
-
-    /**
-     * Return whether input matches regex of url.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isURL(final CharSequence input) {
-        return isMatch(REGEX_URL, input);
-    }
-
-    /**
-     * Return whether input matches regex of Chinese character.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isZh(final CharSequence input) {
-        return isMatch(REGEX_ZH, input);
-    }
-
-    /**
-     * Return whether input matches regex of username.
-     * <p>scope for "a-z", "A-Z", "0-9", "_", "Chinese character"</p>
-     * <p>can't end with "_"</p>
-     * <p>length is between 6 to 20</p>.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isUsername(final CharSequence input) {
-        return isMatch(REGEX_USERNAME, input);
-    }
-
-    /**
-     * Return whether input matches regex of date which pattern is "yyyy-MM-dd".
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isDate(final CharSequence input) {
-        return isMatch(REGEX_DATE, input);
-    }
-
-    /**
-     * Return whether input matches regex of ip address.
-     *
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isIP(final CharSequence input) {
-        return isMatch(REGEX_IP, input);
-    }
-
-    /**
-     * Return whether input matches the regex.
-     *
-     * @param regex The regex.
-     * @param input The input.
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isMatch(final String regex, final CharSequence input) {
-        return input != null && input.length() > 0 && Pattern.matches(regex, input);
-    }
-
-    /**
-     * Return the list of input matches the regex.
-     *
-     * @param regex The regex.
-     * @param input The input.
-     * @return the list of input matches the regex
-     */
-    public static List<String> getMatches(final String regex, final CharSequence input) {
-        if (input == null) {
-            return Collections.emptyList();
-        }
-        List<String> matches = new ArrayList<>();
-        Pattern pattern = Pattern.compile(regex);
-        Matcher matcher = pattern.matcher(input);
-        while (matcher.find()) {
-            matches.add(matcher.group());
-        }
-        return matches;
-    }
-
-    /**
-     * Splits input around matches of the regex.
-     *
-     * @param input The input.
-     * @param regex The regex.
-     * @return the array of strings computed by splitting input around matches of regex
-     */
-    public static String[] getSplits(final String input, final String regex) {
-        if (input == null) {
-            return new String[0];
-        }
-        return input.split(regex);
-    }
-
-    /**
-     * Replace the first subsequence of the input sequence that matches the
-     * regex with the given replacement string.
-     *
-     * @param input       The input.
-     * @param regex       The regex.
-     * @param replacement The replacement string.
-     * @return the string constructed by replacing the first matching
-     * subsequence by the replacement string, substituting captured
-     * subsequences as needed
-     */
-    public static String getReplaceFirst(final String input,
-                                         final String regex,
-                                         final String replacement) {
-        if (input == null) {
-            return "";
-        }
-        return Pattern.compile(regex).matcher(input).replaceFirst(replacement);
-    }
-
-    /**
-     * Replace every subsequence of the input sequence that matches the
-     * pattern with the given replacement string.
-     *
-     * @param input       The input.
-     * @param regex       The regex.
-     * @param replacement The replacement string.
-     * @return the string constructed by replacing each matching subsequence
-     * by the replacement string, substituting captured subsequences
-     * as needed
-     */
-    public static String getReplaceAll(final String input,
-                                       final String regex,
-                                       final String replacement) {
-        if (input == null) {
-            return "";
-        }
-        return Pattern.compile(regex).matcher(input).replaceAll(replacement);
-    }
-
-    /**
-     * 将一个普通文本里面带有正则表达式特殊字符的字符进行转义
-     * ex:你好?->你好\?
-     *
-     * @param text
-     * @return
-     */
-    public static String normalText(String text) {
-        return text.replaceAll("\\$", "\\\\$")
-                .replaceAll("\\(", "\\\\(")
-                .replaceAll("\\)", "\\\\)")
-                .replaceAll("\\*", "\\\\*")
-                .replaceAll("\\+", "\\\\+")
-                .replaceAll("\\.", "\\\\.")
-                .replaceAll("\\[", "\\\\[")
-                .replaceAll("\\?", "\\\\?")
-                .replaceAll("\\\\", "\\\\")
-                .replaceAll("\\^", "\\\\^")
-                .replaceAll("\\{", "\\\\{")
-                .replaceAll("\\|", "\\\\|");
-    }
-}

+ 1 - 6
game-module/game-common/src/main/java/com/zanxiang/common/utils/StringUtils.java

@@ -1,7 +1,7 @@
 package com.zanxiang.common.utils;
 
-import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
 import com.zanxiang.common.text.StrFormatter;
+import org.apache.commons.lang3.ArrayUtils;
 
 import java.util.Collection;
 import java.util.Map;
@@ -23,11 +23,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
      */
     private static final char SEPARATOR = '_';
 
-
-    public static String trimBlank(String str) {
-        return str.replaceAll(RegexUtil.REGEX_BLANK_CHARACTER, "");
-    }
-
     /**
      * 获取参数不为空值
      *

+ 49 - 9
game-module/game-manage/pom.xml

@@ -12,30 +12,70 @@
 
     <dependencies>
         <dependency>
-            <artifactId>game-mybatis</artifactId>
+            <artifactId>game-common</artifactId>
             <groupId>com.zanxiang.game</groupId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>com.zanxiang.game</groupId>
-            <artifactId>game-common-redis</artifactId>
-            <version>${game-common-redis.vertion}</version>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter</artifactId>
         </dependency>
-
         <!-- spring boot默认不去扫描 bootstrap.yml文件了 -->
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-bootstrap</artifactId>
         </dependency>
+        <!-- SpringBoot start -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <!-- nacos配置中心 默认的 nacos-client 2.0.3有 bug -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.alibaba.nacos</groupId>
+                    <artifactId>nacos-client</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- nacos注册中心 -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.alibaba.nacos</groupId>
+                    <artifactId>nacos-client</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.nacos</groupId>
+            <artifactId>nacos-client</artifactId>
+        </dependency>
+        <!-- 解决validated不生效的依赖问题 -->
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>6.0.17.Final</version>
+            <scope>compile</scope>
+        </dependency>
+        <!--oss集成-->
         <dependency>
             <groupId>com.zanxiang.module</groupId>
             <artifactId>zx-oss</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
+        <!--redis集成-->
         <dependency>
             <groupId>com.zanxiang.module</groupId>
-            <artifactId>zx-web</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
+            <artifactId>zx-redis</artifactId>
         </dependency>
         <!-- 谷歌http工具类 -->
         <dependency>

+ 1 - 1
game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GamePayWayServiceImpl.java

@@ -8,7 +8,6 @@ import com.zanxiang.common.enums.DeleteEnum;
 import com.zanxiang.common.enums.PayWayEnum;
 import com.zanxiang.common.enums.StatusEnum;
 import com.zanxiang.common.exception.ParamNullException;
-import com.zanxiang.common.utils.JsonUtil;
 import com.zanxiang.common.utils.StringUtils;
 import com.zanxiang.common.utils.bean.BeanUtils;
 import com.zanxiang.manage.domain.mapper.GamePayWayListMapper;
@@ -17,6 +16,7 @@ import com.zanxiang.manage.domain.params.GamePayWayListParam;
 import com.zanxiang.manage.domain.params.GamePayWayParam;
 import com.zanxiang.manage.domain.vo.*;
 import com.zanxiang.manage.service.*;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.mybatis.entity.*;
 import com.zanxiang.mybatis.mapper.GamePayWayMapper;
 import org.apache.logging.log4j.util.Strings;

+ 1 - 1
game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GameStrategyServiceImpl.java

@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.common.enums.DeleteEnum;
 import com.zanxiang.common.exception.ParamNullException;
-import com.zanxiang.common.utils.JsonUtil;
 import com.zanxiang.common.utils.StringUtils;
 import com.zanxiang.common.utils.bean.BeanUtils;
 import com.zanxiang.manage.domain.mapper.GameStrategyListMapper;
@@ -20,6 +19,7 @@ import com.zanxiang.manage.service.GamePayWayService;
 import com.zanxiang.manage.service.GameStrategyService;
 import com.zanxiang.manage.service.PayBoxService;
 import com.zanxiang.manage.service.PayMerchantService;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.mybatis.entity.GamePayWay;
 import com.zanxiang.mybatis.entity.GameStrategy;
 import com.zanxiang.mybatis.entity.PayMerchant;

+ 1 - 1
game-module/game-manage/src/main/java/com/zanxiang/manage/service/api/MiniAppletApiService.java

@@ -6,7 +6,7 @@ import com.zanxiang.common.exception.BaseException;
 import com.zanxiang.common.text.UUID;
 import com.zanxiang.common.utils.URIUtil;
 import com.zanxiang.module.oss.service.IOssService;
-import com.zanxiangnet.module.util.JsonUtil;
+import com.zanxiang.module.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Autowired;

+ 0 - 6
game-module/game-mybatis/pom.xml

@@ -12,18 +12,12 @@
     <artifactId>game-mybatis</artifactId>
 
     <dependencies>
-        <dependency>
-            <artifactId>game-common</artifactId>
-            <groupId>com.zanxiang.game</groupId>
-            <version>0.0.1-SNAPSHOT</version>
-        </dependency>
         <!-- Mybatis Plus -->
         <dependency>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
             <version>${mybatis-plus.version}</version>
         </dependency>
-
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-jdbc</artifactId>

+ 55 - 13
game-module/game-sdk/pom.xml

@@ -12,25 +12,72 @@
 
     <dependencies>
         <dependency>
-            <artifactId>game-mybatis</artifactId>
+            <artifactId>game-common</artifactId>
             <groupId>com.zanxiang.game</groupId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>com.zanxiang.game</groupId>
-            <artifactId>game-common-redis</artifactId>
-            <version>${game-common-redis.vertion}</version>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter</artifactId>
+        </dependency>
+        <!-- spring boot默认不去扫描 bootstrap.yml文件了 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-bootstrap</artifactId>
         </dependency>
+        <!-- SpringBoot start -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <!-- nacos配置中心 默认的 nacos-client 2.0.3有 bug -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.alibaba.nacos</groupId>
+                    <artifactId>nacos-client</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- nacos注册中心 -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.alibaba.nacos</groupId>
+                    <artifactId>nacos-client</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.nacos</groupId>
+            <artifactId>nacos-client</artifactId>
         </dependency>
+        <!-- 解决validated不生效的依赖问题 -->
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>6.0.17.Final</version>
+            <scope>compile</scope>
+        </dependency>
+        <!--sms集成-->
         <dependency>
             <groupId>com.zanxiang.module</groupId>
             <artifactId>zx-sms</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
-        <!--    支付相关pom  -->
+        <!--redis集成-->
+        <dependency>
+            <groupId>com.zanxiang.module</groupId>
+            <artifactId>zx-redis</artifactId>
+        </dependency>
+        <!-- 支付相关依赖 -->
         <dependency>
             <groupId>com.alipay.sdk</groupId>
             <artifactId>alipay-easysdk</artifactId>
@@ -57,11 +104,6 @@
             <artifactId>hutool-all</artifactId>
             <version>5.8.0.M1</version>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-bootstrap</artifactId>
-            <version>3.0.2</version>
-        </dependency>
     </dependencies>
 
     <build>

+ 2 - 2
game-module/game-sdk/src/main/java/com/zanxiang/sdk/adapter/ArgumentAdapter.java

@@ -2,8 +2,8 @@ package com.zanxiang.sdk.adapter;
 
 import com.zanxiang.common.enums.HttpStatusEnum;
 import com.zanxiang.common.exception.CustomException;
-import com.zanxiang.common.utils.IpUtils;
 import com.zanxiang.common.utils.StringUtils;
+import com.zanxiang.module.web.util.IpUtil;
 import com.zanxiang.sdk.annotation.ValidLogin;
 import com.zanxiang.sdk.domain.dto.UserTokenDTO;
 import com.zanxiang.sdk.domain.params.UserData;
@@ -56,7 +56,7 @@ public class ArgumentAdapter implements HandlerMethodArgumentResolver {
         //构造用户信息
         UserData data = UserData.builder()
                 .gameId(Long.valueOf(request.getHeader("gameId")))
-                .ip(IpUtils.getRealIp(request))
+                .ip(IpUtil.getRealIp(request))
                 .deviceType(deviceType)
                 .deviceSystem(request.getHeader("os"))
                 .mac(request.getHeader("mac"))

+ 4 - 4
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/LoginServiceImpl.java

@@ -7,9 +7,9 @@ import com.zanxiang.common.enums.HttpStatusEnum;
 import com.zanxiang.common.enums.SmsTypeEnum;
 import com.zanxiang.common.exception.BaseException;
 import com.zanxiang.common.text.UUID;
-import com.zanxiang.common.utils.IpUtils;
-import com.zanxiang.common.utils.JsonUtil;
 import com.zanxiang.common.utils.URIUtil;
+import com.zanxiang.module.util.JsonUtil;
+import com.zanxiang.module.web.util.IpUtil;
 import com.zanxiang.mybatis.entity.User;
 import com.zanxiang.mybatis.entity.UserCard;
 import com.zanxiang.sdk.constant.ApiUrlConstant;
@@ -331,7 +331,7 @@ public class LoginServiceImpl implements RegisterLoginService {
         //用户登录成功
         String userToken = userTokenService.getUserToken(userOauthDTO.getId(), deviceType);
         //登录的ip
-        String realIp = IpUtils.getRealIp(request);
+        String realIp = IpUtil.getRealIp(request);
         //插入用户登录记录
         userLoginLogService.addUserLoginLog(realIp, user, Long.valueOf(param.getGameId()), 0);
         //移出state
@@ -388,7 +388,7 @@ public class LoginServiceImpl implements RegisterLoginService {
         //获取用户信息
         User user = this.getUserByUserOauth(deviceType, userInfoMap, userOauthDTO);
         //登录的ip
-        String realIp = IpUtils.getRealIp(request);
+        String realIp = IpUtil.getRealIp(request);
         //用户登录成功
         String userToken = userTokenService.getUserToken(userOauthDTO.getId(), deviceType);
         //插入用户登录记录

+ 2 - 2
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/PlatformOrderServiceImpl.java

@@ -3,6 +3,7 @@ package com.zanxiang.sdk.service.Impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.common.enums.OrderStateEnum;
+import com.zanxiang.common.exception.BaseException;
 import com.zanxiang.common.exception.ParamNullException;
 import com.zanxiang.common.utils.StringUtils;
 import com.zanxiang.common.utils.bean.BeanUtils;
@@ -13,7 +14,6 @@ import com.zanxiang.sdk.domain.dto.PlatformOrderDTO;
 import com.zanxiang.sdk.listener.OrderPaySuccessEvent;
 import com.zanxiang.sdk.service.PlatformOrderService;
 import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.extension.ParameterResolutionException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -70,7 +70,7 @@ public class PlatformOrderServiceImpl extends ServiceImpl<OrderMapper, Order> im
                 return true;
             }
             if (!order.getStatus().equals(OrderStateEnum.NO_PAY.getCode())) {
-                throw new ParameterResolutionException("订单状态非待支付");
+                throw new BaseException("订单状态非待支付");
             }
             platformOrderBO.setPayTime(new Date());
             logger.info("订单支付提交数据 data:{}", platformOrderBO);

+ 0 - 1
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/UserCardServiceImpl.java

@@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;

+ 1 - 1
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/auth/QqApiServiceImpl.java

@@ -3,9 +3,9 @@ package com.zanxiang.sdk.service.auth;
 import cn.hutool.http.HttpUtil;
 import com.zanxiang.common.exception.BaseException;
 import com.zanxiang.common.utils.URIUtil;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.sdk.constant.ApiUrlConstant;
 import com.zanxiang.sdk.service.QqApiService;
-import com.zanxiangnet.module.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Value;

+ 1 - 1
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/auth/VxApiServiceImpl.java

@@ -3,9 +3,9 @@ package com.zanxiang.sdk.service.auth;
 import cn.hutool.http.HttpUtil;
 import com.zanxiang.common.exception.BaseException;
 import com.zanxiang.common.utils.URIUtil;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.sdk.constant.ApiUrlConstant;
 import com.zanxiang.sdk.service.VxApiService;
-import com.zanxiangnet.module.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Value;

+ 1 - 1
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/pay/AliPayService.java

@@ -12,7 +12,7 @@ import com.zanxiang.common.domain.ResultMap;
 import com.zanxiang.common.enums.HttpStatusEnum;
 import com.zanxiang.common.enums.OsEnum;
 import com.zanxiang.common.enums.ResEnum;
-import com.zanxiang.common.utils.JsonUtil;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.sdk.domain.bo.ProductPayParamBO;
 import com.zanxiang.sdk.util.HttpUtil;
 import lombok.extern.slf4j.Slf4j;

+ 1 - 1
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/pay/MiPayService.java

@@ -8,9 +8,9 @@ import com.zanxiang.common.enums.HttpStatusEnum;
 import com.zanxiang.common.enums.StatusEnum;
 import com.zanxiang.common.exception.BaseException;
 import com.zanxiang.common.exception.CustomException;
-import com.zanxiang.common.utils.JsonUtil;
 import com.zanxiang.common.utils.StringUtils;
 import com.zanxiang.common.utils.URIUtil;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.mybatis.entity.GamePayWay;
 import com.zanxiang.sdk.constant.MiPayConstants;
 import com.zanxiang.sdk.domain.bo.ProductPayParamBO;

+ 1 - 1
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/pay/WxPayService.java

@@ -4,8 +4,8 @@ import com.zanxiang.common.constant.Constants;
 import com.zanxiang.common.domain.ResultMap;
 import com.zanxiang.common.enums.ResEnum;
 import com.zanxiang.common.exception.BaseException;
-import com.zanxiang.common.utils.JsonUtil;
 import com.zanxiang.common.utils.URIUtil;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.sdk.constant.WxPayConstants;
 import com.zanxiang.sdk.domain.bo.ProductPayAttachParamBO;
 import com.zanxiang.sdk.domain.bo.ProductPayParamBO;

+ 5 - 21
game-module/pom.xml

@@ -16,29 +16,13 @@
         <module>game-manage</module>
         <module>game-sdk</module>
         <module>game-common</module>
-        <module>game-common-redis</module>
         <module>game-mybatis</module>
     </modules>
 
-    <dependencies>
-        <!-- web 的集成 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <!--swagger2 的集成-->
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger2</artifactId>
-            <version>${swagger2.version}</version>
-        </dependency>
-        <!--swagger样式 的集成-->
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
-            <version>${swagger2.ui.version}</version>
-        </dependency>
-
-    </dependencies>
+    <properties>
+        <swagger2.version>2.9.2</swagger2.version>
+        <swagger2.ui.version>2.9.2</swagger2.ui.version>
+        <mybatis-plus.version>3.4.0</mybatis-plus.version>
+    </properties>
 
 </project>

+ 2 - 10
pom.xml

@@ -10,20 +10,12 @@
     <parent>
         <groupId>com.zanxiang</groupId>
         <artifactId>microservices-parent</artifactId>
-        <version>0.0.1-SNAPSHOT</version>
-        <relativePath/> <!-- lookup parent from repository -->
+        <version>0.0.3-SNAPSHOT</version>
+        <relativePath/>
     </parent>
 
     <groupId>com.zanxiang.game</groupId>
     <artifactId>game-center</artifactId>
     <version>0.0.1-SNAPSHOT</version>
 
-    <properties>
-        <swagger2.version>2.9.2</swagger2.version>
-        <swagger2.ui.version>2.9.2</swagger2.ui.version>
-        <mybatis-plus.version>3.4.0</mybatis-plus.version>
-        <game-common.vertion>0.0.1-SNAPSHOT</game-common.vertion>
-        <game-common-redis.vertion>0.0.1-SNAPSHOT</game-common-redis.vertion>
-    </properties>
-
 </project>