diff --git a/pom.xml b/pom.xml index 29d8eb3f..f59fb985 100644 --- a/pom.xml +++ b/pom.xml @@ -404,6 +404,12 @@ guava 33.0.0-jre + + + + org.springframework.boot + spring-boot-starter-amqp + diff --git a/src/main/java/com/rymcu/forest/auth/BaseHashedCredentialsMatcher.java b/src/main/java/com/rymcu/forest/auth/BaseHashedCredentialsMatcher.java index 039666ea..1c0c4833 100644 --- a/src/main/java/com/rymcu/forest/auth/BaseHashedCredentialsMatcher.java +++ b/src/main/java/com/rymcu/forest/auth/BaseHashedCredentialsMatcher.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.auth; import com.rymcu.forest.util.UserUtils; diff --git a/src/main/java/com/rymcu/forest/auth/JwtConstants.java b/src/main/java/com/rymcu/forest/auth/JwtConstants.java index 82ff6be3..2f779cd2 100644 --- a/src/main/java/com/rymcu/forest/auth/JwtConstants.java +++ b/src/main/java/com/rymcu/forest/auth/JwtConstants.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.auth; /** diff --git a/src/main/java/com/rymcu/forest/auth/JwtFilter.java b/src/main/java/com/rymcu/forest/auth/JwtFilter.java index e7c28356..bc63a217 100644 --- a/src/main/java/com/rymcu/forest/auth/JwtFilter.java +++ b/src/main/java/com/rymcu/forest/auth/JwtFilter.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.auth; import com.alibaba.fastjson2.JSONObject; diff --git a/src/main/java/com/rymcu/forest/auth/JwtRealm.java b/src/main/java/com/rymcu/forest/auth/JwtRealm.java index 65b30b85..b130f623 100644 --- a/src/main/java/com/rymcu/forest/auth/JwtRealm.java +++ b/src/main/java/com/rymcu/forest/auth/JwtRealm.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.auth; import com.rymcu.forest.dto.TokenUser; diff --git a/src/main/java/com/rymcu/forest/auth/RedisTokenManager.java b/src/main/java/com/rymcu/forest/auth/RedisTokenManager.java index 7001355a..be089b95 100644 --- a/src/main/java/com/rymcu/forest/auth/RedisTokenManager.java +++ b/src/main/java/com/rymcu/forest/auth/RedisTokenManager.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.auth; @@ -6,7 +29,8 @@ import io.jsonwebtoken.SignatureAlgorithm; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationEventPublisher; +import com.rymcu.forest.config.RabbitMQConfig; +import com.rymcu.forest.event.EventPublisher; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; @@ -27,7 +51,7 @@ public class RedisTokenManager implements TokenManager { @Autowired private StringRedisTemplate redisTemplate; @Resource - private ApplicationEventPublisher applicationEventPublisher; + private EventPublisher eventPublisher; /** * 生成TOKEN @@ -60,7 +84,7 @@ public boolean checkToken(TokenModel model) { String result = redisTemplate.boundValueOps(key.toString()).get(); if (StringUtils.isBlank(result)) { // 更新最后在线时间 - applicationEventPublisher.publishEvent(new AccountEvent(model.getUsername())); + eventPublisher.publish(RabbitMQConfig.RK_ACCOUNT_LOGIN, new AccountEvent(model.getUsername())); redisTemplate.boundValueOps(key.toString()).set(LocalDateTime.now().toString(), JwtConstants.LAST_ONLINE_EXPIRES_MINUTE, TimeUnit.MINUTES); } return true; diff --git a/src/main/java/com/rymcu/forest/auth/TokenManager.java b/src/main/java/com/rymcu/forest/auth/TokenManager.java index ad28ec2e..ccba0086 100644 --- a/src/main/java/com/rymcu/forest/auth/TokenManager.java +++ b/src/main/java/com/rymcu/forest/auth/TokenManager.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.auth; /** diff --git a/src/main/java/com/rymcu/forest/auth/TokenModel.java b/src/main/java/com/rymcu/forest/auth/TokenModel.java index ef3e5578..568aebbb 100644 --- a/src/main/java/com/rymcu/forest/auth/TokenModel.java +++ b/src/main/java/com/rymcu/forest/auth/TokenModel.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.auth; import org.apache.shiro.authc.AuthenticationToken; diff --git a/src/main/java/com/rymcu/forest/config/BaseExceptionHandler.java b/src/main/java/com/rymcu/forest/config/BaseExceptionHandler.java index bedebd27..791bfc8c 100644 --- a/src/main/java/com/rymcu/forest/config/BaseExceptionHandler.java +++ b/src/main/java/com/rymcu/forest/config/BaseExceptionHandler.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import com.alibaba.fastjson.support.spring.annotation.FastJsonView; diff --git a/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java b/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java index b943f4b7..3589f4e7 100644 --- a/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java +++ b/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import com.github.pagehelper.PageInterceptor; diff --git a/src/main/java/com/rymcu/forest/config/RabbitMQConfig.java b/src/main/java/com/rymcu/forest/config/RabbitMQConfig.java new file mode 100644 index 00000000..ed9ca4c1 --- /dev/null +++ b/src/main/java/com/rymcu/forest/config/RabbitMQConfig.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +package com.rymcu.forest.config; + +import org.springframework.amqp.core.*; +import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; +import org.springframework.amqp.support.converter.MessageConverter; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * RabbitMQ 配置 —— 替代 Spring Event 的消息队列 + *

+ * 架构: + * 1 个 Topic Exchange(forest.events) + * 5 个持久化 Queue(按业务域划分) + * 7 个 Routing Key(精确路由不同类型的事件) + * + * @author 麦小文 + */ +@Configuration +public class RabbitMQConfig { + + // ==================== 交换机 ==================== + public static final String FOREST_EXCHANGE = "forest.events"; + + // ==================== 队列名 ==================== + public static final String QUEUE_ARTICLE = "forest.article"; + public static final String QUEUE_COMMENT = "forest.comment"; + public static final String QUEUE_FOLLOW = "forest.follow"; + public static final String QUEUE_PORTFOLIO = "forest.portfolio"; + public static final String QUEUE_ACCOUNT = "forest.account"; + + // ==================== Routing Key ==================== + public static final String RK_ARTICLE_POST = "article.post"; + public static final String RK_ARTICLE_DELETE = "article.delete"; + public static final String RK_ARTICLE_STATUS = "article.status"; + public static final String RK_COMMENT_CREATE = "comment.create"; + public static final String RK_FOLLOW = "follow"; + public static final String RK_PORTFOLIO = "portfolio"; + public static final String RK_ACCOUNT_LOGIN = "account.login"; + + // ==================== 交换机 Bean ==================== + @Bean + public TopicExchange forestExchange() { + return new TopicExchange(FOREST_EXCHANGE, true, false); + } + + // ==================== 队列 Bean ==================== + @Bean + public Queue articleQueue() { + return QueueBuilder.durable(QUEUE_ARTICLE).build(); + } + + @Bean + public Queue commentQueue() { + return QueueBuilder.durable(QUEUE_COMMENT).build(); + } + + @Bean + public Queue followQueue() { + return QueueBuilder.durable(QUEUE_FOLLOW).build(); + } + + @Bean + public Queue portfolioQueue() { + return QueueBuilder.durable(QUEUE_PORTFOLIO).build(); + } + + @Bean + public Queue accountQueue() { + return QueueBuilder.durable(QUEUE_ACCOUNT).build(); + } + + // ==================== 绑定 ==================== + @Bean + public Binding articlePostBinding() { + return BindingBuilder.bind(articleQueue()).to(forestExchange()).with(RK_ARTICLE_POST); + } + + @Bean + public Binding articleDeleteBinding() { + return BindingBuilder.bind(articleQueue()).to(forestExchange()).with(RK_ARTICLE_DELETE); + } + + @Bean + public Binding articleStatusBinding() { + return BindingBuilder.bind(articleQueue()).to(forestExchange()).with(RK_ARTICLE_STATUS); + } + + @Bean + public Binding commentBinding() { + return BindingBuilder.bind(commentQueue()).to(forestExchange()).with(RK_COMMENT_CREATE); + } + + @Bean + public Binding followBinding() { + return BindingBuilder.bind(followQueue()).to(forestExchange()).with(RK_FOLLOW); + } + + @Bean + public Binding portfolioBinding() { + return BindingBuilder.bind(portfolioQueue()).to(forestExchange()).with(RK_PORTFOLIO); + } + + @Bean + public Binding accountBinding() { + return BindingBuilder.bind(accountQueue()).to(forestExchange()).with(RK_ACCOUNT_LOGIN); + } + + // ==================== JSON 序列化 ==================== + /** + * 使用 Jackson 序列化事件对象为 JSON 发送到 RabbitMQ + */ + @Bean + public MessageConverter jsonMessageConverter() { + return new Jackson2JsonMessageConverter(); + } +} diff --git a/src/main/java/com/rymcu/forest/config/RedisKeyExpirationListener.java b/src/main/java/com/rymcu/forest/config/RedisKeyExpirationListener.java index 7b358e0e..330132f9 100644 --- a/src/main/java/com/rymcu/forest/config/RedisKeyExpirationListener.java +++ b/src/main/java/com/rymcu/forest/config/RedisKeyExpirationListener.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import com.rymcu.forest.auth.JwtConstants; diff --git a/src/main/java/com/rymcu/forest/config/RedisListenerConfig.java b/src/main/java/com/rymcu/forest/config/RedisListenerConfig.java index ec7ee364..2ea43a62 100644 --- a/src/main/java/com/rymcu/forest/config/RedisListenerConfig.java +++ b/src/main/java/com/rymcu/forest/config/RedisListenerConfig.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/com/rymcu/forest/config/RedisProperties.java b/src/main/java/com/rymcu/forest/config/RedisProperties.java index 5e0332e6..a90e9c25 100644 --- a/src/main/java/com/rymcu/forest/config/RedisProperties.java +++ b/src/main/java/com/rymcu/forest/config/RedisProperties.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/src/main/java/com/rymcu/forest/config/ShiroConfig.java b/src/main/java/com/rymcu/forest/config/ShiroConfig.java index bd6563aa..57e19155 100644 --- a/src/main/java/com/rymcu/forest/config/ShiroConfig.java +++ b/src/main/java/com/rymcu/forest/config/ShiroConfig.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import com.rymcu.forest.auth.BaseHashedCredentialsMatcher; diff --git a/src/main/java/com/rymcu/forest/config/TaskExecutorConfig.java b/src/main/java/com/rymcu/forest/config/TaskExecutorConfig.java index 0a69501d..cf187431 100644 --- a/src/main/java/com/rymcu/forest/config/TaskExecutorConfig.java +++ b/src/main/java/com/rymcu/forest/config/TaskExecutorConfig.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java b/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java index bc12f9a2..8c112613 100644 --- a/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java +++ b/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import org.slf4j.Logger; diff --git a/src/main/java/com/rymcu/forest/config/WebLogAspect.java b/src/main/java/com/rymcu/forest/config/WebLogAspect.java index 995af56c..e1d80541 100644 --- a/src/main/java/com/rymcu/forest/config/WebLogAspect.java +++ b/src/main/java/com/rymcu/forest/config/WebLogAspect.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import com.rymcu.forest.util.Utils; diff --git a/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java b/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java index 03050f8d..aa65168f 100644 --- a/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java +++ b/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; diff --git a/src/main/java/com/rymcu/forest/config/WebSocketStompConfig.java b/src/main/java/com/rymcu/forest/config/WebSocketStompConfig.java index 7119ab98..68e985c2 100644 --- a/src/main/java/com/rymcu/forest/config/WebSocketStompConfig.java +++ b/src/main/java/com/rymcu/forest/config/WebSocketStompConfig.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.config; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/rymcu/forest/event/EventPublisher.java b/src/main/java/com/rymcu/forest/event/EventPublisher.java new file mode 100644 index 00000000..6878a3e0 --- /dev/null +++ b/src/main/java/com/rymcu/forest/event/EventPublisher.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +package com.rymcu.forest.event; + +import com.rymcu.forest.config.RabbitMQConfig; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; +import org.springframework.transaction.support.TransactionSynchronization; +import org.springframework.transaction.support.TransactionSynchronizationManager; + +import javax.annotation.Resource; + +/** + * 事件发布器 —— 替代 Spring 的 ApplicationEventPublisher + *

+ * 核心设计: + *

+ * 完全保持了原来 @TransactionalEventListener(phase = AFTER_COMMIT) 的语义, + * 避免"消息发出去了但数据库回滚了"的脏数据问题。 + * + * @author 麦小文 + */ +@Slf4j +@Component +public class EventPublisher { + + @Resource + private RabbitTemplate rabbitTemplate; + + /** + * 发布事件到 RabbitMQ + * + * @param routingKey RabbitMQConfig 中定义的 RK_* 常量 + * @param event 事件对象(会被 Jackson 序列化为 JSON) + */ + public void publish(String routingKey, Object event) { + if (TransactionSynchronizationManager.isSynchronizationActive()) { + // 在事务中 → 等事务提交后再发送 + TransactionSynchronizationManager.registerSynchronization( + new TransactionSynchronization() { + @Override + public void afterCommit() { + doSend(routingKey, event); + } + }); + } else { + // 不在事务中 → 直接发送(如 RedisTokenManager 的登录事件) + doSend(routingKey, event); + } + } + + private void doSend(String routingKey, Object event) { + try { + rabbitTemplate.convertAndSend(RabbitMQConfig.FOREST_EXCHANGE, routingKey, event); + log.info("RabbitMQ 消息已发送: routingKey={}, event={}", + routingKey, event.getClass().getSimpleName()); + } catch (Exception e) { + log.error("RabbitMQ 发送失败: routingKey={}, event={}", + routingKey, event.getClass().getSimpleName(), e); + } + } +} diff --git a/src/main/java/com/rymcu/forest/handler/AccountHandler.java b/src/main/java/com/rymcu/forest/handler/AccountHandler.java index f696c7b0..18a61291 100644 --- a/src/main/java/com/rymcu/forest/handler/AccountHandler.java +++ b/src/main/java/com/rymcu/forest/handler/AccountHandler.java @@ -1,10 +1,34 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler; +import com.rymcu.forest.config.RabbitMQConfig; import com.rymcu.forest.handler.event.AccountEvent; import com.rymcu.forest.mapper.UserMapper; import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; -import org.springframework.transaction.event.TransactionalEventListener; import javax.annotation.Resource; @@ -22,7 +46,7 @@ public class AccountHandler { @Resource private UserMapper userMapper; - @TransactionalEventListener + @RabbitListener(queues = RabbitMQConfig.QUEUE_ACCOUNT) public void processAccountLastOnlineTimeEvent(AccountEvent accountEvent) { userMapper.updateLastOnlineTimeByAccount(accountEvent.getAccount()); } diff --git a/src/main/java/com/rymcu/forest/handler/ArticleHandler.java b/src/main/java/com/rymcu/forest/handler/ArticleHandler.java index 446ffc59..bf7c3b86 100644 --- a/src/main/java/com/rymcu/forest/handler/ArticleHandler.java +++ b/src/main/java/com/rymcu/forest/handler/ArticleHandler.java @@ -1,6 +1,29 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler; -import com.alibaba.fastjson.JSON; +import com.rymcu.forest.config.RabbitMQConfig; import com.rymcu.forest.core.constant.NotificationConstant; import com.rymcu.forest.handler.event.ArticleDeleteEvent; import com.rymcu.forest.handler.event.ArticleEvent; @@ -8,8 +31,8 @@ import com.rymcu.forest.lucene.service.LuceneService; import com.rymcu.forest.util.NotificationUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; -import org.springframework.transaction.event.TransactionalEventListener; import javax.annotation.Resource; import javax.mail.MessagingException; @@ -26,9 +49,22 @@ public class ArticleHandler { @Resource private LuceneService luceneService; - @TransactionalEventListener - public void processArticlePostEvent(ArticleEvent articleEvent) { - log.info(String.format("执行文章发布相关事件:[%s]", JSON.toJSONString(articleEvent))); + /** + * 统一的文章事件入口 —— 三种事件共用一个队列,按类型分发 + */ + @RabbitListener(queues = RabbitMQConfig.QUEUE_ARTICLE) + public void handleArticleEvent(Object event) throws MessagingException { + if (event instanceof ArticleEvent) { + processArticlePostEvent((ArticleEvent) event); + } else if (event instanceof ArticleDeleteEvent) { + processArticleDeleteEvent((ArticleDeleteEvent) event); + } else if (event instanceof ArticleStatusEvent) { + processArticleStatusEvent((ArticleStatusEvent) event); + } + } + + private void processArticlePostEvent(ArticleEvent articleEvent) { + log.info("执行文章发布相关事件:[{}]", articleEvent); // 发送系统通知 if (articleEvent.getNotification()) { NotificationUtils.sendAnnouncement(articleEvent.getIdArticle(), NotificationConstant.Article, articleEvent.getArticleTitle()); @@ -54,16 +90,14 @@ public void processArticlePostEvent(ArticleEvent articleEvent) { log.info("执行完成文章发布相关事件...id={}", articleEvent.getIdArticle()); } - @TransactionalEventListener - public void processArticleDeleteEvent(ArticleDeleteEvent articleDeleteEvent) { - log.info(String.format("执行文章删除相关事件:[%s]", JSON.toJSONString(articleDeleteEvent))); + private void processArticleDeleteEvent(ArticleDeleteEvent articleDeleteEvent) { + log.info("执行文章删除相关事件:[{}]", articleDeleteEvent); luceneService.deleteArticle(articleDeleteEvent.getIdArticle()); log.info("执行完成文章删除相关事件...id={}", articleDeleteEvent.getIdArticle()); } - @TransactionalEventListener - public void processArticleStatusEvent(ArticleStatusEvent articleStatusEvent) throws MessagingException { - log.info(String.format("执行文章删除相关事件:[%s]", JSON.toJSONString(articleStatusEvent))); + private void processArticleStatusEvent(ArticleStatusEvent articleStatusEvent) throws MessagingException { + log.info("执行文章状态变更相关事件:[{}]", articleStatusEvent); NotificationUtils.saveNotification(articleStatusEvent.getArticleAuthor(), articleStatusEvent.getIdArticle(), NotificationConstant.UpdateArticleStatus, articleStatusEvent.getMessage()); } } diff --git a/src/main/java/com/rymcu/forest/handler/CommentHandler.java b/src/main/java/com/rymcu/forest/handler/CommentHandler.java index f044e1ce..381ed890 100644 --- a/src/main/java/com/rymcu/forest/handler/CommentHandler.java +++ b/src/main/java/com/rymcu/forest/handler/CommentHandler.java @@ -1,6 +1,29 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler; -import com.alibaba.fastjson.JSON; +import com.rymcu.forest.config.RabbitMQConfig; import com.rymcu.forest.core.constant.NotificationConstant; import com.rymcu.forest.entity.Comment; import com.rymcu.forest.handler.event.CommentEvent; @@ -8,8 +31,8 @@ import com.rymcu.forest.util.Html2TextUtil; import com.rymcu.forest.util.NotificationUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; -import org.springframework.transaction.event.TransactionalEventListener; import javax.annotation.Resource; import javax.mail.MessagingException; @@ -29,9 +52,9 @@ public class CommentHandler { @Resource private CommentMapper commentMapper; - @TransactionalEventListener + @RabbitListener(queues = RabbitMQConfig.QUEUE_COMMENT) public void processCommentCreatedEvent(CommentEvent commentEvent) throws MessagingException { - log.info(String.format("开始执行评论发布事件:[%s]", JSON.toJSONString(commentEvent))); + log.info("开始执行评论发布事件:[{}]", commentEvent); String commentContent = commentEvent.getContent(); int length = commentContent.length(); if (length > MAX_PREVIEW) { diff --git a/src/main/java/com/rymcu/forest/handler/FollowHandler.java b/src/main/java/com/rymcu/forest/handler/FollowHandler.java index 1ad65e6e..3ba45542 100644 --- a/src/main/java/com/rymcu/forest/handler/FollowHandler.java +++ b/src/main/java/com/rymcu/forest/handler/FollowHandler.java @@ -1,12 +1,35 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler; -import com.alibaba.fastjson.JSON; +import com.rymcu.forest.config.RabbitMQConfig; import com.rymcu.forest.core.constant.NotificationConstant; import com.rymcu.forest.handler.event.FollowEvent; import com.rymcu.forest.util.NotificationUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; -import org.springframework.transaction.event.TransactionalEventListener; import javax.mail.MessagingException; @@ -20,9 +43,9 @@ @Slf4j @Component public class FollowHandler { - @TransactionalEventListener + @RabbitListener(queues = RabbitMQConfig.QUEUE_FOLLOW) public void processFollowEvent(FollowEvent followEvent) throws MessagingException { - log.info(String.format("执行关注相关事件: [%s]", JSON.toJSONString(followEvent))); + log.info("执行关注相关事件: [{}]", followEvent); // 发送系统通知 NotificationUtils.saveNotification(followEvent.getFollowingId(), followEvent.getIdFollow(), NotificationConstant.Follow, followEvent.getSummary()); log.info("执行完成关注相关事件..."); diff --git a/src/main/java/com/rymcu/forest/handler/PortfolioHandler.java b/src/main/java/com/rymcu/forest/handler/PortfolioHandler.java index f9fde5e4..bb762326 100644 --- a/src/main/java/com/rymcu/forest/handler/PortfolioHandler.java +++ b/src/main/java/com/rymcu/forest/handler/PortfolioHandler.java @@ -1,12 +1,35 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler; -import com.alibaba.fastjson.JSON; +import com.rymcu.forest.config.RabbitMQConfig; import com.rymcu.forest.handler.event.PortfolioEvent; import com.rymcu.forest.lucene.model.PortfolioLucene; import com.rymcu.forest.lucene.util.PortfolioIndexUtil; import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; -import org.springframework.transaction.event.TransactionalEventListener; /** * Created on 2024/12/22 20:39. @@ -19,9 +42,9 @@ @Component public class PortfolioHandler { - @TransactionalEventListener + @RabbitListener(queues = RabbitMQConfig.QUEUE_PORTFOLIO) public void processPortfolioEvent(PortfolioEvent portfolioEvent) { - log.info("执行作品集发布相关事件:[{}]", JSON.toJSONString(portfolioEvent)); + log.info("执行作品集发布相关事件:[{}]", portfolioEvent); switch (portfolioEvent.getOperateType()) { case ADD: log.info("执行完成作品集发布相关事件...id={}", portfolioEvent.getIdPortfolio()); diff --git a/src/main/java/com/rymcu/forest/handler/event/AccountEvent.java b/src/main/java/com/rymcu/forest/handler/event/AccountEvent.java index dfdc955c..b3fb9fbc 100644 --- a/src/main/java/com/rymcu/forest/handler/event/AccountEvent.java +++ b/src/main/java/com/rymcu/forest/handler/event/AccountEvent.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler.event; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/rymcu/forest/handler/event/ArticleDeleteEvent.java b/src/main/java/com/rymcu/forest/handler/event/ArticleDeleteEvent.java index c44b34cf..6cd33664 100644 --- a/src/main/java/com/rymcu/forest/handler/event/ArticleDeleteEvent.java +++ b/src/main/java/com/rymcu/forest/handler/event/ArticleDeleteEvent.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler.event; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/rymcu/forest/handler/event/ArticleEvent.java b/src/main/java/com/rymcu/forest/handler/event/ArticleEvent.java index 57940d2b..aed489ba 100644 --- a/src/main/java/com/rymcu/forest/handler/event/ArticleEvent.java +++ b/src/main/java/com/rymcu/forest/handler/event/ArticleEvent.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler.event; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/rymcu/forest/handler/event/ArticleStatusEvent.java b/src/main/java/com/rymcu/forest/handler/event/ArticleStatusEvent.java index 203cbc58..2993e4fc 100644 --- a/src/main/java/com/rymcu/forest/handler/event/ArticleStatusEvent.java +++ b/src/main/java/com/rymcu/forest/handler/event/ArticleStatusEvent.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler.event; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/rymcu/forest/handler/event/CommentEvent.java b/src/main/java/com/rymcu/forest/handler/event/CommentEvent.java index 2599006c..0e4e4848 100644 --- a/src/main/java/com/rymcu/forest/handler/event/CommentEvent.java +++ b/src/main/java/com/rymcu/forest/handler/event/CommentEvent.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler.event; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/rymcu/forest/handler/event/FollowEvent.java b/src/main/java/com/rymcu/forest/handler/event/FollowEvent.java index fbd031f3..f5a04181 100644 --- a/src/main/java/com/rymcu/forest/handler/event/FollowEvent.java +++ b/src/main/java/com/rymcu/forest/handler/event/FollowEvent.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler.event; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/rymcu/forest/handler/event/PortfolioEvent.java b/src/main/java/com/rymcu/forest/handler/event/PortfolioEvent.java index cc5b7a36..ee160bc9 100644 --- a/src/main/java/com/rymcu/forest/handler/event/PortfolioEvent.java +++ b/src/main/java/com/rymcu/forest/handler/event/PortfolioEvent.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.handler.event; import com.rymcu.forest.enumerate.OperateType; diff --git a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java index 7faed05f..ea9a4575 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.constant.NotificationConstant; @@ -22,7 +45,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.text.StringEscapeUtils; import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationEventPublisher; +import com.rymcu.forest.config.RabbitMQConfig; +import com.rymcu.forest.event.EventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import tk.mybatis.mapper.entity.Condition; @@ -49,7 +73,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Resource private NotificationService notificationService; @Resource - private ApplicationEventPublisher publisher; + private EventPublisher eventPublisher; @Resource private BankAccountService bankAccountService; @@ -60,9 +84,6 @@ public class ArticleServiceImpl extends AbstractService
implements Arti private static final String DEFAULT_STATUS = "0"; private static final String DEFAULT_TOPIC_URI = "news"; - @Resource - private ApplicationEventPublisher applicationEventPublisher; - @Override public List findArticles(ArticleSearchDTO searchDTO) { List list; @@ -170,7 +191,9 @@ public Long postArticle(ArticleDTO article, User user) throws UnsupportedEncodin tagService.saveTagArticle(newArticle, articleContentHtml, user.getIdUser()); if (DEFAULT_STATUS.equals(newArticle.getArticleStatus())) { // 文章发布事件 - publisher.publishEvent(new ArticleEvent(newArticleId, newArticle.getArticleTitle(), isUpdate, notification, user.getNickname(), newArticle.getArticleAuthorId())); + eventPublisher.publish(RabbitMQConfig.RK_ARTICLE_POST, + new ArticleEvent(newArticleId, newArticle.getArticleTitle(), isUpdate, + notification, user.getNickname(), newArticle.getArticleAuthorId())); } return newArticleId; } @@ -185,7 +208,7 @@ public Integer delete(Long id) { // 删除文章 int result = articleMapper.deleteByPrimaryKey(id); if (result > 0) { - publisher.publishEvent(new ArticleDeleteEvent(id)); + eventPublisher.publish(RabbitMQConfig.RK_ARTICLE_DELETE, new ArticleDeleteEvent(id)); } return result; } else { @@ -281,7 +304,8 @@ public Boolean updateStatus(Long idArticle, String articleStatus, String remarks } else { message += "已上架!"; } - applicationEventPublisher.publishEvent(new ArticleStatusEvent(idArticle, article.getArticleAuthorId(), message)); + eventPublisher.publish(RabbitMQConfig.RK_ARTICLE_STATUS, + new ArticleStatusEvent(idArticle, article.getArticleAuthorId(), message)); return true; } diff --git a/src/main/java/com/rymcu/forest/service/impl/ArticleThumbsUpServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ArticleThumbsUpServiceImpl.java index feb2ee11..c32bfa27 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ArticleThumbsUpServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ArticleThumbsUpServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.exception.BusinessException; diff --git a/src/main/java/com/rymcu/forest/service/impl/BankAccountServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/BankAccountServiceImpl.java index 8734cfbb..0384af10 100644 --- a/src/main/java/com/rymcu/forest/service/impl/BankAccountServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/BankAccountServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import cn.hutool.core.date.LocalDateTimeUtil; diff --git a/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java index 4040f34c..a218dafd 100644 --- a/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/java/com/rymcu/forest/service/impl/CommentServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/CommentServiceImpl.java index f27149c1..fa4548b9 100644 --- a/src/main/java/com/rymcu/forest/service/impl/CommentServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/CommentServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.exception.ContentNotExistException; @@ -13,7 +36,8 @@ import com.rymcu.forest.util.Utils; import com.rymcu.forest.util.XssUtils; import org.apache.commons.lang.StringUtils; -import org.springframework.context.ApplicationEventPublisher; +import com.rymcu.forest.config.RabbitMQConfig; +import com.rymcu.forest.event.EventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -33,7 +57,7 @@ public class CommentServiceImpl extends AbstractService implements Comm @Resource private ArticleService articleService; @Resource - private ApplicationEventPublisher applicationEventPublisher; + private EventPublisher eventPublisher; @Override public List getArticleComments(Integer idArticle) { @@ -92,7 +116,10 @@ public Comment postComment(Comment comment, HttpServletRequest request) { String commentContent = comment.getCommentContent(); if (StringUtils.isNotBlank(commentContent)) { - applicationEventPublisher.publishEvent(new CommentEvent(comment.getIdComment(), article.getArticleAuthorId(), comment.getCommentAuthorId(), commentContent, comment.getCommentOriginalCommentId())); + eventPublisher.publish(RabbitMQConfig.RK_COMMENT_CREATE, + new CommentEvent(comment.getIdComment(), article.getArticleAuthorId(), + comment.getCommentAuthorId(), commentContent, + comment.getCommentOriginalCommentId())); } return comment; } diff --git a/src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java index ff472ec6..53e8cf6c 100644 --- a/src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/CurrencyRuleServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/java/com/rymcu/forest/service/impl/DashboardServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/DashboardServiceImpl.java index 633908d0..f00b9926 100644 --- a/src/main/java/com/rymcu/forest/service/impl/DashboardServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/DashboardServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.dto.ArticleDTO; diff --git a/src/main/java/com/rymcu/forest/service/impl/FollowServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/FollowServiceImpl.java index 6bf252e8..14c14b1e 100644 --- a/src/main/java/com/rymcu/forest/service/impl/FollowServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/FollowServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; @@ -6,7 +29,8 @@ import com.rymcu.forest.handler.event.FollowEvent; import com.rymcu.forest.mapper.FollowMapper; import com.rymcu.forest.service.FollowService; -import org.springframework.context.ApplicationEventPublisher; +import com.rymcu.forest.config.RabbitMQConfig; +import com.rymcu.forest.event.EventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -22,7 +46,7 @@ public class FollowServiceImpl extends AbstractService implements Follow @Resource private FollowMapper followMapper; @Resource - private ApplicationEventPublisher applicationEventPublisher; + private EventPublisher eventPublisher; @Override public Boolean isFollow(Integer followingId, String followingType, Long idUser) { @@ -34,7 +58,9 @@ public Boolean isFollow(Integer followingId, String followingType, Long idUser) public Boolean follow(Follow follow, String nickname) { int result = followMapper.insertSelective(follow); if (result > 0) { - applicationEventPublisher.publishEvent(new FollowEvent(follow.getFollowingId(), follow.getFollowerId(), nickname + " 关注了你!")); + eventPublisher.publish(RabbitMQConfig.RK_FOLLOW, + new FollowEvent(follow.getFollowingId(), follow.getFollowerId(), + nickname + " 关注了你!")); } return result > 0; } diff --git a/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java index 9354b192..0d192a9f 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/java/com/rymcu/forest/service/impl/JavaMailServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/JavaMailServiceImpl.java index 5cfb2355..66bf5711 100644 --- a/src/main/java/com/rymcu/forest/service/impl/JavaMailServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/JavaMailServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.constant.NotificationConstant; diff --git a/src/main/java/com/rymcu/forest/service/impl/LoginRecordServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/LoginRecordServiceImpl.java index 8d7e33e7..118f98a2 100644 --- a/src/main/java/com/rymcu/forest/service/impl/LoginRecordServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/LoginRecordServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import cn.hutool.http.useragent.UserAgent; diff --git a/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java index f7edf904..a09d4a81 100644 --- a/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/java/com/rymcu/forest/service/impl/OpenDataServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/OpenDataServiceImpl.java index 29cd7e36..3b7fb692 100644 --- a/src/main/java/com/rymcu/forest/service/impl/OpenDataServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/OpenDataServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.dto.admin.Dashboard; diff --git a/src/main/java/com/rymcu/forest/service/impl/PermissionServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/PermissionServiceImpl.java index a09fa5af..dc09746e 100644 --- a/src/main/java/com/rymcu/forest/service/impl/PermissionServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/PermissionServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/java/com/rymcu/forest/service/impl/PortfolioServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/PortfolioServiceImpl.java index 458b560b..321aa62c 100644 --- a/src/main/java/com/rymcu/forest/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/PortfolioServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.github.pagehelper.PageHelper; @@ -19,7 +42,8 @@ import com.rymcu.forest.util.XssUtils; import com.rymcu.forest.web.api.common.UploadController; import org.apache.commons.lang3.StringUtils; -import org.springframework.context.ApplicationEventPublisher; +import com.rymcu.forest.config.RabbitMQConfig; +import com.rymcu.forest.event.EventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -40,7 +64,7 @@ public class PortfolioServiceImpl extends AbstractService implements @Resource private ArticleService articleService; @Resource - private ApplicationEventPublisher applicationEventPublisher; + private EventPublisher eventPublisher; @Override public List findUserPortfoliosByUser(UserDTO userDTO) { @@ -92,7 +116,10 @@ public Portfolio postPortfolio(Portfolio portfolio) { portfolio.setPortfolioDescriptionHtml(XssUtils.filterHtmlCode(portfolio.getPortfolioDescription())); portfolioMapper.insertSelective(portfolio); } - applicationEventPublisher.publishEvent(new PortfolioEvent(portfolio.getIdPortfolio(), portfolio.getPortfolioTitle(), portfolio.getPortfolioDescription(), isUpdate ? OperateType.UPDATE : OperateType.ADD)); + eventPublisher.publish(RabbitMQConfig.RK_PORTFOLIO, + new PortfolioEvent(portfolio.getIdPortfolio(), portfolio.getPortfolioTitle(), + portfolio.getPortfolioDescription(), + isUpdate ? OperateType.UPDATE : OperateType.ADD)); return portfolio; } @@ -170,7 +197,8 @@ public boolean deletePortfolio(Long idPortfolio, Long idUser, Integer roleWeight if (result.equals(0)) { throw new BusinessException("操作失败!"); } - applicationEventPublisher.publishEvent(new PortfolioEvent(idPortfolio, null, null, OperateType.DELETE)); + eventPublisher.publish(RabbitMQConfig.RK_PORTFOLIO, + new PortfolioEvent(idPortfolio, null, null, OperateType.DELETE)); return true; } } diff --git a/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java index 3b5f277b..69c9333e 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/java/com/rymcu/forest/service/impl/RoleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/RoleServiceImpl.java index cb8569bf..b072fb92 100644 --- a/src/main/java/com/rymcu/forest/service/impl/RoleServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/RoleServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.exception.ServiceException; diff --git a/src/main/java/com/rymcu/forest/service/impl/SpecialDayServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/SpecialDayServiceImpl.java index 7b6283de..8464034c 100644 --- a/src/main/java/com/rymcu/forest/service/impl/SpecialDayServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/SpecialDayServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/java/com/rymcu/forest/service/impl/SponsorServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/SponsorServiceImpl.java index 77bf4271..9056f80b 100644 --- a/src/main/java/com/rymcu/forest/service/impl/SponsorServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/SponsorServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; diff --git a/src/main/java/com/rymcu/forest/service/impl/TagServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/TagServiceImpl.java index ae872b2e..1008db5e 100644 --- a/src/main/java/com/rymcu/forest/service/impl/TagServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/TagServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.alibaba.fastjson.JSON; diff --git a/src/main/java/com/rymcu/forest/service/impl/TopicServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/TopicServiceImpl.java index f92dcf08..75f0b46b 100644 --- a/src/main/java/com/rymcu/forest/service/impl/TopicServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/TopicServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.exception.BusinessException; diff --git a/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java index ee31eecb..fe6d98f2 100644 --- a/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.exception.TransactionException; diff --git a/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java index 6114df66..6532f474 100644 --- a/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.github.f4b6a3.ulid.UlidCreator; diff --git a/src/main/java/com/rymcu/forest/service/impl/VisitServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/VisitServiceImpl.java index c5d49253..374a69b7 100644 --- a/src/main/java/com/rymcu/forest/service/impl/VisitServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/VisitServiceImpl.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service.impl; import com.rymcu.forest.core.service.AbstractService; diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index d2f1beab..d26763d7 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -8,6 +8,20 @@ spring: servlet: content-type: text/html cache: false + rabbitmq: + host: 127.0.0.1 + port: 5672 + username: guest + password: guest + virtual-host: / + listener: + simple: + retry: + enabled: true + max-attempts: 3 + initial-interval: 3000ms + publisher-confirm-type: correlated + publisher-returns: true redis: host: 192.168.31.200 port: 6379 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 17b86a44..95279572 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -36,6 +36,20 @@ spring: port: 465 username: # 邮箱 password: # 密码 + rabbitmq: + host: 127.0.0.1 + port: 5672 + username: guest + password: guest + virtual-host: / + listener: + simple: + retry: + enabled: true + max-attempts: 3 + initial-interval: 3000ms + publisher-confirm-type: correlated + publisher-returns: true application: name: forest wx: diff --git a/src/test/java/com/rymcu/forest/ForestApplicationTests.java b/src/test/java/com/rymcu/forest/ForestApplicationTests.java index e7d9cce4..8da80394 100644 --- a/src/test/java/com/rymcu/forest/ForestApplicationTests.java +++ b/src/test/java/com/rymcu/forest/ForestApplicationTests.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/rymcu/forest/base/BaseServiceTest.java b/src/test/java/com/rymcu/forest/base/BaseServiceTest.java index c0163c9d..e19a1d96 100644 --- a/src/test/java/com/rymcu/forest/base/BaseServiceTest.java +++ b/src/test/java/com/rymcu/forest/base/BaseServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.base; import org.junit.jupiter.api.MethodOrderer; diff --git a/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java b/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java index 817763e8..c6377438 100644 --- a/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import cn.hutool.core.collection.CollectionUtil; diff --git a/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java b/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java index c57c95c9..68e8e042 100644 --- a/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/BankAccountServiceTest.java b/src/test/java/com/rymcu/forest/service/BankAccountServiceTest.java index 536dc791..0c22ae84 100644 --- a/src/test/java/com/rymcu/forest/service/BankAccountServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/BankAccountServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/BankServiceTest.java b/src/test/java/com/rymcu/forest/service/BankServiceTest.java index 88fa46ee..0e89344a 100644 --- a/src/test/java/com/rymcu/forest/service/BankServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/BankServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/CommentServiceTest.java b/src/test/java/com/rymcu/forest/service/CommentServiceTest.java index 027671a6..fe0c3687 100644 --- a/src/test/java/com/rymcu/forest/service/CommentServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/CommentServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/CurrencyRuleServiceTest.java b/src/test/java/com/rymcu/forest/service/CurrencyRuleServiceTest.java index 1a6c2e98..08c230bd 100644 --- a/src/test/java/com/rymcu/forest/service/CurrencyRuleServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/CurrencyRuleServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/DashboardServiceTest.java b/src/test/java/com/rymcu/forest/service/DashboardServiceTest.java index 3e6f43bb..048e93d9 100644 --- a/src/test/java/com/rymcu/forest/service/DashboardServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/DashboardServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/FollowServiceTest.java b/src/test/java/com/rymcu/forest/service/FollowServiceTest.java index 15850a04..df8417b1 100644 --- a/src/test/java/com/rymcu/forest/service/FollowServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/FollowServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/ForestFileServiceTest.java b/src/test/java/com/rymcu/forest/service/ForestFileServiceTest.java index db87f608..d9ea8575 100644 --- a/src/test/java/com/rymcu/forest/service/ForestFileServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/ForestFileServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/JavaMailServiceTest.java b/src/test/java/com/rymcu/forest/service/JavaMailServiceTest.java index ce358aeb..fc87e9ca 100644 --- a/src/test/java/com/rymcu/forest/service/JavaMailServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/JavaMailServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/LoginRecordServiceTest.java b/src/test/java/com/rymcu/forest/service/LoginRecordServiceTest.java index c560b72a..8b1f6f3f 100644 --- a/src/test/java/com/rymcu/forest/service/LoginRecordServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/LoginRecordServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/NotificationServiceTest.java b/src/test/java/com/rymcu/forest/service/NotificationServiceTest.java index 772c2ae1..fdc60674 100644 --- a/src/test/java/com/rymcu/forest/service/NotificationServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/NotificationServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/OpenDataServiceTest.java b/src/test/java/com/rymcu/forest/service/OpenDataServiceTest.java index 7324b4ed..3af2e920 100644 --- a/src/test/java/com/rymcu/forest/service/OpenDataServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/OpenDataServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/PermissionServiceTest.java b/src/test/java/com/rymcu/forest/service/PermissionServiceTest.java index 6ffb4464..6d237d27 100644 --- a/src/test/java/com/rymcu/forest/service/PermissionServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/PermissionServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java b/src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java index b10f7b58..f0f3ae1b 100644 --- a/src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.github.pagehelper.PageInfo; diff --git a/src/test/java/com/rymcu/forest/service/ProductServiceTest.java b/src/test/java/com/rymcu/forest/service/ProductServiceTest.java index eeecc874..b3a7535d 100644 --- a/src/test/java/com/rymcu/forest/service/ProductServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/ProductServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/RoleServiceTest.java b/src/test/java/com/rymcu/forest/service/RoleServiceTest.java index 13f113aa..39f16bfc 100644 --- a/src/test/java/com/rymcu/forest/service/RoleServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/RoleServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/SpecialDayServiceTest.java b/src/test/java/com/rymcu/forest/service/SpecialDayServiceTest.java index d2afb4b8..ac816078 100644 --- a/src/test/java/com/rymcu/forest/service/SpecialDayServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/SpecialDayServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/SponsorServiceTest.java b/src/test/java/com/rymcu/forest/service/SponsorServiceTest.java index 73b8d6ce..6b5a2300 100644 --- a/src/test/java/com/rymcu/forest/service/SponsorServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/SponsorServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/TagServiceTest.java b/src/test/java/com/rymcu/forest/service/TagServiceTest.java index 93b78787..4c546f10 100644 --- a/src/test/java/com/rymcu/forest/service/TagServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/TagServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/TopicServiceTest.java b/src/test/java/com/rymcu/forest/service/TopicServiceTest.java index 0bc01cf3..ed97553c 100644 --- a/src/test/java/com/rymcu/forest/service/TopicServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/TopicServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/TransactionRecordServiceTest.java b/src/test/java/com/rymcu/forest/service/TransactionRecordServiceTest.java index c640508f..d920870b 100644 --- a/src/test/java/com/rymcu/forest/service/TransactionRecordServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/TransactionRecordServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/UserServiceTest.java b/src/test/java/com/rymcu/forest/service/UserServiceTest.java index 815ac54a..3a7bbc4e 100644 --- a/src/test/java/com/rymcu/forest/service/UserServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/UserServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest; diff --git a/src/test/java/com/rymcu/forest/service/VisitServiceTest.java b/src/test/java/com/rymcu/forest/service/VisitServiceTest.java index 35b3acc1..13d380e5 100644 --- a/src/test/java/com/rymcu/forest/service/VisitServiceTest.java +++ b/src/test/java/com/rymcu/forest/service/VisitServiceTest.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2020 RYMCU (https://rymcu.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + package com.rymcu.forest.service; import com.rymcu.forest.base.BaseServiceTest;