2 Commits 07ee027a44 ... 16c8f709c4

Author SHA1 Message Date
  liyang1 16c8f709c4 UPDATE-biz-common 处理 2 months ago
  liyang1 a85dc3e7d7 UPDATE-biz-common 处理 2 months ago
30 changed files with 16 additions and 1810 deletions
  1. 0 82
      pom.xml
  2. 0 98
      src/main/java/com/ywt/biz/common/config/dubbo/DubboGenericService.java
  3. 0 10
      src/main/java/com/ywt/biz/common/config/dubbo/GenericResponse.java
  4. 0 54
      src/main/java/com/ywt/biz/common/config/dubbo/GenericServiceFactory.java
  5. 0 87
      src/main/java/com/ywt/biz/common/config/kafka/KafkaAnalyzeProducer.java
  6. 0 21
      src/main/java/com/ywt/biz/common/config/kafka/SendCallBack.java
  7. 0 107
      src/main/java/com/ywt/biz/common/config/redis/LettuceRedisConfig.java
  8. 0 67
      src/main/java/com/ywt/biz/common/config/redission/properties/RedissonConfig.java
  9. 0 33
      src/main/java/com/ywt/biz/common/config/redission/properties/RedissonProperties.java
  10. 0 77
      src/main/java/com/ywt/biz/common/config/rocketmq/BaseMqMessage.java
  11. 0 156
      src/main/java/com/ywt/biz/common/config/rocketmq/BaseMqMessageListener.java
  12. 0 161
      src/main/java/com/ywt/biz/common/config/rocketmq/RocketAnalyzeProducer.java
  13. 14 0
      src/main/java/com/ywt/biz/common/constant/RespCodePrefix.java
  14. 0 8
      src/main/java/com/ywt/biz/common/core/domain/BaseEntity.java
  15. 0 51
      src/main/java/com/ywt/biz/common/core/domain/PageQuery.java
  16. 0 39
      src/main/java/com/ywt/biz/common/core/domain/TreeEntity.java
  17. 0 86
      src/main/java/com/ywt/biz/common/core/page/PageData.java
  18. 0 57
      src/main/java/com/ywt/biz/common/core/service/DictService.java
  19. 0 18
      src/main/java/com/ywt/biz/common/core/service/OssService.java
  20. 0 11
      src/main/java/com/ywt/biz/common/core/service/PermissionService.java
  21. 0 18
      src/main/java/com/ywt/biz/common/core/service/SensitiveService.java
  22. 0 36
      src/main/java/com/ywt/biz/common/core/service/UserService.java
  23. 0 96
      src/main/java/com/ywt/biz/common/dto/PageResultDTO.java
  24. 0 49
      src/main/java/com/ywt/biz/common/enums/SensitiveStrategy.java
  25. 1 8
      src/main/java/com/ywt/biz/common/exception/YwtCommonException.java
  26. 0 7
      src/main/java/com/ywt/biz/common/exception/YwtException.java
  27. 0 68
      src/main/java/com/ywt/biz/common/structs/MultipleTree.java
  28. 0 92
      src/main/java/com/ywt/biz/common/structs/TreeNode.java
  29. 0 203
      src/main/java/com/ywt/biz/common/structs/TrieTree.java
  30. 1 10
      src/main/java/com/ywt/biz/common/web/YwtHttpResponse.java

+ 0 - 82
pom.xml

@@ -22,23 +22,6 @@
 	
 	<dependencies>
 
-		<!-- hutool 核心包,包括集合、字符串、Bean等工具-->
-		<dependency>
-			<groupId>cn.hutool</groupId>
-			<artifactId>hutool-core</artifactId>
-		</dependency>
-
-		<!-- Hutool 扩展工具类(提供其它类库的封装)-->
-		<dependency>
-			<groupId>cn.hutool</groupId>
-			<artifactId>hutool-extra</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>cn.hutool</groupId>
-			<artifactId>hutool-http</artifactId>
-		</dependency>
-
 		<!-- mybatis 基调 当前工程用于定义baseEntity -->
 		<dependency>
 			<groupId>com.baomidou</groupId>
@@ -47,75 +30,10 @@
 		</dependency>
 
 		<dependency>
-			<groupId>com.fasterxml.jackson.core</groupId>
-			<artifactId>jackson-databind</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>com.fasterxml.jackson.datatype</groupId>
-			<artifactId>jackson-datatype-jsr310</artifactId>
-		</dependency>
-
-
-
-		<dependency>
-			<groupId>org.apache.commons</groupId>
-			<artifactId>commons-lang3</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-web</artifactId>
-			<scope>provided</scope>
-		</dependency>
-
-
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-autoconfigure</artifactId>
-			<scope>provided</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-data-redis</artifactId>
-			<scope>provided</scope>
-		</dependency>
-
-
-		<dependency>
-			<groupId>org.redisson</groupId>
-			<artifactId>redisson</artifactId>
-		</dependency>
-
-		<dependency>
 			<groupId>org.projectlombok</groupId>
 			<artifactId>lombok</artifactId>
 		</dependency>
 
-		<!-- logback核心组件 -->
-		<dependency>
-			<groupId>ch.qos.logback</groupId>
-			<artifactId>logback-core</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.dubbo</groupId>
-			<artifactId>dubbo-spring-boot-starter</artifactId>
-			<scope>provided</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.springframework.kafka</groupId>
-			<artifactId>spring-kafka</artifactId>
-			<scope>provided</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.rocketmq</groupId>
-			<artifactId>rocketmq-spring-boot-starter</artifactId>
-			<scope>provided</scope>
-		</dependency>
 
 
 	</dependencies>

+ 0 - 98
src/main/java/com/ywt/biz/common/config/dubbo/DubboGenericService.java

@@ -1,98 +0,0 @@
-package com.ywt.biz.common.config.dubbo;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.dubbo.rpc.RpcException;
-import org.apache.dubbo.rpc.service.GenericException;
-import org.apache.dubbo.rpc.service.GenericService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Service;
-
-import java.util.Map;
-
-/**
- * 调用处理
- */
-@Service
-@Slf4j
-@ConditionalOnProperty(name = "switch.dubbo.generic", havingValue = "true")
-public class DubboGenericService {
-
-    @Autowired
-    private GenericServiceFactory genericServiceFactory;
-
-    /**
-     * 实体对象调用
-     * @param interfaceName 接口名称 全限定名
-     * @param methodName 方法名称
-     * @param parameterType  参数名称-请求实体全限定名
-     * @param parameter 请求参数  用map进行包装
-     * @return
-     */
-    public GenericResponse<Object> genericCall(String interfaceName, String methodName, String parameterType, Map<String, Object> parameter) {
-        try {
-            // 从工厂中获取对应接口的泛化服务
-            GenericService genericService = genericServiceFactory.getGenericService(interfaceName);
-            // 通过invoke进行泛化调用
-            Object object = genericService.$invoke(methodName, new String[]{parameterType}, new Object[]{parameter});
-            // 判断返回类型对象返回一般也是map 暂时不考虑返回
-            /*if (result instanceof Map) {
-                Object responseObj = JacksonUtil.convertMapToObject((Map<String, Object>) result, MyResponse.class);
-                return new GenericResponse<>(true, "Success", responseObj);
-            }*/
-            GenericResponse<Object> response = new GenericResponse<>();
-            response.setSuccess(true);
-            response.setMessage("Success");
-            response.setData(object);
-            return response ;
-        }catch (GenericException | RpcException e){
-            log.error("调用rpc异常,接口名称:{},方法名称:{}",interfaceName,methodName,e);
-            return handleRpcException(e);
-        }catch (Exception e){
-            log.error("调用系统异常,接口名称:{},方法名称:{}",interfaceName,methodName,e);
-            return handleGenericException(e);
-        }
-    }
-
-    /**
-     * 通用调用
-     * @param interfaceName 接口名称 全限定名
-     * @param methodName 方法名称
-     * @param parameterTypes  请求参数类型- 根据传入的参数个数按序进行填充
-     * @param parameters 请求参数- 根据传入的参数个数按序进行填充
-     * @return
-     */
-    public GenericResponse<Object> genericCall(String interfaceName, String methodName, String[] parameterTypes,Object[] parameters) {
-        try {
-            GenericService genericService = genericServiceFactory.getGenericService(interfaceName);
-            Object object =  genericService.$invoke(methodName, parameterTypes, parameters);
-            GenericResponse<Object> response = new GenericResponse<>();
-            response.setSuccess(true);
-            response.setMessage("Success");
-            response.setData(object);
-            return response ;
-        }catch (GenericException | RpcException e){
-            log.error("调用rpc异常,接口名称:{},方法名称:{}",interfaceName,methodName,e);
-            return handleRpcException(e);
-        }catch (Exception e){
-            log.error("调用系统异常,接口名称:{},方法名称:{}",interfaceName,methodName,e);
-            return handleGenericException(e);
-        }
-    }
-
-    private GenericResponse<Object> handleRpcException(RuntimeException e) {
-        // 此处添加针对RpcException的处理逻辑
-        GenericResponse<Object> response = new GenericResponse<>();
-        response.setSuccess(false);
-        response.setMessage("RPC Exception: " + e.getMessage());
-        return response;
-    }
-
-    private GenericResponse<Object> handleGenericException(Exception e) {
-        // 此处添加针对其他类型异常的处理逻辑
-        GenericResponse<Object> response = new GenericResponse<>();
-        response.setSuccess(false);
-        response.setMessage("Exception: " + e.getMessage());
-        return response;
-    }
-}

+ 0 - 10
src/main/java/com/ywt/biz/common/config/dubbo/GenericResponse.java

@@ -1,10 +0,0 @@
-package com.ywt.biz.common.config.dubbo;
-
-import lombok.Data;
-
-@Data
-public class GenericResponse<T> {
-    private boolean success;
-    private String message;
-    private T data;
-}

+ 0 - 54
src/main/java/com/ywt/biz/common/config/dubbo/GenericServiceFactory.java

@@ -1,54 +0,0 @@
-package com.ywt.biz.common.config.dubbo;
-
-import org.apache.dubbo.config.ApplicationConfig;
-import org.apache.dubbo.config.ReferenceConfig;
-import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.rpc.service.GenericService;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-@Component
-@ConditionalOnProperty(name = "switch.dubbo.generic", havingValue = "true")
-public class GenericServiceFactory {
-
-    @Value("${dubbo.application.name:genericService}")
-    private String applicationName;
-
-    @Value("${dubbo.registry.address:nacos://127.0.0.1:8848}")
-    private String registryAddress;
-
-    @Value("${dubbo.registry.namespace:public}")
-    private String namespace;
-
-    private final Map<String, GenericService> genericServices = new ConcurrentHashMap<>();
-
-    public GenericService getGenericService(String interfaceName) {
-        return genericServices.computeIfAbsent(interfaceName, this::createGenericService);
-    }
-
-    private GenericService createGenericService(String interfaceName) {
-        ApplicationConfig applicationConfig = new ApplicationConfig(applicationName);
-        // 配置 Nacos 注册中心和命名空间
-        RegistryConfig registryConfig = new RegistryConfig();
-        registryConfig.setAddress(registryAddress);
-        registryConfig.setProtocol("nacos");
-        Map<String, String> parameters  = new HashMap<>();
-        parameters.put("namespace",namespace);
-        // 可根据实际诉求进行扩展
-        registryConfig.setParameters(parameters);
-
-        ReferenceConfig<GenericService> referenceConfig = new ReferenceConfig<>();
-        referenceConfig.setApplication(applicationConfig);
-        referenceConfig.setRegistry(registryConfig);
-        referenceConfig.setInterface(interfaceName);
-        referenceConfig.setGeneric("true");
-        referenceConfig.setProtocol("tri");
-
-        return referenceConfig.get();
-    }
-}

+ 0 - 87
src/main/java/com/ywt/biz/common/config/kafka/KafkaAnalyzeProducer.java

@@ -1,87 +0,0 @@
-package com.ywt.biz.common.config.kafka;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.kafka.core.KafkaTemplate;
-import org.springframework.kafka.support.SendResult;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-import org.springframework.util.concurrent.FailureCallback;
-import org.springframework.util.concurrent.ListenableFuture;
-import org.springframework.util.concurrent.ListenableFutureCallback;
-import org.springframework.util.concurrent.SuccessCallback;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-/**
- * @author liyang
- * @version 1.0
- * @description: 生产者封装类
- * @date 2022/9/29 8:50
- */
-@Slf4j
-@Component
-@ConditionalOnProperty(value = "spring.kafka.producer.enable",havingValue = "true")
-public class KafkaAnalyzeProducer {
-    @Autowired
-    private KafkaTemplate<String, Object> kafkaTemplate;
-
-    /**
-     * 异步发送数据到kafka 自定义回调
-     *
-     * @param topic        topic名称
-     * @param message      发送信息字符串
-     * @param sendCallBack 发送回调
-     */
-    public void send(String topic, String message, SendCallBack sendCallBack) {
-
-        ListenableFuture<SendResult<String, Object>> listenableFuture = kafkaTemplate.send(topic, message);
-        //发送成功后回调
-        SuccessCallback<Object> successCallback = result -> sendCallBack.sendSuccessCallBack(topic, message);
-        //发送失败回调
-        FailureCallback failureCallback = ex -> sendCallBack.sendFailCallBack(topic, message, ex);
-        listenableFuture.addCallback(successCallback, failureCallback);
-    }
-
-
-    /**
-     * producer 同步方式发送数据 10S 超时
-     *
-     * @param topic   topic名称
-     * @param message producer发送的数据
-     */
-    public void sendAsynchronize(String topic, String message) throws InterruptedException, ExecutionException, TimeoutException {
-        if(StringUtils.hasText(topic)&&topic.contains("/")){
-            topic = topic.replaceAll("/","_");
-        }
-        kafkaTemplate.send(topic, message).get(10, TimeUnit.SECONDS);
-    }
-
-
-    /**
-     * producer 异步方式发送数据 通用回调
-     *
-     * @param topic   topic名称
-     * @param message producer发送的数据
-     */
-    public void sendSynchronize(String topic, String message) {
-        if(StringUtils.hasText(topic)&&topic.contains("/")){
-            topic = topic.replaceAll("/","_");
-        }
-        String finalTopic = topic;
-        kafkaTemplate.send(finalTopic, message).addCallback(new ListenableFutureCallback<Object>() {
-            @Override
-            public void onFailure(Throwable throwable) {
-                log.error("----事件kafka记录解析完成放入topic:{},发送失败{}", finalTopic, message, throwable);
-            }
-
-            @Override
-            public void onSuccess(Object o) {
-                log.info("----事件kafka记录解析完成放入topic:{},发送成功:{}", finalTopic, message);
-            }
-        });
-    }
-}

+ 0 - 21
src/main/java/com/ywt/biz/common/config/kafka/SendCallBack.java

@@ -1,21 +0,0 @@
-package com.ywt.biz.common.config.kafka;
-
-/**
- * 发送回调处理
- */
-public interface SendCallBack {
-    /**
-     * 生产成功回调
-     * @param topic topic
-     * @param msg 信息字符串
-     */
-    void sendSuccessCallBack(String topic,String msg);
-
-    /**
-     * 生产失败回调
-     * @param topic topic
-     * @param msg 信息字符串
-     * @param ex 异常
-     */
-    void sendFailCallBack(String topic,String msg,Throwable ex) ;
-}

+ 0 - 107
src/main/java/com/ywt/biz/common/config/redis/LettuceRedisConfig.java

@@ -1,107 +0,0 @@
-package com.ywt.biz.common.config.redis;
-
-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 org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.cache.CacheManager;
-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.connection.lettuce.LettuceConnectionFactory;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.serializer.*;
-
-import java.time.Duration;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Redis配置类
- * @author liy
- * @date 2021/5/18 16:48
- */
-@Configuration
-@ConditionalOnProperty(name = "spring.redis.enable", havingValue = "true")
-public class LettuceRedisConfig {
-
-    @Bean(name = "stringRedisSerializer")
-    public StringRedisSerializer stringRedisSerializer(){
-        return  new StringRedisSerializer() ;
-    }
-
-
-    @Bean(name = "jackson2JsonRedisSerializer")
-    public Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer(){
-        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer= new Jackson2JsonRedisSerializer<>(Object.class);
-        //解决value的序列化方式
-        //序列化时将类的数据类型存入json,以便反序列化的时候转换成正确的类型
-        ObjectMapper objectMapper = new ObjectMapper();
-        //objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
-        objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
-        // 解决jackson2无法反序列化LocalDateTime的问题
-        objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-        objectMapper.registerModule(new JavaTimeModule());
-        jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
-        return  jackson2JsonRedisSerializer ;
-    }
-
-
-    @Bean
-    public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory connectionFactory, StringRedisSerializer stringRedisSerializer, Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer) {
-        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
-        redisTemplate.setConnectionFactory(connectionFactory);
-        //首先解决key的序列化方式
-        redisTemplate.setKeySerializer(stringRedisSerializer);
-        redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
-        return redisTemplate;
-    }
-
-    /**
-     * 设置CacheManager缓存规则
-     * @param factory
-     * @return
-     */
-    @Bean
-    public CacheManager cacheManager(RedisConnectionFactory factory,StringRedisSerializer stringRedisSerializer, Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer) {
-        // 缓存配置
-        RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig()
-                // 默认没有特殊指定的缓存,设置失效时间为600s
-                .entryTtl(Duration.ofSeconds(600))
-                .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(stringRedisSerializer))
-                .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer))
-                .disableCachingNullValues()
-                // 在缓存名称前加上前缀
-                .computePrefixWith(cacheName -> "default:" + cacheName);
-        Map<String, RedisCacheConfiguration> initialCacheConfiguration = new HashMap<>(8);
-        // 设定失效时间为1小时
-        initialCacheConfiguration.put("sys_oss_config", getDefaultSimpleConfiguration(stringRedisSerializer,jackson2JsonRedisSerializer));
-        return RedisCacheManager.builder(factory)
-                .cacheDefaults(defaultCacheConfig )
-                .withInitialCacheConfigurations(initialCacheConfiguration)
-                .build();
-    }
-
-
-    /**
-     * 覆盖默认的构造key[默认拼接的时候是两个冒号(::)],否则会多出一个冒号
-     *
-     * @return 返回缓存配置信息
-     */
-    private RedisCacheConfiguration getDefaultSimpleConfiguration(StringRedisSerializer stringRedisSerializer, Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer) {
-        return RedisCacheConfiguration.defaultCacheConfig().
-                 serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(stringRedisSerializer))
-                .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer))
-                .disableCachingNullValues().computePrefixWith(cacheName -> cacheName + ":");
-    }
-
-
-}

+ 0 - 67
src/main/java/com/ywt/biz/common/config/redission/properties/RedissonConfig.java

@@ -1,67 +0,0 @@
-
-package com.ywt.biz.common.config.redission.properties;
-
-
-import org.redisson.Redisson;
-import org.redisson.api.RedissonClient;
-import org.redisson.config.Config;
-import org.redisson.config.SentinelServersConfig;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.util.StringUtils;
-
-
-/**
- * redisson 配置
- * @author liyang
- */
-
-@Configuration
-@EnableConfigurationProperties(RedissonProperties.class)
-@ConditionalOnProperty(name = "redisson.enable", havingValue = "true")
-public class RedissonConfig {
-
-
-    @Bean
-    public RedissonClient getRedisson(RedissonProperties redissonProperties) {
-        Config config = new Config();
-        if("single".equals(redissonProperties.getModel())){
-            // 单机节点
-            config.useSingleServer()
-                    .setAddress("redis://" + redissonProperties.getHost() + ":" + redissonProperties.getPort())
-                    .setPassword(redissonProperties.getPassword())
-                    .setDatabase(redissonProperties.getDatabase())
-                    .setRetryInterval(5000)
-                    .setTimeout(10000)
-                    .setConnectTimeout(10000);
-            return Redisson.create(config);
-        }
-        if("sentinel".equals(redissonProperties.getModel())){
-            String[] sentinelAddresses  = redissonProperties.getSentinelAddresses();
-            String schema = redissonProperties.getSchema();
-            // 拼接协议
-            String[] sentinelAddressesWithSchema = new String[sentinelAddresses.length];
-            for (int i = 0; i < sentinelAddresses.length; i++) {
-                sentinelAddressesWithSchema[i] = schema + sentinelAddresses[i];
-            }
-
-            SentinelServersConfig serversConfig = config.useSentinelServers()
-                    .setMasterName(redissonProperties.getMasterName())
-                    .addSentinelAddress(sentinelAddressesWithSchema)
-                    .setMasterConnectionPoolSize(redissonProperties.getMasterConnectionPoolSize())
-                    .setSlaveConnectionPoolSize(redissonProperties.getSlaveConnectionPoolSize())
-                    .setMasterConnectionMinimumIdleSize(redissonProperties.getConnectionMinimumIdleSize())
-                    .setSlaveConnectionMinimumIdleSize(redissonProperties.getConnectionMinimumIdleSize());
-
-            if (StringUtils.hasText(redissonProperties.getPassword())) {
-                serversConfig.setPassword(redissonProperties.getPassword());
-            }
-            return Redisson.create(config);
-        }
-        return null ;
-    }
-
-}
-

+ 0 - 33
src/main/java/com/ywt/biz/common/config/redission/properties/RedissonProperties.java

@@ -1,33 +0,0 @@
-
-package com.ywt.biz.common.config.redission.properties;
-
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-
-/**
- * redisson 配置暂用spring-redis
- * @author liyang
- */
-
-@ConfigurationProperties(prefix = "redisson")
-@Data
-public class RedissonProperties {
-
-    private String model;
-    private int timeout = 3000;
-    private String schema = "redis://";
-    private String host;
-    private String port;
-    private int database;
-    private String password;
-    private int connectionPoolSize = 64;
-    private int connectionMinimumIdleSize = 10;
-    private int slaveConnectionPoolSize = 250;
-    private int masterConnectionPoolSize = 250;
-    private String[] sentinelAddresses;
-    private String masterName;
-
-}
-

+ 0 - 77
src/main/java/com/ywt/biz/common/config/rocketmq/BaseMqMessage.java

@@ -1,77 +0,0 @@
-package com.ywt.biz.common.config.rocketmq;
-
-import lombok.Data;
-
-import java.time.LocalDateTime;
-import java.util.UUID;
-
-/**
- * 基础消息实体,包含基础的消息  根据自己的业务消息设置更多的字段
- * 那么剩下的所有业务消息实体只需要继承此基类,然后在自己业务类中包含自己需要的字段即可
- *
- * @author liyang
- * @since 2024/6/20
- */
-
-public abstract class BaseMqMessage {
-    /**
-     * 业务键,用于RocketMQ控制台查看消费情况
-     */
-    protected String key;
-    /**
-     * 发送消息来源,用于排查问题
-     */
-    protected String source = "";
-    /**
-     * 发送时间
-     */
-    protected LocalDateTime sendTime = LocalDateTime.now();
-    /**
-     * 跟踪id,用于slf4j等日志记录跟踪id,方便查询业务链
-     */
-    protected String traceId = UUID.randomUUID().toString();
-    /**
-     * 重试次数,用于判断重试次数,超过重试次数发送异常警告
-     */
-    protected Integer retryTimes = 0;
-
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public String getSource() {
-        return source;
-    }
-
-    public void setSource(String source) {
-        this.source = source;
-    }
-
-    public LocalDateTime getSendTime() {
-        return sendTime;
-    }
-
-    public void setSendTime(LocalDateTime sendTime) {
-        this.sendTime = sendTime;
-    }
-
-    public String getTraceId() {
-        return traceId;
-    }
-
-    public void setTraceId(String traceId) {
-        this.traceId = traceId;
-    }
-
-    public Integer getRetryTimes() {
-        return retryTimes;
-    }
-
-    public void setRetryTimes(Integer retryTimes) {
-        this.retryTimes = retryTimes;
-    }
-}

+ 0 - 156
src/main/java/com/ywt/biz/common/config/rocketmq/BaseMqMessageListener.java

@@ -1,156 +0,0 @@
-package com.ywt.biz.common.config.rocketmq;
-
-import com.ywt.biz.common.constant.MsgConstants;
-import com.ywt.biz.common.exception.YwtException;
-import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.io.Serializable;
-import java.time.Instant;
-
-/**
- * 抽象消息监听器,封装了所有公共处理业务,如
- * 1、基础日志记录
- * 2、异常处理
- * 3、消息重试
- * 4、警告通知
- * 5、....
- *
- * @author tianxincoord@163.com
- * @since 2022/4/17
- */
-public abstract class BaseMqMessageListener<T extends BaseMqMessage> implements Serializable {
-    /**
-     * 这里的日志记录器是哪个子类的就会被哪个子类的类进行初始化
-     */
-    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    private static  final String  Logger_prefix = "[{}]消费者收到消息[{}]";
-
-    @Autowired(required = false)
-    private RocketAnalyzeProducer rocketAnalyzeProducer;
-
-    /**
-     * 消息者名称
-     *
-     * @return 消费者名称
-     */
-    protected abstract String consumerName();
-
-    /**
-     * 消息处理
-     *
-     * @param message 待处理消息
-     * @throws Exception 消费异常
-     */
-    protected abstract void handleMessage(T message) throws Exception;
-
-    /**
-     * 超过重试次数消息,需要启用isRetry
-     *
-     * @param message 待处理消息
-     */
-    protected abstract void overMaxRetryTimesMessage(T message);
-
-    /**
-     * 是否过滤消息,例如某些
-     *
-     * @param message 待处理消息
-     * @return true: 本次消息被过滤,false:不过滤
-     */
-    protected boolean isFilter(T message) {
-        return false;
-    }
-
-    /**
-     * 是否异常时重复发送
-     *
-     * @return true: 消息重试,false:不重试
-     */
-    protected abstract boolean isRetry();
-
-    /**
-     * 消费异常时是否抛出异常
-     * 若返回true,则由rocketmq机制自动重试
-     * 若false:消费异常(如果没有开启重试则消息会被自动ack)
-     */
-    protected abstract boolean isThrowException();
-
-    /**
-     * 最大重试次数
-     *
-     * @return 最大重试次数,默认10次
-     */
-    protected int maxRetryTimes() {
-        return 10;
-    }
-
-    /**
-     * isRetry开启时,重新入队延迟时间
-     *
-     * @return -1:立即入队重试
-     */
-    protected int retryDelayLevel() {
-        return -1;
-    }
-
-    /**
-     * 由父类来完成基础的日志和调配
-     */
-    public void dispatchMessage(T message) {
-        logger.info(Logger_prefix, consumerName(), message);
-        if (isFilter(message)) {
-            logger.info(Logger_prefix+"消息不满足消费条件,已过滤", consumerName(), message);
-            return;
-        }
-        // 超过最大重试次数时调用子类方法处理
-        if (message.getRetryTimes() > maxRetryTimes()) {
-            logger.error(Logger_prefix+"超过重试次数消息", consumerName(), message);
-            overMaxRetryTimesMessage(message);
-            return;
-        }
-        try {
-            long start = Instant.now().toEpochMilli();
-            handleMessage(message);
-            long end = Instant.now().toEpochMilli();
-            logger.info(Logger_prefix+"消息消费成功,耗时[{}ms]", consumerName(), message, (end - start));
-        } catch (Exception e) {
-            if(e instanceof YwtException){
-                logger.error(Logger_prefix+" 业务异常,原因:{}", consumerName(), message, ((YwtException) e).getErrDetail());
-            }else{
-                logger.error(Logger_prefix+ "消息消费系统异常", consumerName(), message, e);
-            }
-            // 是捕获异常还是抛出,由子类决定
-            if (isThrowException()) {
-                // 如果设置抛异常, 将会在按照Rocketmq消费者端的机制进行重试
-                throw new RuntimeException(e);
-            }
-            if (isRetry()) {
-                handleRetry(message);
-            }
-        }
-    }
-
-    protected void handleRetry(T message) {
-        // 获取子类RocketMQMessageListener注解拿到topic和tag
-        RocketMQMessageListener annotation = this.getClass().getAnnotation(RocketMQMessageListener.class);
-        if (annotation == null) {
-            return;
-        }
-        //重新构建消息体
-        String messageSource = message.getSource();
-        if (!messageSource.startsWith("retry")) {
-            message.setSource(MsgConstants.RETRY_PREFIX + messageSource);
-        }
-        message.setRetryTimes(message.getRetryTimes() + 1);
-
-        // 如果消息发送不成功,则再次重新发送,如果发送异常则抛出由MQ再次处理(异常时不走延迟消息)
-        boolean result = rocketAnalyzeProducer.delayConsumer(annotation.topic(), annotation.selectorExpression(), message, 10);
-        if (!result) {
-            throw new RuntimeException("重试消息发送失败");
-        }
-    }
-}
-

+ 0 - 161
src/main/java/com/ywt/biz/common/config/rocketmq/RocketAnalyzeProducer.java

@@ -1,161 +0,0 @@
-package com.ywt.biz.common.config.rocketmq;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.rocketmq.client.producer.SendCallback;
-import org.apache.rocketmq.client.producer.SendResult;
-import org.apache.rocketmq.client.producer.SendStatus;
-import org.apache.rocketmq.spring.core.RocketMQTemplate;
-import org.apache.rocketmq.spring.support.RocketMQHeaders;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.messaging.Message;
-import org.springframework.messaging.MessagingException;
-import org.springframework.messaging.support.MessageBuilder;
-import org.springframework.stereotype.Component;
-
-
-/**
- * @author liyang
- * @version 1.0
- * @description: rocket生产者封装类
- * @date 2022/9/29 8:50
- */
-@Slf4j
-@Component
-@ConditionalOnProperty(value = "rocketmq.producer.enable",havingValue = "true")
-public class RocketAnalyzeProducer {
-    
-
-    @Autowired
-    private RocketMQTemplate rocketMQTemplate;
-
-    /**
-     * 构建目的地 String destination = topic + “:” + tag
-     */
-    public String buildDestination(String topic, String tag) {
-        return topic + ":" + tag;
-    }
-
-
-    /**
-     * 发送同步消息 带主题和标签
-     */
-    public <T extends BaseMqMessage> boolean send(String topic, String tag, T message) {
-        // 注意分隔符
-        return send(buildDestination(topic, tag), message);
-    }
-
-
-    public <T extends BaseMqMessage> boolean send(String destination, T message) {
-        // 设置业务键,此处根据公共的参数进行处理
-        // 更多的其它基础业务处理...
-        boolean result = true;
-        try{
-            log.info("消息目的:[{}],消息Key:{},消息内容:{},开始发送同步消息",destination,message.getKey(),message);
-            Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build();
-            SendResult sendResult = rocketMQTemplate.syncSend(destination, sendMessage);
-            log.info("消息目的:[{}],消息Key:{},发送同步消息,发送结果[{}]", destination,message.getKey(), message, sendResult);
-            if(SendStatus.SEND_OK.compareTo(sendResult.getSendStatus())!=0){
-                log.info("消息目的:[{}],消息Key:{},发送同步消息失败,status:{}", destination,message.getKey(), message, sendResult.getSendStatus());
-                result = false;
-            }
-        }catch (MessagingException e ){
-            log.info("消息目的:[{}],消息Key:{},发送同步消息异常,reason:{}", destination,message.getKey(), message, e);
-            result = false;
-        }
-        return result;
-    }
-
-
-    /**
-     * 发送同步消息 带主题和标签
-     */
-
-    public <T extends BaseMqMessage> void asyncSend(String topic, String tag, T message, SendCallback sendCallBack) {
-        // 注意分隔符
-         asyncSend(buildDestination(topic, tag), message,sendCallBack);
-    }
-
-
-    /**
-     * 异步发生消息自定义回调
-     *
-     * @param destination       目的地
-     * @param message      发送信息字符串
-     * @param sendCallBack 发送回调
-     */
-    public <T extends BaseMqMessage> void asyncSend(String destination, T message, SendCallback sendCallBack) {
-        Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build();
-        rocketMQTemplate.asyncSend(destination,  sendMessage, sendCallBack);
-    }
-
-
-    /**
-     * producer 异步方式发送数据 通用回调
-     *
-     * @param destination   目的名称
-     * @param message producer发送的数据
-     */
-    public <T extends BaseMqMessage> void asyncSend(String destination, T message) {
-        Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build();
-        log.info("消息目的:[{}],消息Key:{},消息内容:{},开始发送异步消息",destination,message.getKey(),message);
-        rocketMQTemplate.asyncSend(destination,  sendMessage,  new SendCallback() {
-            @Override
-            public void onSuccess(SendResult var1) {
-                if(SendStatus.SEND_OK.compareTo(var1.getSendStatus())!=0){
-                    log.error("消息目的:[{}],消息Key:{},发送异步消息结果失败,status:{}", destination,message.getKey(),  var1.getSendStatus());
-                }else{
-                    log.info("消息目的:[{}],消息Key:{},发送异步消息状态成功",destination,message.getKey());
-                }
-            }
-
-            @Override
-            public void onException(Throwable var1) {
-                log.info("消息目的:[{}],消息Key:{},消息内容:{},开始发送异步消息出现异常,reason:{}",destination,message.getKey(),message,var1.getMessage());
-            }
-
-        });
-    }
-
-    /**
-     * 延时消息
-     * @param destination
-     * @param message
-     * @param delay
-     * @param <T>
-     */
-    public<T extends BaseMqMessage> boolean delayConsumer(String destination, T message,Integer delay){
-        boolean result =true;
-        //延迟时间,单位秒
-        try {
-            log.info("消息目的:[{}],消息Key:{},消息内容:{},开始发送延迟消息",destination,message.getKey(),message);
-            Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build();
-            SendResult sendResult = rocketMQTemplate.syncSendDelayTimeSeconds(
-                    destination,
-                    sendMessage,
-                    delay);
-            if(SendStatus.SEND_OK.compareTo(sendResult.getSendStatus())!=0){
-                log.info("消息目的:[{}],消息Key:{},发送同步消息发送同步延迟消息成功,返回失败,status:{}", destination,message.getKey(), message, sendResult.getSendStatus());
-                result = false;
-            }else{
-                log.info("消息目的:[{}],消息Key:{},发送同步延迟消息成功,返回成功,status:{}", destination,message.getKey(), message, sendResult.getSendStatus());
-            }
-        }catch (MessagingException e){
-            result = false;
-            log.info("消息目的:[{}],消息Key:{},发送同步消息异常,reason:{}", destination,message.getKey(), message, e);
-        }
-        return result ;
-    }
-
-    /**
-     * 延时消息
-     * @param topic
-     * @param tag
-     * @param message
-     * @param delay 数量 单位秒
-     * @param <T>
-     */
-    public<T extends BaseMqMessage> boolean delayConsumer(String topic, String tag, T message,Integer delay){
-        return  delayConsumer(buildDestination(topic, tag),message,delay);
-    }
-}

+ 14 - 0
src/main/java/com/ywt/biz/common/constant/RespCodePrefix.java

@@ -39,6 +39,11 @@ public interface RespCodePrefix {
 	 */
 	String PREFIX_HEALTH = "111";
 
+	/**
+	 *	HEALTH响应码前缀
+	 */
+	String PREFIX_MESSAGE = "112";
+
 
 	//////////////////////////////////////////////////////////////////////////////////////////////////////
 	// 所有响应码类型定义
@@ -130,6 +135,15 @@ public interface RespCodePrefix {
 	String PREFIX_HEALTH_S = PREFIX_HEALTH+PREFIX_S;
 	String PREFIX_HEALTH_R = PREFIX_HEALTH+PREFIX_R;
 
+	//////////////////////////////////////////////////////////////////////////////////////////////////////
+	// MESSAGE响应码前两段,正常响应码为全部
+	//////////////////////////////////////////////////////////////////////////////////////////////////////
+	String PREFIX_MESSAGE_N = PREFIX_MESSAGE+PREFIX_N+RESPONSE_SUCESS;
+	String PREFIX_MESSAGE_P = PREFIX_MESSAGE+PREFIX_P;
+	String PREFIX_MESSAGE_D = PREFIX_MESSAGE+PREFIX_D;
+	String PREFIX_MESSAGE_S = PREFIX_MESSAGE+PREFIX_S;
+	String PREFIX_MESSAGE_R = PREFIX_MESSAGE+PREFIX_R;
+
 	/**
 	 * 返回状态码
 	 * @return

+ 0 - 8
src/main/java/com/ywt/biz/common/core/domain/BaseEntity.java

@@ -2,7 +2,6 @@ package com.ywt.biz.common.core.domain;
 
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -20,13 +19,6 @@ public class BaseEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 搜索值
-     */
-    @JsonIgnore
-    @TableField(exist = false)
-    private String searchValue;
-
-    /**
      * 创建者
      */
     @TableField(fill = FieldFill.INSERT)

+ 0 - 51
src/main/java/com/ywt/biz/common/core/domain/PageQuery.java

@@ -1,51 +0,0 @@
-package com.ywt.biz.common.core.domain;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * 分页查询实体类
- *
- * @author Lion Li
- */
-
-@Data
-public class PageQuery implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 分页大小
-     */
-    private Integer pageSize;
-
-    /**
-     * 当前页数
-     */
-    private Integer current;
-
-
-    /**
-     * 当前记录起始索引 默认值
-     */
-    public static final int DEFAULT_PAGE_NUM = 1;
-
-    /**
-     * 每页显示记录数 默认值 默认查全部
-     */
-    public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
-
-    public <T> Page<T> build() {
-        Integer pageNum = ObjectUtil.defaultIfNull(getCurrent(), DEFAULT_PAGE_NUM);
-        Integer size = ObjectUtil.defaultIfNull(getPageSize(), DEFAULT_PAGE_SIZE);
-        if (pageNum <= 0) {
-            pageNum = DEFAULT_PAGE_NUM;
-        }
-        return new Page<>(pageNum, size);
-    }
-
-
-}

+ 0 - 39
src/main/java/com/ywt/biz/common/core/domain/TreeEntity.java

@@ -1,39 +0,0 @@
-package com.ywt.biz.common.core.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Tree基类
- *
- * @author Lion Li
- */
-
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class TreeEntity<T> extends BaseEntity {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 父菜单名称
-     */
-    @TableField(exist = false)
-    private String parentName;
-
-    /**
-     * 父菜单ID
-     */
-    private Long parentId;
-
-    /**
-     * 子部门
-     */
-    @TableField(exist = false)
-    private transient List<T> routes = new ArrayList<>();
-
-}

+ 0 - 86
src/main/java/com/ywt/biz/common/core/page/PageData.java

@@ -1,86 +0,0 @@
-package com.ywt.biz.common.core.page;
-
-import cn.hutool.http.HttpStatus;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * 表格分页数据对象
- *
- * @author Lion Li
- */
-
-@Data
-@NoArgsConstructor
-public class PageData<T> implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 总记录数
-     */
-    private long total;
-
-    /**
-     * 列表数据
-     */
-    private transient List<T> rows;
-
-    /**
-     * 消息状态码
-     */
-    private int code;
-
-    /**
-     * 消息内容
-     */
-    private String msg;
-
-    private Object extend;
-
-    /**
-     * 分页
-     *
-     * @param list  列表数据
-     * @param total 总记录数
-     */
-    public PageData(List<T> list, long total) {
-        this.rows = list;
-        this.total = total;
-    }
-
-    public static <T> PageData<T> build(IPage<T> page) {
-        PageData<T> rspData = new PageData<>();
-        rspData.setCode(HttpStatus.HTTP_OK);
-        rspData.setMsg("查询成功");
-        rspData.setRows(page.getRecords());
-        rspData.setTotal(page.getTotal());
-        return rspData;
-    }
-
-    public static <T> PageData<T> build(IPage<T> page, Object extend) {
-        PageData<T> rspData = build(page);
-        rspData.setExtend(extend);
-        return rspData;
-    }
-
-    public static <T> PageData<T> build(List<T> list) {
-        PageData<T> rspData = new PageData<>();
-        rspData.setCode(HttpStatus.HTTP_OK);
-        rspData.setMsg("查询成功");
-        rspData.setRows(list);
-        rspData.setTotal(list.size());
-        return rspData;
-    }
-
-    public static <T> PageData<T> build() {
-        PageData<T> rspData = new PageData<>();
-        rspData.setCode(HttpStatus.HTTP_OK);
-        rspData.setMsg("查询成功");
-        return rspData;
-    }
-
-}

+ 0 - 57
src/main/java/com/ywt/biz/common/core/service/DictService.java

@@ -1,57 +0,0 @@
-package com.ywt.biz.common.core.service;
-
-/**
- * 通用 字典服务
- *
- * @author Lion Li
- */
-public interface DictService {
-
-    /**
-     * 分隔符
-     */
-    String SEPARATOR = ",";
-
-    /**
-     * 根据字典类型和字典值获取字典标签
-     *
-     * @param dictType  字典类型
-     * @param dictValue 字典值
-     * @return 字典标签
-     */
-    default String getDictLabel(String dictType, String dictValue) {
-        return getDictLabel(dictType, dictValue, SEPARATOR);
-    }
-
-    /**
-     * 根据字典类型和字典标签获取字典值
-     *
-     * @param dictType  字典类型
-     * @param dictLabel 字典标签
-     * @return 字典值
-     */
-    default String getDictValue(String dictType, String dictLabel) {
-        return getDictValue(dictType, dictLabel, SEPARATOR);
-    }
-
-    /**
-     * 根据字典类型和字典值获取字典标签
-     *
-     * @param dictType  字典类型
-     * @param dictValue 字典值
-     * @param separator 分隔符
-     * @return 字典标签
-     */
-    String getDictLabel(String dictType, String dictValue, String separator);
-
-    /**
-     * 根据字典类型和字典标签获取字典值
-     *
-     * @param dictType  字典类型
-     * @param dictLabel 字典标签
-     * @param separator 分隔符
-     * @return 字典值
-     */
-    String getDictValue(String dictType, String dictLabel, String separator);
-
-}

+ 0 - 18
src/main/java/com/ywt/biz/common/core/service/OssService.java

@@ -1,18 +0,0 @@
-package com.ywt.biz.common.core.service;
-
-/**
- * 通用 OSS服务
- *
- * @author Lion Li
- */
-public interface OssService {
-
-    /**
-     * 通过ossId查询对应的url
-     *
-     * @param ossIds ossId串逗号分隔
-     * @return url串逗号分隔
-     */
-    String selectUrlByIds(String ossIds);
-
-}

+ 0 - 11
src/main/java/com/ywt/biz/common/core/service/PermissionService.java

@@ -1,11 +0,0 @@
-package com.ywt.biz.common.core.service;
-
-import java.util.Set;
-
-/**
- * @author Qioes
- * @date 2023/8/16 10:06:21
- */
-public interface PermissionService {
-    Set<String> getMenuPermission(Long userId);
-}

+ 0 - 18
src/main/java/com/ywt/biz/common/core/service/SensitiveService.java

@@ -1,18 +0,0 @@
-package com.ywt.biz.common.core.service;
-
-/**
- * 脱敏服务
- * 默认管理员不过滤
- * 需自行根据业务重写实现
- *
- * @author Lion Li
- * @version 3.6.0
- */
-public interface SensitiveService {
-
-    /**
-     * 是否脱敏
-     */
-    boolean isSensitive();
-
-}

+ 0 - 36
src/main/java/com/ywt/biz/common/core/service/UserService.java

@@ -1,36 +0,0 @@
-package com.ywt.biz.common.core.service;
-
-/**
- * 通用 用户服务
- *
- * @author Lion Li
- */
-public interface UserService {
-
-    /**
-     * 通过用户ID查询用户账户
-     *
-     * @param userId 用户ID
-     * @return 用户账户
-     */
-    String selectUserNameById(Long userId);
-
-    /**
-     * 重置用户密码
-     *
-     * @param userId   用户id
-     * @param password 密码
-     * @return 结果
-     */
-    int resetUserPwd(Long userId, String password);
-
-    /**
-     * 通过用户ID查询用户密码
-     *
-     * @param userId 用户ID
-     * @return 用户密码
-     */
-    String selectPasswordByUserId(Long userId);
-
-    Object selectUserById(Long userId);
-}

+ 0 - 96
src/main/java/com/ywt/biz/common/dto/PageResultDTO.java

@@ -1,96 +0,0 @@
-package com.ywt.biz.common.dto;
-
-import java.util.List;
-
-/**
- * 使用spring mvc中的page翻页
- * @author  Aning
- * @date 2018-11-09
- */
-public class PageResultDTO<T> {
-
-
-    /**
-     * 页码
-     */
-    private Integer page;
-    /**
-     * 页容量
-     */
-    private Integer rows;
-
-    /**
-     * 总数量
-     */
-    private Long total;
-    /**
-     * 总页数
-     */
-    private Long totalPage;
-    /**
-     * 总数据
-     */
-    private List<T> data;
-
-    public PageResultDTO() {
-    }
-
-    public int getPage() {
-        return page;
-    }
-
-    public void setPage(int page) {
-        this.page = page;
-    }
-
-    public int getRows() {
-        return rows;
-    }
-
-    public void setRows(int rows) {
-        this.rows = rows;
-    }
-
-    public long getTotal() {
-        return total;
-    }
-
-    public void setTotal(long total) {
-        this.total = total;
-    }
-
-    public long getTotalPage() {
-        return totalPage;
-    }
-
-    public void setTotalPage(long totalPage) {
-        this.totalPage = totalPage;
-    }
-
-    public List<T> getData() {
-        return data;
-    }
-
-    public void setData(List<T> data) {
-        this.data = data;
-    }
-
-    public PageResultDTO(int page, int rows, long total, long totalPage, List<T> data) {
-        this.page = page;
-        this.rows = rows;
-        this.total = total;
-        this.totalPage = totalPage;
-        this.data = data;
-    }
-
-    @Override
-    public String toString() {
-        final StringBuilder sb = new StringBuilder("PageResultDTO{");
-        sb.append("page=").append(page);
-        sb.append(", rows=").append(rows);
-        sb.append(", total=").append(total);
-        sb.append(", totalPage=").append(totalPage);
-        sb.append('}');
-        return sb.toString();
-    }
-}

+ 0 - 49
src/main/java/com/ywt/biz/common/enums/SensitiveStrategy.java

@@ -1,49 +0,0 @@
-package com.ywt.biz.common.enums;
-
-import cn.hutool.core.util.DesensitizedUtil;
-import lombok.AllArgsConstructor;
-
-import java.util.function.Function;
-
-/**
- * 脱敏策略
- *
- * @author Yjoioooo
- * @version 3.6.0
- */
-@AllArgsConstructor
-public enum SensitiveStrategy {
-
-    /**
-     * 身份证脱敏
-     */
-    ID_CARD(s -> DesensitizedUtil.idCardNum(s, 3, 4)),
-
-    /**
-     * 手机号脱敏
-     */
-    PHONE(DesensitizedUtil::mobilePhone),
-
-    /**
-     * 地址脱敏
-     */
-    ADDRESS(s -> DesensitizedUtil.address(s, 8)),
-
-    /**
-     * 邮箱脱敏
-     */
-    EMAIL(DesensitizedUtil::email),
-
-    /**
-     * 银行卡
-     */
-    BANK_CARD(DesensitizedUtil::bankCard);
-
-    //可自行添加其他脱敏策略
-
-    private final Function<String, String> desensitizer;
-
-    public Function<String, String> desensitizer() {
-        return desensitizer;
-    }
-}

+ 1 - 8
src/main/java/com/ywt/biz/common/exception/YwtCommonException.java

@@ -1,8 +1,6 @@
 package com.ywt.biz.common.exception;
 
 import com.ywt.biz.common.constant.YwtCommonRespCode;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * <p>自定义异常类,如果使用此类,请注意不同构造函数适用的场景
@@ -54,10 +52,5 @@ public class YwtCommonException extends YwtException {
 	public YwtCommonException(YwtCommonRespCode e, String detail, Throwable cause) {
         super(e.getCode(),e.getMsg(),detail,cause);
 	}
-	
-	@Override
-	public String toString() {
-		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-	}
-	
+
 }

+ 0 - 7
src/main/java/com/ywt/biz/common/exception/YwtException.java

@@ -4,8 +4,6 @@
 package com.ywt.biz.common.exception;
 
 import com.ywt.biz.common.constant.RespCodePrefix;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -96,11 +94,6 @@ public class YwtException extends RuntimeException {
 		return errDetail;
 	}
 
-	@Override
-	public String toString() {
-		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-	}
-
 	/**
 	 * 输出堆栈信息到log err
 	 *

+ 0 - 68
src/main/java/com/ywt/biz/common/structs/MultipleTree.java

@@ -1,68 +0,0 @@
-package com.ywt.biz.common.structs;
-
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * 多叉树类
- */
-public class MultipleTree {
-
-    /**
-     * 多叉树根节点
-     */
-    private TreeNode root;
-
-    private List<TreeNode> tempNodeList;
-
-
-    public MultipleTree() {
-    }
-
-    public MultipleTree(List<TreeNode> treeNodeList) {
-        tempNodeList = treeNodeList;
-        generateTree();
-    }
-
-    public TreeNode getRoot() {
-        return root;
-    }
-
-    public void setRoot(TreeNode root) {
-        this.root = root;
-    }
-
-    /**
-     * 生成多叉树
-     */
-    public void generateTree() {
-        int maxId = Integer.MAX_VALUE;
-        HashMap<String, TreeNode> map = new HashMap<>();
-
-        for(TreeNode treeNode : tempNodeList){
-            if(treeNode.getId() < maxId){
-                maxId = treeNode.getId();
-                this.root = treeNode;
-            }
-
-            map.put(String.valueOf(treeNode.getId()), treeNode);
-        }
-
-        for (String key : map.keySet()) {
-            TreeNode treeNode = map.get(key);
-            int parentId = treeNode.getParentId();
-            String parentKeyId = String.valueOf(parentId);
-
-            if (map.containsKey(parentKeyId)) {
-                TreeNode parentNode = map.get(parentKeyId);
-
-                if (parentNode == null) {
-                    //节点不能构成一棵多叉树
-                    return;
-                } else {
-                    parentNode.addChildNode(treeNode);
-                }
-            }
-        }
-    }
-}

+ 0 - 92
src/main/java/com/ywt/biz/common/structs/TreeNode.java

@@ -1,92 +0,0 @@
-package com.ywt.biz.common.structs;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * 树节点类
- */
-public class TreeNode implements Serializable {
-    private int parentId;
-    private int id;
-    private String label;
-    private List<TreeNode> children;
-
-    public TreeNode() {
-        initChildren();
-    }
-
-
-    public void addChildNode(TreeNode treeNode) {
-        initChildren();
-        children.add(treeNode);
-    }
-
-    private void initChildren() {
-        if (children == null) {
-            children = new ArrayList<>();
-        }
-    }
-
-    public List<TreeNode> getChildren() {
-        return children;
-    }
-
-    public void setChildren(List<TreeNode> children) {
-        this.children = children;
-    }
-
-    public int getParentId() {
-        return parentId;
-    }
-
-    public void setParentId(int parentId) {
-        this.parentId = parentId;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getLabel() {
-        return label;
-    }
-
-    public void setLabel(String label) {
-        this.label = label;
-    }
-
-    // 孩子节点排序
-    public void sortChildren() {
-        Collections.sort(children, new IdComparator());
-
-        // 对节点的子节点进行排序
-        for(TreeNode node : children){
-            node.sortChildren();
-        }
-//        for (Iterator it = children.iterator(); it.hasNext(); ) {
-//            ((TreeNode) it.next()).sortChildren();
-//        }
-    }
-
-    /**
-     * 节点比较器
-     */
-    class IdComparator implements Comparator {
-        // 按照节点编号比较
-        public int compare(Object o1, Object o2) {
-            int j1 = (((TreeNode) o1).getId());
-            int j2 = (((TreeNode) o2).getId());
-            return (j1 < j2 ? -1 : (j1 == j2 ? 0 : 1));
-        }
-    }
-
-}
-

+ 0 - 203
src/main/java/com/ywt/biz/common/structs/TrieTree.java

@@ -1,203 +0,0 @@
-package com.ywt.biz.common.structs;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Trie 树
- * Created by huangguoping on 16/9/13.
- */
-public class TrieTree<T extends Serializable> implements Serializable {
-
-    private Node<T> root;
-    public TrieTree(){
-        root = new Node<>();
-    }
-
-    public void insert(String key, T data){
-        if (key == null || key.equals("")) return;
-        Node<T> tempNode = root;
-        for (int i = 0; i < key.length(); i++){
-            if (tempNode.getChildren() == null) tempNode.setChildren(new HashMap<Character, Node<T>>());
-            Character c = key.charAt(i);
-            //System.out.println(c);
-            if (tempNode.getChildren().containsKey(c)){
-                //System.out.println(c);
-                tempNode = tempNode.getChildren().get(c);
-            }else{
-                Node<T> node_t = new Node<>();
-                tempNode.getChildren().put(c, node_t);
-                tempNode = node_t;
-            }
-        }
-        tempNode.setHitNum(tempNode.getHitNum() + 1);
-        tempNode.setData(data);
-        tempNode.setIshit(true);
-    }
-
-    private int _search(Node<T> node, String content, int next_i, int len, List<T> hitNodeDatas, List<String> hitKeys, StringBuffer stringBuffer){
-        if (next_i >= len) return next_i;
-        Character c = content.charAt(next_i);
-        stringBuffer.append(c);
-        if (node.getChildren().containsKey(c)){
-            Node<T> nextNode = node.children.get(c);
-            if (nextNode.ishit){
-                hitKeys.add(stringBuffer.toString());
-                hitNodeDatas.add(nextNode.data);
-            }
-            if (nextNode.children == null || nextNode.children.size() == 0){
-                return next_i + 1;
-            }
-            return _search(nextNode, content, next_i + 1, len, hitNodeDatas, hitKeys, stringBuffer);
-        }else {
-            return next_i;
-        }
-    }
-
-    public SearchResult<T> search(String content){
-        SearchResult<T> searchResult = new SearchResult<>();
-
-        if (content == null) return searchResult;
-        int len = content.length();
-        if (len == 0) return searchResult;
-
-        StringBuffer stringBuffer = null;
-
-        if(root.getChildren() == null || root.getChildren().size() == 0) return searchResult;
-        List<T> hitNodeDataLstAll = new LinkedList<>();
-        List<T> hitNodeDatasTemp = new LinkedList<>();
-        List<String> hitKeysTemp = new LinkedList<>();
-        Map<String, Integer> hitsCount = new HashMap<>();
-        int curr_i = 0;
-        while (curr_i < len){
-            hitNodeDatasTemp.clear();
-            hitKeysTemp.clear();
-            stringBuffer = new StringBuffer();
-            int next_i = this._search(root, content, curr_i, len, hitNodeDatasTemp, hitKeysTemp, stringBuffer);
-            if (next_i > curr_i) {
-                if (hitNodeDatasTemp.size() > 0) {
-                    String key_t = hitKeysTemp.get(hitKeysTemp.size() - 1);
-                    curr_i += key_t.length();
-                    if (hitsCount.containsKey(key_t)){
-                        hitsCount.replace(key_t, hitsCount.get(key_t) + 1);
-                    }else {
-                        hitNodeDataLstAll.add(hitNodeDatasTemp.get(hitNodeDatasTemp.size() - 1));
-                        hitsCount.put(key_t, 1);
-                    }
-                } else {
-                    curr_i++;
-                }
-            }
-            else
-                curr_i++;
-        }
-
-        searchResult.setHitsCount(hitsCount);
-        searchResult.setHitNodeDatas(hitNodeDataLstAll);
-        return searchResult;
-    }
-
-    public List<T> searchByPrefix(String prefix){
-        if(prefix == null || prefix.length() == 0) return null;
-        int len = prefix.length();
-        int curr_i = 0;
-
-        if (root.children == null || root.children.size() == 0) return null;
-        Node<T> tempNode = root;
-        while (curr_i < len) {
-            Character c = prefix.charAt(curr_i);
-            if (tempNode.children.containsKey(c)) {
-                curr_i++;
-                tempNode = tempNode.children.get(c);
-                if (tempNode.children == null || tempNode.children.size() == 0) break;
-            } else {
-                break;
-            }
-        }
-
-        List<T> hitNodeDataLstAll = new LinkedList<>();
-        if (curr_i > 0 && curr_i == len){
-            traversal(tempNode, hitNodeDataLstAll);
-        }
-        return hitNodeDataLstAll;
-    }
-
-    private void traversal(Node<T> node, List<T> hitNodeDatas){
-        if (node.ishit){
-            hitNodeDatas.add(node.data);
-        }
-        if (node.children == null || node.children.size() == 0) return;
-        for (Map.Entry<Character, Node<T>> entry : node.children.entrySet()){
-            traversal(entry.getValue(), hitNodeDatas);
-        }
-    }
-
-    public class Node<T extends Serializable> implements Serializable {
-        private T data;
-        private int hitNum;
-        private boolean ishit = false;
-
-        private Map<Character, Node<T>> children = null;
-
-        public T getData() {
-            return data;
-        }
-
-        public void setData(T data) {
-            this.data = data;
-        }
-
-        public int getHitNum() {
-            return hitNum;
-        }
-
-        public void setHitNum(int hitNum) {
-            this.hitNum = hitNum;
-        }
-
-        public Map<Character, Node<T>> getChildren() {
-            return children;
-        }
-
-        public void setChildren(Map<Character, Node<T>> children) {
-            this.children = children;
-        }
-
-        public boolean isIshit() {
-            return ishit;
-        }
-
-        public void setIshit(boolean ishit) {
-            this.ishit = ishit;
-        }
-    }
-
-    public class SearchResult<T extends Serializable> {
-        private List<T> hitNodeDatas = null;
-        private Map<String, Integer> hitsCount = null;
-
-        public SearchResult(){
-            this.hitNodeDatas = new LinkedList<>();
-            this.hitsCount = new HashMap<>();
-        }
-
-        public List<T> getHitNodeDatas() {
-            return hitNodeDatas;
-        }
-
-        public void setHitNodeDatas(List<T> hitNodeDatas) {
-            this.hitNodeDatas = hitNodeDatas;
-        }
-
-        public Map<String, Integer> getHitsCount() {
-            return hitsCount;
-        }
-
-        public void setHitsCount(Map<String, Integer> hitsCount) {
-            this.hitsCount = hitsCount;
-        }
-    }
-}

+ 1 - 10
src/main/java/com/ywt/biz/common/web/YwtHttpResponse.java

@@ -1,12 +1,8 @@
-/**
- * 
- */
+
 package com.ywt.biz.common.web;
 
 import com.ywt.biz.common.constant.YwtCommonRespCode;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 
 
@@ -119,9 +115,4 @@ public class YwtHttpResponse<T> {
         this.detail = detail;
         this.data = null;
     }
-    
-	@Override
-    public String toString() {
-    	return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
-    }
 }