diff --git a/README-zh.md b/README-zh.md index 81558b8d71a9c74fe97a46c0d777b5af33f9a355..20ad3774722afa12819f64da1b0243da5e16e721 100644 --- a/README-zh.md +++ b/README-zh.md @@ -333,8 +333,8 @@ spring-boot-plus/bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPl @EnableTransactionManagement @EnableConfigurationProperties @ServletComponentScan -@MapperScan({"io.geekidea.springbootplus.**.mapper", "com.example.**.mapper"}) -@SpringBootApplication(scanBasePackages = {"io.geekidea.springbootplus", "com.example"}) +@MapperScan({"io.geekidea.boot.**.mapper", "com.example.**.mapper"}) +@SpringBootApplication(scanBasePackages = {"io.geekidea.boot", "com.example"}) public class SpringBootPlusApplication { public static void main(String[] args) { diff --git a/README.md b/README.md index 92ef1fbfba96a5b293e3aed3ac709330b3b537fa..be8a26fa876bc79e7e36e86ad9c298542aeb3d60 100644 --- a/README.md +++ b/README.md @@ -335,8 +335,8 @@ spring-boot-plus/bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPl @EnableTransactionManagement @EnableConfigurationProperties @ServletComponentScan -@MapperScan({"io.geekidea.springbootplus.**.mapper", "com.example.**.mapper"}) -@SpringBootApplication(scanBasePackages = {"io.geekidea.springbootplus", "com.example"}) +@MapperScan({"io.geekidea.boot.**.mapper", "com.example.**.mapper"}) +@SpringBootApplication(scanBasePackages = {"io.geekidea.boot", "com.example"}) public class SpringBootPlusApplication { public static void main(String[] args) { diff --git a/admin/pom.xml b/admin/pom.xml index fca4af827d8aaf61a3e9eaa65aa591cb0751c4a3..d981fbf6122d67d52ca24d4d6616ab27cfd07cee 100644 --- a/admin/pom.xml +++ b/admin/pom.xml @@ -20,9 +20,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT admin diff --git a/admin/src/main/java/io/geekidea/springbootplus/admin/SpringBootPlusAdminApplication.java b/admin/src/main/java/io/geekidea/boot/admin/SpringBootPlusAdminApplication.java similarity index 95% rename from admin/src/main/java/io/geekidea/springbootplus/admin/SpringBootPlusAdminApplication.java rename to admin/src/main/java/io/geekidea/boot/admin/SpringBootPlusAdminApplication.java index 0096867965e84ee0e9685896112e191ea0f63552..0be70e4c00cc8d84df95d6e414d5ef26850ebbd4 100644 --- a/admin/src/main/java/io/geekidea/springbootplus/admin/SpringBootPlusAdminApplication.java +++ b/admin/src/main/java/io/geekidea/boot/admin/SpringBootPlusAdminApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.admin; +package io.geekidea.boot.admin; import de.codecentric.boot.admin.server.config.EnableAdminServer; import lombok.extern.slf4j.Slf4j; @@ -43,6 +43,7 @@ public class SpringBootPlusAdminApplication { ConfigurableEnvironment environment = context.getEnvironment(); String serverPort = environment.getProperty("server.port"); log.info("SpringBootAdmin: http://localhost:" + serverPort); + log.info("登录账号密码: admin/admin"); } } diff --git a/admin/src/main/java/io/geekidea/springbootplus/admin/config/AdminWebMvcConfig.java b/admin/src/main/java/io/geekidea/boot/admin/config/AdminWebMvcConfig.java similarity index 96% rename from admin/src/main/java/io/geekidea/springbootplus/admin/config/AdminWebMvcConfig.java rename to admin/src/main/java/io/geekidea/boot/admin/config/AdminWebMvcConfig.java index 70112385f2b19e55b31e8a778eba162c60e69ec2..8cc3ca64a24934ec3899d786a9877edd03626eb6 100644 --- a/admin/src/main/java/io/geekidea/springbootplus/admin/config/AdminWebMvcConfig.java +++ b/admin/src/main/java/io/geekidea/boot/admin/config/AdminWebMvcConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.admin.config; +package io.geekidea.boot.admin.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; diff --git a/admin/src/main/java/io/geekidea/springbootplus/admin/config/SecuritySecureConfig.java b/admin/src/main/java/io/geekidea/boot/admin/config/SecuritySecureConfig.java similarity index 98% rename from admin/src/main/java/io/geekidea/springbootplus/admin/config/SecuritySecureConfig.java rename to admin/src/main/java/io/geekidea/boot/admin/config/SecuritySecureConfig.java index 1d7df8232759ec173e5923324dfaadbb4e1bcd92..4529dc74bfd16afe7fb71e56b3970c785dd53cba 100644 --- a/admin/src/main/java/io/geekidea/springbootplus/admin/config/SecuritySecureConfig.java +++ b/admin/src/main/java/io/geekidea/boot/admin/config/SecuritySecureConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.admin.config; +package io.geekidea.boot.admin.config; import de.codecentric.boot.admin.server.config.AdminServerProperties; import org.springframework.beans.factory.annotation.Value; diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml index 60b39a76a05dd1cd00f9b3b36ce2cf1190de9876..40a6ad0982c43993190bbf372fd8f5ab7a6109db 100644 --- a/bootstrap/pom.xml +++ b/bootstrap/pom.xml @@ -20,9 +20,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT bootstrap @@ -36,19 +36,23 @@ ${spring-boot-admin.version} - io.geekidea.springbootplus + io.geekidea.boot framework - io.geekidea.springbootplus + io.geekidea.boot example - io.geekidea.springbootplus + io.geekidea.boot system - io.geekidea.springbootplus + io.geekidea.boot + wechat + + + io.geekidea.boot scheduled diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java b/bootstrap/src/main/java/io/geekidea/boot/SpringBootPlusApplication.java similarity index 82% rename from bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java rename to bootstrap/src/main/java/io/geekidea/boot/SpringBootPlusApplication.java index 82dda088a7834b058b9f9bb62504fe2352af3c9d..dad04b27db0a20041bede0b57d061599a2da3064 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java +++ b/bootstrap/src/main/java/io/geekidea/boot/SpringBootPlusApplication.java @@ -14,14 +14,15 @@ * limitations under the License. */ -package io.geekidea.springbootplus; +package io.geekidea.boot; -import io.geekidea.springbootplus.framework.util.PrintApplicationInfo; +import io.geekidea.boot.framework.util.PrintApplicationInfo; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; @@ -35,11 +36,12 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; */ @EnableAsync @EnableScheduling +@EnableCaching // 开启基于注解的缓存 @EnableTransactionManagement @EnableConfigurationProperties @ServletComponentScan -@MapperScan({"io.geekidea.springbootplus.**.mapper", "com.example.**.mapper"}) -@SpringBootApplication(scanBasePackages = {"io.geekidea.springbootplus", "com.example"}) +@MapperScan({"io.geekidea.boot.**.mapper", "com.example.**.mapper", "com.koronol.**.mapper"}) +@SpringBootApplication(scanBasePackages = {"io.geekidea.boot", "com.example", "com.koronol"}) public class SpringBootPlusApplication { public static void main(String[] args) { diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/aop/LogAop.java b/bootstrap/src/main/java/io/geekidea/boot/aop/LogAop.java similarity index 87% rename from bootstrap/src/main/java/io/geekidea/springbootplus/aop/LogAop.java rename to bootstrap/src/main/java/io/geekidea/boot/aop/LogAop.java index 31b6ab248c38cb419681f072aece5fdb49411ba9..d9ff74a48a275f0b8731e82a92f0163427e4485f 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/aop/LogAop.java +++ b/bootstrap/src/main/java/io/geekidea/boot/aop/LogAop.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.geekidea.springbootplus.aop; +package io.geekidea.boot.aop; -import io.geekidea.springbootplus.framework.log.aop.BaseLogAop; -import io.geekidea.springbootplus.framework.log.bean.OperationLogInfo; -import io.geekidea.springbootplus.framework.log.bean.RequestInfo; +import io.geekidea.boot.framework.log.aop.BaseLogAop; +import io.geekidea.boot.framework.log.bean.OperationLogInfo; +import io.geekidea.boot.framework.log.bean.RequestInfo; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; @@ -47,7 +47,8 @@ public class LogAop extends BaseLogAop { * 切点 */ private static final String POINTCUT = - "execution(public * io.geekidea.springbootplus..*.controller..*.*(..)) || " + + "execution(public * io.geekidea.boot..*.controller..*.*(..)) || " + + "execution(public * com.koronol..*.controller..*.*(..))" + "execution(public * com.example..*.controller..*.*(..))"; @Around(POINTCUT) diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/JacksonConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/JacksonConfig.java similarity index 87% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/JacksonConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/JacksonConfig.java index 9efd9775fc74fdc45707fae4847de8b0db5330c7..370ba48fb2c5d9ca2315777a8b018ee8a1dd8f38 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/JacksonConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/JacksonConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -28,13 +28,13 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; -import io.geekidea.springbootplus.config.constant.DatePattern; -import io.geekidea.springbootplus.framework.config.jackson.deserializer.JacksonDateDeserializer; -import io.geekidea.springbootplus.framework.config.jackson.deserializer.JacksonDoubleDeserializer; -import io.geekidea.springbootplus.framework.config.jackson.serializer.JacksonDateSerializer; -import io.geekidea.springbootplus.framework.config.jackson.serializer.JacksonIntegerDeserializer; -import io.geekidea.springbootplus.framework.core.xss.XssJacksonDeserializer; -import io.geekidea.springbootplus.framework.core.xss.XssJacksonSerializer; +import io.geekidea.boot.config.constant.DatePattern; +import io.geekidea.boot.framework.config.jackson.deserializer.JacksonDateDeserializer; +import io.geekidea.boot.framework.config.jackson.deserializer.JacksonDoubleDeserializer; +import io.geekidea.boot.framework.config.jackson.serializer.JacksonDateSerializer; +import io.geekidea.boot.framework.config.jackson.serializer.JacksonIntegerDeserializer; +import io.geekidea.boot.framework.core.xss.XssJacksonDeserializer; +import io.geekidea.boot.framework.core.xss.XssJacksonSerializer; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.HttpMessageConverter; diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/MybatisPlusConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/MybatisPlusConfig.java similarity index 97% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/MybatisPlusConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/MybatisPlusConfig.java index fe7f3d5586cad62224c831b1349cedb6773f0f37..e0eef01793caa9018525192096de7cd1538af217 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/MybatisPlusConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/MybatisPlusConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; diff --git a/bootstrap/src/main/java/io/geekidea/boot/config/QiniuConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/QiniuConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d5be009d3dcd3404a2dd5cde9b66bfebcb75ad72 --- /dev/null +++ b/bootstrap/src/main/java/io/geekidea/boot/config/QiniuConfig.java @@ -0,0 +1,72 @@ +package io.geekidea.boot.config; + +import com.qiniu.storage.BucketManager; +import com.qiniu.storage.Region; +import com.qiniu.storage.UploadManager; +import com.qiniu.util.Auth; +import io.geekidea.boot.framework.common.exception.BusinessException; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class QiniuConfig { + @Value("${qiniu.accessKey}") + private String accessKey; + + @Value("${qiniu.secretKey}") + private String secretKey; + + @Value("${qiniu.zone}") + private String zone; + + /** + * 配置空间的存储区域 + */ + @Bean + public com.qiniu.storage.Configuration qiNiuConfig() { + switch (zone) { + case "huadong": + return new com.qiniu.storage.Configuration(Region.region0()); + case "huabei": + return new com.qiniu.storage.Configuration(Region.region1()); + case "huanan": + return new com.qiniu.storage.Configuration(Region.region2()); + case "beimei": + return new com.qiniu.storage.Configuration(Region.regionNa0()); + case "dongnanya": + return new com.qiniu.storage.Configuration(Region.regionAs0()); + default: + throw new BusinessException("存储区域配置错误"); + } + } + + /** + * 构建一个七牛上传工具实例 + */ + @Bean + public UploadManager uploadManager() { + return new UploadManager(qiNiuConfig()); + } + + /** + * 认证信息实例 + */ + @Bean + public Auth auth() { + return Auth.create(accessKey, secretKey); + } + + /** + * 构建七牛空间管理实例 + */ + @Bean + public BucketManager bucketManager() { + return new BucketManager(auth(), qiNiuConfig()); + } + +// @Bean +// public Gson gson() { +// return new Gson(); +// } +} diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/RedisCacheConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/RedisCacheConfig.java similarity index 96% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/RedisCacheConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/RedisCacheConfig.java index 2a1e8ffb4f9f90d9e3a94b6f95d2ba8f3f28819f..1261886c977663ffa195f964167c1d9163640367 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/RedisCacheConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/RedisCacheConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.CachingConfigurerSupport; @@ -72,6 +72,7 @@ public class RedisCacheConfig extends CachingConfigurerSupport { Map configMap = new HashMap<>(10); configMap.put("my-redis-cache1", config); configMap.put("my-redis-cache2", config.entryTtl(Duration.ofSeconds(120))); + configMap.put("userRank", config.entryTtl(Duration.ofDays(1))); // 使用自定义的缓存配置初始化一个cacheManager RedisCacheManager cacheManager = RedisCacheManager.builder(factory) diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/RedisTemplateConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/RedisTemplateConfig.java similarity index 98% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/RedisTemplateConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/RedisTemplateConfig.java index 7e66baba628f2f39024cad89df4c194306e63b62..833d8eb3ad166efeff5cbba8c5f2f6c57ab091b7 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/RedisTemplateConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/RedisTemplateConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/RestTemplateConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/RestTemplateConfig.java similarity index 97% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/RestTemplateConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/RestTemplateConfig.java index baf2b99fec1526576fd777e53938619af219f630..186bafd90bd792123763c2fa6d6a7a88ff6b2902 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/RestTemplateConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/RestTemplateConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/ShiroConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/ShiroConfig.java similarity index 93% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/ShiroConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/ShiroConfig.java index e3598f5afa1264af978953fedf2530c1f2f9e24a..899fdf84a07e38f5ad24ce426b72b3e66f676496 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/ShiroConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/ShiroConfig.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import com.alibaba.fastjson.JSON; -import io.geekidea.springbootplus.config.properties.JwtProperties; -import io.geekidea.springbootplus.config.properties.ShiroPermissionProperties; -import io.geekidea.springbootplus.config.properties.ShiroProperties; -import io.geekidea.springbootplus.framework.shiro.cache.LoginRedisService; -import io.geekidea.springbootplus.framework.shiro.exception.ShiroConfigException; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtCredentialsMatcher; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtFilter; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtRealm; -import io.geekidea.springbootplus.framework.shiro.service.ShiroLoginService; -import io.geekidea.springbootplus.framework.util.IniUtil; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.config.properties.ShiroPermissionProperties; +import io.geekidea.boot.config.properties.ShiroProperties; +import io.geekidea.boot.framework.shiro.cache.LoginRedisService; +import io.geekidea.boot.framework.shiro.exception.ShiroConfigException; +import io.geekidea.boot.framework.shiro.jwt.JwtCredentialsMatcher; +import io.geekidea.boot.framework.shiro.jwt.JwtFilter; +import io.geekidea.boot.framework.shiro.jwt.JwtRealm; +import io.geekidea.boot.framework.shiro.service.ShiroLoginService; +import io.geekidea.boot.framework.util.IniUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusConfig.java similarity index 94% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusConfig.java index 4cfd1008cfe38d2874d162c835862665e96a1383..611653bcdc8f820e19233beee7e6a473389fc11a 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusConfig.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import lombok.extern.slf4j.Slf4j; diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusCorsConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusCorsConfig.java similarity index 95% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusCorsConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusCorsConfig.java index 077f512169162fd157fe463ef1b71bf9c05e0c2b..e9a35e7561f08735d7d9b595c1bc71e7ace3380f 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusCorsConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusCorsConfig.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; -import io.geekidea.springbootplus.config.properties.SpringBootPlusCorsProperties; +import io.geekidea.boot.config.properties.SpringBootPlusCorsProperties; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.web.servlet.FilterRegistrationBean; diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusWebMvcConfig.java b/bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusWebMvcConfig.java similarity index 76% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusWebMvcConfig.java rename to bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusWebMvcConfig.java index 67498454a315cd6f13897802426bb2df28c0358c..fcaf35f690b25198ea00501e2c8ff410229a11fc 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/SpringBootPlusWebMvcConfig.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/SpringBootPlusWebMvcConfig.java @@ -14,21 +14,25 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import com.alibaba.fastjson.JSON; -import io.geekidea.springbootplus.config.properties.SpringBootPlusFilterProperties; -import io.geekidea.springbootplus.config.properties.SpringBootPlusInterceptorProperties; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.core.filter.RequestDetailFilter; -import io.geekidea.springbootplus.framework.core.interceptor.PermissionInterceptor; -import io.geekidea.springbootplus.framework.core.xss.XssFilter; -import io.geekidea.springbootplus.framework.util.IniUtil; -import io.geekidea.springbootplus.system.interceptor.DownloadInterceptor; -import io.geekidea.springbootplus.system.interceptor.ResourceInterceptor; -import io.geekidea.springbootplus.system.interceptor.UploadInterceptor; +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.koronol.wxpay.interceptor.WxPayInterceptor; +import io.geekidea.boot.config.properties.SpringBootPlusFilterProperties; +import io.geekidea.boot.config.properties.SpringBootPlusInterceptorProperties; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.core.filter.RequestDetailFilter; +import io.geekidea.boot.framework.core.interceptor.PermissionInterceptor; +import io.geekidea.boot.framework.core.xss.XssFilter; +import io.geekidea.boot.framework.util.IniUtil; +import io.geekidea.boot.framework.util.LoginUtil; +import io.geekidea.boot.system.interceptor.DownloadInterceptor; +import io.geekidea.boot.system.interceptor.ResourceInterceptor; +import io.geekidea.boot.system.interceptor.UploadInterceptor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.reflection.MetaObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; @@ -38,6 +42,7 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import javax.annotation.PostConstruct; +import java.util.Date; import java.util.Map; /** @@ -141,6 +146,31 @@ public class SpringBootPlusWebMvcConfig implements WebMvcConfigurer { return new DownloadInterceptor(); } + @Bean + public WxPayInterceptor wxPayInterceptor() { return new WxPayInterceptor();} + + /** + * 配置自动填充 + * + * @return + */ + @Bean + public MetaObjectHandler metaObjectHandler() { + return new MetaObjectHandler() { + @Override + public void insertFill(MetaObject metaObject) { + // 数据类型要与fileName一致 + this.strictInsertFill(metaObject, "createdBy", String.class, LoginUtil.getUsername()); + this.strictInsertFill(metaObject, "createdTime", Date.class, new Date()); + } + + @Override + public void updateFill(MetaObject metaObject) { + this.strictUpdateFill(metaObject, "updatedTime", Date.class, new Date()); + this.strictUpdateFill(metaObject, "updatedBy", String.class, LoginUtil.getUsername()); + } + }; + } @PostConstruct public void init() { @@ -176,6 +206,8 @@ public class SpringBootPlusWebMvcConfig implements WebMvcConfigurer { .addPathPatterns(interceptorConfig.getPermission().getIncludePaths()) .excludePathPatterns(interceptorConfig.getPermission().getExcludePaths()); } + // 微信支付拦截器 + registry.addInterceptor(wxPayInterceptor()).addPathPatterns("/wxPay/**"); } diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/config/Swagger2Config.java b/bootstrap/src/main/java/io/geekidea/boot/config/Swagger2Config.java similarity index 98% rename from bootstrap/src/main/java/io/geekidea/springbootplus/config/Swagger2Config.java rename to bootstrap/src/main/java/io/geekidea/boot/config/Swagger2Config.java index ac027f3c53de0da352ceaeb261821ccbf1b044d5..c1f7894ecadcffaac738d8bebbb3aa88ea73d2b8 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/config/Swagger2Config.java +++ b/bootstrap/src/main/java/io/geekidea/boot/config/Swagger2Config.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config; +package io.geekidea.boot.config; import com.fasterxml.jackson.databind.introspect.AnnotatedField; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; @@ -22,8 +22,8 @@ import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicate; -import io.geekidea.springbootplus.config.properties.SwaggerProperties; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusConfigException; +import io.geekidea.boot.config.properties.SwaggerProperties; +import io.geekidea.boot.framework.common.exception.SpringBootPlusConfigException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import lombok.extern.slf4j.Slf4j; diff --git a/bootstrap/src/main/java/io/geekidea/springbootplus/handler/GlobalExceptionHandler.java b/bootstrap/src/main/java/io/geekidea/boot/handler/GlobalExceptionHandler.java similarity index 92% rename from bootstrap/src/main/java/io/geekidea/springbootplus/handler/GlobalExceptionHandler.java rename to bootstrap/src/main/java/io/geekidea/boot/handler/GlobalExceptionHandler.java index 9c8828d234486012cae923070a567344e101d0b9..c3757cf11d7329c05a23e1ec683c4397c29de854 100644 --- a/bootstrap/src/main/java/io/geekidea/springbootplus/handler/GlobalExceptionHandler.java +++ b/bootstrap/src/main/java/io/geekidea/boot/handler/GlobalExceptionHandler.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.geekidea.springbootplus.handler; +package io.geekidea.boot.handler; import com.alibaba.fastjson.JSON; import com.auth0.jwt.exceptions.JWTDecodeException; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.exception.BusinessException; -import io.geekidea.springbootplus.framework.common.exception.DaoException; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusException; -import io.geekidea.springbootplus.framework.core.bean.RequestDetail; -import io.geekidea.springbootplus.framework.core.util.RequestDetailThreadLocal; -import io.geekidea.springbootplus.system.exception.SysLoginException; -import io.geekidea.springbootplus.system.exception.VerificationCodeException; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.common.exception.DaoException; +import io.geekidea.boot.framework.common.exception.SpringBootPlusException; +import io.geekidea.boot.framework.core.bean.RequestDetail; +import io.geekidea.boot.framework.core.util.RequestDetailThreadLocal; +import io.geekidea.boot.system.exception.SysLoginException; +import io.geekidea.boot.system.exception.VerificationCodeException; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authz.UnauthenticatedException; diff --git a/bootstrap/src/test/java/io/geekidea/springbootplus/test/BaseTest.java b/bootstrap/src/test/java/io/geekidea/boot/test/BaseTest.java similarity index 90% rename from bootstrap/src/test/java/io/geekidea/springbootplus/test/BaseTest.java rename to bootstrap/src/test/java/io/geekidea/boot/test/BaseTest.java index 22dcddf24f0f9716a5c92d42965569df7174514b..3c9743208a747cbfc19442bbc728633eed2e94cd 100644 --- a/bootstrap/src/test/java/io/geekidea/springbootplus/test/BaseTest.java +++ b/bootstrap/src/test/java/io/geekidea/boot/test/BaseTest.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.test; +package io.geekidea.boot.test; -import io.geekidea.springbootplus.SpringBootPlusApplication; +import io.geekidea.boot.SpringBootPlusApplication; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; diff --git a/bootstrap/src/test/java/io/geekidea/springbootplus/test/FooBarMapperTest.java b/bootstrap/src/test/java/io/geekidea/boot/test/FooBarMapperTest.java similarity index 97% rename from bootstrap/src/test/java/io/geekidea/springbootplus/test/FooBarMapperTest.java rename to bootstrap/src/test/java/io/geekidea/boot/test/FooBarMapperTest.java index f53872c876f2620b60e83a65f93240466c2c621f..a827743217345f340e786e043c63b99f881a8d7a 100644 --- a/bootstrap/src/test/java/io/geekidea/springbootplus/test/FooBarMapperTest.java +++ b/bootstrap/src/test/java/io/geekidea/boot/test/FooBarMapperTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.test; +package io.geekidea.boot.test; import com.example.foobar.entity.FooBar; import com.example.foobar.mapper.FooBarMapper; diff --git a/config/pom.xml b/config/pom.xml index 0280db6619ddf7ef20cae6a3f5fff69854c003a1..97032242a481545797e3e5320539c91b1ba7fdce 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -19,11 +19,23 @@ 4.0.0 + + + com.zaxxer + HikariCP + 3.4.5 + compile + + + mysql + mysql-connector-java + + - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT config diff --git a/config/src/main/java/io/geekidea/springbootplus/config/constant/CacheKey.java b/config/src/main/java/io/geekidea/boot/config/constant/CacheKey.java similarity index 93% rename from config/src/main/java/io/geekidea/springbootplus/config/constant/CacheKey.java rename to config/src/main/java/io/geekidea/boot/config/constant/CacheKey.java index 8d348c8f5dacfb5f5993b80ee59ccfb34dbcefc9..7585cfa4b6299592b08fb45689e8d6158bccd3fe 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/constant/CacheKey.java +++ b/config/src/main/java/io/geekidea/boot/config/constant/CacheKey.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.constant; +package io.geekidea.boot.config.constant; /** * 可排序查询参数对象 diff --git a/config/src/main/java/io/geekidea/springbootplus/config/constant/CommonConstant.java b/config/src/main/java/io/geekidea/boot/config/constant/CommonConstant.java similarity index 96% rename from config/src/main/java/io/geekidea/springbootplus/config/constant/CommonConstant.java rename to config/src/main/java/io/geekidea/boot/config/constant/CommonConstant.java index 634d3d27bc7ef9e18a95950b1dd43cbfdabad897..bc292463023722544718a021205b2599976c42b0 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/constant/CommonConstant.java +++ b/config/src/main/java/io/geekidea/boot/config/constant/CommonConstant.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.constant; +package io.geekidea.boot.config.constant; /** * 公共常量 @@ -88,7 +88,7 @@ public interface CommonConstant { /** * JWT 默认过期时间,3600L,单位秒 */ - Long JWT_DEFAULT_EXPIRE_SECOND = 3600L; + Long JWT_DEFAULT_EXPIRE_SECOND = 3600 * 24L; /** * 默认头像 diff --git a/config/src/main/java/io/geekidea/springbootplus/config/constant/CommonRedisKey.java b/config/src/main/java/io/geekidea/boot/config/constant/CommonRedisKey.java similarity index 96% rename from config/src/main/java/io/geekidea/springbootplus/config/constant/CommonRedisKey.java rename to config/src/main/java/io/geekidea/boot/config/constant/CommonRedisKey.java index f3d79bd1105177fbef18d5e9a765f9389dd9b8e4..77cdae77191efed958fc9359b4e0fdd4c0c60d8b 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/constant/CommonRedisKey.java +++ b/config/src/main/java/io/geekidea/boot/config/constant/CommonRedisKey.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.constant; +package io.geekidea.boot.config.constant; /** *

diff --git a/config/src/main/java/io/geekidea/springbootplus/config/constant/DatePattern.java b/config/src/main/java/io/geekidea/boot/config/constant/DatePattern.java similarity index 96% rename from config/src/main/java/io/geekidea/springbootplus/config/constant/DatePattern.java rename to config/src/main/java/io/geekidea/boot/config/constant/DatePattern.java index a7d5735e6da3fcd4a4452b0e66d23af49e703122..3478c6598b18519695adfe07e365efd3911f9804 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/constant/DatePattern.java +++ b/config/src/main/java/io/geekidea/boot/config/constant/DatePattern.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.constant; +package io.geekidea.boot.config.constant; /** *

diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/JwtProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/JwtProperties.java similarity index 94% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/JwtProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/JwtProperties.java index c66377eff9ef0b4ec838fb9d14ab23c9e9f595f6..8d04832b8cc703a0d3c5213c1db01293f08dc98b 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/JwtProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/JwtProperties.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; -import io.geekidea.springbootplus.config.constant.CommonConstant; +import io.geekidea.boot.config.constant.CommonConstant; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/ShiroPermissionProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/ShiroPermissionProperties.java similarity index 94% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/ShiroPermissionProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/ShiroPermissionProperties.java index 39847e93d0764479131c567dc7ed370c4c876739..1754442e42663d0e3da0741a9735469f8e4a415c 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/ShiroPermissionProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/ShiroPermissionProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/ShiroProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/ShiroProperties.java similarity index 96% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/ShiroProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/ShiroProperties.java index 3acc6ba3e8c3ed6ae871e60bde2fdd4c8e31fd57..bcf9e35a93b1b0bc0bccae20d92e86f53e5b56da 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/ShiroProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/ShiroProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusAopProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusAopProperties.java similarity index 98% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusAopProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusAopProperties.java index d294b60ff5582fcdb5cdfc321d3f54675249c85d..d3a087261153c2b2b6b68efc893fb2347ff0ba69 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusAopProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusAopProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusCorsProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusCorsProperties.java similarity index 97% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusCorsProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusCorsProperties.java index b6eda2b46a2a4b366cdd0202c78274c04e67355e..83585a642336ac1e9836692a50783b105ebbc968 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusCorsProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusCorsProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusFilterProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusFilterProperties.java similarity index 96% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusFilterProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusFilterProperties.java index 16fc40d8868e1b64a2dde4d23171ad3dfeb04fd7..258c69df3a2f6f3bd8e5ec3ee0fc5fe0ff4ab90e 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusFilterProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusFilterProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusInterceptorProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusInterceptorProperties.java similarity index 97% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusInterceptorProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusInterceptorProperties.java index 5224a78361db7b1af7fe5ce7e89501ef7c61a93f..1855b5e32a3598d4338a21f6b93b587f98c8cfba 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusInterceptorProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusInterceptorProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusProperties.java similarity index 98% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusProperties.java index b486ad9ea78403db3ae767fab5ff2dcad9e79c1b..b0c75dda999aefd1b71153c2a439f3ce74052251 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusStaticProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusStaticProperties.java similarity index 96% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusStaticProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusStaticProperties.java index 5e338c8bb9c3e9bff9e5ead51dbd9dff74a787b4..94cc0017ea23c150fc621fd0e36f307715f8c187 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/SpringBootPlusStaticProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/SpringBootPlusStaticProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; import lombok.extern.slf4j.Slf4j; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/SwaggerProperties.java b/config/src/main/java/io/geekidea/boot/config/properties/SwaggerProperties.java similarity index 98% rename from config/src/main/java/io/geekidea/springbootplus/config/properties/SwaggerProperties.java rename to config/src/main/java/io/geekidea/boot/config/properties/SwaggerProperties.java index c400475b0e237c05106db583e31cbcf4838c078f..a5a3a3406194c9d2839b0b10f1a1511bfc65032a 100644 --- a/config/src/main/java/io/geekidea/springbootplus/config/properties/SwaggerProperties.java +++ b/config/src/main/java/io/geekidea/boot/config/properties/SwaggerProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.config.properties; +package io.geekidea.boot.config.properties; import lombok.Data; import org.springframework.beans.factory.annotation.Value; diff --git a/config/src/main/java/io/geekidea/springbootplus/config/properties/QiniuProperties.java b/config/src/main/java/io/geekidea/springbootplus/config/properties/QiniuProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..d76e884b5d891e6c56e274fbb6c0bcfc6bc8fc2a --- /dev/null +++ b/config/src/main/java/io/geekidea/springbootplus/config/properties/QiniuProperties.java @@ -0,0 +1,17 @@ +package io.geekidea.springbootplus.config.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +@Data +@ConfigurationProperties(prefix = "qiniu") +public class QiniuProperties { + + private String accessKey; + + private String secretKey; + + private String bucket; + + private String prefix; +} diff --git a/config/src/main/resources/config/application-dev.yml b/config/src/main/resources/config/application-dev.yml index eb3e3dcf59cc01f84526b6c3af8405fb2d972095..9c080306446cc1c59113bbd329dcaecaa6b026c1 100644 --- a/config/src/main/resources/config/application-dev.yml +++ b/config/src/main/resources/config/application-dev.yml @@ -9,7 +9,7 @@ spring-boot-plus: spring: datasource: - url: jdbc:mysql://localhost:3306/spring_boot_plus?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306/spring_boot_pmp?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true username: root password: root @@ -20,7 +20,35 @@ spring: password: port: 6379 + servlet: + multipart: + location: /Users/limingguang/upload_tmp + # 打印SQL语句和结果集,本地开发环境可开启,线上注释掉 mybatis-plus: configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl \ No newline at end of file + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +# 七牛云配置 +qiniu: + accessKey: VNddBCSpToUG5AHuQHpQSHX2X1v_CWDgbbTCk-Mw + secretKey: t7eYfFBBsyj7RNas5N2l_z8mzKvGgIsHf49EfCQk + bucket: pmp-sys + zone: huadong + domain: cdn.koronol.com + +# 微信配置 +wechat: + appId: wx89e746383cc2cf6a + secret: 9f1bf70209fb0feb97d577f5f4e163f7 + mchId: 1606561696 + partnerKey: 765d11bba1ce4c00bf343e087d25865a + apiV3Key: eb79f964741711eb87f88c8590719960 + mchSerialNo: 6223053CFC87658408133AB1DAE52F24B9BA85C1 + notifyUrl: http://l17424255.gicp.net/api + certPath: cert/apiclient_cert.p12 + +# 头条小程序配置 +toutiao: + appId: tt6f6419d9f05c9be001 + secret: 9889be8caf652f947e07144e519036ab3619e350 \ No newline at end of file diff --git a/config/src/main/resources/config/application-prod.yml b/config/src/main/resources/config/application-prod.yml index 0e22cd9a7ba7366a4ccfc86c3af4a8c592e760ec..5f61b540ddb0fb0946548b106eec6c86bf31674f 100644 --- a/config/src/main/resources/config/application-prod.yml +++ b/config/src/main/resources/config/application-prod.yml @@ -2,7 +2,7 @@ spring-boot-plus: # 是否启用ansi控制台输出有颜色的字体,local环境建议开启,服务器环境设置为false enable-ansi: false # 当前环境服务IP地址 - server-ip: + server-ip: 127.0.0.1 # 生产环境禁用Swagger swagger: enable: false @@ -16,14 +16,37 @@ spring-boot-plus: spring: datasource: - url: - username: - password: + url: jdbc:mysql://localhost:3306/spring_boot_pmp?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true + username: root + password: Springboot666! # Redis配置 redis: - database: - host: + database: 0 + host: localhost password: - port: + port: 6379 + +# 七牛云配置 +qiniu: + accessKey: VNddBCSpToUG5AHuQHpQSHX2X1v_CWDgbbTCk-Mw + secretKey: t7eYfFBBsyj7RNas5N2l_z8mzKvGgIsHf49EfCQk + bucket: pmp-sys + zone: huadong + domain: cdn.koronol.com + +# 微信配置 +wechat: + appId: wx89e746383cc2cf6a + secret: 9f1bf70209fb0feb97d577f5f4e163f7 + mchId: 1606561696 + partnerKey: 765d11bba1ce4c00bf343e087d25865a + apiV3Key: eb79f964741711eb87f88c8590719960 + mchSerialNo: 6223053CFC87658408133AB1DAE52F24B9BA85C1 + notifyUrl: https://pmp.koronol.com/api + certPath: /data/pmp/apiclient_cert.p12 +# 头条小程序配置 +toutiao: + appId: tt6f6419d9f05c9be001 + secret: 9889be8caf652f947e07144e519036ab3619e350 diff --git a/config/src/main/resources/config/application.yml b/config/src/main/resources/config/application.yml index 831a00dd3f2aded5fb2c8642442062d5a57391f9..47b5d952e1c0400053206a6e7e33f4f0c59fff67 100644 --- a/config/src/main/resources/config/application.yml +++ b/config/src/main/resources/config/application.yml @@ -5,6 +5,10 @@ server: port: 8888 servlet: context-path: /api + encoding: + charset: UTF-8 + enabled: true + force: true tomcat: max-threads: 1000 min-spare-threads: 30 @@ -40,7 +44,8 @@ spring: --- spring: profiles: - active: @profileActive@ + active: prod +# active: @profileActive@ # logback.xml中有详细的日志配置 logging: @@ -184,12 +189,19 @@ spring-boot-plus: anon: # 排除登录登出 - /login,/logout + - /profile/signIn + - /profile/signInByToutiao + - /profile/signInByPhone + - /**/wechat/** + # 微信支付异步通知 + - /wxPay/payNotify # 排除静态资源 - /static/**,/templates/** # 排除Swagger - ${spring-boot-plus.swagger-paths} # 排除actuator - /actuator/** + - /paper/wechat/getOpenPaper - # 排除首页 - /,/index.html # 排除测试路径 @@ -221,7 +233,7 @@ spring-boot-plus: # 刷新token的时间间隔,默认10分钟,单位:秒 refresh-token-countdown: 600 # redis校验jwt token是否存在,可选 - redis-check: true + redis-check: false # true: 同一个账号只能是最后一次登录token有效,false:同一个账号可多次登录 single-login: false # 盐值校验,如果不加自定义盐值,则使用secret校验 @@ -236,7 +248,7 @@ mybatis-plus: # 启动时是否检查MyBatis XML文件是否存在 check-config-location: true # 支持统配符 * 或者 ; 分割 - typeEnumsPackage: io.geekidea.springbootplus.*.enums + typeEnumsPackage: io.geekidea.boot.*.enums # MyBatis原生配置 configuration: # 字段名称下划线转驼峰命名 @@ -302,7 +314,7 @@ spring-boot-plus: enable: true base: # 扫描的包,多个包使用逗号隔开 - package: io.geekidea.springbootplus,com.example + package: io.geekidea.boot,com.example,com.koronol contact: email: geekidea@qq.com name: springboot.plus diff --git a/config/src/main/resources/config/logback.xml b/config/src/main/resources/config/logback.xml index dbe0c96888696319c216883b9cdaeb735418b7d0..df5b4ce76e711c875fa340fad2b72c65d1d95aae 100644 --- a/config/src/main/resources/config/logback.xml +++ b/config/src/main/resources/config/logback.xml @@ -89,7 +89,7 @@ - + diff --git a/distribution/pom.xml b/distribution/pom.xml index 85b89ce7093952e654538001ea2bea925f549b6d..3ecb1e0aaa176b5c8177186dec95309f62d6ba95 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT distribution @@ -35,7 +35,7 @@ release - io.geekidea.springbootplus + io.geekidea.boot bootstrap diff --git a/distribution/release.xml b/distribution/release.xml index b46646fa5909374d972b798f056f7d18f61adef7..81ce21de57b23ce17586b2e006a140c3d56b7375 100644 --- a/distribution/release.xml +++ b/distribution/release.xml @@ -67,7 +67,7 @@ true - io.geekidea.springbootplus:bootstrap + io.geekidea.boot:bootstrap diff --git a/docs/db/mysql_spring_boot_plus.sql b/docs/db/mysql_spring_boot_plus.sql index 1c9f6167cd7295a20602b7dc32e87f47786bde42..d05adc6a9e5c821a4fc4ea5a73c62272143b51ad 100644 --- a/docs/db/mysql_spring_boot_plus.sql +++ b/docs/db/mysql_spring_boot_plus.sql @@ -406,5 +406,5 @@ INSERT INTO sys_login_log (id, request_id, username, ip, area, operator, token, INSERT INTO sys_login_log (id, request_id, username, ip, area, operator, token, type, success, code, exception_message, user_agent, browser_name, browser_version, engine_name, engine_version, os_name, platform_name, mobile, device_name, device_model, remark, create_time, update_time) VALUES (3, '1242814069371625474', 'admin', '127.0.0.1', '本机地址', null, null, 1, 0, null, '用户名或密码错误', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36', 'Chrome', '80.0.3987.149', 'Webkit', '537.36', 'OSX', 'Mac', 0, null, null, null, '2020-03-25 22:02:25', null); INSERT INTO sys_login_log (id, request_id, username, ip, area, operator, token, type, success, code, exception_message, user_agent, browser_name, browser_version, engine_name, engine_version, os_name, platform_name, mobile, device_name, device_model, remark, create_time, update_time) VALUES (4, '1242814192096960513', null, '127.0.0.1', '本机地址', null, null, 2, 0, null, 'token不能为空', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36', 'Chrome', '80.0.3987.149', 'Webkit', '537.36', 'OSX', 'Mac', 0, null, null, null, '2020-03-25 22:02:54', null); -INSERT INTO sys_operation_log (id, request_id, user_id, user_name, name, ip, area, operator, path, module, class_name, method_name, request_method, content_type, request_body, param, token, type, success, code, message, exception_name, exception_message, browser_name, browser_version, engine_name, engine_version, os_name, platform_name, mobile, device_name, device_model, remark, create_time, update_time) VALUES (1, '1242805276474634241', null, null, 'helloWorld', '127.0.0.1', '本机地址', null, '/api/hello/world', null, 'io.geekidea.springbootplus.system.controller.HelloWorldController', 'helloWorld', 'GET', null, 0, null, null, 0, 1, 200, '操作成功', null, null, 'Chrome', '80.0.3987.149', 'Webkit', '537.36', 'OSX', 'Mac', 0, null, null, '', '2020-03-25 21:27:22', null); +INSERT INTO sys_operation_log (id, request_id, user_id, user_name, name, ip, area, operator, path, module, class_name, method_name, request_method, content_type, request_body, param, token, type, success, code, message, exception_name, exception_message, browser_name, browser_version, engine_name, engine_version, os_name, platform_name, mobile, device_name, device_model, remark, create_time, update_time) VALUES (1, '1242805276474634241', null, null, 'helloWorld', '127.0.0.1', '本机地址', null, '/api/hello/world', null, 'io.geekidea.boot.system.controller.HelloWorldController', 'helloWorld', 'GET', null, 0, null, null, 0, 1, 200, '操作成功', null, null, 'Chrome', '80.0.3987.149', 'Webkit', '537.36', 'OSX', 'Mac', 0, null, null, '', '2020-03-25 21:27:22', null); INSERT INTO sys_operation_log (id, request_id, user_id, user_name, name, ip, area, operator, path, module, class_name, method_name, request_method, content_type, request_body, param, token, type, success, code, message, exception_name, exception_message, browser_name, browser_version, engine_name, engine_version, os_name, platform_name, mobile, device_name, device_model, remark, create_time, update_time) VALUES (2, '1242820418688049153', null, null, 'FooBar分页列表', '127.0.0.1', '本机地址', null, '/api/fooBar/getPageList', 'foobar', 'com.example.foobar.controller.FooBarController', 'getFooBarPageList', 'POST', 'application/json', 1, '{"pageIndex":1,"pageSize":10}', null, 7, 1, 200, '操作成功', null, null, 'Chrome', '80.0.3987.149', 'Webkit', '537.36', 'OSX', 'Mac', 0, null, null, '', '2020-03-25 22:27:33', null); diff --git a/example/pom.xml b/example/pom.xml index afed3bd513310886771364f2afa518590aa60663..9929884c2da0c0d81145747efce827555d405b01 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT example @@ -32,7 +32,7 @@ - io.geekidea.springbootplus + io.geekidea.boot framework diff --git a/example/src/main/java/com/example/category/controller/CategoryController.java b/example/src/main/java/com/example/category/controller/CategoryController.java new file mode 100644 index 0000000000000000000000000000000000000000..323b10bd1a57b01a2064c78d6ffdb861a6db5048 --- /dev/null +++ b/example/src/main/java/com/example/category/controller/CategoryController.java @@ -0,0 +1,131 @@ +package com.example.category.controller; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.category.entity.Category; +import com.example.category.service.CategoryService; +import com.example.category.vo.CategoryDetailVo; +import com.example.order.entity.Order; +import com.example.order.service.OrderService; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.util.LoginUtil; +import lombok.extern.slf4j.Slf4j; +import com.example.category.param.CategoryPageParam; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 题目分类 控制器 + * + * @author geekidea + * @since 2021-01-26 + */ +@Slf4j +@RestController +@RequestMapping("/category") +@Module("category") +@Api(value = "题目分类API", tags = {"题目分类"}) +public class CategoryController extends BaseController { + + @Autowired + private CategoryService categoryService; + + @Autowired + private OrderService orderService; + + /** + * 添加题目分类 + */ + @PostMapping("/submit") + @OperationLog(name = "添加题目分类", type = OperationLogType.ADD) + @ApiOperation(value = "添加题目分类", response = ApiResult.class) + @CacheEvict(cacheNames = "category", allEntries = true) + public ApiResult addPCategory(@Validated(Add.class) @RequestBody Category category) throws Exception { + boolean flag = category.insertOrUpdate(); + return ApiResult.result(flag); + } + + /** + * 修改题目分类 + */ + @PostMapping("/update") + @OperationLog(name = "修改题目分类", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改题目分类", response = ApiResult.class) + public ApiResult updatePCategory(@Validated(Update.class) @RequestBody Category pCategory) throws Exception { + boolean flag = categoryService.updateById(pCategory); + return ApiResult.result(flag); + } + + /** + * 删除题目分类 + */ + @PostMapping("/delete") + @OperationLog(name = "删除题目分类", type = OperationLogType.DELETE) + @ApiOperation(value = "删除题目分类", response = ApiResult.class) + @CacheEvict(cacheNames = "category", allEntries = true) + public ApiResult deleteCategory(@RequestBody List ids) throws Exception { + boolean flag = categoryService.deletePCategory(ids); + return ApiResult.result(flag); + } + + /** + * 获取题目分类详情 + */ + @GetMapping("/wechat/info/{code}") + @OperationLog(name = "题目分类详情", type = OperationLogType.INFO) + @ApiOperation(value = "题目分类详情", response = Category.class) + public ApiResult getCategory(@PathVariable("code") String code) throws Exception { + Category category = categoryService.getOne(new LambdaQueryWrapper().eq(Category::getCode, code)); + CategoryDetailVo detailVo = Convert.convert(CategoryDetailVo.class, category); + + if (StrUtil.isEmpty(LoginUtil.getAppUserId())) { + detailVo.setIsBuy(false); + } else { + int count = orderService.count(new LambdaQueryWrapper() + .eq(Order::getGroupId, code) + .eq(Order::getUserId, LoginUtil.getAppUserId()) + .eq(Order::getStatus, "2") + ); + detailVo.setIsBuy(count > 0 ? true : false); + } + + return ApiResult.ok(detailVo); + } + + /** + * 题目分类分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "题目分类分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "题目分类分页列表", response = Category.class) + @Cacheable(cacheNames = "category", key = "#categoryPageParam.getPageIndex()+'::'+#categoryPageParam.getPageSize()") + public ApiResult> getPCategoryPageList(@Validated @RequestBody CategoryPageParam categoryPageParam) throws Exception { + Paging paging = categoryService.getCategoryPageList(categoryPageParam); + return ApiResult.ok(paging); + } + + @GetMapping("/wechat/getAllList") + @OperationLog(name = "题目分类列表", type = OperationLogType.LIST) + @ApiOperation(value = "题目分类列表", response = Category.class) + @Cacheable(cacheNames = "category", key = "#root.method.name") + public ApiResult> getAllCategoryList() throws Exception { + return ApiResult.ok(categoryService.list()); + } + +} + diff --git a/example/src/main/java/com/example/category/entity/Category.java b/example/src/main/java/com/example/category/entity/Category.java new file mode 100644 index 0000000000000000000000000000000000000000..fd4d254c78609013a93099081c8e23f5e6bc8aa1 --- /dev/null +++ b/example/src/main/java/com/example/category/entity/Category.java @@ -0,0 +1,85 @@ +package com.example.category.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; + +import java.math.BigDecimal; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 题目分类 + * + * @author geekidea + * @since 2021-01-26 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName(value = "p_category") +@ApiModel(value = "Category对象") +public class Category extends Model { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("标题") + @TableField("SUBJECT") + private String subject; + + @ApiModelProperty("封面图片") + @TableField("COVER_IMG") + private String coverImg; + + @ApiModelProperty("编号") + @TableField("CODE") + private String code; + + @ApiModelProperty("价格") + @TableField("PRICE") + @NotNull(message = "请输入价格", groups = {Add.class, Update.class}) + @Min(value = 0, message = "价格不能小于0") + @Max(value = 99999, message = "价格不能超过99999") + private BigDecimal price; + + @ApiModelProperty("描述") + @TableField("REMARK") + private String remark; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + @Version + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField("CREATED_TIME") + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/category/mapper/CategoryMapper.java b/example/src/main/java/com/example/category/mapper/CategoryMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..31f5d7e1daa95b14eab0370091d580990ccafe6a --- /dev/null +++ b/example/src/main/java/com/example/category/mapper/CategoryMapper.java @@ -0,0 +1,23 @@ +package com.example.category.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.category.entity.Category; +import com.example.category.param.CategoryPageParam; + +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; + +/** + * 题目分类 Mapper 接口 + * + * @author geekidea + * @since 2021-01-26 + */ +@Repository +public interface CategoryMapper extends BaseMapper { + +} diff --git a/example/src/main/java/com/example/category/param/CategoryPageParam.java b/example/src/main/java/com/example/category/param/CategoryPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..3843c4dd7156fa7827a72f6d06ada7bb20fb648f --- /dev/null +++ b/example/src/main/java/com/example/category/param/CategoryPageParam.java @@ -0,0 +1,23 @@ +package com.example.category.param; + +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 题目分类 分页参数对象
+ * 
+ * + * @author geekidea + * @date 2021-01-26 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "题目分类分页参数") +public class CategoryPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; +} diff --git a/example/src/main/java/com/example/category/service/CategoryService.java b/example/src/main/java/com/example/category/service/CategoryService.java new file mode 100644 index 0000000000000000000000000000000000000000..8c9690b7c11f19495e62f9f5e9245b56e9b20719 --- /dev/null +++ b/example/src/main/java/com/example/category/service/CategoryService.java @@ -0,0 +1,55 @@ +package com.example.category.service; + +import com.example.category.entity.Category; +import com.example.category.param.CategoryPageParam; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +import java.util.List; + +/** + * 题目分类 服务类 + * + * @author geekidea + * @since 2021-01-26 + */ +public interface CategoryService extends BaseService { + + /** + * 保存 + * + * @param pCategory + * @return + * @throws Exception + */ + boolean savePCategory(Category pCategory) throws Exception; + + /** + * 修改 + * + * @param pCategory + * @return + * @throws Exception + */ + boolean updatePCategory(Category pCategory) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deletePCategory(List id) throws Exception; + + + /** + * 获取分页对象 + * + * @param categoryPageParam + * @return + * @throws Exception + */ + Paging getCategoryPageList(CategoryPageParam categoryPageParam) throws Exception; + +} diff --git a/example/src/main/java/com/example/category/service/impl/CategoryServiceImpl.java b/example/src/main/java/com/example/category/service/impl/CategoryServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0789be764f7824b97df11face1d4df16b622ddc0 --- /dev/null +++ b/example/src/main/java/com/example/category/service/impl/CategoryServiceImpl.java @@ -0,0 +1,60 @@ +package com.example.category.service.impl; + +import com.example.category.entity.Category; +import com.example.category.mapper.CategoryMapper; +import com.example.category.service.CategoryService; +import com.example.category.param.CategoryPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.util.LoginUtil; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +/** + * 题目分类 服务实现类 + * + * @author geekidea + * @since 2021-01-26 + */ +@Slf4j +@Service +public class CategoryServiceImpl extends BaseServiceImpl implements CategoryService { + + @Autowired + private CategoryMapper categoryMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean savePCategory(Category pCategory) throws Exception { + return super.save(pCategory); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updatePCategory(Category pCategory) throws Exception { + return super.updateById(pCategory); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deletePCategory(List ids) throws Exception { + return super.removeByIds(ids); + } + + @Override + public Paging getCategoryPageList(CategoryPageParam getCategoryPageList) throws Exception { + Page page = new PageInfo<>(getCategoryPageList, OrderItem.desc(getLambdaColumn(Category::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = categoryMapper.selectPage(page, wrapper); + return new Paging(iPage); + } +} diff --git a/example/src/main/java/com/example/category/vo/CategoryDetailVo.java b/example/src/main/java/com/example/category/vo/CategoryDetailVo.java new file mode 100644 index 0000000000000000000000000000000000000000..3bf207177999f13b940652b637580af9489cc727 --- /dev/null +++ b/example/src/main/java/com/example/category/vo/CategoryDetailVo.java @@ -0,0 +1,45 @@ +package com.example.category.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@Accessors(chain = true) +@ApiModel(value = "CategoryDetailVo对象", description = "小程序专题详情对象") +public class CategoryDetailVo implements Serializable { + private static final long serialVersionUID = 6599710269043866693L; + + @ApiModelProperty("ID") + private Integer id; + + @ApiModelProperty("标题") + private String subject; + + @ApiModelProperty("封面图片") + private String coverImg; + + @ApiModelProperty("编号") + private String code; + + @ApiModelProperty("价格") + private BigDecimal price; + + @ApiModelProperty("描述") + private String remark; + + @ApiModelProperty("是否购买") + private Boolean isBuy; +} diff --git a/example/src/main/java/com/example/chapter/controller/ChapterController.java b/example/src/main/java/com/example/chapter/controller/ChapterController.java new file mode 100644 index 0000000000000000000000000000000000000000..fd497722c1b2a0aa5a8db9e7794d6626e8b5f5c9 --- /dev/null +++ b/example/src/main/java/com/example/chapter/controller/ChapterController.java @@ -0,0 +1,104 @@ +package com.example.chapter.controller; + +import com.example.chapter.entity.Chapter; +import com.example.chapter.service.ChapterService; +import lombok.extern.slf4j.Slf4j; +import com.example.chapter.param.ChapterPageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.param.IdParam; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 控制器 + * + * @author limg + * @since 2021-02-18 + */ +@Slf4j +@RestController +@RequestMapping("/chapter") +@Module("chapter") +@Api(value = "章节管理API", tags = {"章节管理"}) +public class ChapterController extends BaseController { + + @Autowired + private ChapterService chapterService; + + /** + * 添加 + */ + @PostMapping("/submit") + @OperationLog(name = "添加", type = OperationLogType.ADD) + @ApiOperation(value = "添加", response = ApiResult.class) + @CacheEvict(cacheNames = "chapter", allEntries = true) + public ApiResult addChapter(@Validated(Add.class) @RequestBody Chapter chapter) throws Exception { +// boolean flag = chapterService.saveChapter(chapter); + boolean flag = chapter.insertOrUpdate(); + return ApiResult.result(flag); + } + + /** + * 删除 + */ + @PostMapping("/delete/{id}") + @OperationLog(name = "删除", type = OperationLogType.DELETE) + @ApiOperation(value = "删除", response = ApiResult.class) + @CacheEvict(cacheNames = "chapter", allEntries = true) + public ApiResult deleteChapter(@PathVariable("id") Long id) throws Exception { + boolean flag = chapterService.deleteChapter(id); + return ApiResult.result(flag); + } + + /** + * 获取详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "详情", type = OperationLogType.INFO) + @ApiOperation(value = "详情", response = Chapter.class) + public ApiResult getChapter(@PathVariable("id") Long id) throws Exception { + Chapter chapter = chapterService.getById(id); + return ApiResult.ok(chapter); + } + + /** + * 分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "分页列表", response = Chapter.class) + @Cacheable(cacheNames = "chapter", key = "#chapterPageParam.getPageIndex()+'::'+#chapterPageParam.getPageSize()") + public ApiResult> getChapterPageList(@Validated @RequestBody ChapterPageParam chapterPageParam) throws Exception { + Paging paging = chapterService.getChapterPageList(chapterPageParam); + return ApiResult.ok(paging); + } + + /** + * 分页列表 + */ + @GetMapping("/wechat/getPageList") + @OperationLog(name = "小程序端分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "小程序端分页列表", response = Chapter.class) + @Cacheable(cacheNames = "chapter", key = "#root.methodName") + public ApiResult> getWechatChapterPageList() throws Exception { + ChapterPageParam chapterPageParam = new ChapterPageParam(); + chapterPageParam.setPageIndex(1L); + chapterPageParam.setPageSize(100L); + Paging paging = chapterService.getChapterPageList(chapterPageParam); + return ApiResult.ok(paging); + } + +} + diff --git a/example/src/main/java/com/example/chapter/entity/Chapter.java b/example/src/main/java/com/example/chapter/entity/Chapter.java new file mode 100644 index 0000000000000000000000000000000000000000..e412faf85d53a0da55a06a1a5cc0abdeb0467d3d --- /dev/null +++ b/example/src/main/java/com/example/chapter/entity/Chapter.java @@ -0,0 +1,60 @@ +package com.example.chapter.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * + * + * @author limg + * @since 2021-02-18 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_chapter") +@ApiModel(value = "Chapter对象") +public class Chapter extends Model { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("章节名称") + @TableField("NAME") + private String name; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/chapter/mapper/ChapterMapper.java b/example/src/main/java/com/example/chapter/mapper/ChapterMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..5141079ddc038de1d71721d544e19d04c51c27b3 --- /dev/null +++ b/example/src/main/java/com/example/chapter/mapper/ChapterMapper.java @@ -0,0 +1,24 @@ +package com.example.chapter.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.chapter.entity.Chapter; +import com.example.chapter.param.ChapterPageParam; + +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; + +/** + * Mapper 接口 + * + * @author limg + * @since 2021-02-18 + */ +@Repository +public interface ChapterMapper extends BaseMapper { + + +} diff --git a/example/src/main/java/com/example/chapter/param/ChapterPageParam.java b/example/src/main/java/com/example/chapter/param/ChapterPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..e7e8415477a63fdbe7dde57804083f1f20ee4267 --- /dev/null +++ b/example/src/main/java/com/example/chapter/param/ChapterPageParam.java @@ -0,0 +1,23 @@ +package com.example.chapter.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ *  分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-18 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "分页参数") +public class ChapterPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; +} diff --git a/example/src/main/java/com/example/chapter/service/ChapterService.java b/example/src/main/java/com/example/chapter/service/ChapterService.java new file mode 100644 index 0000000000000000000000000000000000000000..8ccfb310379c73108b2b373c9088e202f9898cd3 --- /dev/null +++ b/example/src/main/java/com/example/chapter/service/ChapterService.java @@ -0,0 +1,53 @@ +package com.example.chapter.service; + +import com.example.chapter.entity.Chapter; +import com.example.chapter.param.ChapterPageParam; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +/** + * 服务类 + * + * @author limg + * @since 2021-02-18 + */ +public interface ChapterService extends BaseService { + + /** + * 保存 + * + * @param chapter + * @return + * @throws Exception + */ + boolean saveChapter(Chapter chapter) throws Exception; + + /** + * 修改 + * + * @param chapter + * @return + * @throws Exception + */ + boolean updateChapter(Chapter chapter) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteChapter(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param chapterPageParam + * @return + * @throws Exception + */ + Paging getChapterPageList(ChapterPageParam chapterPageParam) throws Exception; + +} diff --git a/example/src/main/java/com/example/chapter/service/impl/ChapterServiceImpl.java b/example/src/main/java/com/example/chapter/service/impl/ChapterServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0bb526db71b7c7d14218a1d6c222db0a4a63fd2d --- /dev/null +++ b/example/src/main/java/com/example/chapter/service/impl/ChapterServiceImpl.java @@ -0,0 +1,58 @@ +package com.example.chapter.service.impl; + +import com.example.chapter.entity.Chapter; +import com.example.chapter.mapper.ChapterMapper; +import com.example.chapter.service.ChapterService; +import com.example.chapter.param.ChapterPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * 服务实现类 + * + * @author limg + * @since 2021-02-18 + */ +@Slf4j +@Service +public class ChapterServiceImpl extends BaseServiceImpl implements ChapterService { + + @Autowired + private ChapterMapper chapterMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveChapter(Chapter chapter) throws Exception { + return super.save(chapter); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateChapter(Chapter chapter) throws Exception { + return super.updateById(chapter); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteChapter(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getChapterPageList(ChapterPageParam chapterPageParam) throws Exception { + Page page = new PageInfo<>(chapterPageParam, OrderItem.asc(getLambdaColumn(Chapter::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = chapterMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + +} diff --git a/example/src/main/java/com/example/examDate/controller/DateController.java b/example/src/main/java/com/example/examDate/controller/DateController.java new file mode 100644 index 0000000000000000000000000000000000000000..22404000b53a26d3d9a4f6d515c23fa6bb412060 --- /dev/null +++ b/example/src/main/java/com/example/examDate/controller/DateController.java @@ -0,0 +1,100 @@ +package com.example.examDate.controller; + +import com.example.examDate.entity.ExamDate; +import com.example.examDate.service.DateService; +import com.example.examDate.vo.ExamDateGoodVo; +import lombok.extern.slf4j.Slf4j; +import com.example.examDate.param.DatePageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 考试日期设置 控制器 + * + * @author limg + * @since 2021-02-27 + */ +@Slf4j +@RestController +@RequestMapping("/date") +@Module("examDate") +@Api(value = "考试日期设置API", tags = {"考试日期设置"}) +public class DateController extends BaseController { + + @Autowired + private DateService dateService; + + /** + * 添加考试日期设置 + */ + @PostMapping("/add") + @OperationLog(name = "添加考试日期设置", type = OperationLogType.ADD) + @ApiOperation(value = "添加考试日期设置", response = ApiResult.class) + @CacheEvict(value = "userRank", allEntries = true) + public ApiResult addDate(@Validated(Add.class) @RequestBody ExamDate date) throws Exception { + boolean flag = dateService.saveDate(date); + return ApiResult.result(flag); + } + + /** + * 修改考试日期设置 + */ + @PostMapping("/update") + @OperationLog(name = "修改考试日期设置", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改考试日期设置", response = ApiResult.class) + @CacheEvict(value = "userRank", allEntries = true) + public ApiResult updateDate(@Validated(Update.class) @RequestBody ExamDate date) throws Exception { + boolean flag = dateService.updateDate(date); + return ApiResult.result(flag); + } + + /** + * 删除考试日期设置 + */ + @PostMapping("/delete/{id}") + @OperationLog(name = "删除考试日期设置", type = OperationLogType.DELETE) + @ApiOperation(value = "删除考试日期设置", response = ApiResult.class) + @CacheEvict(value = "userRank", allEntries = true) + public ApiResult deleteDate(@PathVariable("id") Long id) throws Exception { + boolean flag = dateService.deleteDate(id); + return ApiResult.result(flag); + } + + /** + * 考试日期设置分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "考试日期设置分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "考试日期设置分页列表", response = ExamDate.class) + public ApiResult> getDatePageList(@Validated @RequestBody DatePageParam datePageParam) throws Exception { + Paging paging = dateService.getDatePageList(datePageParam); + return ApiResult.ok(paging); + } + + /** + * 考试日期商品信息 + */ + @GetMapping("/wechat/getExamDateInfo") + @OperationLog(name = "考试日期商品信息", type = OperationLogType.INFO) + @ApiOperation(value = "考试日期商品信息", response = ExamDateGoodVo.class) + @Cacheable(value = "userRank", key = "#root.methodName") + public ApiResult getExamDateInfo() throws Exception { + ExamDateGoodVo examDateGoodVo = dateService.calcOrderAmount(); + return ApiResult.ok(examDateGoodVo); + } + +} + diff --git a/example/src/main/java/com/example/examDate/entity/ExamDate.java b/example/src/main/java/com/example/examDate/entity/ExamDate.java new file mode 100644 index 0000000000000000000000000000000000000000..b56dd366c1764058e2fc0e81fba96d648843a2c3 --- /dev/null +++ b/example/src/main/java/com/example/examDate/entity/ExamDate.java @@ -0,0 +1,63 @@ +package com.example.examDate.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +import java.time.LocalDate; +import java.util.Date; + +/** + * 考试日期设置 + * + * @author limg + * @since 2021-02-27 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("sys_date") +@ApiModel(value = "examDate对象") +public class ExamDate extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("考试时间") + @TableField("EXAM_DATE") + private LocalDate examDate; + + @ApiModelProperty("备注") + @TableField("REMARK") + private String remark; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/examDate/mapper/DateMapper.java b/example/src/main/java/com/example/examDate/mapper/DateMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f1d247650a6104cf88b30e146cb85748ea303c57 --- /dev/null +++ b/example/src/main/java/com/example/examDate/mapper/DateMapper.java @@ -0,0 +1,23 @@ +package com.example.examDate.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.examDate.entity.ExamDate; + +import org.springframework.stereotype.Repository; + +/** + * 考试日期设置 Mapper 接口 + * + * @author limg + * @since 2021-02-27 + */ +@Repository +public interface DateMapper extends BaseMapper { + + + /** + * 查询距离当天最早的一次考试 + * @return + */ + ExamDate selectEarliestOne(); +} diff --git a/example/src/main/java/com/example/examDate/param/DatePageParam.java b/example/src/main/java/com/example/examDate/param/DatePageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..e88c1cf42b4734e72650174ae2344f8c5353a376 --- /dev/null +++ b/example/src/main/java/com/example/examDate/param/DatePageParam.java @@ -0,0 +1,23 @@ +package com.example.examDate.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ * 考试日期设置 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-27 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "考试日期设置分页参数") +public class DatePageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; +} diff --git a/example/src/main/java/com/example/examDate/service/DateService.java b/example/src/main/java/com/example/examDate/service/DateService.java new file mode 100644 index 0000000000000000000000000000000000000000..00052f49cf8f22afcccee941a3049d6692431ed2 --- /dev/null +++ b/example/src/main/java/com/example/examDate/service/DateService.java @@ -0,0 +1,58 @@ +package com.example.examDate.service; + +import com.example.examDate.entity.ExamDate; +import com.example.examDate.param.DatePageParam; +import com.example.examDate.vo.ExamDateGoodVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +import java.math.BigDecimal; + +/** + * 考试日期设置 服务类 + * + * @author limg + * @since 2021-02-27 + */ +public interface DateService extends BaseService { + + /** + * 保存 + * + * @param date + * @return + * @throws Exception + */ + boolean saveDate(ExamDate date) throws Exception; + + /** + * 修改 + * + * @param date + * @return + * @throws Exception + */ + boolean updateDate(ExamDate date) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteDate(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param datePageParam + * @return + * @throws Exception + */ + Paging getDatePageList(DatePageParam datePageParam) throws Exception; + + ExamDateGoodVo calcOrderAmount() throws Exception; + +} diff --git a/example/src/main/java/com/example/examDate/service/impl/DateServiceImpl.java b/example/src/main/java/com/example/examDate/service/impl/DateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d11033719155edb1bb055f05a7a79ce7eec48c75 --- /dev/null +++ b/example/src/main/java/com/example/examDate/service/impl/DateServiceImpl.java @@ -0,0 +1,91 @@ +package com.example.examDate.service.impl; + +import cn.hutool.core.convert.Convert; +import com.example.examDate.entity.ExamDate; +import com.example.examDate.mapper.DateMapper; +import com.example.examDate.service.DateService; +import com.example.examDate.param.DatePageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.examDate.vo.ExamDateGoodVo; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.Period; + +/** + * 考试日期设置 服务实现类 + * + * @author limg + * @since 2021-02-27 + */ +@Slf4j +@Service +public class DateServiceImpl extends BaseServiceImpl implements DateService { + + @Autowired + private DateMapper dateMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveDate(ExamDate date) throws Exception { + return super.save(date); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateDate(ExamDate date) throws Exception { + return super.updateById(date); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteDate(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getDatePageList(DatePageParam datePageParam) throws Exception { + Page page = new PageInfo<>(datePageParam, OrderItem.desc(getLambdaColumn(ExamDate::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = dateMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + + @Override + public ExamDateGoodVo calcOrderAmount() throws Exception { + BigDecimal total = new BigDecimal(90); // 90天会员 + ExamDate examDate = dateMapper.selectEarliestOne(); + + // 如果没有查询到考试日期,则按照最低金额9.9元计算 + if (examDate == null) { + ExamDateGoodVo examDateGoodVo = new ExamDateGoodVo(); + examDateGoodVo.setExamDate(null); + examDateGoodVo.setAmount(new BigDecimal(9.9)); + examDateGoodVo.setPrice(new BigDecimal(0.11)); + return examDateGoodVo; + } + ExamDateGoodVo examDateGoodVo = Convert.convert(ExamDateGoodVo.class, examDate); + // 计算考试日期距离当天的天数差 + long days = examDate.getExamDate().toEpochDay() - LocalDate.now().toEpochDay(); + // 最少需要支付9.9 + double minDays = Math.max(75 - days, 9.9); + BigDecimal amount = new BigDecimal(minDays); + examDateGoodVo.setAmount(amount); + examDateGoodVo.setPrice(amount.divide(total,2, BigDecimal.ROUND_HALF_UP)); +// 取消价格计算,统一按照9.9元收费2021-6-5 +// examDateGoodVo.setAmount(new BigDecimal(9.9)); +// examDateGoodVo.setPrice(new BigDecimal(0.11)); + return examDateGoodVo; + } + +} diff --git a/example/src/main/java/com/example/examDate/vo/ExamDateGoodVo.java b/example/src/main/java/com/example/examDate/vo/ExamDateGoodVo.java new file mode 100644 index 0000000000000000000000000000000000000000..b302fc4b34d800dfd555a998b3b991883bd2363a --- /dev/null +++ b/example/src/main/java/com/example/examDate/vo/ExamDateGoodVo.java @@ -0,0 +1,32 @@ +package com.example.examDate.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; + +@Data +@Accessors(chain = true) +@ApiModel(value = "ExamDateGoodVo对象", description = "小程序获取考试信息对象") +public class ExamDateGoodVo implements Serializable { + private static final long serialVersionUID = 8101678988453788458L; + + @ApiModelProperty("编号") + private Integer id; + + @ApiModelProperty("考试时间") + private LocalDate examDate; + + @ApiModelProperty("总金额") + private BigDecimal amount; + + @ApiModelProperty("平均每日价格") + private BigDecimal price; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/example/src/main/java/com/example/favorite/controller/FavorController.java b/example/src/main/java/com/example/favorite/controller/FavorController.java new file mode 100644 index 0000000000000000000000000000000000000000..f2437878463c891a54c088698d4c37ac17742381 --- /dev/null +++ b/example/src/main/java/com/example/favorite/controller/FavorController.java @@ -0,0 +1,129 @@ +package com.example.favorite.controller; + +import com.example.favorite.entity.Favor; +import com.example.favorite.service.FavorService; +import com.example.history.entity.History; +import com.example.notes.vo.WrongVo; +import com.example.question.param.QuestionPageParam; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.util.LoginUtil; +import lombok.extern.slf4j.Slf4j; +import com.example.favorite.param.FavorPageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.param.IdParam; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 收藏记录 控制器 + * + * @author limg + * @since 2021-02-12 + */ +@Slf4j +@RestController +@RequestMapping("/favor") +@Module("favorite") +@Api(value = "收藏记录API", tags = {"收藏记录"}) +public class FavorController extends BaseController { + + @Autowired + private FavorService favorService; + + /** + * 添加收藏记录 + */ + @PostMapping("/add") + @OperationLog(name = "添加收藏记录", type = OperationLogType.ADD) + @ApiOperation(value = "添加收藏记录", response = ApiResult.class) + @CacheEvict(cacheNames = {"favorite", "question"}, allEntries = true) + public ApiResult addFavor(@Validated(Add.class) @RequestBody Favor favor) throws Exception { + boolean flag = favorService.saveFavor(favor); + return ApiResult.result(flag); + } + + /** + * 修改收藏记录 + */ + @PostMapping("/update") + @OperationLog(name = "修改收藏记录", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改收藏记录", response = ApiResult.class) + public ApiResult updateFavor(@Validated(Update.class) @RequestBody Favor favor) throws Exception { + boolean flag = favorService.updateFavor(favor); + return ApiResult.result(flag); + } + + /** + * 删除收藏记录 + */ + @PostMapping("/delete/{questionId}") + @OperationLog(name = "删除收藏记录", type = OperationLogType.DELETE) + @ApiOperation(value = "删除收藏记录", response = ApiResult.class) + @CacheEvict(cacheNames = {"favorite", "question"}, allEntries = true) + public ApiResult deleteFavor(@PathVariable String questionId) throws Exception { + boolean flag = favorService.deleteFavor(questionId); + return ApiResult.result(flag); + } + + /** + * 删除收藏记录 + */ + @PostMapping("/remove/{id}") + @OperationLog(name = "根据id删除收藏记录", type = OperationLogType.DELETE) + @ApiOperation(value = "根据id删除收藏记录", response = ApiResult.class) + @CacheEvict(cacheNames = {"favorite", "question"}, allEntries = true) + public ApiResult removeFavor(@PathVariable String id) throws Exception { + boolean flag = favorService.removeById(id); + return ApiResult.result(flag); + } + + /** + * 获取收藏记录详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "收藏记录详情", type = OperationLogType.INFO) + @ApiOperation(value = "收藏记录详情", response = Favor.class) + public ApiResult getFavor(@PathVariable Long id) throws Exception { + Favor favor = favorService.getById(id); + return ApiResult.ok(favor); + } + + /** + * 收藏试题汇总列表 + */ + @GetMapping("/getFavoList") + @OperationLog(name = "收藏试题汇总列表", type = OperationLogType.LIST) + @ApiOperation(value = "收藏试题汇总列表", response = History.class) + public ApiResult> getFavoList() throws Exception { + List list = favorService.getFavoList(); + return ApiResult.ok(list); + } + + /** + * 收藏列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "收藏列表", type = OperationLogType.PAGE) + @ApiOperation(value = "收藏列表", response = QuestionPageVo.class) + @Cacheable(value = "favorite", key = "#p0.toString()") + public ApiResult> getFavoQuestionList(@Validated @RequestBody QuestionPageParam questionPageParam) throws Exception { + Paging paging = favorService.getQuestionPageList(questionPageParam); + return ApiResult.ok(paging); + } + +} + diff --git a/example/src/main/java/com/example/favorite/entity/Favor.java b/example/src/main/java/com/example/favorite/entity/Favor.java new file mode 100644 index 0000000000000000000000000000000000000000..85695264551527807511d81303b5cc752a8510d1 --- /dev/null +++ b/example/src/main/java/com/example/favorite/entity/Favor.java @@ -0,0 +1,70 @@ +package com.example.favorite.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.core.validator.groups.Add; + +/** + * 收藏记录 + * + * @author limg + * @since 2021-02-12 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_favor") +@ApiModel(value = "Favor对象") +public class Favor extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("用户编号") + @TableField("USER_ID") + private Integer userId; + + @ApiModelProperty("章节编号") + @TableField("CHAPTER_ID") + private Integer chapterId; + + @ApiModelProperty("试题编号") + @TableField("QUESTION_ID") + @NotNull(message = "试题编号不能为空", groups = {Add.class, Update.class}) + private Integer questionId; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/favorite/mapper/FavorMapper.java b/example/src/main/java/com/example/favorite/mapper/FavorMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..399bc62ecbb621c6d56da209c2012a882d612838 --- /dev/null +++ b/example/src/main/java/com/example/favorite/mapper/FavorMapper.java @@ -0,0 +1,31 @@ +package com.example.favorite.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.favorite.entity.Favor; +import com.example.favorite.param.FavorPageParam; + +import com.example.notes.vo.WrongVo; +import com.example.question.vo.QuestionPageVo; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; +import java.util.List; + +/** + * 收藏记录 Mapper 接口 + * + * @author limg + * @since 2021-02-12 + */ +@Repository +public interface FavorMapper extends BaseMapper { + + + List selectFavoriteList(String appUserId); + + IPage getQuestionPageList(Page page, @Param("appUserId") String appUserId, @Param("chapterId") String chapterId); +} diff --git a/example/src/main/java/com/example/favorite/param/FavorPageParam.java b/example/src/main/java/com/example/favorite/param/FavorPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..ecc400d61bfc1a89c649aadd8210a191e176cfef --- /dev/null +++ b/example/src/main/java/com/example/favorite/param/FavorPageParam.java @@ -0,0 +1,27 @@ +package com.example.favorite.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ * 收藏记录 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-12 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "收藏记录分页参数") +public class FavorPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("章节编号") + private Integer chapterId; +} diff --git a/example/src/main/java/com/example/favorite/service/FavorService.java b/example/src/main/java/com/example/favorite/service/FavorService.java new file mode 100644 index 0000000000000000000000000000000000000000..d99df0b6b82ca84b4a35050d4a80d71f251e9424 --- /dev/null +++ b/example/src/main/java/com/example/favorite/service/FavorService.java @@ -0,0 +1,68 @@ +package com.example.favorite.service; + +import com.example.favorite.entity.Favor; +import com.example.favorite.param.FavorPageParam; +import com.example.notes.vo.WrongVo; +import com.example.question.param.QuestionPageParam; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +import java.util.List; + +/** + * 收藏记录 服务类 + * + * @author limg + * @since 2021-02-12 + */ +public interface FavorService extends BaseService { + + /** + * 保存 + * + * @param favor + * @return + * @throws Exception + */ + boolean saveFavor(Favor favor) throws Exception; + + /** + * 修改 + * + * @param favor + * @return + * @throws Exception + */ + boolean updateFavor(Favor favor) throws Exception; + + /** + * 删除 + * + * @param questionId + * @return + * @throws Exception + */ + boolean deleteFavor(String questionId) throws Exception; + + + /** + * 获取分页对象 + * + * @param favorPageParam + * @return + * @throws Exception + */ + Paging getFavorPageList(FavorPageParam favorPageParam) throws Exception; + + List getFavoList() throws Exception; + + /** + * 获取分页对象 + * + * @param questionPageParam + * @return + * @throws Exception + */ + Paging getQuestionPageList(QuestionPageParam questionPageParam) throws Exception; +} diff --git a/example/src/main/java/com/example/favorite/service/impl/FavorServiceImpl.java b/example/src/main/java/com/example/favorite/service/impl/FavorServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5ab7a01c190760224568483468a88404893a7924 --- /dev/null +++ b/example/src/main/java/com/example/favorite/service/impl/FavorServiceImpl.java @@ -0,0 +1,115 @@ +package com.example.favorite.service.impl; + +import cn.hutool.core.convert.Convert; +import com.example.favorite.entity.Favor; +import com.example.favorite.mapper.FavorMapper; +import com.example.favorite.service.FavorService; +import com.example.favorite.param.FavorPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.notes.vo.WrongVo; +import com.example.question.param.QuestionPageParam; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.util.LoginUtil; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 收藏记录 服务实现类 + * + * @author limg + * @since 2021-02-12 + */ +@Slf4j +@Service +public class FavorServiceImpl extends BaseServiceImpl implements FavorService { + + @Autowired + private FavorMapper favorMapper; + + @Lazy + @Autowired + private RedisTemplate redisTemplate; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveFavor(Favor favor) throws Exception { + String appUserId = LoginUtil.getAppUserId(); + String key = String.format("favoriteList-%s", appUserId); + int count = favorMapper.selectCount(new LambdaQueryWrapper() + .eq(Favor::getUserId, appUserId) + .eq(Favor::getQuestionId, favor.getQuestionId())); + if (count > 0) { + return true; + } + + favor.setUserId(Convert.toInt(appUserId)); + // 清空缓存 + redisTemplate.delete(key); + return super.save(favor); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateFavor(Favor favor) throws Exception { + favor.setUserId(Convert.toInt(LoginUtil.getAppUserId())); + return super.updateById(favor); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteFavor(String questionId) throws Exception { + String appUserId = LoginUtil.getAppUserId(); + String key = String.format("favoriteList-%s", appUserId); + // 清空缓存 + redisTemplate.delete(key); + return super.remove(new LambdaQueryWrapper() + .eq(Favor::getUserId, appUserId) + .eq(Favor::getQuestionId, questionId) + ); + } + + @Override + public Paging getFavorPageList(FavorPageParam favorPageParam) throws Exception { + Page page = new PageInfo<>(favorPageParam, OrderItem.desc(getLambdaColumn(Favor::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = favorMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + + @Override + public List getFavoList() throws Exception { + String appUserId = LoginUtil.getAppUserId(); + String key = String.format("favoriteList-%s", appUserId); + List redisList = (List) redisTemplate.opsForValue().get(key); + if (redisList != null) { + return redisList; + } + List list = favorMapper.selectFavoriteList(appUserId); + redisTemplate.opsForValue().set(key, list, 3, TimeUnit.DAYS); + + return list; + } + + @Override + public Paging getQuestionPageList(QuestionPageParam questionPageParam) throws Exception { + Page page = new PageInfo<>(questionPageParam, OrderItem.asc(getLambdaColumn(Favor::getId))); + IPage iPage = favorMapper.getQuestionPageList(page, LoginUtil.getAppUserId(), questionPageParam.getChapterId()); + return new Paging<>(iPage); + } + +} diff --git a/example/src/main/java/com/example/foobar/controller/FooBarController.java b/example/src/main/java/com/example/foobar/controller/FooBarController.java index a5e98a8c90c157bc90387fe30c52e41fbc5fbe44..a63db027b982520e416b41829cf8fc7acc807aaa 100644 --- a/example/src/main/java/com/example/foobar/controller/FooBarController.java +++ b/example/src/main/java/com/example/foobar/controller/FooBarController.java @@ -16,24 +16,28 @@ package com.example.foobar.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.example.foobar.entity.FooBar; import com.example.foobar.param.FooBarPageParam; import com.example.foobar.service.FooBarService; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.core.validator.groups.Add; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * FooBar 控制器 * diff --git a/example/src/main/java/com/example/foobar/entity/FooBar.java b/example/src/main/java/com/example/foobar/entity/FooBar.java index 42df4c6502a441a17ea66bdfa6223533dccffc75..db4fcaac4d3ac54e059c962c8572696eabc0e7c3 100644 --- a/example/src/main/java/com/example/foobar/entity/FooBar.java +++ b/example/src/main/java/com/example/foobar/entity/FooBar.java @@ -19,8 +19,8 @@ package com.example.foobar.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.Version; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.core.validator.groups.Update; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/example/src/main/java/com/example/foobar/mapper/FooBarMapper.java b/example/src/main/java/com/example/foobar/mapper/FooBarMapper.java index 9e26e2cc2bd1861e720cef94f02b0cea9885f18a..9c9fb0e823ef2dc14419597ddeb32e682e65fc4e 100644 --- a/example/src/main/java/com/example/foobar/mapper/FooBarMapper.java +++ b/example/src/main/java/com/example/foobar/mapper/FooBarMapper.java @@ -18,6 +18,7 @@ package com.example.foobar.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.example.foobar.entity.FooBar; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; /** @@ -29,5 +30,4 @@ import org.springframework.stereotype.Repository; @Repository public interface FooBarMapper extends BaseMapper { - } diff --git a/example/src/main/java/com/example/foobar/param/FooBarPageParam.java b/example/src/main/java/com/example/foobar/param/FooBarPageParam.java index 8baca6491c2417faacf960339641f1547f802f67..1d30469280e4cd1b9f00db03f33778c385c72976 100644 --- a/example/src/main/java/com/example/foobar/param/FooBarPageParam.java +++ b/example/src/main/java/com/example/foobar/param/FooBarPageParam.java @@ -16,7 +16,7 @@ package com.example.foobar.param; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/example/src/main/java/com/example/foobar/service/FooBarService.java b/example/src/main/java/com/example/foobar/service/FooBarService.java index 1f9d085751b8a8d1b0a20030937024adc6d2aa13..2347ecb2a572a02fd41c7803e31d2d4e925839db 100644 --- a/example/src/main/java/com/example/foobar/service/FooBarService.java +++ b/example/src/main/java/com/example/foobar/service/FooBarService.java @@ -18,8 +18,8 @@ package com.example.foobar.service; import com.example.foobar.entity.FooBar; import com.example.foobar.param.FooBarPageParam; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; /** * FooBar 服务类 diff --git a/example/src/main/java/com/example/foobar/service/impl/FooBarServiceImpl.java b/example/src/main/java/com/example/foobar/service/impl/FooBarServiceImpl.java index 5488a1225c942a3e99eec8f6a62395287276078e..2057c3b8b84e2328c3aa8d2307c56748f1faf874 100644 --- a/example/src/main/java/com/example/foobar/service/impl/FooBarServiceImpl.java +++ b/example/src/main/java/com/example/foobar/service/impl/FooBarServiceImpl.java @@ -24,10 +24,10 @@ import com.example.foobar.entity.FooBar; import com.example.foobar.mapper.FooBarMapper; import com.example.foobar.param.FooBarPageParam; import com.example.foobar.service.FooBarService; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.OrderMapping; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import io.geekidea.springbootplus.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.OrderMapping; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/example/src/main/java/com/example/group/controller/GroupController.java b/example/src/main/java/com/example/group/controller/GroupController.java new file mode 100644 index 0000000000000000000000000000000000000000..c5c43cb8e12c03f35cc3ee4208ee716a9451460e --- /dev/null +++ b/example/src/main/java/com/example/group/controller/GroupController.java @@ -0,0 +1,106 @@ +package com.example.group.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.group.entity.Group; +import com.example.group.service.GroupService; +import lombok.extern.slf4j.Slf4j; +import com.example.group.param.GroupPageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.param.IdParam; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 微信群 控制器 + * + * @author limg + * @since 2021-03-14 + */ +@Slf4j +@RestController +@RequestMapping("/group") +@Module("group") +@Api(value = "微信群API", tags = {"微信群"}) +public class GroupController extends BaseController { + + @Autowired + private GroupService groupService; + + /** + * 添加微信群 + */ + @PostMapping("/add") + @OperationLog(name = "添加微信群", type = OperationLogType.ADD) + @ApiOperation(value = "添加微信群", response = ApiResult.class) + public ApiResult addGroup(@Validated(Add.class) @RequestBody Group group) throws Exception { + boolean flag = groupService.saveGroup(group); + return ApiResult.result(flag); + } + + /** + * 修改微信群 + */ + @PostMapping("/update") + @OperationLog(name = "修改微信群", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改微信群", response = ApiResult.class) + public ApiResult updateGroup(@Validated(Update.class) @RequestBody Group group) throws Exception { + boolean flag = groupService.updateGroup(group); + return ApiResult.result(flag); + } + + /** + * 删除微信群 + */ + @PostMapping("/delete/{id}") + @OperationLog(name = "删除微信群", type = OperationLogType.DELETE) + @ApiOperation(value = "删除微信群", response = ApiResult.class) + public ApiResult deleteGroup(@PathVariable("id") Long id) throws Exception { + boolean flag = groupService.deleteGroup(id); + return ApiResult.result(flag); + } + + /** + * 获取微信群详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "微信群详情", type = OperationLogType.INFO) + @ApiOperation(value = "微信群详情", response = Group.class) + public ApiResult getGroup(@PathVariable("id") Long id) throws Exception { + Group group = groupService.getById(id); + return ApiResult.ok(group); + } + + /** + * 获取当前正在答疑的群 + */ + @GetMapping("/wechat/getGroup") + @OperationLog(name = "获取微信群", type = OperationLogType.INFO) + @ApiOperation(value = "获取微信群", response = Group.class) + public ApiResult getCurrentGroup() throws Exception { + Group group = groupService.getOne(new LambdaQueryWrapper().eq(Group::getStatus, 1)); + return ApiResult.ok(group); + } + + /** + * 微信群分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "微信群分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "微信群分页列表", response = Group.class) + public ApiResult> getGroupPageList(@Validated @RequestBody GroupPageParam groupPageParam) throws Exception { + Paging paging = groupService.getGroupPageList(groupPageParam); + return ApiResult.ok(paging); + } + +} + diff --git a/example/src/main/java/com/example/group/entity/Group.java b/example/src/main/java/com/example/group/entity/Group.java new file mode 100644 index 0000000000000000000000000000000000000000..77587d3f2bdd53211841f73ac8c24484c17fb316 --- /dev/null +++ b/example/src/main/java/com/example/group/entity/Group.java @@ -0,0 +1,68 @@ +package com.example.group.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * 微信群 + * + * @author limg + * @since 2021-03-14 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_group") +@ApiModel(value = "Group对象") +public class Group extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("ID") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("群名称") + @TableField("NAME") + private String name; + + @ApiModelProperty("群二维码") + @TableField("GROUP_QRCODE") + private String qrCode; + + @ApiModelProperty("状态") + @TableField("STATUS") + private Integer status; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/group/mapper/GroupMapper.java b/example/src/main/java/com/example/group/mapper/GroupMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..b9fff4fd021964a64e5a805baac7416de73a8dce --- /dev/null +++ b/example/src/main/java/com/example/group/mapper/GroupMapper.java @@ -0,0 +1,24 @@ +package com.example.group.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.group.entity.Group; +import com.example.group.param.GroupPageParam; + +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; + +/** + * 微信群 Mapper 接口 + * + * @author limg + * @since 2021-03-14 + */ +@Repository +public interface GroupMapper extends BaseMapper { + + +} diff --git a/example/src/main/java/com/example/group/param/GroupPageParam.java b/example/src/main/java/com/example/group/param/GroupPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..26a9bc8bd5c209bbf1db04bd51f125657421412b --- /dev/null +++ b/example/src/main/java/com/example/group/param/GroupPageParam.java @@ -0,0 +1,23 @@ +package com.example.group.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ * 微信群 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-03-14 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "微信群分页参数") +public class GroupPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; +} diff --git a/example/src/main/java/com/example/group/service/GroupService.java b/example/src/main/java/com/example/group/service/GroupService.java new file mode 100644 index 0000000000000000000000000000000000000000..50846e07fb8ec691c4705be23c35fbac66b33adf --- /dev/null +++ b/example/src/main/java/com/example/group/service/GroupService.java @@ -0,0 +1,53 @@ +package com.example.group.service; + +import com.example.group.entity.Group; +import com.example.group.param.GroupPageParam; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +/** + * 微信群 服务类 + * + * @author limg + * @since 2021-03-14 + */ +public interface GroupService extends BaseService { + + /** + * 保存 + * + * @param group + * @return + * @throws Exception + */ + boolean saveGroup(Group group) throws Exception; + + /** + * 修改 + * + * @param group + * @return + * @throws Exception + */ + boolean updateGroup(Group group) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteGroup(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param groupQueryParam + * @return + * @throws Exception + */ + Paging getGroupPageList(GroupPageParam groupPageParam) throws Exception; + +} diff --git a/example/src/main/java/com/example/group/service/impl/GroupServiceImpl.java b/example/src/main/java/com/example/group/service/impl/GroupServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c3c2f2069af537ed799da38afec947b903747617 --- /dev/null +++ b/example/src/main/java/com/example/group/service/impl/GroupServiceImpl.java @@ -0,0 +1,58 @@ +package com.example.group.service.impl; + +import com.example.group.entity.Group; +import com.example.group.mapper.GroupMapper; +import com.example.group.service.GroupService; +import com.example.group.param.GroupPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * 微信群 服务实现类 + * + * @author limg + * @since 2021-03-14 + */ +@Slf4j +@Service +public class GroupServiceImpl extends BaseServiceImpl implements GroupService { + + @Autowired + private GroupMapper groupMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveGroup(Group group) throws Exception { + return super.save(group); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateGroup(Group group) throws Exception { + return super.updateById(group); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteGroup(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getGroupPageList(GroupPageParam groupPageParam) throws Exception { + Page page = new PageInfo<>(groupPageParam, OrderItem.desc(getLambdaColumn(Group::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = groupMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + +} diff --git a/example/src/main/java/com/example/history/controller/HistoryController.java b/example/src/main/java/com/example/history/controller/HistoryController.java new file mode 100644 index 0000000000000000000000000000000000000000..ee0a1bff2011efad12005607c3cc8432f5f7c0ee --- /dev/null +++ b/example/src/main/java/com/example/history/controller/HistoryController.java @@ -0,0 +1,70 @@ +package com.example.history.controller; + +import com.example.history.entity.History; +import com.example.history.service.HistoryService; +import lombok.extern.slf4j.Slf4j; +import com.example.history.param.HistoryPageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 做题记录 控制器 + * + * @author limg + * @since 2021-02-15 + */ +@Slf4j +@RestController +@RequestMapping("/history") +@Module("history") +@Api(value = "做题记录API", tags = {"做题记录"}) +public class HistoryController extends BaseController { + + @Autowired + private HistoryService historyService; + + /** + * 添加做题记录 + */ + @PostMapping("/add") + @OperationLog(name = "添加做题记录", type = OperationLogType.ADD) + @ApiOperation(value = "添加做题记录", response = ApiResult.class) + public ApiResult addHistory(@Validated(Add.class) @RequestBody History history) throws Exception { + boolean flag = historyService.saveHistory(history); + return ApiResult.result(flag); + } + + /** + * 获取做题记录详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "做题记录详情", type = OperationLogType.INFO) + @ApiOperation(value = "做题记录详情", response = History.class) + public ApiResult getHistory(@PathVariable("id") Long id) throws Exception { + History history = historyService.getById(id); + return ApiResult.ok(history); + } + + /** + * 做题记录分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "做题记录分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "做题记录分页列表", response = History.class) + public ApiResult> getHistoryPageList(@Validated @RequestBody HistoryPageParam historyPageParam) throws Exception { + Paging paging = historyService.getHistoryPageList(historyPageParam); + return ApiResult.ok(paging); + } + +} + diff --git a/example/src/main/java/com/example/history/entity/History.java b/example/src/main/java/com/example/history/entity/History.java new file mode 100644 index 0000000000000000000000000000000000000000..a1d49dd73555f50b654254a5b52d32813a747451 --- /dev/null +++ b/example/src/main/java/com/example/history/entity/History.java @@ -0,0 +1,76 @@ +package com.example.history.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * 做题记录 + * + * @author limg + * @since 2021-02-15 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_history") +@ApiModel(value = "History对象") +public class History extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("用户编号") + @TableField("USER_ID") + private Integer userId; + + @ApiModelProperty("章节编号") + @TableField("CHAPTER_ID") + private Integer chapterId; + + @ApiModelProperty("试题编号") + @TableField("QUESTION_ID") + private Integer questionId; + + @ApiModelProperty("用户选择") + @TableField("USER_ANSWER") + private String userAnswer; + + @ApiModelProperty("是否正确 0-错误,1-正确") + @TableField("IS_RIGHT") + private String isRight; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField("CREATED_BY") + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField("UPDATED_BY") + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/history/mapper/HistoryMapper.java b/example/src/main/java/com/example/history/mapper/HistoryMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ee3bc4fed54b9fa140db5c91d90a451c08c5a5e3 --- /dev/null +++ b/example/src/main/java/com/example/history/mapper/HistoryMapper.java @@ -0,0 +1,17 @@ +package com.example.history.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.history.entity.History; + +import org.springframework.stereotype.Repository; + +/** + * 做题记录 Mapper 接口 + * + * @author limg + * @since 2021-02-15 + */ +@Repository +public interface HistoryMapper extends BaseMapper { + +} diff --git a/example/src/main/java/com/example/history/param/HistoryPageParam.java b/example/src/main/java/com/example/history/param/HistoryPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..e1a8062ff5d0a5fab57c7d1cc3332adff7ccc037 --- /dev/null +++ b/example/src/main/java/com/example/history/param/HistoryPageParam.java @@ -0,0 +1,23 @@ +package com.example.history.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ * 做题记录 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-15 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "做题记录分页参数") +public class HistoryPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; +} diff --git a/example/src/main/java/com/example/history/service/HistoryService.java b/example/src/main/java/com/example/history/service/HistoryService.java new file mode 100644 index 0000000000000000000000000000000000000000..c878049384428d486d209308ea60f2811b9b0b22 --- /dev/null +++ b/example/src/main/java/com/example/history/service/HistoryService.java @@ -0,0 +1,34 @@ +package com.example.history.service; + +import com.example.history.entity.History; +import com.example.history.param.HistoryPageParam; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +/** + * 做题记录 服务类 + * + * @author limg + * @since 2021-02-15 + */ +public interface HistoryService extends BaseService { + + /** + * 保存 + * + * @param history + * @return + * @throws Exception + */ + boolean saveHistory(History history) throws Exception; + + /** + * 获取分页对象 + * + * @param historyPageParam + * @return + * @throws Exception + */ + Paging getHistoryPageList(HistoryPageParam historyPageParam) throws Exception; + +} diff --git a/example/src/main/java/com/example/history/service/impl/HistoryServiceImpl.java b/example/src/main/java/com/example/history/service/impl/HistoryServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b28077cfa3acdf33c28ccc0ec62784187c1400df --- /dev/null +++ b/example/src/main/java/com/example/history/service/impl/HistoryServiceImpl.java @@ -0,0 +1,46 @@ +package com.example.history.service.impl; + +import com.example.history.entity.History; +import com.example.history.mapper.HistoryMapper; +import com.example.history.service.HistoryService; +import com.example.history.param.HistoryPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * 做题记录 服务实现类 + * + * @author limg + * @since 2021-02-15 + */ +@Slf4j +@Service +public class HistoryServiceImpl extends BaseServiceImpl implements HistoryService { + + @Autowired + private HistoryMapper historyMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveHistory(History history) throws Exception { + return super.save(history); + } + + @Override + public Paging getHistoryPageList(HistoryPageParam historyPageParam) throws Exception { + Page page = new PageInfo<>(historyPageParam, OrderItem.desc(getLambdaColumn(History::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = historyMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + +} diff --git a/example/src/main/java/com/example/interceptor/UpdateUserInterceptor.java b/example/src/main/java/com/example/interceptor/UpdateUserInterceptor.java new file mode 100644 index 0000000000000000000000000000000000000000..54aed4e3fa212ce3ccc6f574f18d0f563c1df269 --- /dev/null +++ b/example/src/main/java/com/example/interceptor/UpdateUserInterceptor.java @@ -0,0 +1,44 @@ +package com.example.interceptor; + +import com.example.category.entity.Category; +import io.geekidea.boot.framework.util.LoginUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.SqlCommandType; +import org.apache.ibatis.plugin.Interceptor; +import org.apache.ibatis.plugin.Intercepts; +import org.apache.ibatis.plugin.Invocation; +import org.apache.ibatis.plugin.Signature; + +import java.lang.reflect.Field; + +@Slf4j +@Intercepts({@Signature( + type = Executor.class, + method = "update", + args = {MappedStatement.class, Object.class})}) +public class UpdateUserInterceptor implements Interceptor { + @Override + public Object intercept(Invocation invocation) throws Throwable { + + MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; + SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType(); + Object parameter = invocation.getArgs()[1]; + if (parameter instanceof Category) { + log.info("更新人"); + } + Field[] declaredFields = parameter.getClass().getDeclaredFields(); + for (Field field : declaredFields) { + log.info(field.getName()); + if ("updatedBy".equals(field.getName())) { + if (SqlCommandType.INSERT.equals(sqlCommandType) || SqlCommandType.UPDATE.equals(sqlCommandType)) { + field.setAccessible(true); + field.set(parameter, LoginUtil.getUserId()); + } + } + } + + return invocation.proceed(); + } +} diff --git a/example/src/main/java/com/example/notes/controller/NotesController.java b/example/src/main/java/com/example/notes/controller/NotesController.java new file mode 100644 index 0000000000000000000000000000000000000000..2b7f6a1b0a2c941bf9ec4e1a56300ee069705369 --- /dev/null +++ b/example/src/main/java/com/example/notes/controller/NotesController.java @@ -0,0 +1,140 @@ +package com.example.notes.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.notes.entity.Notes; +import com.example.notes.service.NotesService; +import com.example.notes.vo.WrongVo; +import com.example.question.param.QuestionPageParam; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.util.LoginUtil; +import lombok.extern.slf4j.Slf4j; +import com.example.notes.param.NotesPageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 错题记录 控制器 + * + * @author limg + * @since 2021-02-16 + */ +@Slf4j +@RestController +@RequestMapping("/notes") +@Module("notes") +@Api(value = "错题记录API", tags = {"错题记录"}) +public class NotesController extends BaseController { + + @Autowired + private NotesService notesService; + + @Lazy + @Autowired + private RedisTemplate redisTemplate; + + /** + * 添加错题记录 + */ + @PostMapping("/add") + @OperationLog(name = "添加错题记录", type = OperationLogType.ADD) + @ApiOperation(value = "添加错题记录", response = ApiResult.class) + public ApiResult addNotes(@Validated(Add.class) @RequestBody Notes notes) throws Exception { + boolean flag = notesService.saveNotes(notes); + return ApiResult.result(flag); + } + + /** + * 修改错题记录 + */ + @PostMapping("/update") + @OperationLog(name = "修改错题记录", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改错题记录", response = ApiResult.class) + public ApiResult updateNotes(@Validated(Update.class) @RequestBody Notes notes) throws Exception { + boolean flag = notesService.updateNotes(notes); + return ApiResult.result(flag); + } + + /** + * 删除错题记录 + */ + @PostMapping("/delete") + @OperationLog(name = "删除错题记录", type = OperationLogType.DELETE) + @ApiOperation(value = "删除错题记录", response = ApiResult.class) + public ApiResult deleteNotes(@RequestParam("id") String id) throws Exception { + boolean flag = false; + String appUserId = LoginUtil.getAppUserId(); + String key1 = String.format("wrongPaperList-%s-1", appUserId); + String key2 = String.format("wrongPaperList-%s-2", appUserId); + + if (StrUtil.isNotBlank(id)) { + flag = notesService.remove(new LambdaQueryWrapper().eq(Notes::getUserId, appUserId).eq(Notes::getQuestionId, id)); + } else { + flag = notesService.remove(new LambdaQueryWrapper().eq(Notes::getUserId, appUserId)); + } + redisTemplate.delete(key1); + redisTemplate.delete(key2); + return ApiResult.result(flag); + } + + /** + * 获取错题记录详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "错题记录详情", type = OperationLogType.INFO) + @ApiOperation(value = "错题记录详情", response = Notes.class) + public ApiResult getNotes(@PathVariable("id") Long id) throws Exception { + Notes notes = notesService.getById(id); + return ApiResult.ok(notes); + } + + /** + * 错题记录分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "错题记录分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "错题记录分页列表", response = Notes.class) + public ApiResult> getNotesPageList(@Validated @RequestBody NotesPageParam notesPageParam) throws Exception { + Paging paging = notesService.getNotesPageList(notesPageParam); + return ApiResult.ok(paging); + } + + /** + * 错题试卷列表 + */ + @GetMapping("/getWrongList") + @OperationLog(name = "错题试卷列表", type = OperationLogType.LIST) + @ApiOperation(value = "错题试卷列表", response = WrongVo.class) + public ApiResult> getWrongList(@RequestParam(value = "type", required = false) String type) throws Exception { + List list = notesService.getHistoryWrongList(type); + return ApiResult.ok(list); + } + + /** + * 错题列表 + */ + @PostMapping("/getWrongQuestionList") + @OperationLog(name = "错题列表", type = OperationLogType.PAGE) + @ApiOperation(value = "错题列表", response = QuestionPageVo.class) + public ApiResult> getWrongQuestionList(@Validated @RequestBody QuestionPageParam questionPageParam) throws Exception { + List list = notesService.getQuestionPageList(questionPageParam); + return ApiResult.ok(list); + } + +} + diff --git a/example/src/main/java/com/example/notes/entity/Notes.java b/example/src/main/java/com/example/notes/entity/Notes.java new file mode 100644 index 0000000000000000000000000000000000000000..f96680192957358e07a84d2ce99fd8f3466486e7 --- /dev/null +++ b/example/src/main/java/com/example/notes/entity/Notes.java @@ -0,0 +1,72 @@ +package com.example.notes.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * 错题记录 + * + * @author limg + * @since 2021-02-16 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_notes") +@ApiModel(value = "Notes对象") +public class Notes extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("用户编号") + @TableField("USER_ID") + private Integer userId; + + @ApiModelProperty("章节编号") + @TableField("CHAPTER_ID") + private Integer chapterId; + + @ApiModelProperty("试题编号") + @TableField("QUESTION_ID") + private Integer questionId; + + @ApiModelProperty("用户选择") + @TableField("USER_ANSWER") + private String userAnswer; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField("CREATED_BY") + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField("UPDATED_BY") + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/notes/mapper/NotesMapper.java b/example/src/main/java/com/example/notes/mapper/NotesMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d50c09653041b3610c859471a897833044ac3ee9 --- /dev/null +++ b/example/src/main/java/com/example/notes/mapper/NotesMapper.java @@ -0,0 +1,31 @@ +package com.example.notes.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.example.notes.entity.Notes; + +import com.example.notes.vo.WrongVo; +import com.example.question.vo.QuestionPageVo; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 错题记录 Mapper 接口 + * + * @author limg + * @since 2021-02-16 + */ +@Repository +public interface NotesMapper extends BaseMapper { + + // 根据试卷汇总错题集 + List selectWrongPaperList(String appUserId); + + // 根据章节汇总错题集 + List selectWrongChapterList(String appUserId); + + List selectWrongQuestionPageList(@Param("appUserId") String appUserId, @Param("chapterId") String chapterId, @Param("paperId") String paperId); +} diff --git a/example/src/main/java/com/example/notes/param/NotesPageParam.java b/example/src/main/java/com/example/notes/param/NotesPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..30bd95d6785b90882476506e169e954740a03269 --- /dev/null +++ b/example/src/main/java/com/example/notes/param/NotesPageParam.java @@ -0,0 +1,23 @@ +package com.example.notes.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ * 错题记录 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-16 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "错题记录分页参数") +public class NotesPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; +} diff --git a/example/src/main/java/com/example/notes/service/NotesService.java b/example/src/main/java/com/example/notes/service/NotesService.java new file mode 100644 index 0000000000000000000000000000000000000000..23fd3be3c7cfe2718d419f6adfa03b62578dcbe0 --- /dev/null +++ b/example/src/main/java/com/example/notes/service/NotesService.java @@ -0,0 +1,68 @@ +package com.example.notes.service; + +import com.example.notes.entity.Notes; +import com.example.notes.param.NotesPageParam; +import com.example.notes.vo.WrongVo; +import com.example.question.param.QuestionPageParam; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +import java.util.List; + +/** + * 错题记录 服务类 + * + * @author limg + * @since 2021-02-16 + */ +public interface NotesService extends BaseService { + + /** + * 保存 + * + * @param notes + * @return + * @throws Exception + */ + boolean saveNotes(Notes notes) throws Exception; + + /** + * 修改 + * + * @param notes + * @return + * @throws Exception + */ + boolean updateNotes(Notes notes) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteNotes(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param notesPageParam + * @return + * @throws Exception + */ + Paging getNotesPageList(NotesPageParam notesPageParam) throws Exception; + + /** + * 获取错题列表 + * @param questionPageParam + * @return + * @throws Exception + */ + List getQuestionPageList(QuestionPageParam questionPageParam) throws Exception; + + List getHistoryWrongList(String type) throws Exception; + +} diff --git a/example/src/main/java/com/example/notes/service/impl/NotesServiceImpl.java b/example/src/main/java/com/example/notes/service/impl/NotesServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..47ad760b2ccd4516b79b607b2c78cd2e6c92cfad --- /dev/null +++ b/example/src/main/java/com/example/notes/service/impl/NotesServiceImpl.java @@ -0,0 +1,97 @@ +package com.example.notes.service.impl; + +import com.example.notes.entity.Notes; +import com.example.notes.mapper.NotesMapper; +import com.example.notes.service.NotesService; +import com.example.notes.param.NotesPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.notes.vo.WrongVo; +import com.example.question.param.QuestionPageParam; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.util.LoginUtil; +import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 错题记录 服务实现类 + * + * @author limg + * @since 2021-02-16 + */ +@Slf4j +@Service +public class NotesServiceImpl extends BaseServiceImpl implements NotesService { + + @Autowired + private NotesMapper notesMapper; + + @Lazy + @Autowired + private RedisTemplate redisTemplate; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveNotes(Notes notes) throws Exception { + return super.save(notes); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateNotes(Notes notes) throws Exception { + return super.updateById(notes); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteNotes(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getNotesPageList(NotesPageParam notesPageParam) throws Exception { + Page page = new PageInfo<>(notesPageParam, OrderItem.desc(getLambdaColumn(Notes::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = notesMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + + @Override + public List getQuestionPageList(QuestionPageParam questionPageParam) throws Exception { + List list = notesMapper.selectWrongQuestionPageList(LoginUtil.getAppUserId(), questionPageParam.getChapterId(), questionPageParam.getPaperId()); + return list; + } + + @Override + public List getHistoryWrongList(String type) throws Exception { + String appUserId = LoginUtil.getAppUserId(); + String key = String.format("wrongPaperList-%s-%s", appUserId, type); + List redisList = (List) redisTemplate.opsForValue().get(key); + if (redisList != null) { + return redisList; + } + List list; + // 按照章节分类 + if ("2".equals(type)) { + list = notesMapper.selectWrongChapterList(appUserId); + } else { + list = notesMapper.selectWrongPaperList(appUserId); + } + redisTemplate.opsForValue().set(key, list, 3, TimeUnit.DAYS); + + return list; + } + +} diff --git a/example/src/main/java/com/example/notes/vo/WrongVo.java b/example/src/main/java/com/example/notes/vo/WrongVo.java new file mode 100644 index 0000000000000000000000000000000000000000..201fb64919f75011b198de1efd8fe95162d89c12 --- /dev/null +++ b/example/src/main/java/com/example/notes/vo/WrongVo.java @@ -0,0 +1,24 @@ +package com.example.notes.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@Accessors(chain = true) +@ApiModel(value = "做错试卷列表对象", description = "小程序用户做错试题列表") +public class WrongVo implements Serializable { + private static final long serialVersionUID = -5160036959137826314L; + + @ApiModelProperty("章节编号") + private Integer id; + + @ApiModelProperty("章节名称") + private String name; + + @ApiModelProperty("错题数") + private Integer count; +} diff --git a/example/src/main/java/com/example/order/controller/ExampleOrderController.java b/example/src/main/java/com/example/order/controller/ExampleOrderController.java deleted file mode 100644 index f5de7e02994f2df525aca9f5f38b4c8ee67d46b2..0000000000000000000000000000000000000000 --- a/example/src/main/java/com/example/order/controller/ExampleOrderController.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2019-2029 geekidea(https://github.com/geekidea) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.order.controller; - -import com.example.order.entity.ExampleOrder; -import com.example.order.service.ExampleOrderService; -import lombok.extern.slf4j.Slf4j; -import com.example.order.param.ExampleOrderPageParam; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.common.param.IdParam; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.framework.core.validator.groups.Add; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; -import org.springframework.validation.annotation.Validated; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -/** - * 订单示例 控制器 - * - * @author geekidea - * @since 2020-03-27 - */ -@Slf4j -@RestController -@RequestMapping("/exampleOrder") -@Module("order") -@Api(value = "ExampleOrderAPI", tags = {"ExampleOrder"}) -public class ExampleOrderController extends BaseController { - - @Autowired - private ExampleOrderService exampleOrderService; - - /** - * 添加订单示例 - */ - @PostMapping("/add") - @OperationLog(name = "添加订单示例", type = OperationLogType.ADD) - @ApiOperation(value = "添加订单示例", response = ApiResult.class) - public ApiResult addExampleOrder(@Validated(Add.class) @RequestBody ExampleOrder exampleOrder) throws Exception { - boolean flag = exampleOrderService.saveExampleOrder(exampleOrder); - return ApiResult.result(flag); - } - - /** - * 修改订单示例 - */ - @PostMapping("/update") - @OperationLog(name = "修改订单示例", type = OperationLogType.UPDATE) - @ApiOperation(value = "修改订单示例", response = ApiResult.class) - public ApiResult updateExampleOrder(@Validated(Update.class) @RequestBody ExampleOrder exampleOrder) throws Exception { - boolean flag = exampleOrderService.updateExampleOrder(exampleOrder); - return ApiResult.result(flag); - } - - /** - * 删除订单示例 - */ - @PostMapping("/delete/{id}") - @OperationLog(name = "删除订单示例", type = OperationLogType.DELETE) - @ApiOperation(value = "删除订单示例", response = ApiResult.class) - public ApiResult deleteExampleOrder(@PathVariable("id") Long id) throws Exception { - boolean flag = exampleOrderService.deleteExampleOrder(id); - return ApiResult.result(flag); - } - - /** - * 获取订单示例详情 - */ - @GetMapping("/info/{id}") - @OperationLog(name = "订单示例详情", type = OperationLogType.INFO) - @ApiOperation(value = "订单示例详情", response = ExampleOrder.class) - public ApiResult getExampleOrder(@PathVariable("id") Long id) throws Exception { - ExampleOrder exampleOrder = exampleOrderService.getById(id); - return ApiResult.ok(exampleOrder); - } - - /** - * 订单示例分页列表 - */ - @PostMapping("/getPageList") - @OperationLog(name = "订单示例分页列表", type = OperationLogType.PAGE) - @ApiOperation(value = "订单示例分页列表", response = ExampleOrder.class) - public ApiResult> getExampleOrderPageList(@Validated @RequestBody ExampleOrderPageParam exampleOrderPageParam) throws Exception { - Paging paging = exampleOrderService.getExampleOrderPageList(exampleOrderPageParam); - return ApiResult.ok(paging); - } - -} - diff --git a/example/src/main/java/com/example/order/controller/OrderController.java b/example/src/main/java/com/example/order/controller/OrderController.java new file mode 100644 index 0000000000000000000000000000000000000000..bf2f8beb6a2b741630ae1a43ae8b919ab21b5770 --- /dev/null +++ b/example/src/main/java/com/example/order/controller/OrderController.java @@ -0,0 +1,144 @@ +package com.example.order.controller; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.category.entity.Category; +import com.example.category.service.CategoryService; +import com.example.order.entity.Order; +import com.example.order.param.CategoryOrderParam; +import com.example.order.service.OrderService; +import com.example.order.vo.OrderPageVo; +import com.example.order.vo.OrderVo; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.util.LoginUtil; +import lombok.extern.slf4j.Slf4j; +import com.example.order.param.OrderPageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.param.IdParam; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 订单表 控制器 + * + * @author limg + * @since 2021-02-20 + */ +@Slf4j +@RestController +@RequestMapping("/order") +@Module("order") +@Api(value = "订单表API", tags = {"订单表"}) +public class OrderController extends BaseController { + + @Autowired + private OrderService orderService; + + @Autowired + private CategoryService categoryService; + + /** + * 添加订单表 + */ + @PostMapping("/add") + @OperationLog(name = "添加订单表", type = OperationLogType.ADD) + @ApiOperation(value = "添加订单表", response = ApiResult.class) + public ApiResult addOrder(@Validated(Add.class) @RequestBody Order order) throws Exception { + boolean flag = orderService.saveOrder(order); + return ApiResult.result(flag); + } + + /** + * 提交专题订单 + */ + @PostMapping("/categoryOrder") + @OperationLog(name = "提交专题订单", type = OperationLogType.ADD) + @ApiOperation(value = "提交专题订单", response = ApiResult.class) + public ApiResult categoryOrder(@Validated @RequestBody CategoryOrderParam categoryOrderParam) throws Exception { + Category category = categoryService.getOne(new LambdaQueryWrapper().eq(Category::getCode, categoryOrderParam.getCode())); + + if (category == null) { + throw new BusinessException("专题不存在"); + } + + String format = DateUtil.format(new Date(),"yyyyMMddHHmmss"); + String numbers = RandomUtil.randomNumbers(5); + String orderId = format+numbers; + + Order order = new Order(); + order.setOrderId(orderId); + order.setOrderType("1"); + order.setGroupId(category.getCode()); + order.setAmount(category.getPrice()); + order.setUserId(LoginUtil.getAppUserId()); + order.setRemark(String.format("购买%s", category.getSubject())); + + boolean flag = orderService.saveOrder(order); + + if (!flag) { + throw new BusinessException("创建订单失败"); + } + + return ApiResult.ok(order); + } + + /** + * 删除订单表 + */ + @PostMapping("/delete/{id}") + @OperationLog(name = "删除订单表", type = OperationLogType.DELETE) + @ApiOperation(value = "删除订单表", response = ApiResult.class) + public ApiResult deleteOrder(@PathVariable("id") Long id) throws Exception { + boolean flag = orderService.deleteOrder(id); + return ApiResult.result(flag); + } + + /** + * 获取订单表详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "订单表详情", type = OperationLogType.INFO) + @ApiOperation(value = "订单表详情", response = Order.class) + public ApiResult getOrder(@PathVariable("id") Long id) throws Exception { + Order order = orderService.getById(id); + return ApiResult.ok(order); + } + + /** + * 订单表分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "订单表分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "订单表分页列表", response = Order.class) + public ApiResult> getOrderPageList(@Validated @RequestBody OrderPageParam orderPageParam) throws Exception { + Paging paging = orderService.getOrderPageList(orderPageParam); + return ApiResult.ok(paging); + } + + /** + * 订单表分页列表 + */ + @PostMapping("/getList") + @OperationLog(name = "用户订单列表", type = OperationLogType.PAGE) + @ApiOperation(value = "用户订单列表", response = Order.class) + public ApiResult> getWechatOrderPageList(@Validated @RequestBody OrderPageParam orderPageParam) throws Exception { + Paging paging = orderService.getOrderList(orderPageParam); + return ApiResult.ok(paging); + } + +} + diff --git a/example/src/main/java/com/example/order/entity/ExampleOrder.java b/example/src/main/java/com/example/order/entity/ExampleOrder.java deleted file mode 100644 index e7a0290b69d1ad833f73a22ee98d750bd83956f3..0000000000000000000000000000000000000000 --- a/example/src/main/java/com/example/order/entity/ExampleOrder.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2019-2029 geekidea(https://github.com/geekidea) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.order.entity; - -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; -import com.baomidou.mybatisplus.annotation.IdType; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.Version; -import com.baomidou.mybatisplus.annotation.TableId; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; - -/** - * 订单示例 - * - * @author geekidea - * @since 2020-03-27 - */ -@Data -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "ExampleOrder对象") -public class ExampleOrder extends BaseEntity { - private static final long serialVersionUID = 1L; - - @NotNull(message = "id不能为空", groups = {Update.class}) - @ApiModelProperty("主键") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @NotBlank(message = "订单名称不能为空") - @ApiModelProperty("订单名称") - private String name; - - @ApiModelProperty("订单编号") - private String orderNo; - - @ApiModelProperty("备注") - private String remark; - - @ApiModelProperty("状态,0:禁用,1:启用") - private Integer state; - - @ApiModelProperty("版本") - @Version - private Integer version; - - @ApiModelProperty("创建时间") - private Date createTime; - - @ApiModelProperty("修改时间") - private Date updateTime; - -} diff --git a/example/src/main/java/com/example/order/entity/Order.java b/example/src/main/java/com/example/order/entity/Order.java new file mode 100644 index 0000000000000000000000000000000000000000..1ff856704dedccc1dffd8ce679f1b11171e3258a --- /dev/null +++ b/example/src/main/java/com/example/order/entity/Order.java @@ -0,0 +1,98 @@ +package com.example.order.entity; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * 订单表 + * + * @author limg + * @since 2021-02-20 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_order") +@ApiModel(value = "Order对象") +public class Order extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("订单号") + @TableField("ORDER_ID") + private String orderId; + + @ApiModelProperty("用户编号") + @TableField("USER_ID") + private String userId; + + @ApiModelProperty("订单类型 1-购买试题,2-充值会员") + @TableField("ORDER_TYPE") + private String orderType; + + @ApiModelProperty("金额") + @TableField("AMOUNT") + private BigDecimal amount; + + @ApiModelProperty("试卷编号") + @TableField("PAPER_ID") + private Integer paperId; + + @ApiModelProperty("专题编号") + @TableField("GROUP_ID") + private String groupId; + + @ApiModelProperty("支付流水号") + @TableField("TRADE_NO") + private String tradeNo; + + @ApiModelProperty("状态 1-新建,2-支付成功,3-已取消") + @TableField("STATUS") + private String status; + + @ApiModelProperty("支付时间") + @TableField("PAY_TIME") + private Date payTime; + + @ApiModelProperty("备注") + @TableField("REMARK") + private String remark; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField("CREATED_BY") + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/order/mapper/ExampleOrderMapper.java b/example/src/main/java/com/example/order/mapper/ExampleOrderMapper.java deleted file mode 100644 index 3e677f412571e4359aabc34d3914dfae63af6370..0000000000000000000000000000000000000000 --- a/example/src/main/java/com/example/order/mapper/ExampleOrderMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2019-2029 geekidea(https://github.com/geekidea) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.order.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.example.order.entity.ExampleOrder; -import com.example.order.param.ExampleOrderPageParam; - -import org.springframework.stereotype.Repository; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.ibatis.annotations.Param; -import java.io.Serializable; - -/** - * 订单示例 Mapper 接口 - * - * @author geekidea - * @since 2020-03-27 - */ -@Repository -public interface ExampleOrderMapper extends BaseMapper { - - -} diff --git a/example/src/main/java/com/example/order/mapper/OrderMapper.java b/example/src/main/java/com/example/order/mapper/OrderMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..48b13fa64ef01ba9168720cf9b849f8e21bdc766 --- /dev/null +++ b/example/src/main/java/com/example/order/mapper/OrderMapper.java @@ -0,0 +1,30 @@ +package com.example.order.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.order.entity.Order; +import com.example.order.param.OrderPageParam; + +import com.example.order.vo.OrderPageVo; +import com.example.order.vo.OrderVo; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; + +/** + * 订单表 Mapper 接口 + * + * @author limg + * @since 2021-02-20 + */ +@Repository +public interface OrderMapper extends BaseMapper { + + + IPage selectUserOrder(Page page, @Param("userId") String userId); + + IPage selectOrderPage(Page page, @Param("param") OrderPageParam orderPageParam); +} diff --git a/example/src/main/java/com/example/order/param/CategoryOrderParam.java b/example/src/main/java/com/example/order/param/CategoryOrderParam.java new file mode 100644 index 0000000000000000000000000000000000000000..57ab1684ed633b22b45aca93939751bc122e24fd --- /dev/null +++ b/example/src/main/java/com/example/order/param/CategoryOrderParam.java @@ -0,0 +1,20 @@ +package com.example.order.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@Accessors(chain = true) +@ApiModel(value = "提交专题订单对象") +public class CategoryOrderParam implements Serializable { + private static final long serialVersionUID = 6278016382933563028L; + + @ApiModelProperty("专题编号") + @NotNull(message = "专题编号不能为空") + private String code; +} diff --git a/example/src/main/java/com/example/order/param/ExampleOrderPageParam.java b/example/src/main/java/com/example/order/param/ExampleOrderPageParam.java deleted file mode 100644 index 6b25f18d5d704776fde64d8eedc58cdecbffb638..0000000000000000000000000000000000000000 --- a/example/src/main/java/com/example/order/param/ExampleOrderPageParam.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2019-2029 geekidea(https://github.com/geekidea) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.order.param; - -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - *
- * 订单示例 分页参数对象
- * 
- * - * @author geekidea - * @date 2020-03-27 - */ -@Data -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "订单示例分页参数") -public class ExampleOrderPageParam extends BasePageOrderParam { - private static final long serialVersionUID = 6092080418269664419L; - - @ApiModelProperty("订单名称") - private String name; - - @ApiModelProperty("订单编号") - private String orderNo; - -} diff --git a/example/src/main/java/com/example/order/param/OrderPageParam.java b/example/src/main/java/com/example/order/param/OrderPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..5ef20e18bbcc54c9169699d3c222c7c0faaa7edc --- /dev/null +++ b/example/src/main/java/com/example/order/param/OrderPageParam.java @@ -0,0 +1,41 @@ +package com.example.order.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +import java.time.LocalDate; + +/** + *
+ * 订单表 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-20 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "订单表分页参数") +public class OrderPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("订单开始日期") + private LocalDate startDate; + + @ApiModelProperty("订单开始日期") + private LocalDate endDate; + + @ApiModelProperty("订单类型") + private Integer orderType; + + @ApiModelProperty("订单状态") + private Integer status; + + @ApiModelProperty("用户昵称") + private String nickName; +} diff --git a/example/src/main/java/com/example/order/service/ExampleOrderService.java b/example/src/main/java/com/example/order/service/ExampleOrderService.java deleted file mode 100644 index 3246ca71d0456c47127a2c1c91b9ba58883399fc..0000000000000000000000000000000000000000 --- a/example/src/main/java/com/example/order/service/ExampleOrderService.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2019-2029 geekidea(https://github.com/geekidea) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.order.service; - -import com.example.order.entity.ExampleOrder; -import com.example.order.param.ExampleOrderPageParam; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; - -/** - * 订单示例 服务类 - * - * @author geekidea - * @since 2020-03-27 - */ -public interface ExampleOrderService extends BaseService { - - /** - * 保存 - * - * @param exampleOrder - * @return - * @throws Exception - */ - boolean saveExampleOrder(ExampleOrder exampleOrder) throws Exception; - - /** - * 修改 - * - * @param exampleOrder - * @return - * @throws Exception - */ - boolean updateExampleOrder(ExampleOrder exampleOrder) throws Exception; - - /** - * 删除 - * - * @param id - * @return - * @throws Exception - */ - boolean deleteExampleOrder(Long id) throws Exception; - - - /** - * 获取分页对象 - * - * @param exampleOrderQueryParam - * @return - * @throws Exception - */ - Paging getExampleOrderPageList(ExampleOrderPageParam exampleOrderPageParam) throws Exception; - -} diff --git a/example/src/main/java/com/example/order/service/OrderService.java b/example/src/main/java/com/example/order/service/OrderService.java new file mode 100644 index 0000000000000000000000000000000000000000..4a3863101bd73e48d2d9b48c1545d9e5c85cd094 --- /dev/null +++ b/example/src/main/java/com/example/order/service/OrderService.java @@ -0,0 +1,56 @@ +package com.example.order.service; + +import com.example.order.entity.Order; +import com.example.order.param.OrderPageParam; +import com.example.order.vo.OrderPageVo; +import com.example.order.vo.OrderVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +/** + * 订单表 服务类 + * + * @author limg + * @since 2021-02-20 + */ +public interface OrderService extends BaseService { + + /** + * 保存 + * + * @param order + * @return + * @throws Exception + */ + boolean saveOrder(Order order) throws Exception; + + /** + * 修改 + * + * @param order + * @return + * @throws Exception + */ + boolean updateOrder(Order order) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteOrder(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param orderPageParam + * @return + * @throws Exception + */ + Paging getOrderPageList(OrderPageParam orderPageParam) throws Exception; + + Paging getOrderList(OrderPageParam orderPageParam) throws Exception; +} diff --git a/example/src/main/java/com/example/order/service/impl/ExampleOrderServiceImpl.java b/example/src/main/java/com/example/order/service/impl/ExampleOrderServiceImpl.java deleted file mode 100644 index f3b0880fe39af1268e995e98443fcb187573653b..0000000000000000000000000000000000000000 --- a/example/src/main/java/com/example/order/service/impl/ExampleOrderServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2019-2029 geekidea(https://github.com/geekidea) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.order.service.impl; - -import com.example.order.entity.ExampleOrder; -import com.example.order.mapper.ExampleOrderMapper; -import com.example.order.service.ExampleOrderService; -import com.example.order.param.ExampleOrderPageParam; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.metadata.OrderItem; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.commons.lang3.StringUtils; -import org.springframework.transaction.annotation.Transactional; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * 订单示例 服务实现类 - * - * @author geekidea - * @since 2020-03-27 - */ -@Slf4j -@Service -public class ExampleOrderServiceImpl extends BaseServiceImpl implements ExampleOrderService { - - @Autowired - private ExampleOrderMapper exampleOrderMapper; - - @Transactional(rollbackFor = Exception.class) - @Override - public boolean saveExampleOrder(ExampleOrder exampleOrder) throws Exception { - return super.save(exampleOrder); - } - - @Transactional(rollbackFor = Exception.class) - @Override - public boolean updateExampleOrder(ExampleOrder exampleOrder) throws Exception { - return super.updateById(exampleOrder); - } - - @Transactional(rollbackFor = Exception.class) - @Override - public boolean deleteExampleOrder(Long id) throws Exception { - return super.removeById(id); - } - - @Override - public Paging getExampleOrderPageList(ExampleOrderPageParam exampleOrderPageParam) throws Exception { - Page page = new PageInfo<>(exampleOrderPageParam, OrderItem.desc(getLambdaColumn(ExampleOrder::getCreateTime))); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - String keyword = exampleOrderPageParam.getKeyword(); - String name = exampleOrderPageParam.getName(); - String orderNo = exampleOrderPageParam.getOrderNo(); - // keyword模糊查询 - if (StringUtils.isNotBlank(keyword)) { - wrapper.like(ExampleOrder::getName, keyword).or().like(ExampleOrder::getOrderNo, keyword); - } - // name模糊查询 - if (StringUtils.isNotBlank(name)) { - wrapper.like(ExampleOrder::getName, name); - } - // 订单号模糊查询 - if (StringUtils.isNotBlank(orderNo)) { - wrapper.like(ExampleOrder::getOrderNo, orderNo); - } - IPage iPage = exampleOrderMapper.selectPage(page, wrapper); - return new Paging(iPage); - } - -} diff --git a/example/src/main/java/com/example/order/service/impl/OrderServiceImpl.java b/example/src/main/java/com/example/order/service/impl/OrderServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..823619c51bd60870563b89d6b951b6fe6a9eac99 --- /dev/null +++ b/example/src/main/java/com/example/order/service/impl/OrderServiceImpl.java @@ -0,0 +1,67 @@ +package com.example.order.service.impl; + +import com.example.order.entity.Order; +import com.example.order.mapper.OrderMapper; +import com.example.order.service.OrderService; +import com.example.order.param.OrderPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.order.vo.OrderPageVo; +import com.example.order.vo.OrderVo; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.util.LoginUtil; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * 订单表 服务实现类 + * + * @author limg + * @since 2021-02-20 + */ +@Slf4j +@Service +public class OrderServiceImpl extends BaseServiceImpl implements OrderService { + + @Autowired + private OrderMapper orderMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveOrder(Order order) throws Exception { + return super.save(order); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateOrder(Order order) throws Exception { + return super.updateById(order); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteOrder(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getOrderPageList(OrderPageParam orderPageParam) throws Exception { + Page page = new PageInfo<>(orderPageParam, OrderItem.desc(getLambdaColumn(Order::getCreatedTime))); + IPage iPage = orderMapper.selectOrderPage(page, orderPageParam); + return new Paging(iPage); + } + + @Override + public Paging getOrderList(OrderPageParam orderPageParam) throws Exception { + Page page = new PageInfo<>(orderPageParam, OrderItem.desc(getLambdaColumn(Order::getCreatedTime))); + IPage iPage = orderMapper.selectUserOrder(page, LoginUtil.getAppUserId()); + return new Paging(iPage); + } + +} diff --git a/example/src/main/java/com/example/order/vo/OrderPageVo.java b/example/src/main/java/com/example/order/vo/OrderPageVo.java new file mode 100644 index 0000000000000000000000000000000000000000..f3e33abcbe1d3630ed0a1835e9cc6bade620911b --- /dev/null +++ b/example/src/main/java/com/example/order/vo/OrderPageVo.java @@ -0,0 +1,51 @@ +package com.example.order.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@Data +@Accessors(chain = true) +@ApiModel(value = "OrderPageVo对象", description = "小程序订单列表对象") +public class OrderPageVo implements Serializable { + private static final long serialVersionUID = -8270719309957728936L; + + @ApiModelProperty("ID") + private Integer id; + + @ApiModelProperty("订单号") + private String orderId; + + @ApiModelProperty("用户编号") + private String userId; + + @ApiModelProperty("金额") + private BigDecimal amount; + + @ApiModelProperty("专题编号") + private String code; + + @ApiModelProperty("支付流水号") + private String tradeNo; + + @ApiModelProperty("状态 1-新建,2-支付成功,3-已取消") + private String status; + + @ApiModelProperty("订单创建时间") + private Date createdTime; + + @ApiModelProperty("专题名称") + private String subject; + + @ApiModelProperty("封面") + private String coverImg; + + @ApiModelProperty("描述") + private String remark; +} diff --git a/example/src/main/java/com/example/order/vo/OrderVo.java b/example/src/main/java/com/example/order/vo/OrderVo.java new file mode 100644 index 0000000000000000000000000000000000000000..4cc61d966a1dd3bd3b5213f68a2c55d3af7ac4c5 --- /dev/null +++ b/example/src/main/java/com/example/order/vo/OrderVo.java @@ -0,0 +1,50 @@ +package com.example.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@Data +@Accessors(chain = true) +@ApiModel(value = "OrderVo对象", description = "订单列表对象") +public class OrderVo implements Serializable { + private static final long serialVersionUID = -7797671947919534428L; + + @ApiModelProperty("ID") + private Integer id; + + @ApiModelProperty("订单号") + private String orderId; + + @ApiModelProperty("用户编号") + private String userId; + + @ApiModelProperty("用户昵称") + private String nickName; + + @ApiModelProperty("用户头像") + private String avatarUrl; + + @ApiModelProperty("金额") + private BigDecimal amount; + + @ApiModelProperty("支付流水号") + private String tradeNo; + + @ApiModelProperty("订单类型") + private String orderType; + + @ApiModelProperty("状态 1-新建,2-支付成功,3-已取消") + private String status; + + @ApiModelProperty("订单创建时间") + private Date createdTime; + + @ApiModelProperty("订单备注") + private String remark; +} diff --git a/example/src/main/java/com/example/paper/controller/PaperController.java b/example/src/main/java/com/example/paper/controller/PaperController.java new file mode 100644 index 0000000000000000000000000000000000000000..760d0bb9576705461ff096a432d1c6981a012519 --- /dev/null +++ b/example/src/main/java/com/example/paper/controller/PaperController.java @@ -0,0 +1,121 @@ +package com.example.paper.controller; + +import com.example.paper.entity.Paper; +import com.example.paper.service.PaperService; +import com.example.paper.vo.PaperAppVo; +import com.example.paper.vo.PaperQueryVo; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import lombok.extern.slf4j.Slf4j; +import com.example.paper.param.PaperPageParam; +import org.apache.shiro.SecurityUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 试卷实体 控制器 + * + * @author limg + * @since 2021-01-31 + */ +@Slf4j +@RestController +@RequestMapping("/paper") +@Module("paper") +@Api(value = "试卷实体API", tags = {"试卷实体"}) +public class PaperController extends BaseController { + + @Autowired + private PaperService paperService; + + /** + * 添加试卷实体 + */ + @PostMapping("/submit") + @OperationLog(name = "添加试卷实体", type = OperationLogType.ADD) + @ApiOperation(value = "添加试卷实体", response = ApiResult.class) + @CacheEvict(cacheNames = "p_paper", allEntries = true) + public ApiResult addPaper(@Validated(Add.class) @RequestBody Paper paper) throws Exception { + boolean flag = paper.insertOrUpdate(); + return ApiResult.result(flag); + } + + /** + * 修改试卷实体 + */ + @PostMapping("/update") + @OperationLog(name = "修改试卷实体", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改试卷实体", response = ApiResult.class) + @CacheEvict(cacheNames = "p_paper", allEntries = true) + public ApiResult updatePaper(@Validated(Update.class) @RequestBody Paper paper) throws Exception { + Paper paper1 = new Paper(); + paper1.setId(paper.getId()); + paper1.setIsOpen(paper.getIsOpen()); + boolean flag = paperService.updatePaper(paper1); + return ApiResult.result(flag); + } + + /** + * 删除试卷实体 + */ + @PostMapping("/delete/{id}") + @OperationLog(name = "删除试卷实体", type = OperationLogType.DELETE) + @ApiOperation(value = "删除试卷实体", response = ApiResult.class) + @CacheEvict(cacheNames = "p_paper", allEntries = true) + public ApiResult deletePaper(@PathVariable("id") Long id) throws Exception { + boolean flag = paperService.deletePaper(id); + return ApiResult.result(flag); + } + + /** + * 获取试卷实体详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "试卷实体详情", type = OperationLogType.INFO) + @ApiOperation(value = "试卷实体详情", response = Paper.class) + public ApiResult getPaper(@PathVariable("id") Long id) throws Exception { + Paper paper = paperService.getById(id); + return ApiResult.ok(paper); + } + + /** + * 试卷实体分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "试卷实体分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "试卷实体分页列表", response = Paper.class) + @Cacheable(cacheNames = "p_paper", key = "#paperPageParam.getPageIndex() " + + "+ '::' +#paperPageParam.getPageSize() " + + "+ ':' + #paperPageParam.getName() " + + "+ ':' + #paperPageParam.getCategoryId()") + public ApiResult> getPaperPageList(@Validated @RequestBody PaperPageParam paperPageParam) throws Exception { +// Paging paging = paperService.getPaperPageList(paperPageParam); + Paging paging = paperService.getPaperPageList(paperPageParam); + return ApiResult.ok(paging); + } + + + @GetMapping("/wechat/getOpenPaper") + @OperationLog(name = "获取开放试卷分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "获取开放试卷分页列表", response = Paper.class) + public ApiResult> getOpenPaperList(@RequestParam("categoryCode") String code) throws Exception { + List list = paperService.getOpenPaperList(code); + return ApiResult.ok(list); + } + +} + diff --git a/example/src/main/java/com/example/paper/entity/Paper.java b/example/src/main/java/com/example/paper/entity/Paper.java new file mode 100644 index 0000000000000000000000000000000000000000..c1c5caab655ba7dc10a79fa1a5ec735ad469e0a9 --- /dev/null +++ b/example/src/main/java/com/example/paper/entity/Paper.java @@ -0,0 +1,80 @@ +package com.example.paper.entity; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.util.Date; + +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.*; + +/** + * 试卷实体 + * + * @author limg + * @since 2021-01-31 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_paper") +@ApiModel(value = "Paper对象") +public class Paper extends Model { + private static final long serialVersionUID = 1L; + + @NotNull(message = "编号不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("试卷名称") + @TableField("PAPER_NAME") + @NotNull(message = "试卷名称不能为空", groups = Add.class) + private String paperName; + + @ApiModelProperty("是否开放") + @TableField("IS_OPEN") + private String isOpen; + + @ApiModelProperty("价格") + @TableField("PRICE") + @NotNull(message = "请输入价格", groups = Add.class) + @Min(value = 0, message = "价格不能小于0") + @Max(value = 99999, message = "价格不能超过99999") + private BigDecimal price; + + @ApiModelProperty("所属分类") + @TableField("CATEGORY_ID") + private String categoryId; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + @Version + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/paper/mapper/PaperMapper.java b/example/src/main/java/com/example/paper/mapper/PaperMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..1e83ac582252896e5f7c6526f3240ace536750ed --- /dev/null +++ b/example/src/main/java/com/example/paper/mapper/PaperMapper.java @@ -0,0 +1,36 @@ +package com.example.paper.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.paper.entity.Paper; +import com.example.paper.param.PaperPageParam; + +import com.example.paper.vo.PaperAppVo; +import com.example.paper.vo.PaperQueryVo; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; +import java.util.List; + +/** + * 试卷实体 Mapper 接口 + * + * @author limg + * @since 2021-01-31 + */ +@Repository +public interface PaperMapper extends BaseMapper { + + /** + * 获取分页对象 + * + * @param page + * @param paperPageParam + * @return + */ + IPage getPaperPageList(@Param("page") Page page, @Param("param") PaperPageParam paperPageParam); + + List getOpenPaperList(@Param("userId") String userId, @Param("code") String code); +} diff --git a/example/src/main/java/com/example/paper/param/PaperPageParam.java b/example/src/main/java/com/example/paper/param/PaperPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..aa056d15ffffa42587cf00aa96ca808d4ae2f0e2 --- /dev/null +++ b/example/src/main/java/com/example/paper/param/PaperPageParam.java @@ -0,0 +1,30 @@ +package com.example.paper.param; + +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *
+ * 试卷实体 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-01-31 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "试卷实体分页参数") +public class PaperPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("试卷名称") + private String name; + + @ApiModelProperty("试卷分类") + private String categoryId; +} diff --git a/example/src/main/java/com/example/paper/service/PaperService.java b/example/src/main/java/com/example/paper/service/PaperService.java new file mode 100644 index 0000000000000000000000000000000000000000..71282213c225f490ec74b888de4cdfd62c557416 --- /dev/null +++ b/example/src/main/java/com/example/paper/service/PaperService.java @@ -0,0 +1,59 @@ +package com.example.paper.service; + +import com.example.paper.entity.Paper; +import com.example.paper.param.PaperPageParam; +import com.example.paper.vo.PaperAppVo; +import com.example.paper.vo.PaperQueryVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +import java.util.List; + +/** + * 试卷实体 服务类 + * + * @author limg + * @since 2021-01-31 + */ +public interface PaperService extends BaseService { + + /** + * 保存 + * + * @param paper + * @return + * @throws Exception + */ + boolean savePaper(Paper paper) throws Exception; + + /** + * 修改 + * + * @param paper + * @return + * @throws Exception + */ + boolean updatePaper(Paper paper) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deletePaper(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param paperPageParam + * @return + * @throws Exception + */ + Paging getPaperPageList(PaperPageParam paperPageParam) throws Exception; + + List getOpenPaperList(String code) throws Exception; + +} diff --git a/example/src/main/java/com/example/paper/service/impl/PaperServiceImpl.java b/example/src/main/java/com/example/paper/service/impl/PaperServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..916d028c5cbcc6cd62908153646dc648d4012627 --- /dev/null +++ b/example/src/main/java/com/example/paper/service/impl/PaperServiceImpl.java @@ -0,0 +1,70 @@ +package com.example.paper.service.impl; + +import com.example.paper.entity.Paper; +import com.example.paper.mapper.PaperMapper; +import com.example.paper.service.PaperService; +import com.example.paper.param.PaperPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.paper.vo.PaperAppVo; +import com.example.paper.vo.PaperQueryVo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.util.LoginUtil; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +/** + * 试卷实体 服务实现类 + * + * @author limg + * @since 2021-01-31 + */ +@Slf4j +@Service +public class PaperServiceImpl extends BaseServiceImpl implements PaperService { + + @Autowired + private PaperMapper paperMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean savePaper(Paper paper) throws Exception { + return super.save(paper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updatePaper(Paper paper) throws Exception { + return super.updateById(paper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deletePaper(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getPaperPageList(PaperPageParam paperPageParam) throws Exception { + Page page = new PageInfo<>(paperPageParam, OrderItem.desc(getLambdaColumn(Paper::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// IPage iPage = paperMapper.selectPage(page, wrapper); + IPage iPage = paperMapper.getPaperPageList(page, paperPageParam); + return new Paging(iPage); + } + + @Override + public List getOpenPaperList(String code) throws Exception { + String userId = LoginUtil.getAppUserId(); + return paperMapper.getOpenPaperList(userId, code); + } + +} diff --git a/example/src/main/java/com/example/paper/vo/PaperAppVo.java b/example/src/main/java/com/example/paper/vo/PaperAppVo.java new file mode 100644 index 0000000000000000000000000000000000000000..b5a914204e3ad2cda329f5e0852ad5933413b912 --- /dev/null +++ b/example/src/main/java/com/example/paper/vo/PaperAppVo.java @@ -0,0 +1,38 @@ +package com.example.paper.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@Accessors(chain = true) +@ApiModel(value = "PaperAppVo对象", description = "小程序试卷对象") +public class PaperAppVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("试卷名称") + private String paperName; + + @ApiModelProperty("价格") + private BigDecimal price; + + @ApiModelProperty("试题数量") + private Integer count; + + @ApiModelProperty("记录编号") + private Long recordId; + + @ApiModelProperty("当前进度") + private Integer progress; + + @ApiModelProperty("正确数量") + private Integer correctCount; + +} diff --git a/example/src/main/java/com/example/paper/vo/PaperQueryVo.java b/example/src/main/java/com/example/paper/vo/PaperQueryVo.java new file mode 100644 index 0000000000000000000000000000000000000000..d11795fd30d32028bd403e9a9b0b1b1f487099e1 --- /dev/null +++ b/example/src/main/java/com/example/paper/vo/PaperQueryVo.java @@ -0,0 +1,49 @@ +package com.example.paper.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@Data +@Accessors(chain = true) +@ApiModel(value = "PaperQueryVo对象", description = "试卷查询对象") +public class PaperQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("试卷名称") + private String name; + + @ApiModelProperty("是否开放") + private String isOpen; + + @ApiModelProperty("价格") + private BigDecimal price; + + @ApiModelProperty("所属分类") + private String categoryId; + + @ApiModelProperty("试题数量") + private Integer count; + + @ApiModelProperty("创建人") + private String createdBy; + + @ApiModelProperty("创建时间") + private Date createdTime; + + @ApiModelProperty("更新人") + private String updatedBy; + + @ApiModelProperty("更新时间") + private Date updatedTime; +} diff --git a/example/src/main/java/com/example/question/controller/QuestionController.java b/example/src/main/java/com/example/question/controller/QuestionController.java new file mode 100644 index 0000000000000000000000000000000000000000..c717767482ed4ea77ed54a07a096b2af6af48259 --- /dev/null +++ b/example/src/main/java/com/example/question/controller/QuestionController.java @@ -0,0 +1,145 @@ +package com.example.question.controller; + +import com.example.question.entity.Question; +import com.example.question.param.QuestionAnswerParam; +import com.example.question.param.QuestionCategoryParam; +import com.example.question.param.QuestionParam; +import com.example.question.service.QuestionService; +import com.example.question.vo.QuestionCategoryPageVo; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import lombok.extern.slf4j.Slf4j; +import com.example.question.param.QuestionPageParam; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 题目信息 控制器 + * + * @author limg + * @since 2021-02-03 + */ +@Slf4j +@RestController +@RequestMapping("/question") +@Module("question") +@Api(value = "题目信息API", tags = {"题目信息"}) +public class QuestionController extends BaseController { + + @Autowired + private QuestionService questionService; + + /** + * 添加题目信息 + */ + @PostMapping("/submit") + @OperationLog(name = "添加题目信息", type = OperationLogType.ADD) + @ApiOperation(value = "添加题目信息", response = ApiResult.class) + @CacheEvict( value = "question", allEntries = true) + public ApiResult addQuestion(@Validated(Add.class) @RequestBody Question question) throws Exception { +// boolean flag = questionService.saveQuestion(question); + boolean flag = question.insertOrUpdate(); + return ApiResult.result(flag); + } + + /** + * 修改题目信息 + */ + @PostMapping("/update") + @OperationLog(name = "修改题目信息", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改题目信息", response = ApiResult.class) + @CacheEvict(value = "question", allEntries = true) + public ApiResult updateQuestion(@Validated(Update.class) @RequestBody Question question) throws Exception { + boolean flag = questionService.updateQuestion(question); + return ApiResult.result(flag); + } + + /** + * 删除题目信息 + */ + @PostMapping("/delete/{id}") + @OperationLog(name = "删除题目信息", type = OperationLogType.DELETE) + @ApiOperation(value = "删除题目信息", response = ApiResult.class) + @CacheEvict(value = "question", allEntries = true) + public ApiResult deleteQuestion(@PathVariable("id") Long id) throws Exception { + boolean flag = questionService.deleteQuestion(id); + return ApiResult.result(flag); + } + + @GetMapping("/maxorder/{pid}") + @OperationLog(name = "查询最大单号", type = OperationLogType.OTHER_QUERY) + @ApiOperation(value = "查询最大单号", response = ApiResult.class) + public ApiResult getMaxOrder(@PathVariable("pid") Long pid) throws Exception { + Integer order = questionService.getCountByPid(pid); + return ApiResult.ok(order + 1); + } + + /** + * 获取题目信息详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "题目信息详情", type = OperationLogType.INFO) + @ApiOperation(value = "题目信息详情", response = Question.class) + public ApiResult getQuestion(@PathVariable("id") Long id) throws Exception { + Question question = questionService.getById(id); + return ApiResult.ok(question); + } + + /** + * 题目信息分页列表-小程序端 + */ + @PostMapping("/getPageList") + @OperationLog(name = "题目信息分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "题目信息分页列表", response = Question.class) +// @Cacheable(cacheNames = "question", key = "#p0.toString()") + public ApiResult> getQuestionPageList(@Validated @RequestBody QuestionPageParam questionPageParam) throws Exception { + Paging paging = questionService.getQuestionPageList(questionPageParam); + return ApiResult.ok(paging); + } + + /** + * 专题详情页题目分页列表-小程序端 + */ + @PostMapping("/wechat/getPageList") + @OperationLog(name = "题目信息分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "题目信息分页列表", response = Question.class) + @Cacheable(cacheNames = "question", key = "#p0.toString()") + public ApiResult> getCategoryQuestionPageList(@Validated @RequestBody QuestionCategoryParam questionCategoryParam) throws Exception { + Paging paging = questionService.getCategoryQuestionPageList(questionCategoryParam); + return ApiResult.ok(paging); + } + + /** + * 题目分页列表-PC端 + */ + @PostMapping("/getList") + @OperationLog(name = "题目信息分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "题目信息分页列表", response = Question.class) + @Cacheable(value = "question", key = "#p0.toString()") + public ApiResult> getPageList(@Validated @RequestBody QuestionParam questionParam) throws Exception { + Paging paging = questionService.getPageList(questionParam); + return ApiResult.ok(paging); + } + + @PostMapping("/submitAnswer") + @OperationLog(name = "提交答案", type = OperationLogType.ADD) + @ApiOperation(value = "提交答案", response = Question.class) + public ApiResult submitAnswer(@Validated @RequestBody QuestionAnswerParam questionAnswerParam) throws Exception { + Boolean flag = questionService.sumitAnswer(questionAnswerParam); + return ApiResult.ok(flag); + } + +} + diff --git a/example/src/main/java/com/example/question/entity/Question.java b/example/src/main/java/com/example/question/entity/Question.java new file mode 100644 index 0000000000000000000000000000000000000000..d0193b4fc75b7b6b377cf32085abd038e82fd04f --- /dev/null +++ b/example/src/main/java/com/example/question/entity/Question.java @@ -0,0 +1,126 @@ +package com.example.question.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.util.Date; + +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 题目信息 + * + * @author limg + * @since 2021-02-03 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_question") +@ApiModel(value = "Question对象") +public class Question extends Model { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("题目编号") + @TableField("SERIAL") + private Integer serial; + + @ApiModelProperty("标题") + @TableField("SUBJECT") + @NotNull(message = "标题不能为空") + private String subject; + + @ApiModelProperty("标题-英文") + @TableField("SUBJECT_EN") + private String subjectEn; + + @ApiModelProperty("所属试卷") + @TableField("PAPER_ID") + private Integer paperId; + + @ApiModelProperty("图片") + @TableField("IMG_URL") + private String imgUrl; + + @ApiModelProperty("选项A") + @TableField("OPTION_A") + private String optionA; + + @ApiModelProperty("选项A-英文") + @TableField("OPTION_A_EN") + private String optionAEn; + + @ApiModelProperty("选项B") + @TableField("OPTION_B") + private String optionB; + + @ApiModelProperty("选项B-英文") + @TableField("OPTION_B_EN") + private String optionBEn; + + @ApiModelProperty("选项C") + @TableField("OPTION_C") + private String optionC; + + @ApiModelProperty("选项C-英文") + @TableField("OPTION_C_EN") + private String optionCEn; + + @ApiModelProperty("选项D") + @TableField("OPTION_D") + private String optionD; + + @ApiModelProperty("选项D-英文") + @TableField("OPTION_D_EN") + private String optionDEn; + + @ApiModelProperty("正确答案") + @TableField("ANSWER") + @NotNull(message = "请选择正确答案") + private String answer; + + @ApiModelProperty("解析") + @TableField("ANSWER_DETAIL") + private String answerDetail; + + @ApiModelProperty("所属过程组") + @TableField("GROUP_ID") + private String groupId; + + @ApiModelProperty("所属章节") + @TableField("CHAPTER_ID") + private Integer chapterId; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/question/mapper/QuestionMapper.java b/example/src/main/java/com/example/question/mapper/QuestionMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..6029249276a8ab8f5e2ef09ab0144a088488f423 --- /dev/null +++ b/example/src/main/java/com/example/question/mapper/QuestionMapper.java @@ -0,0 +1,37 @@ +package com.example.question.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.paper.param.PaperPageParam; +import com.example.paper.vo.PaperQueryVo; +import com.example.question.entity.Question; +import com.example.question.param.QuestionPageParam; + +import com.example.question.vo.QuestionCategoryPageVo; +import com.example.question.vo.QuestionPageVo; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; + +/** + * 题目信息 Mapper 接口 + * + * @author limg + * @since 2021-02-03 + */ +@Repository +public interface QuestionMapper extends BaseMapper { + + /** + * 获取分页对象 + * + * @param page + * @param paperPageParam + * @return + */ + IPage getQuestionPageList(@Param("page") Page page, @Param("param") QuestionPageParam paperPageParam, @Param("userId") String userId); + + IPage getQuestionCategoryPageList(@Param("page") Page page, @Param("groupId") String groupId); +} diff --git a/example/src/main/java/com/example/question/param/QuestionAnswerParam.java b/example/src/main/java/com/example/question/param/QuestionAnswerParam.java new file mode 100644 index 0000000000000000000000000000000000000000..9355502c0d13315b61f1a5ae86156dd48ee95c73 --- /dev/null +++ b/example/src/main/java/com/example/question/param/QuestionAnswerParam.java @@ -0,0 +1,40 @@ +package com.example.question.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *
+ * 题目信息 提交答案表单对象
+ * 
+ * + * @author limg + * @date 2021-02-03 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "提交答案表单对象") +public class QuestionAnswerParam implements Serializable { + private static final long serialVersionUID = 5364321420976152006L; + + @ApiModelProperty("试卷id") + private String paperId; + + @ApiModelProperty("考试id") + private Long recordId; + + @ApiModelProperty("试题id") + @NotNull(message = "试题id不能为空") + private Long questionId; + + @ApiModelProperty("用户选择的答案") + @NotNull(message = "答案不能为空") + private String answer; + +} diff --git a/example/src/main/java/com/example/question/param/QuestionCategoryParam.java b/example/src/main/java/com/example/question/param/QuestionCategoryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..ed71170ad6b1ea15596f0a369b4a9e8ab083b7ba --- /dev/null +++ b/example/src/main/java/com/example/question/param/QuestionCategoryParam.java @@ -0,0 +1,35 @@ +package com.example.question.param; + +import cn.hutool.core.text.StrFormatter; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.util.LoginUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "题目信息分页参数") +public class QuestionCategoryParam extends BasePageOrderParam { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("所属专题id") + @NotNull(message = "专题编号不能为空") + private String groupId; + + @Override + public String toString() { + String key = StrFormatter.format("{}-{}-{}", + this.getGroupId() == null ? "" : this.getGroupId(), + this.getPageIndex() == null ? "1" : this.getPageIndex(), + this.getPageSize() == null ? "10" : this.getPageSize()); + return key; + } + +} diff --git a/example/src/main/java/com/example/question/param/QuestionPageParam.java b/example/src/main/java/com/example/question/param/QuestionPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..1e17476fe6e5cc2279d228141587b588d25df47c --- /dev/null +++ b/example/src/main/java/com/example/question/param/QuestionPageParam.java @@ -0,0 +1,49 @@ +package com.example.question.param; + +import cn.hutool.core.text.StrFormatter; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.util.LoginUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *
+ * 题目信息 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-03 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "题目信息分页参数") +public class QuestionPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("试卷id") + private String paperId; + + @ApiModelProperty("所属专题id") + private String groupId; + + @ApiModelProperty("所属章节id") + private String chapterId; + + @Override + public String toString() { + String key = StrFormatter.format("{}-{}-{}-{}-{}", LoginUtil.getAppUserId(), + this.getChapterId() == null ? "" : this.getChapterId(), + this.getGroupId() == null ? "" : this.getGroupId(), + this.getPageIndex() == null ? "1" : this.getPageIndex(), + this.getPageSize() == null ? "10" : this.getPageSize()); + System.out.printf("key:", key); + return key; + } + +} diff --git a/example/src/main/java/com/example/question/param/QuestionParam.java b/example/src/main/java/com/example/question/param/QuestionParam.java new file mode 100644 index 0000000000000000000000000000000000000000..757733e2bb67ff66a5415d69530dc6de328fe8fc --- /dev/null +++ b/example/src/main/java/com/example/question/param/QuestionParam.java @@ -0,0 +1,44 @@ +package com.example.question.param; + +import cn.hutool.core.text.StrFormatter; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "题目信息分页参数") +public class QuestionParam extends BasePageOrderParam { + + private static final long serialVersionUID = 5431374571367066733L; + + @ApiModelProperty("试卷id") + private String paperId; + + @ApiModelProperty("标题") + private String subject; + + @ApiModelProperty("专项ID") + private String groupId; + + @ApiModelProperty("章节ID") + private String chapterId; + + @Override + public String toString() { + String key = StrFormatter.format("{}-{}-{}-{}-{}", this.getSubject() == null ? "" : this.getSubject(), + this.getChapterId() == null ? "" : this.getChapterId(), + this.getGroupId() == null ? "" : this.getGroupId(), + this.getPageIndex() == null ? "1" : this.getPageIndex(), + this.getPageSize() == null ? "10" : this.getPageSize()); + System.out.printf("key:", key); + return key; + } + +} diff --git a/example/src/main/java/com/example/question/service/QuestionService.java b/example/src/main/java/com/example/question/service/QuestionService.java new file mode 100644 index 0000000000000000000000000000000000000000..74294c37d71b1f31b5599c7266e5a5ff788a32a0 --- /dev/null +++ b/example/src/main/java/com/example/question/service/QuestionService.java @@ -0,0 +1,65 @@ +package com.example.question.service; + +import com.example.question.entity.Question; +import com.example.question.param.QuestionAnswerParam; +import com.example.question.param.QuestionCategoryParam; +import com.example.question.param.QuestionPageParam; +import com.example.question.param.QuestionParam; +import com.example.question.vo.QuestionCategoryPageVo; +import com.example.question.vo.QuestionPageVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +/** + * 题目信息 服务类 + * + * @author limg + * @since 2021-02-03 + */ +public interface QuestionService extends BaseService { + + /** + * 保存 + * + * @param question + * @return + * @throws Exception + */ + boolean saveQuestion(Question question) throws Exception; + + /** + * 修改 + * + * @param question + * @return + * @throws Exception + */ + boolean updateQuestion(Question question) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteQuestion(Long id) throws Exception; + + Integer getCountByPid(Long pid) throws Exception; + + + /** + * 获取分页对象 + * + * @param questionPageParam + * @return + * @throws Exception + */ + Paging getQuestionPageList(QuestionPageParam questionPageParam) throws Exception; + + Boolean sumitAnswer(QuestionAnswerParam questionAnswerParam) throws Exception; + + Paging getPageList(QuestionParam questionParam); + + Paging getCategoryQuestionPageList(QuestionCategoryParam questionCategoryParam) throws Exception; +} diff --git a/example/src/main/java/com/example/question/service/impl/QuestionServiceImpl.java b/example/src/main/java/com/example/question/service/impl/QuestionServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e64383557d12a352483186dba59756be84ba8368 --- /dev/null +++ b/example/src/main/java/com/example/question/service/impl/QuestionServiceImpl.java @@ -0,0 +1,187 @@ +package com.example.question.service.impl; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import com.example.history.entity.History; +import com.example.history.service.HistoryService; +import com.example.notes.entity.Notes; +import com.example.notes.service.NotesService; +import com.example.order.entity.Order; +import com.example.order.service.OrderService; +import com.example.question.entity.Question; +import com.example.question.mapper.QuestionMapper; +import com.example.question.param.QuestionAnswerParam; +import com.example.question.param.QuestionCategoryParam; +import com.example.question.param.QuestionParam; +import com.example.question.service.QuestionService; +import com.example.question.param.QuestionPageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.question.vo.QuestionCategoryPageVo; +import com.example.question.vo.QuestionPageVo; +import com.example.userPaper.entity.UserPaper; +import com.example.userPaper.service.UserPaperService; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.util.LoginUtil; +import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * 题目信息 服务实现类 + * + * @author limg + * @since 2021-02-03 + */ +@Slf4j +@Service +public class QuestionServiceImpl extends BaseServiceImpl implements QuestionService { + + @Autowired + private QuestionMapper questionMapper; + + @Lazy + @Autowired + private HistoryService historyService; + + @Lazy + @Autowired + private UserPaperService userPaperService; + + @Lazy + @Autowired + private NotesService notesService; + + @Lazy + @Autowired + private OrderService orderService; + + @Lazy + @Autowired + private RedisTemplate redisTemplate; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveQuestion(Question question) throws Exception { + return super.save(question); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateQuestion(Question question) throws Exception { + return super.updateById(question); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteQuestion(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Integer getCountByPid(Long pid) throws Exception { + return questionMapper.selectCount(new LambdaQueryWrapper().eq(Question::getPaperId, pid)); + } + + @Override +// @Cacheable(cacheNames = "question", key = "#p0") + public Paging getQuestionPageList(QuestionPageParam questionPageParam) throws Exception { + // 暂时取消是否购买的判断 +// if (questionPageParam.getGroupId() != null) { +// int count = orderService.count(new LambdaQueryWrapper() +// .eq(Order::getUserId, LoginUtil.getAppUserId()) +// .eq(Order::getGroupId, questionPageParam.getGroupId()) +// .eq(Order::getStatus, 2)); +// if (count < 1) { +// throw new BusinessException(401, "您还未购买该专题"); +// } +// } + Page page = new PageInfo<>(questionPageParam, OrderItem.asc(getLambdaColumn(Question::getSerial))); + IPage iPage = questionMapper.getQuestionPageList(page, questionPageParam, LoginUtil.getAppUserId()); + return new Paging(iPage); + } + + @Override + public Paging getCategoryQuestionPageList(QuestionCategoryParam questionCategoryParam) throws Exception { + Page page = new PageInfo<>(questionCategoryParam, OrderItem.asc(getLambdaColumn(Question::getSerial))); + IPage iPage = questionMapper.getQuestionCategoryPageList(page, questionCategoryParam.getGroupId()); + return new Paging(iPage); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean sumitAnswer(QuestionAnswerParam questionAnswerParam) throws Exception { + Question question = super.getById(questionAnswerParam.getQuestionId()); + if (question == null) { + throw new BusinessException("试题不存在"); + } + String appUserId = LoginUtil.getAppUserId(); + // 插入历史记录 + History history = new History(); + history.setChapterId(Convert.toInt(question.getChapterId())); + history.setQuestionId(question.getId()); + history.setUserAnswer(questionAnswerParam.getAnswer()); + history.setIsRight(questionAnswerParam.getAnswer().equals(question.getAnswer()) ? "1" : "0"); + history.setUserId(Convert.toInt(appUserId)); + boolean flag = historyService.saveOrUpdate(history, new LambdaQueryWrapper().eq(History::getQuestionId, question.getId()).eq(History::getUserId, appUserId)); + // 更新考试正确题数和当前进度 + UserPaper userPaper = userPaperService.getById(questionAnswerParam.getRecordId()); + if (userPaper != null) { + userPaper.setPaperId(questionAnswerParam.getPaperId()); + if (questionAnswerParam.getAnswer().equals(question.getAnswer())) { + userPaper.setCorrectCount(userPaper.getCorrectCount() + 1); + } else { + userPaper.setErrorCount(userPaper.getErrorCount() + 1); + } + userPaper.setProgress(question.getSerial()); + userPaper.setUserId(appUserId); + userPaperService.updateById(userPaper); + } + + // 如果答错,插入错题集 + if (!questionAnswerParam.getAnswer().equals(question.getAnswer())) { + Integer count = notesService.count(new LambdaQueryWrapper().eq(Notes::getUserId, appUserId).eq(Notes::getQuestionId, question.getId())); + if (count == 0) { + String key1 = String.format("wrongPaperList-%s-1", appUserId); + String key2 = String.format("wrongPaperList-%s-2", appUserId); + Notes notes = new Notes(); + notes.setChapterId(Convert.toInt(question.getChapterId())); + notes.setQuestionId(question.getId()); + notes.setUserAnswer(questionAnswerParam.getAnswer()); + notes.setUserId(Convert.toInt(appUserId)); + notesService.saveNotes(notes); + redisTemplate.delete(key1); + redisTemplate.delete(key2); + } + } + + return flag; + } + + @Override + public Paging getPageList(QuestionParam questionParam) { + Page page = new PageInfo<>(questionParam, OrderItem.asc(getLambdaColumn(Question::getId))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if(StrUtil.isNotEmpty(questionParam.getSubject())) { + wrapper.like(Question::getSubject, questionParam.getSubject()); + } + if(StrUtil.isNotEmpty(questionParam.getChapterId())) { + wrapper.eq(Question::getChapterId, questionParam.getChapterId()); + } + if(StrUtil.isNotEmpty(questionParam.getGroupId())) { + wrapper.eq(Question::getGroupId, questionParam.getGroupId()); + } + IPage iPage = questionMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + +} diff --git a/example/src/main/java/com/example/question/vo/QuestionCategoryPageVo.java b/example/src/main/java/com/example/question/vo/QuestionCategoryPageVo.java new file mode 100644 index 0000000000000000000000000000000000000000..9dc3ae26e96992a340621588b013ff1edbe8d978 --- /dev/null +++ b/example/src/main/java/com/example/question/vo/QuestionCategoryPageVo.java @@ -0,0 +1,21 @@ +package com.example.question.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@Accessors(chain = true) +@ApiModel(value = "QuestionPageVo对象", description = "小程序试题列表对象") +public class QuestionCategoryPageVo implements Serializable { + private static final long serialVersionUID = 2035660340076641198L; + + @ApiModelProperty("编号") + private Integer id; + + @ApiModelProperty("标题") + private String subject; +} diff --git a/example/src/main/java/com/example/question/vo/QuestionPageVo.java b/example/src/main/java/com/example/question/vo/QuestionPageVo.java new file mode 100644 index 0000000000000000000000000000000000000000..3c5e7405e182217a2a34690fb477f0b4735dae86 --- /dev/null +++ b/example/src/main/java/com/example/question/vo/QuestionPageVo.java @@ -0,0 +1,76 @@ +package com.example.question.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@Accessors(chain = true) +@ApiModel(value = "QuestionPageVo对象", description = "小程序试题列表对象") +public class QuestionPageVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("编号") + private Integer id; + + @ApiModelProperty("编号") + private Integer questionId; + + @ApiModelProperty("题目编号") + private Integer serial; + + @ApiModelProperty("标题") + private String subject; + + @ApiModelProperty("标题-英文") + private String subjectEn; + + @ApiModelProperty("所属试卷") + private Integer paperId; + + @ApiModelProperty("所属章节") + private Integer chapterId; + + @ApiModelProperty("图片") + private String imgUrl; + + @ApiModelProperty("选项A") + private String optionA; + + @ApiModelProperty("选项A-英文") + private String optionAEn; + + @ApiModelProperty("选项B") + private String optionB; + + @ApiModelProperty("选项B-英文") + private String optionBEn; + + @ApiModelProperty("选项C") + private String optionC; + + @ApiModelProperty("选项C-英文") + private String optionCEn; + + @ApiModelProperty("选项D") + private String optionD; + + @ApiModelProperty("选项D-英文") + private String optionDEn; + + @ApiModelProperty("正确答案") + private String answer; + + @ApiModelProperty("解析") + private String answerDetail; + + @ApiModelProperty("是否收藏") + private Boolean isFavorite; +} diff --git a/example/src/main/java/com/example/userPaper/controller/UserPaperController.java b/example/src/main/java/com/example/userPaper/controller/UserPaperController.java new file mode 100644 index 0000000000000000000000000000000000000000..d3aa24a39cd2a412619705744461b1120904a527 --- /dev/null +++ b/example/src/main/java/com/example/userPaper/controller/UserPaperController.java @@ -0,0 +1,108 @@ +package com.example.userPaper.controller; + +import com.example.userPaper.entity.UserPaper; +import com.example.userPaper.service.UserPaperService; +import com.example.userPaper.vo.UserPaperVo; +import com.example.userPaper.vo.UserRankVo; +import lombok.extern.slf4j.Slf4j; +import com.example.userPaper.param.UserPaperPageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.param.IdParam; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 用户考试表 控制器 + * + * @author limg + * @since 2021-02-14 + */ +@Slf4j +@RestController +@RequestMapping("/userPaper") +@Module("userPaper") +@Api(value = "用户考试表API", tags = {"用户考试表"}) +public class UserPaperController extends BaseController { + + @Autowired + private UserPaperService userPaperService; + + /** + * 添加用户考试表 + */ + @PostMapping("/add") + @OperationLog(name = "添加用户考试表", type = OperationLogType.ADD) + @ApiOperation(value = "添加用户考试表", response = ApiResult.class) + public ApiResult addUserPaper(@Validated(Add.class) @RequestBody UserPaper userPaper) throws Exception { + Integer id = userPaperService.saveUserPaper(userPaper); + return ApiResult.ok(id); + } + + /** + * 修改用户考试表 + */ + @PostMapping("/update") + @OperationLog(name = "修改用户考试表", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改用户考试表", response = ApiResult.class) + public ApiResult updateUserPaper(@Validated(Update.class) @RequestBody UserPaper userPaper) throws Exception { + boolean flag = userPaperService.updateUserPaper(userPaper); + return ApiResult.result(flag); + } + + /** + * 删除用户考试表 + */ + @PostMapping("/delete/{id}") + @OperationLog(name = "删除用户考试表", type = OperationLogType.DELETE) + @ApiOperation(value = "删除用户考试表", response = ApiResult.class) + public ApiResult deleteUserPaper(@PathVariable("id") Long id) throws Exception { + boolean flag = userPaperService.deleteUserPaper(id); + return ApiResult.result(flag); + } + + /** + * 获取用户考试表详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "用户考试表详情", type = OperationLogType.INFO) + @ApiOperation(value = "用户考试表详情", response = UserPaper.class) + public ApiResult getUserPaper(@PathVariable("id") Long id) throws Exception { + UserPaper userPaper = userPaperService.getById(id); + return ApiResult.ok(userPaper); + } + + /** + * 用户考试表分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "用户考试表分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "用户考试表分页列表", response = UserPaperVo.class) + public ApiResult> getUserPaperPageList(@Validated @RequestBody UserPaperPageParam userPaperPageParam) throws Exception { + Paging paging = userPaperService.getUserPaperPageList(userPaperPageParam); + return ApiResult.ok(paging); + } + + @GetMapping("/wechat/userRank") + @OperationLog(name = "用户考试排行", type = OperationLogType.PAGE) + @ApiOperation(value = "用户考试排行", response = UserPaper.class) + @Cacheable(value = "userRank", key = "#root.methodName") + public ApiResult> getRankList() throws Exception { + List list = userPaperService.getRankList(); + return ApiResult.ok(list); + } + +} + diff --git a/example/src/main/java/com/example/userPaper/entity/UserPaper.java b/example/src/main/java/com/example/userPaper/entity/UserPaper.java new file mode 100644 index 0000000000000000000000000000000000000000..79a26de6be3d1abcfb1fb2330cbde8aa581e9690 --- /dev/null +++ b/example/src/main/java/com/example/userPaper/entity/UserPaper.java @@ -0,0 +1,80 @@ +package com.example.userPaper.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * 用户考试表 + * + * @author limg + * @since 2021-02-14 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_user_paper") +@ApiModel(value = "UserPaper对象") +public class UserPaper extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("ID") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("用户编号") + @TableField("USER_ID") + private String userId; + + @ApiModelProperty("试卷编号") + @TableField("PAPER_ID") + private String paperId; + + @ApiModelProperty("当前进度") + @TableField("PROGRESS") + private Integer progress; + + @ApiModelProperty("正确数") + @TableField("CORRECT_COUNT") + private Integer correctCount; + + @ApiModelProperty("错误数") + @TableField("ERROR_COUNT") + private Integer errorCount; + + @ApiModelProperty("总用时") + @TableField("TIME_COST") + private Integer timeCost; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField("CREATED_BY") + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField("UPDATED_BY") + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/example/src/main/java/com/example/userPaper/mapper/UserPaperMapper.java b/example/src/main/java/com/example/userPaper/mapper/UserPaperMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f4439a21a5307d2923e02d052df53ad8b35fee86 --- /dev/null +++ b/example/src/main/java/com/example/userPaper/mapper/UserPaperMapper.java @@ -0,0 +1,31 @@ +package com.example.userPaper.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.userPaper.entity.UserPaper; +import com.example.userPaper.param.UserPaperPageParam; + +import com.example.userPaper.vo.UserPaperVo; +import com.example.userPaper.vo.UserRankVo; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + * 用户考试表 Mapper 接口 + * + * @author limg + * @since 2021-02-14 + */ +@Repository +public interface UserPaperMapper extends BaseMapper { + + + List selectRank(); + + Integer getAvgScore(String appUserId); + + IPage selectUserPaperPage(Page page, @Param("param") UserPaperPageParam userPaperPageParam, @Param("appUserId") String appUserId); +} diff --git a/example/src/main/java/com/example/userPaper/param/UserPaperPageParam.java b/example/src/main/java/com/example/userPaper/param/UserPaperPageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..d46e1faa708f6e1d68f0d752bd8e7776a1183577 --- /dev/null +++ b/example/src/main/java/com/example/userPaper/param/UserPaperPageParam.java @@ -0,0 +1,30 @@ +package com.example.userPaper.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ * 用户考试表 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-14 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "用户考试表分页参数") +public class UserPaperPageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("昵称") + private String nickName; + + @ApiModelProperty("试卷id") + private Integer paperId; +} diff --git a/example/src/main/java/com/example/userPaper/service/UserPaperService.java b/example/src/main/java/com/example/userPaper/service/UserPaperService.java new file mode 100644 index 0000000000000000000000000000000000000000..8c4f522cd14b040ae5c8c6f108ae8281de14729d --- /dev/null +++ b/example/src/main/java/com/example/userPaper/service/UserPaperService.java @@ -0,0 +1,70 @@ +package com.example.userPaper.service; + +import com.example.userPaper.entity.UserPaper; +import com.example.userPaper.param.UserPaperPageParam; +import com.example.userPaper.vo.UserPaperVo; +import com.example.userPaper.vo.UserRankVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +import java.util.List; + +/** + * 用户考试表 服务类 + * + * @author limg + * @since 2021-02-14 + */ +public interface UserPaperService extends BaseService { + + /** + * 保存 + * + * @param userPaper + * @return + * @throws Exception + */ + Integer saveUserPaper(UserPaper userPaper) throws Exception; + + /** + * 修改 + * + * @param userPaper + * @return + * @throws Exception + */ + boolean updateUserPaper(UserPaper userPaper) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteUserPaper(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param userPaperPageParam + * @return + * @throws Exception + */ + Paging getUserPaperPageList(UserPaperPageParam userPaperPageParam) throws Exception; + + /** + * 获取用户排行 + * @return + * @throws Exception + */ + List getRankList() throws Exception; + + /** + * 获取用户平均分 + * @return + * @throws Exception + */ + Integer getUserAvgScore() throws Exception; +} diff --git a/example/src/main/java/com/example/userPaper/service/impl/UserPaperServiceImpl.java b/example/src/main/java/com/example/userPaper/service/impl/UserPaperServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..979859c93c40ef7373406d7cce47786ec0619d24 --- /dev/null +++ b/example/src/main/java/com/example/userPaper/service/impl/UserPaperServiceImpl.java @@ -0,0 +1,78 @@ +package com.example.userPaper.service.impl; + +import com.example.userPaper.entity.UserPaper; +import com.example.userPaper.mapper.UserPaperMapper; +import com.example.userPaper.service.UserPaperService; +import com.example.userPaper.param.UserPaperPageParam; +import com.example.userPaper.vo.UserPaperVo; +import com.example.userPaper.vo.UserRankVo; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.util.LoginUtil; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +/** + * 用户考试表 服务实现类 + * + * @author limg + * @since 2021-02-14 + */ +@Slf4j +@Service +public class UserPaperServiceImpl extends BaseServiceImpl implements UserPaperService { + + @Autowired + private UserPaperMapper userPaperMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public Integer saveUserPaper(UserPaper userPaper) throws Exception { + boolean flag = super.save(userPaper); + if (flag) { + return userPaper.getId(); + } + throw new Exception("添加失败"); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateUserPaper(UserPaper userPaper) throws Exception { + return super.updateById(userPaper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteUserPaper(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getUserPaperPageList(UserPaperPageParam userPaperPageParam) throws Exception { + Page page = new PageInfo<>(userPaperPageParam, OrderItem.desc(getLambdaColumn(UserPaper::getCreatedTime))); + String appUserId = LoginUtil.getAppUserId(); + IPage iPage = userPaperMapper.selectUserPaperPage(page, userPaperPageParam, appUserId); + return new Paging<>(iPage); + } + + @Override + public List getRankList() throws Exception { + List list = userPaperMapper.selectRank(); + return list; + } + + @Override + public Integer getUserAvgScore() throws Exception { + Integer score = userPaperMapper.getAvgScore(LoginUtil.getAppUserId()); + return score; + } + +} diff --git a/example/src/main/java/com/example/userPaper/vo/UserPaperVo.java b/example/src/main/java/com/example/userPaper/vo/UserPaperVo.java new file mode 100644 index 0000000000000000000000000000000000000000..0408767ab80b42b2048b97ceb31d2fa88ef440d2 --- /dev/null +++ b/example/src/main/java/com/example/userPaper/vo/UserPaperVo.java @@ -0,0 +1,50 @@ +package com.example.userPaper.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +@Data +@Accessors(chain = true) +@ApiModel(value = "UserPaperVo对象", description = "考试记录对象") +public class UserPaperVo implements Serializable { + + private static final long serialVersionUID = -6557771116248176541L; + + @ApiModelProperty("id") + private String id; + + @ApiModelProperty("用户编号") + private String userId; + + @ApiModelProperty("用户昵称") + private String nickName; + + @ApiModelProperty("用户头像") + private String avatarUrl; + + @ApiModelProperty("试卷编号") + private Integer paperId; + + @ApiModelProperty("试卷名称") + private String paperName; + + @ApiModelProperty("考试进度") + private Integer progress; + + @ApiModelProperty("正确题数") + private Integer correctCount; + + @ApiModelProperty("错误题数") + private Integer errorCount; + + @ApiModelProperty("耗时") + private Integer timeCost; + + @ApiModelProperty("createdTime") + private Date createdTime; +} diff --git a/example/src/main/java/com/example/userPaper/vo/UserRankVo.java b/example/src/main/java/com/example/userPaper/vo/UserRankVo.java new file mode 100644 index 0000000000000000000000000000000000000000..68c4a511896cc0fc4e05dbdb0e4e303a11d55c65 --- /dev/null +++ b/example/src/main/java/com/example/userPaper/vo/UserRankVo.java @@ -0,0 +1,27 @@ +package com.example.userPaper.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@Accessors(chain = true) +@ApiModel(value = "PaperRankVo对象", description = "考试排行对象") +public class UserRankVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("userId") + private String userId; + + @ApiModelProperty("nickName") + private String nickName; + + @ApiModelProperty("avatarUrl") + private String avatarUrl; + + @ApiModelProperty("count") + private Integer count; +} diff --git a/example/src/main/resources/mapper/category/PCategoryMapper.xml b/example/src/main/resources/mapper/category/PCategoryMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..91c73bc20ac9f876ade5c166b5b5bf80ff034c51 --- /dev/null +++ b/example/src/main/resources/mapper/category/PCategoryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/example/src/main/resources/mapper/chapter/ChapterMapper.xml b/example/src/main/resources/mapper/chapter/ChapterMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..30e9e95a914ac390a5cdac3e5c7a603263d78b45 --- /dev/null +++ b/example/src/main/resources/mapper/chapter/ChapterMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/example/src/main/resources/mapper/examDate/DateMapper.xml b/example/src/main/resources/mapper/examDate/DateMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..ddfce8bd3c39f9b4d161d03523fc6455bae127aa --- /dev/null +++ b/example/src/main/resources/mapper/examDate/DateMapper.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/example/src/main/resources/mapper/favorite/FavorMapper.xml b/example/src/main/resources/mapper/favorite/FavorMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..21d833c115c861b86937c3beeccf6fd4dcf2c62d --- /dev/null +++ b/example/src/main/resources/mapper/favorite/FavorMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/example/src/main/resources/mapper/foobar/FooBarMapper.xml b/example/src/main/resources/mapper/foobar/FooBarMapper.xml index 8fa137f9c32c98be7e12de110237d2143dae5890..36330e6c9c35bdd2caf6330f78085ab7a67c44e1 100644 --- a/example/src/main/resources/mapper/foobar/FooBarMapper.xml +++ b/example/src/main/resources/mapper/foobar/FooBarMapper.xml @@ -18,4 +18,7 @@ + diff --git a/example/src/main/resources/mapper/group/GroupMapper.xml b/example/src/main/resources/mapper/group/GroupMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..8bfdd25c3601177e0d0d9fb034c36b62ea56a557 --- /dev/null +++ b/example/src/main/resources/mapper/group/GroupMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/example/src/main/resources/mapper/history/HistoryMapper.xml b/example/src/main/resources/mapper/history/HistoryMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f2c97579040880f9e98a42e6b2b846da68506172 --- /dev/null +++ b/example/src/main/resources/mapper/history/HistoryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/example/src/main/resources/mapper/invite/InviteMapper.xml b/example/src/main/resources/mapper/invite/InviteMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..0bfa682b778910dcaf7158c8bdb2e4765cfa59c2 --- /dev/null +++ b/example/src/main/resources/mapper/invite/InviteMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/example/src/main/resources/mapper/notes/NotesMapper.xml b/example/src/main/resources/mapper/notes/NotesMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..8aacac802d44f47ccc16ee3b5267d7204f54aec4 --- /dev/null +++ b/example/src/main/resources/mapper/notes/NotesMapper.xml @@ -0,0 +1,72 @@ + + + + + + + + + + diff --git a/example/src/main/resources/mapper/order/ExampleOrderMapper.xml b/example/src/main/resources/mapper/order/ExampleOrderMapper.xml deleted file mode 100644 index 4c7321811b5088a48e921209e632c1729c1ffeed..0000000000000000000000000000000000000000 --- a/example/src/main/resources/mapper/order/ExampleOrderMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - diff --git a/example/src/main/resources/mapper/order/OrderMapper.xml b/example/src/main/resources/mapper/order/OrderMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c4c36303694b1df6d9d661c509a52f9304253517 --- /dev/null +++ b/example/src/main/resources/mapper/order/OrderMapper.xml @@ -0,0 +1,57 @@ + + + + + + diff --git a/example/src/main/resources/mapper/paper/PaperMapper.xml b/example/src/main/resources/mapper/paper/PaperMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..81e6ad9d62b3286b0f785b16fb4f9067c3372202 --- /dev/null +++ b/example/src/main/resources/mapper/paper/PaperMapper.xml @@ -0,0 +1,74 @@ + + + + + + + diff --git a/example/src/main/resources/mapper/question/QuestionMapper.xml b/example/src/main/resources/mapper/question/QuestionMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4801ea51d113e67580dfe390a097abe7050ee8a6 --- /dev/null +++ b/example/src/main/resources/mapper/question/QuestionMapper.xml @@ -0,0 +1,59 @@ + + + + + + + diff --git a/example/src/main/resources/mapper/userPaper/UserPaperMapper.xml b/example/src/main/resources/mapper/userPaper/UserPaperMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ba99015af1780968c4f4fc262b1baca1d80131f --- /dev/null +++ b/example/src/main/resources/mapper/userPaper/UserPaperMapper.xml @@ -0,0 +1,59 @@ + + + + + + + diff --git a/framework/pom.xml b/framework/pom.xml index 7412c99efe89a3f866b9c6deabaea962dd777ad9..58cf561e3862670807170d5e7fc1fb321dd92c4b 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT framework @@ -92,8 +92,24 @@ + - io.geekidea.springbootplus + com.qiniu + qiniu-java-sdk + ${qiniu.version} + + + + + + com.github.javen205 + IJPay-WxPay + ${ijapy.version} + + + + + io.geekidea.boot config diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiCode.java b/framework/src/main/java/io/geekidea/boot/framework/common/api/ApiCode.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiCode.java rename to framework/src/main/java/io/geekidea/boot/framework/common/api/ApiCode.java index 1e0607f5062e5d1e83dc37e25a5c894264095ed7..9863b4c4826669b883105f35b9b7953b11b7e167 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiCode.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/api/ApiCode.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.api; +package io.geekidea.boot.framework.common.api; /** *

diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiResult.java b/framework/src/main/java/io/geekidea/boot/framework/common/api/ApiResult.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiResult.java rename to framework/src/main/java/io/geekidea/boot/framework/common/api/ApiResult.java index e076b8e8b967ef9175cfb0b053e33cc0c9086229..491ca1cfd5290f3187ef7121f4c77405d6d192fb 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiResult.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/api/ApiResult.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.api; +package io.geekidea.boot.framework.common.api; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonFormat; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/bean/ClientInfo.java b/framework/src/main/java/io/geekidea/boot/framework/common/bean/ClientInfo.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/bean/ClientInfo.java rename to framework/src/main/java/io/geekidea/boot/framework/common/bean/ClientInfo.java index 6cafa0eb18c28c2fd3e45412ffaf886b796199cb..7e055bcd00cc02e385550efbdfb77b39142402ce 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/bean/ClientInfo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/bean/ClientInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.bean; +package io.geekidea.boot.framework.common.bean; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/bean/DeviceInfo.java b/framework/src/main/java/io/geekidea/boot/framework/common/bean/DeviceInfo.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/bean/DeviceInfo.java rename to framework/src/main/java/io/geekidea/boot/framework/common/bean/DeviceInfo.java index cb087889c294081ab428f57ccb0be5673dbb69ce..c7cb76f2ca62a1f8ff5e0e5c08f21dffce4312cd 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/bean/DeviceInfo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/bean/DeviceInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.bean; +package io.geekidea.boot.framework.common.bean; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/BaseController.java b/framework/src/main/java/io/geekidea/boot/framework/common/controller/BaseController.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/BaseController.java rename to framework/src/main/java/io/geekidea/boot/framework/common/controller/BaseController.java index a37217e240dcb9a867ab7c6b6230f9c4be61a14b..e300df4e5208cc9b976fdc0181f206f182ae7dc0 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/BaseController.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/controller/BaseController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.controller; +package io.geekidea.boot.framework.common.controller; import lombok.extern.slf4j.Slf4j; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/CsrfController.java b/framework/src/main/java/io/geekidea/boot/framework/common/controller/CsrfController.java similarity index 85% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/CsrfController.java rename to framework/src/main/java/io/geekidea/boot/framework/common/controller/CsrfController.java index 0cc4f6687f727b80437c5037f452556fc04c371d..33c9848e4aa53f6fdb2d65b00ad753dac42cab4a 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/CsrfController.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/controller/CsrfController.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.controller; +package io.geekidea.boot.framework.common.controller; -import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore; -import io.geekidea.springbootplus.framework.util.UUIDUtil; +import io.geekidea.boot.framework.log.annotation.OperationLogIgnore; +import io.geekidea.boot.framework.util.UUIDUtil; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/EnumController.java b/framework/src/main/java/io/geekidea/boot/framework/common/controller/EnumController.java similarity index 86% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/EnumController.java rename to framework/src/main/java/io/geekidea/boot/framework/common/controller/EnumController.java index 5e279eda4293c03b4b740d1e6ccce805857d629d..cefb10d466f4fe3b68449598ef3745c47a5ab4a4 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/EnumController.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/controller/EnumController.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.controller; +package io.geekidea.boot.framework.common.controller; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.enums.BaseEnum; -import io.geekidea.springbootplus.framework.common.vo.EnumVo; -import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore; -import io.geekidea.springbootplus.framework.util.BaseEnumUtil; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.enums.BaseEnum; +import io.geekidea.boot.framework.common.vo.EnumVo; +import io.geekidea.boot.framework.log.annotation.OperationLogIgnore; +import io.geekidea.boot.framework.util.BaseEnumUtil; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -48,8 +48,8 @@ import java.util.concurrent.ConcurrentHashMap; public class EnumController { private static final List FRAMEWORK_ENUM_PACKAGES = Arrays.asList( - "io.geekidea.springbootplus.framework.common.enums", - "io.geekidea.springbootplus.system.enums"); + "io.geekidea.boot.framework.common.enums", + "io.geekidea.boot.system.enums"); /** * 枚举包路径 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/IndexController.java b/framework/src/main/java/io/geekidea/boot/framework/common/controller/IndexController.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/IndexController.java rename to framework/src/main/java/io/geekidea/boot/framework/common/controller/IndexController.java index 9031b6aba0b5993f7c8f9fc276dea3879ff1fab5..0f14086de2ff63f76cfd020a6cfb2e183a13b12e 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/controller/IndexController.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/controller/IndexController.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.controller; +package io.geekidea.boot.framework.common.controller; -import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore; +import io.geekidea.boot.framework.log.annotation.OperationLogIgnore; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/entity/BaseEntity.java b/framework/src/main/java/io/geekidea/boot/framework/common/entity/BaseEntity.java similarity index 86% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/entity/BaseEntity.java rename to framework/src/main/java/io/geekidea/boot/framework/common/entity/BaseEntity.java index 58d02fc7bb2075a101a531704014ac46f9159230..c56b91b1e4dd1682299f076510540f7cf205e44d 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/entity/BaseEntity.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/entity/BaseEntity.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.entity; +package io.geekidea.boot.framework.common.entity; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import io.swagger.annotations.ApiModel; import java.io.Serializable; +import java.util.List; /** * 实体父类 @@ -28,5 +30,5 @@ import java.io.Serializable; @ApiModel("BaseEntity") public abstract class BaseEntity implements Serializable{ private static final long serialVersionUID = -7176390653391227433L; - + } diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/enums/BaseEnum.java b/framework/src/main/java/io/geekidea/boot/framework/common/enums/BaseEnum.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/enums/BaseEnum.java rename to framework/src/main/java/io/geekidea/boot/framework/common/enums/BaseEnum.java index dfcc1286ffc580b104d9a068ae90bf22ba9ca1c4..116c50ad3aec3cb40e52d898731f9574aef15a4e 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/enums/BaseEnum.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/enums/BaseEnum.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.enums; +package io.geekidea.boot.framework.common.enums; /** diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/BusinessException.java b/framework/src/main/java/io/geekidea/boot/framework/common/exception/BusinessException.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/BusinessException.java rename to framework/src/main/java/io/geekidea/boot/framework/common/exception/BusinessException.java index 0b769d1ee73eb692bc5869f31fb2728ebc4ae003..792654c664629861fbf80dd1895322e3f50aa2ca 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/BusinessException.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/exception/BusinessException.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.exception; +package io.geekidea.boot.framework.common.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiCode; /** * 业务异常 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/DaoException.java b/framework/src/main/java/io/geekidea/boot/framework/common/exception/DaoException.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/DaoException.java rename to framework/src/main/java/io/geekidea/boot/framework/common/exception/DaoException.java index 015c5237f3e1b6e0c8b0791d3acffcff63b87aca..bb08109b8e1776eef1ade6cb43330a8363d2e584 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/DaoException.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/exception/DaoException.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.exception; +package io.geekidea.boot.framework.common.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiCode; /** * DAO异常 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/GlobalErrorController.java b/framework/src/main/java/io/geekidea/boot/framework/common/exception/GlobalErrorController.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/GlobalErrorController.java rename to framework/src/main/java/io/geekidea/boot/framework/common/exception/GlobalErrorController.java index dbdc25deffbd1622ad47aa9e63f8ae4079bfd58e..8c42330ddaa8313ca742fd40111c6dc2bf9ccdf5 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/GlobalErrorController.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/exception/GlobalErrorController.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.exception; +package io.geekidea.boot.framework.common.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiResult; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/SpringBootPlusConfigException.java b/framework/src/main/java/io/geekidea/boot/framework/common/exception/SpringBootPlusConfigException.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/SpringBootPlusConfigException.java rename to framework/src/main/java/io/geekidea/boot/framework/common/exception/SpringBootPlusConfigException.java index a7e7af33364cc53c4613c5c75824947d5cc04c00..10d9c00bdb1eb9125c9dbdee3c506a3a5558faab 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/SpringBootPlusConfigException.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/exception/SpringBootPlusConfigException.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.exception; +package io.geekidea.boot.framework.common.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiCode; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/SpringBootPlusException.java b/framework/src/main/java/io/geekidea/boot/framework/common/exception/SpringBootPlusException.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/SpringBootPlusException.java rename to framework/src/main/java/io/geekidea/boot/framework/common/exception/SpringBootPlusException.java index 46dc1a7c78cb44ed3b554287c0a9db21aba3a7bf..cada49f9d4abbdce1ec2c025516cc6712a1f0690 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/exception/SpringBootPlusException.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/exception/SpringBootPlusException.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.exception; +package io.geekidea.boot.framework.common.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiCode; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/param/IdParam.java b/framework/src/main/java/io/geekidea/boot/framework/common/param/IdParam.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/param/IdParam.java rename to framework/src/main/java/io/geekidea/boot/framework/common/param/IdParam.java index e5e706d8c9a86a8c087cc2a7573b0a3c5935dc04..61e0fcea76a2c1101600ae0f8690308c88a3d76c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/param/IdParam.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/param/IdParam.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.param; +package io.geekidea.boot.framework.common.param; import io.swagger.annotations.ApiModel; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/service/BaseService.java b/framework/src/main/java/io/geekidea/boot/framework/common/service/BaseService.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/service/BaseService.java rename to framework/src/main/java/io/geekidea/boot/framework/common/service/BaseService.java index 10c4a3f9e20b35b9c09c1cc3a244cd43f38d5f2a..63587a189cd8fa9d4660803c30a4f675c3e596e7 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/service/BaseService.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/service/BaseService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.service; +package io.geekidea.boot.framework.common.service; import com.baomidou.mybatisplus.extension.service.IService; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/service/impl/BaseServiceImpl.java b/framework/src/main/java/io/geekidea/boot/framework/common/service/impl/BaseServiceImpl.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/service/impl/BaseServiceImpl.java rename to framework/src/main/java/io/geekidea/boot/framework/common/service/impl/BaseServiceImpl.java index ee5122c920f58447aa8f69a4b2e1fdb859056942..508f251f9026351d5c7be97502051cdcd2104a8c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/service/impl/BaseServiceImpl.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/service/impl/BaseServiceImpl.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.service.impl; +package io.geekidea.boot.framework.common.service.impl; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.util.LambdaColumn; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.util.LambdaColumn; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/common/vo/EnumVo.java b/framework/src/main/java/io/geekidea/boot/framework/common/vo/EnumVo.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/common/vo/EnumVo.java rename to framework/src/main/java/io/geekidea/boot/framework/common/vo/EnumVo.java index e51618766b541a7c0d891952fca21538cf8d38b8..aeedec5dd02ebc65e1b2a0b518e5b7e48be3c428 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/common/vo/EnumVo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/common/vo/EnumVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.common.vo; +package io.geekidea.boot.framework.common.vo; import lombok.Data; import lombok.experimental.Accessors; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/ConverterConfig.java b/framework/src/main/java/io/geekidea/boot/framework/config/converter/ConverterConfig.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/ConverterConfig.java rename to framework/src/main/java/io/geekidea/boot/framework/config/converter/ConverterConfig.java index e1d9b7fb9ec2806ed6a56648fbde2374d83bc1cf..94d5613d351de29521bb06480fdd1e0579e4328b 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/ConverterConfig.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/converter/ConverterConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.converter; +package io.geekidea.boot.framework.config.converter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDateConverter.java b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDateConverter.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDateConverter.java rename to framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDateConverter.java index 8c54b50b0c7fd6988fb2f183f90bec8f7c99e89d..4f3d520fe89dec42e1b8ff7226ab49a51b6534b3 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDateConverter.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDateConverter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.converter; +package io.geekidea.boot.framework.config.converter; import org.springframework.core.convert.converter.Converter; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDateUtil.java b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDateUtil.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDateUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDateUtil.java index bc686d2c75cdd98d690b99c605615ca349dbde7f..25c34f2b9a0cb22f747b953f18ae860f06c52bb5 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDateUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDateUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.converter; +package io.geekidea.boot.framework.config.converter; import org.apache.commons.lang3.StringUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDoubleConverter.java b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDoubleConverter.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDoubleConverter.java rename to framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDoubleConverter.java index 071b08d6195b9f2da1d2dc63a0618dd47550f44e..5757f171e792b2201178bc0ec5d68cefd7532747 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDoubleConverter.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDoubleConverter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.converter; +package io.geekidea.boot.framework.config.converter; import org.springframework.core.convert.converter.Converter; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDoubleUtil.java b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDoubleUtil.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDoubleUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDoubleUtil.java index b8c90ea8be519619a11aed813bbe6eb29f964b2e..d58a398ddeb866c1437125e54e32006d6dc513ca 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToDoubleUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToDoubleUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.converter; +package io.geekidea.boot.framework.config.converter; import org.apache.commons.lang3.StringUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToIntegerConverter.java b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToIntegerConverter.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToIntegerConverter.java rename to framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToIntegerConverter.java index fad3132304115a5b224f4ec2cc5e0f4ef0f6ef6b..a47a8c7871a84bebdaa5299437fd0a95661ac8bb 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToIntegerConverter.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToIntegerConverter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.converter; +package io.geekidea.boot.framework.config.converter; import org.springframework.core.convert.converter.Converter; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToIntegerUtil.java b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToIntegerUtil.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToIntegerUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToIntegerUtil.java index e57da5ccc5833c725eb093cb8ae7e75d9a909afc..27ba3c056b9f1acf4fe54d34cace88c30281b2a9 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/converter/StringToIntegerUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/converter/StringToIntegerUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.converter; +package io.geekidea.boot.framework.config.converter; import org.apache.commons.lang3.StringUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonDateDeserializer.java b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonDateDeserializer.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonDateDeserializer.java rename to framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonDateDeserializer.java index a72637e7154c90e00b1c8898db537ea61a0d65fe..9fb6692db0a73ebb9d1cdf18836df75fef382866 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonDateDeserializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonDateDeserializer.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.jackson.deserializer; +package io.geekidea.boot.framework.config.jackson.deserializer; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; -import io.geekidea.springbootplus.framework.config.converter.StringToDateUtil; +import io.geekidea.boot.framework.config.converter.StringToDateUtil; import java.io.IOException; import java.util.Date; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonDoubleDeserializer.java b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonDoubleDeserializer.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonDoubleDeserializer.java rename to framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonDoubleDeserializer.java index 40071291cfec4e6a1121aed94451843b3d791134..9f95372a7217fa46c5ddd67398366c56fb191767 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonDoubleDeserializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonDoubleDeserializer.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.jackson.deserializer; +package io.geekidea.boot.framework.config.jackson.deserializer; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; -import io.geekidea.springbootplus.framework.config.converter.StringToDoubleUtil; +import io.geekidea.boot.framework.config.converter.StringToDoubleUtil; import java.io.IOException; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonLocalDateTimeDeserializer.java b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonLocalDateTimeDeserializer.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonLocalDateTimeDeserializer.java rename to framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonLocalDateTimeDeserializer.java index 8fc5071c58939b4a82b1b8aff9e6ca8eb042e451..ba37e000c209362ea6ac9758a2d3cd9472ea7abc 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/deserializer/JacksonLocalDateTimeDeserializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/deserializer/JacksonLocalDateTimeDeserializer.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.jackson.deserializer; +package io.geekidea.boot.framework.config.jackson.deserializer; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; -import io.geekidea.springbootplus.config.constant.DatePattern; +import io.geekidea.boot.config.constant.DatePattern; import org.apache.commons.lang3.StringUtils; import java.io.IOException; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonDateSerializer.java b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonDateSerializer.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonDateSerializer.java rename to framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonDateSerializer.java index 394441a92f6f871fd4e5360f572e145db0be4d39..600824b8880e675fef53a55355db4b203a44ce24 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonDateSerializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonDateSerializer.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.jackson.serializer; +package io.geekidea.boot.framework.config.jackson.serializer; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -import io.geekidea.springbootplus.framework.util.DateUtil; +import io.geekidea.boot.framework.util.DateUtil; import java.io.IOException; import java.util.Date; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonIntegerDeserializer.java b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonIntegerDeserializer.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonIntegerDeserializer.java rename to framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonIntegerDeserializer.java index 785b02bea324a53b8503fea25a0c19b72fb821cb..ccf7bf0545d6278b938647070b1a813c81c12111 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonIntegerDeserializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonIntegerDeserializer.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.jackson.serializer; +package io.geekidea.boot.framework.config.jackson.serializer; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; -import io.geekidea.springbootplus.framework.config.converter.StringToIntegerUtil; +import io.geekidea.boot.framework.config.converter.StringToIntegerUtil; import java.io.IOException; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonLocalDateTimeSerializer.java b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonLocalDateTimeSerializer.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonLocalDateTimeSerializer.java rename to framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonLocalDateTimeSerializer.java index fb72cdd6e1f12ff4f508c0fc621b20e24f93231f..c74efb45950923137341897e9f9e3f5a13c811a3 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/config/jackson/serializer/JacksonLocalDateTimeSerializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/config/jackson/serializer/JacksonLocalDateTimeSerializer.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.config.jackson.serializer; +package io.geekidea.boot.framework.config.jackson.serializer; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -import io.geekidea.springbootplus.config.constant.DatePattern; +import io.geekidea.boot.config.constant.DatePattern; import java.io.IOException; import java.time.LocalDateTime; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/bean/RequestDetail.java b/framework/src/main/java/io/geekidea/boot/framework/core/bean/RequestDetail.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/bean/RequestDetail.java rename to framework/src/main/java/io/geekidea/boot/framework/core/bean/RequestDetail.java index b84b7da384ebfcfd4e13940c1165fcf008c3959c..2b1e2da8d2ceb308fac7cb955c70ad34d6dabb01 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/bean/RequestDetail.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/bean/RequestDetail.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.bean; +package io.geekidea.boot.framework.core.bean; import lombok.Data; import lombok.experimental.Accessors; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/filter/RequestDetailFilter.java b/framework/src/main/java/io/geekidea/boot/framework/core/filter/RequestDetailFilter.java similarity index 87% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/filter/RequestDetailFilter.java rename to framework/src/main/java/io/geekidea/boot/framework/core/filter/RequestDetailFilter.java index b76988b6278d5b32fbf7fbc6849ecdacc4c52d15..e6eb0c98a8df1d1a61077c62b7067390e8884f36 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/filter/RequestDetailFilter.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/filter/RequestDetailFilter.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.filter; +package io.geekidea.boot.framework.core.filter; -import io.geekidea.springbootplus.framework.core.bean.RequestDetail; -import io.geekidea.springbootplus.framework.core.util.RequestDetailThreadLocal; -import io.geekidea.springbootplus.framework.util.IpUtil; +import io.geekidea.boot.framework.core.bean.RequestDetail; +import io.geekidea.boot.framework.core.util.RequestDetailThreadLocal; +import io.geekidea.boot.framework.util.IpUtil; import lombok.extern.slf4j.Slf4j; import javax.servlet.*; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/interceptor/PermissionInterceptor.java b/framework/src/main/java/io/geekidea/boot/framework/core/interceptor/PermissionInterceptor.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/interceptor/PermissionInterceptor.java rename to framework/src/main/java/io/geekidea/boot/framework/core/interceptor/PermissionInterceptor.java index a3cfab0707bbbb5f79f1202b645441234339cad5..1ed27dc1d60aaf07cb2d24203e23b642e4c1ccf7 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/interceptor/PermissionInterceptor.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/interceptor/PermissionInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.interceptor; +package io.geekidea.boot.framework.core.interceptor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/BasePageOrderParam.java b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/BasePageOrderParam.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/BasePageOrderParam.java rename to framework/src/main/java/io/geekidea/boot/framework/core/pagination/BasePageOrderParam.java index 1d32e24f12759a7b5e050f300244ba10eba42271..b4bb0b0fa409afc829b999ad16de18747b7abcca 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/BasePageOrderParam.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/BasePageOrderParam.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.pagination; +package io.geekidea.boot.framework.core.pagination; import com.baomidou.mybatisplus.core.metadata.OrderItem; import io.swagger.annotations.ApiModel; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/BasePageParam.java b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/BasePageParam.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/BasePageParam.java rename to framework/src/main/java/io/geekidea/boot/framework/core/pagination/BasePageParam.java index 99b8b9aa003c5c1c2eeba1d8203ebd72618d0915..1a97ef6022b626bc4a420769fde3c0a006b943b7 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/BasePageParam.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/BasePageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.pagination; +package io.geekidea.boot.framework.core.pagination; -import io.geekidea.springbootplus.config.constant.CommonConstant; +import io.geekidea.boot.config.constant.CommonConstant; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/OrderMapping.java b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/OrderMapping.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/OrderMapping.java rename to framework/src/main/java/io/geekidea/boot/framework/core/pagination/OrderMapping.java index cd817eea88870aab95ca855e9ec90f726ec74542..5f98abf3683bd2bdbeaa76e9f9636e9314bcce6d 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/OrderMapping.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/OrderMapping.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.pagination; +package io.geekidea.boot.framework.core.pagination; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.google.common.base.CaseFormat; -import io.geekidea.springbootplus.framework.util.PropertyColumnUtil; +import io.geekidea.boot.framework.util.PropertyColumnUtil; import lombok.Data; import lombok.experimental.Accessors; import org.apache.commons.collections4.CollectionUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/PageInfo.java b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/PageInfo.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/PageInfo.java rename to framework/src/main/java/io/geekidea/boot/framework/core/pagination/PageInfo.java index 5f98428d8623014ba73d0068c7d70add201d5c01..72c7d7149a8951179f86fd83a58b2018967919a1 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/PageInfo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/PageInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.pagination; +package io.geekidea.boot.framework.core.pagination; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/Paging.java b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/Paging.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/Paging.java rename to framework/src/main/java/io/geekidea/boot/framework/core/pagination/Paging.java index 515b349607f2d7d9ebd7e4d83fc92a15d9d5cfcd..4e1e9b540f2ec464db50ccf7d0e50acdb15709d3 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/pagination/Paging.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/pagination/Paging.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.pagination; +package io.geekidea.boot.framework.core.pagination; import com.alibaba.fastjson.annotation.JSONField; import com.baomidou.mybatisplus.core.metadata.IPage; import com.fasterxml.jackson.annotation.JsonProperty; -import io.geekidea.springbootplus.config.constant.CommonConstant; +import io.geekidea.boot.config.constant.CommonConstant; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/util/RequestDetailThreadLocal.java b/framework/src/main/java/io/geekidea/boot/framework/core/util/RequestDetailThreadLocal.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/util/RequestDetailThreadLocal.java rename to framework/src/main/java/io/geekidea/boot/framework/core/util/RequestDetailThreadLocal.java index a4ba79c7ab7f67a83280c0c6d649e3fd9166035e..2290333f7e1ffc73a2234a547c3e4707265c6538 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/util/RequestDetailThreadLocal.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/util/RequestDetailThreadLocal.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.util; +package io.geekidea.boot.framework.core.util; -import io.geekidea.springbootplus.framework.core.bean.RequestDetail; +import io.geekidea.boot.framework.core.bean.RequestDetail; /** * 记录请求详情信息到当前线程中,可在任何地方获取 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/EnumTypeValidator.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/EnumTypeValidator.java similarity index 80% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/EnumTypeValidator.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/EnumTypeValidator.java index 4853e1ad60abfc6b2a62368a3ab387029a483d38..9c71cd64ef2b7483cf923feca005196e00c511bd 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/EnumTypeValidator.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/EnumTypeValidator.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator; +package io.geekidea.boot.framework.core.validator; -import io.geekidea.springbootplus.framework.common.enums.BaseEnum; -import io.geekidea.springbootplus.framework.common.exception.BusinessException; -import io.geekidea.springbootplus.framework.core.validator.constraints.EnumType; -import io.geekidea.springbootplus.framework.util.BaseEnumUtil; +import io.geekidea.boot.framework.common.enums.BaseEnum; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.core.validator.constraints.EnumType; +import io.geekidea.boot.framework.util.BaseEnumUtil; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/IdCardValidator.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/IdCardValidator.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/IdCardValidator.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/IdCardValidator.java index fd1476bae95f654f48f8dc25bfad41c63f75f3c6..5c8f3a471f4226b1af059bddfe9f91b172599f7b 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/IdCardValidator.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/IdCardValidator.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator; +package io.geekidea.boot.framework.core.validator; -import io.geekidea.springbootplus.framework.core.validator.constraints.IdCard; +import io.geekidea.boot.framework.core.validator.constraints.IdCard; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/PhoneValidator.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/PhoneValidator.java similarity index 90% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/PhoneValidator.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/PhoneValidator.java index a81ef49a812888d1fd665eda9496d0c5e901fbc4..8973a8f11eb5619c3210fcb3b4d547c24fc06731 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/PhoneValidator.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/PhoneValidator.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator; +package io.geekidea.boot.framework.core.validator; -import io.geekidea.springbootplus.framework.core.validator.constraints.Phone; +import io.geekidea.boot.framework.core.validator.constraints.Phone; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/EnumType.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/EnumType.java similarity index 86% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/EnumType.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/EnumType.java index f42908f1f86fd1e0f8835caec02a9286e6926d01..848065e5ebe5f93ecbd182400fa3545205faeadd 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/EnumType.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/EnumType.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator.constraints; +package io.geekidea.boot.framework.core.validator.constraints; -import io.geekidea.springbootplus.framework.common.enums.BaseEnum; -import io.geekidea.springbootplus.framework.core.validator.EnumTypeValidator; +import io.geekidea.boot.framework.common.enums.BaseEnum; +import io.geekidea.boot.framework.core.validator.EnumTypeValidator; import javax.validation.Constraint; import javax.validation.Payload; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/IdCard.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/IdCard.java similarity index 90% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/IdCard.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/IdCard.java index 5e33d3c08d24fd02534ab518725e9f7de617f0a0..9066d3b63f46d65aadeb6efb03549e061bb4ac2c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/IdCard.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/IdCard.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator.constraints; +package io.geekidea.boot.framework.core.validator.constraints; -import io.geekidea.springbootplus.framework.core.validator.IdCardValidator; +import io.geekidea.boot.framework.core.validator.IdCardValidator; import javax.validation.Constraint; import javax.validation.Payload; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/Phone.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/Phone.java similarity index 90% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/Phone.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/Phone.java index 7f2aacfe973cdbd06203cbb55bfabb848171af84..8c1e414daf2599d227ba7481ec9e64520fdccb6b 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/constraints/Phone.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/constraints/Phone.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator.constraints; +package io.geekidea.boot.framework.core.validator.constraints; -import io.geekidea.springbootplus.framework.core.validator.PhoneValidator; +import io.geekidea.boot.framework.core.validator.PhoneValidator; import javax.validation.Constraint; import javax.validation.Payload; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/groups/Add.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/groups/Add.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/groups/Add.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/groups/Add.java index ace305dc5b66cbb2df56a3671ef4851a301454b4..69eae7096b2d747d6d20cd19fd8d0e5be3bcb78a 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/groups/Add.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/groups/Add.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator.groups; +package io.geekidea.boot.framework.core.validator.groups; import javax.validation.groups.Default; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/groups/Update.java b/framework/src/main/java/io/geekidea/boot/framework/core/validator/groups/Update.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/groups/Update.java rename to framework/src/main/java/io/geekidea/boot/framework/core/validator/groups/Update.java index 9e7d41f97255fd73ceb6ff285be08523a17511c1..6c31ca7fa98cff55205ae0d73c2f6fa887b86e10 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/validator/groups/Update.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/validator/groups/Update.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.validator.groups; +package io.geekidea.boot.framework.core.validator.groups; import javax.validation.groups.Default; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssFilter.java b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssFilter.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssFilter.java rename to framework/src/main/java/io/geekidea/boot/framework/core/xss/XssFilter.java index 18ff7c82e77aedb0d47fb6efd5240cef567af5d2..e5c593e6b708b486c650f02b4c422e83400fc03c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssFilter.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssFilter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.xss; +package io.geekidea.boot.framework.core.xss; import lombok.extern.slf4j.Slf4j; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssHttpServletRequestWrapper.java b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssHttpServletRequestWrapper.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssHttpServletRequestWrapper.java rename to framework/src/main/java/io/geekidea/boot/framework/core/xss/XssHttpServletRequestWrapper.java index 83a9def178d18bf5820a0a6a584f67675c659849..295856bd57bd28119e121548f91e04c4582e7c6c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssHttpServletRequestWrapper.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssHttpServletRequestWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.xss; +package io.geekidea.boot.framework.core.xss; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.text.StringEscapeUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssJacksonDeserializer.java b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssJacksonDeserializer.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssJacksonDeserializer.java rename to framework/src/main/java/io/geekidea/boot/framework/core/xss/XssJacksonDeserializer.java index ecc36e6bfb7da380ba387407c0980993025d6b1a..19822ead5a1a3dc74a9e5ef66f901f78760c66e6 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssJacksonDeserializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssJacksonDeserializer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.xss; +package io.geekidea.boot.framework.core.xss; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssJacksonSerializer.java b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssJacksonSerializer.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssJacksonSerializer.java rename to framework/src/main/java/io/geekidea/boot/framework/core/xss/XssJacksonSerializer.java index 536329dfd6de001c56e6b0c75cd8540a8c220522..3702c2831d6be3675c912ddb5cfe0b741560aa3e 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/core/xss/XssJacksonSerializer.java +++ b/framework/src/main/java/io/geekidea/boot/framework/core/xss/XssJacksonSerializer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.core.xss; +package io.geekidea.boot.framework.core.xss; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/entity/IpAddress.java b/framework/src/main/java/io/geekidea/boot/framework/ip/entity/IpAddress.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/ip/entity/IpAddress.java rename to framework/src/main/java/io/geekidea/boot/framework/ip/entity/IpAddress.java index 873838f3494c27d94345216173f965284cd1cf76..51b5a23623fd3b3a86efbedd16f232fd15692e9f 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/entity/IpAddress.java +++ b/framework/src/main/java/io/geekidea/boot/framework/ip/entity/IpAddress.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.ip.entity; +package io.geekidea.boot.framework.ip.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.common.entity.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/mapper/IpAddressMapper.java b/framework/src/main/java/io/geekidea/boot/framework/ip/mapper/IpAddressMapper.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/ip/mapper/IpAddressMapper.java rename to framework/src/main/java/io/geekidea/boot/framework/ip/mapper/IpAddressMapper.java index d92f2b197f8a0597417582402e3097b647e30b46..b6c5350c4c60bba4c0908f574150c9dc4ae2a14a 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/mapper/IpAddressMapper.java +++ b/framework/src/main/java/io/geekidea/boot/framework/ip/mapper/IpAddressMapper.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.ip.mapper; +package io.geekidea.boot.framework.ip.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import io.geekidea.springbootplus.framework.ip.entity.IpAddress; +import io.geekidea.boot.framework.ip.entity.IpAddress; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/service/IpAddressService.java b/framework/src/main/java/io/geekidea/boot/framework/ip/service/IpAddressService.java similarity index 85% rename from framework/src/main/java/io/geekidea/springbootplus/framework/ip/service/IpAddressService.java rename to framework/src/main/java/io/geekidea/boot/framework/ip/service/IpAddressService.java index 9701a809bc4800eef61d87c1af2084188c0f72b6..e03ae165bd9ebda32cfa5b6d59bf987f602e3f2c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/service/IpAddressService.java +++ b/framework/src/main/java/io/geekidea/boot/framework/ip/service/IpAddressService.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.ip.service; +package io.geekidea.boot.framework.ip.service; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.ip.entity.IpAddress; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.ip.entity.IpAddress; /** * IP地址 服务类 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/service/impl/IpAddressServiceImpl.java b/framework/src/main/java/io/geekidea/boot/framework/ip/service/impl/IpAddressServiceImpl.java similarity index 82% rename from framework/src/main/java/io/geekidea/springbootplus/framework/ip/service/impl/IpAddressServiceImpl.java rename to framework/src/main/java/io/geekidea/boot/framework/ip/service/impl/IpAddressServiceImpl.java index 2c17bd001daba7ccafdb47943fd94a9385c4f467..dcc99f305d7ad3076c7b299d5f4508985357f3ca 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/ip/service/impl/IpAddressServiceImpl.java +++ b/framework/src/main/java/io/geekidea/boot/framework/ip/service/impl/IpAddressServiceImpl.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.ip.service.impl; +package io.geekidea.boot.framework.ip.service.impl; -import io.geekidea.springbootplus.config.constant.CommonConstant; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.ip.entity.IpAddress; -import io.geekidea.springbootplus.framework.ip.mapper.IpAddressMapper; -import io.geekidea.springbootplus.framework.ip.service.IpAddressService; +import io.geekidea.boot.config.constant.CommonConstant; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.ip.entity.IpAddress; +import io.geekidea.boot.framework.ip.mapper.IpAddressMapper; +import io.geekidea.boot.framework.ip.service.IpAddressService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/Module.java b/framework/src/main/java/io/geekidea/boot/framework/log/annotation/Module.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/Module.java rename to framework/src/main/java/io/geekidea/boot/framework/log/annotation/Module.java index 3226119d25df2c527905bb1842eb75c60335d152..c553a70391985ff21a7a6b068a4d3c552f8455f6 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/Module.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/annotation/Module.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.annotation; +package io.geekidea.boot.framework.log.annotation; import org.springframework.core.annotation.AliasFor; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/OperationLog.java b/framework/src/main/java/io/geekidea/boot/framework/log/annotation/OperationLog.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/OperationLog.java rename to framework/src/main/java/io/geekidea/boot/framework/log/annotation/OperationLog.java index f90112cc8ce87e45a414b4aa38cab851b57d6edd..e0279f32358ae225a6166c08e90c327567596869 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/OperationLog.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/annotation/OperationLog.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.annotation; +package io.geekidea.boot.framework.log.annotation; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.log.enums.OperationLogType; import org.springframework.core.annotation.AliasFor; import java.lang.annotation.*; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/OperationLogIgnore.java b/framework/src/main/java/io/geekidea/boot/framework/log/annotation/OperationLogIgnore.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/OperationLogIgnore.java rename to framework/src/main/java/io/geekidea/boot/framework/log/annotation/OperationLogIgnore.java index 1283704b50c736394b5f1ccdd2257fcf64988632..9244fa08777795bd75c1f91ce49b9a076b5060de 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/annotation/OperationLogIgnore.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/annotation/OperationLogIgnore.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.annotation; +package io.geekidea.boot.framework.log.annotation; import java.lang.annotation.*; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/aop/BaseLogAop.java b/framework/src/main/java/io/geekidea/boot/framework/log/aop/BaseLogAop.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/aop/BaseLogAop.java rename to framework/src/main/java/io/geekidea/boot/framework/log/aop/BaseLogAop.java index 1b0f38b830a3057a7c47a45962cc6f294638d00d..3b220b861a8a472879b291fe1d38aca5700604ed 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/aop/BaseLogAop.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/aop/BaseLogAop.java @@ -14,33 +14,33 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.aop; +package io.geekidea.boot.framework.log.aop; import com.alibaba.fastjson.JSONObject; import com.auth0.jwt.exceptions.JWTDecodeException; import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import io.geekidea.springbootplus.config.constant.CommonConstant; -import io.geekidea.springbootplus.config.properties.SpringBootPlusAopProperties; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.bean.ClientInfo; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusException; -import io.geekidea.springbootplus.framework.ip.entity.IpAddress; -import io.geekidea.springbootplus.framework.ip.service.IpAddressService; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore; -import io.geekidea.springbootplus.framework.log.bean.OperationLogInfo; -import io.geekidea.springbootplus.framework.log.bean.RequestInfo; -import io.geekidea.springbootplus.framework.log.entity.SysLoginLog; -import io.geekidea.springbootplus.framework.log.entity.SysOperationLog; -import io.geekidea.springbootplus.framework.log.service.SysLoginLogService; -import io.geekidea.springbootplus.framework.log.service.SysOperationLogService; -import io.geekidea.springbootplus.framework.shiro.service.LoginToken; -import io.geekidea.springbootplus.framework.shiro.service.LoginUsername; -import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil; -import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; -import io.geekidea.springbootplus.framework.util.*; +import io.geekidea.boot.config.constant.CommonConstant; +import io.geekidea.boot.config.properties.SpringBootPlusAopProperties; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.bean.ClientInfo; +import io.geekidea.boot.framework.common.exception.SpringBootPlusException; +import io.geekidea.boot.framework.ip.entity.IpAddress; +import io.geekidea.boot.framework.ip.service.IpAddressService; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.annotation.OperationLogIgnore; +import io.geekidea.boot.framework.log.bean.OperationLogInfo; +import io.geekidea.boot.framework.log.bean.RequestInfo; +import io.geekidea.boot.framework.log.entity.SysLoginLog; +import io.geekidea.boot.framework.log.entity.SysOperationLog; +import io.geekidea.boot.framework.log.service.SysLoginLogService; +import io.geekidea.boot.framework.log.service.SysOperationLogService; +import io.geekidea.boot.framework.shiro.service.LoginToken; +import io.geekidea.boot.framework.shiro.service.LoginUsername; +import io.geekidea.boot.framework.shiro.util.JwtTokenUtil; +import io.geekidea.boot.framework.shiro.util.JwtUtil; +import io.geekidea.boot.framework.util.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.collections4.CollectionUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/bean/OperationLogInfo.java b/framework/src/main/java/io/geekidea/boot/framework/log/bean/OperationLogInfo.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/bean/OperationLogInfo.java rename to framework/src/main/java/io/geekidea/boot/framework/log/bean/OperationLogInfo.java index 4841a37d3f3b2d0a62fa1712caedf02af143f4af..9afe0770b5ea6462afa2bcb9d6cd504323f3f17a 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/bean/OperationLogInfo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/bean/OperationLogInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.bean; +package io.geekidea.boot.framework.log.bean; import lombok.Data; import lombok.experimental.Accessors; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/bean/RequestInfo.java b/framework/src/main/java/io/geekidea/boot/framework/log/bean/RequestInfo.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/bean/RequestInfo.java rename to framework/src/main/java/io/geekidea/boot/framework/log/bean/RequestInfo.java index aa035f05146da02cc591d7ccc7df9c1cf490a196..c2191970af62f7344a3ac847cd3ef79d11abddf9 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/bean/RequestInfo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/bean/RequestInfo.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.bean; +package io.geekidea.boot.framework.log.bean; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonIgnore; -import io.geekidea.springbootplus.framework.ip.entity.IpAddress; +import io.geekidea.boot.framework.ip.entity.IpAddress; import lombok.Data; import lombok.experimental.Accessors; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/controller/SysLoginLogController.java b/framework/src/main/java/io/geekidea/boot/framework/log/controller/SysLoginLogController.java similarity index 75% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/controller/SysLoginLogController.java rename to framework/src/main/java/io/geekidea/boot/framework/log/controller/SysLoginLogController.java index f4e4e66f6fd4198be41191bebf62d3a4b2c37afd..6cfe7635501d298778adf8a81f00d3d75e7a60a6 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/controller/SysLoginLogController.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/controller/SysLoginLogController.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.controller; +package io.geekidea.boot.framework.log.controller; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.entity.SysLoginLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.framework.log.param.SysLoginLogPageParam; -import io.geekidea.springbootplus.framework.log.service.SysLoginLogService; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.entity.SysLoginLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.log.param.SysLoginLogPageParam; +import io.geekidea.boot.framework.log.service.SysLoginLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/controller/SysOperationLogController.java b/framework/src/main/java/io/geekidea/boot/framework/log/controller/SysOperationLogController.java similarity index 80% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/controller/SysOperationLogController.java rename to framework/src/main/java/io/geekidea/boot/framework/log/controller/SysOperationLogController.java index 9c6db9edf01272c581e5deb50bde3e9e198be5e3..76c947b6e93ea3986f2536b909e56f948ea72609 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/controller/SysOperationLogController.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/controller/SysOperationLogController.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.controller; +package io.geekidea.boot.framework.log.controller; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.entity.SysOperationLog; -import io.geekidea.springbootplus.framework.log.param.SysOperationLogPageParam; -import io.geekidea.springbootplus.framework.log.service.SysOperationLogService; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.entity.SysOperationLog; +import io.geekidea.boot.framework.log.param.SysOperationLogPageParam; +import io.geekidea.boot.framework.log.service.SysOperationLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/entity/SysLoginLog.java b/framework/src/main/java/io/geekidea/boot/framework/log/entity/SysLoginLog.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/entity/SysLoginLog.java rename to framework/src/main/java/io/geekidea/boot/framework/log/entity/SysLoginLog.java index 25ac5546a0e02464eb44ef9b04f789db3d285704..b20415035ffdce487ba0e937f83b0d1b21e47047 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/entity/SysLoginLog.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/entity/SysLoginLog.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.entity; +package io.geekidea.boot.framework.log.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.core.validator.groups.Update; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/entity/SysOperationLog.java b/framework/src/main/java/io/geekidea/boot/framework/log/entity/SysOperationLog.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/entity/SysOperationLog.java rename to framework/src/main/java/io/geekidea/boot/framework/log/entity/SysOperationLog.java index 87a7b602dc9632f5bbf65d93f267388d233d7daa..066c8812a3bc5115f711a6b0c5a2c1a8af9e4797 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/entity/SysOperationLog.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/entity/SysOperationLog.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.entity; +package io.geekidea.boot.framework.log.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.core.validator.groups.Update; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/enums/OperationLogType.java b/framework/src/main/java/io/geekidea/boot/framework/log/enums/OperationLogType.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/enums/OperationLogType.java rename to framework/src/main/java/io/geekidea/boot/framework/log/enums/OperationLogType.java index cdd141987efdc26132ffd8bef940b5d6000133be..6adb6c88b929ea590974d0252d5bffdda3fc6761 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/enums/OperationLogType.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/enums/OperationLogType.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.enums; +package io.geekidea.boot.framework.log.enums; -import io.geekidea.springbootplus.framework.common.enums.BaseEnum; +import io.geekidea.boot.framework.common.enums.BaseEnum; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/mapper/SysLoginLogMapper.java b/framework/src/main/java/io/geekidea/boot/framework/log/mapper/SysLoginLogMapper.java similarity index 87% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/mapper/SysLoginLogMapper.java rename to framework/src/main/java/io/geekidea/boot/framework/log/mapper/SysLoginLogMapper.java index 1ca535fb64cc44115f327cbfba0615c60904dfdd..671d28dbc217b3c099bd27d7379ae92022ce6920 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/mapper/SysLoginLogMapper.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/mapper/SysLoginLogMapper.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.mapper; +package io.geekidea.boot.framework.log.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import io.geekidea.springbootplus.framework.log.entity.SysLoginLog; +import io.geekidea.boot.framework.log.entity.SysLoginLog; import org.springframework.stereotype.Repository; /** diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/mapper/SysOperationLogMapper.java b/framework/src/main/java/io/geekidea/boot/framework/log/mapper/SysOperationLogMapper.java similarity index 87% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/mapper/SysOperationLogMapper.java rename to framework/src/main/java/io/geekidea/boot/framework/log/mapper/SysOperationLogMapper.java index 431aef35263eef66d63f6dad3e7a914437b2bb63..39f36a20f1f9a48ab5763c64104f3ad30ecf8146 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/mapper/SysOperationLogMapper.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/mapper/SysOperationLogMapper.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.mapper; +package io.geekidea.boot.framework.log.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import io.geekidea.springbootplus.framework.log.entity.SysOperationLog; +import io.geekidea.boot.framework.log.entity.SysOperationLog; import org.springframework.stereotype.Repository; /** diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/param/SysLoginLogPageParam.java b/framework/src/main/java/io/geekidea/boot/framework/log/param/SysLoginLogPageParam.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/param/SysLoginLogPageParam.java rename to framework/src/main/java/io/geekidea/boot/framework/log/param/SysLoginLogPageParam.java index c44e86245086e161fa2a4f54fec76e9f841c854b..a414d444eac0a28eb279559e045eea60337e45df 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/param/SysLoginLogPageParam.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/param/SysLoginLogPageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.param; +package io.geekidea.boot.framework.log.param; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/param/SysOperationLogPageParam.java b/framework/src/main/java/io/geekidea/boot/framework/log/param/SysOperationLogPageParam.java similarity index 89% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/param/SysOperationLogPageParam.java rename to framework/src/main/java/io/geekidea/boot/framework/log/param/SysOperationLogPageParam.java index cfb942099e40351912b87be23ea7fcbb54ba9b0c..bfb2f505e9f67319e0521cb50bbb6c3a7aad9998 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/param/SysOperationLogPageParam.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/param/SysOperationLogPageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.param; +package io.geekidea.boot.framework.log.param; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/SysLoginLogService.java b/framework/src/main/java/io/geekidea/boot/framework/log/service/SysLoginLogService.java similarity index 81% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/service/SysLoginLogService.java rename to framework/src/main/java/io/geekidea/boot/framework/log/service/SysLoginLogService.java index 1746e32a477d8ba42737c5317f06fb97381d68e1..238dfc782827ffd8392d8bd5ea31c54ddfc01c69 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/SysLoginLogService.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/service/SysLoginLogService.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.service; +package io.geekidea.boot.framework.log.service; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.entity.SysLoginLog; -import io.geekidea.springbootplus.framework.log.param.SysLoginLogPageParam; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.entity.SysLoginLog; +import io.geekidea.boot.framework.log.param.SysLoginLogPageParam; /** * 系统登录日志 服务类 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/SysOperationLogService.java b/framework/src/main/java/io/geekidea/boot/framework/log/service/SysOperationLogService.java similarity index 81% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/service/SysOperationLogService.java rename to framework/src/main/java/io/geekidea/boot/framework/log/service/SysOperationLogService.java index 1e11d710067673580b4506c621e42b6345ac8db0..5537a2a81cb5ff15310403960fb128dc50753176 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/SysOperationLogService.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/service/SysOperationLogService.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.service; +package io.geekidea.boot.framework.log.service; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.entity.SysOperationLog; -import io.geekidea.springbootplus.framework.log.param.SysOperationLogPageParam; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.entity.SysOperationLog; +import io.geekidea.boot.framework.log.param.SysOperationLogPageParam; /** * 系统操作日志 服务类 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/impl/SysLoginLogServiceImpl.java b/framework/src/main/java/io/geekidea/boot/framework/log/service/impl/SysLoginLogServiceImpl.java similarity index 80% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/service/impl/SysLoginLogServiceImpl.java rename to framework/src/main/java/io/geekidea/boot/framework/log/service/impl/SysLoginLogServiceImpl.java index 8d52c069f71fe9aaf87ff5fb92484fbd73943e68..e02fad01ad45e952c27bb73b7419b0806cfcc977 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/impl/SysLoginLogServiceImpl.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/service/impl/SysLoginLogServiceImpl.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.service.impl; +package io.geekidea.boot.framework.log.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.entity.SysLoginLog; -import io.geekidea.springbootplus.framework.log.mapper.SysLoginLogMapper; -import io.geekidea.springbootplus.framework.log.param.SysLoginLogPageParam; -import io.geekidea.springbootplus.framework.log.service.SysLoginLogService; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.entity.SysLoginLog; +import io.geekidea.boot.framework.log.mapper.SysLoginLogMapper; +import io.geekidea.boot.framework.log.param.SysLoginLogPageParam; +import io.geekidea.boot.framework.log.service.SysLoginLogService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/impl/SysOperationLogServiceImpl.java b/framework/src/main/java/io/geekidea/boot/framework/log/service/impl/SysOperationLogServiceImpl.java similarity index 81% rename from framework/src/main/java/io/geekidea/springbootplus/framework/log/service/impl/SysOperationLogServiceImpl.java rename to framework/src/main/java/io/geekidea/boot/framework/log/service/impl/SysOperationLogServiceImpl.java index 291f774be38ccee7c9e4d5b36f6a7ace734934ce..a3a6b34ed8ce524e869b2ad315ad0c40f71306b4 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/log/service/impl/SysOperationLogServiceImpl.java +++ b/framework/src/main/java/io/geekidea/boot/framework/log/service/impl/SysOperationLogServiceImpl.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.log.service.impl; +package io.geekidea.boot.framework.log.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.entity.SysOperationLog; -import io.geekidea.springbootplus.framework.log.mapper.SysOperationLogMapper; -import io.geekidea.springbootplus.framework.log.param.SysOperationLogPageParam; -import io.geekidea.springbootplus.framework.log.service.SysOperationLogService; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.entity.SysOperationLog; +import io.geekidea.boot.framework.log.mapper.SysOperationLogMapper; +import io.geekidea.boot.framework.log.param.SysOperationLogPageParam; +import io.geekidea.boot.framework.log.service.SysOperationLogService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/LoginRedisService.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/cache/LoginRedisService.java similarity index 88% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/LoginRedisService.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/cache/LoginRedisService.java index 2a7d7dc9bd41cdcb7087840b2a99bef21ae8cb53..a23f16c6c06f7dc231a08343ecf45d5b0d94965c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/LoginRedisService.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/cache/LoginRedisService.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.cache; +package io.geekidea.boot.framework.shiro.cache; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserRedisVo; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo; +import io.geekidea.boot.framework.shiro.jwt.JwtToken; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserRedisVo; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserVo; /** * 登录信息Redis缓存操作服务 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/impl/LoginRedisServiceImpl.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/cache/impl/LoginRedisServiceImpl.java similarity index 88% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/impl/LoginRedisServiceImpl.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/cache/impl/LoginRedisServiceImpl.java index 011c7cbb384df63c239e5eea3ef825ec10e5bdbd..541f2ba94f1fbe6a47f27d0024cc68110bd62be5 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/impl/LoginRedisServiceImpl.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/cache/impl/LoginRedisServiceImpl.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.cache.impl; - -import io.geekidea.springbootplus.config.constant.CommonRedisKey; -import io.geekidea.springbootplus.config.properties.JwtProperties; -import io.geekidea.springbootplus.framework.common.bean.ClientInfo; -import io.geekidea.springbootplus.framework.shiro.cache.LoginRedisService; -import io.geekidea.springbootplus.framework.shiro.convert.LoginSysUserVoConvert; -import io.geekidea.springbootplus.framework.shiro.convert.ShiroMapstructConvert; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; -import io.geekidea.springbootplus.framework.shiro.vo.JwtTokenRedisVo; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserRedisVo; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo; -import io.geekidea.springbootplus.framework.util.ClientInfoUtil; -import io.geekidea.springbootplus.framework.util.HttpServletRequestUtil; +package io.geekidea.boot.framework.shiro.cache.impl; + +import io.geekidea.boot.config.constant.CommonRedisKey; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.framework.common.bean.ClientInfo; +import io.geekidea.boot.framework.shiro.cache.LoginRedisService; +import io.geekidea.boot.framework.shiro.convert.LoginSysUserVoConvert; +import io.geekidea.boot.framework.shiro.convert.ShiroMapstructConvert; +import io.geekidea.boot.framework.shiro.jwt.JwtToken; +import io.geekidea.boot.framework.shiro.vo.JwtTokenRedisVo; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserRedisVo; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserVo; +import io.geekidea.boot.framework.util.ClientInfoUtil; +import io.geekidea.boot.framework.util.HttpServletRequestUtil; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/convert/LoginSysUserVoConvert.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/convert/LoginSysUserVoConvert.java similarity index 84% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/convert/LoginSysUserVoConvert.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/convert/LoginSysUserVoConvert.java index c1dc5e33148f91f257a9c8c89b0a66675f1db063..4ecdf0fe47ded1b9de80498587844c01c0a5d45a 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/convert/LoginSysUserVoConvert.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/convert/LoginSysUserVoConvert.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.convert; +package io.geekidea.boot.framework.shiro.convert; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserRedisVo; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserRedisVo; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserVo; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/convert/ShiroMapstructConvert.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/convert/ShiroMapstructConvert.java similarity index 85% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/convert/ShiroMapstructConvert.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/convert/ShiroMapstructConvert.java index 2b6fc0406cd6c62c310406b9c13e0c2ed0b0f541..53470ac285d9b648a44950fa219b8fbfe06b3fa2 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/convert/ShiroMapstructConvert.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/convert/ShiroMapstructConvert.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.convert; +package io.geekidea.boot.framework.shiro.convert; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; -import io.geekidea.springbootplus.framework.shiro.vo.JwtTokenRedisVo; +import io.geekidea.boot.framework.shiro.jwt.JwtToken; +import io.geekidea.boot.framework.shiro.vo.JwtTokenRedisVo; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/exception/ShiroConfigException.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/exception/ShiroConfigException.java similarity index 84% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/exception/ShiroConfigException.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/exception/ShiroConfigException.java index 71c3f7a43564ba2f7ac10bc3183dea0b6cfd5944..9c12bd60bfb62305adf54fc39caf932f6d6c588c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/exception/ShiroConfigException.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/exception/ShiroConfigException.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.exception; +package io.geekidea.boot.framework.shiro.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusException; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.exception.SpringBootPlusException; /** * Shiro配置异常 diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtCredentialsMatcher.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtCredentialsMatcher.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtCredentialsMatcher.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtCredentialsMatcher.java index 2d211f61cefa14bfe7a44701a5be920992790a45..bbc665894c91fa3a61317c3199ed7594d8e541ec 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtCredentialsMatcher.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtCredentialsMatcher.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.jwt; +package io.geekidea.boot.framework.shiro.jwt; -import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; +import io.geekidea.boot.framework.shiro.util.JwtUtil; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtFilter.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtFilter.java similarity index 83% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtFilter.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtFilter.java index bca4d2b8408f4265f617507d436991893d8b417c..b7ea1d5c37a674ec507e76861f557216a1e00002 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtFilter.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtFilter.java @@ -14,16 +14,18 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.jwt; - -import io.geekidea.springbootplus.config.properties.JwtProperties; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.shiro.cache.LoginRedisService; -import io.geekidea.springbootplus.framework.shiro.service.ShiroLoginService; -import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil; -import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; -import io.geekidea.springbootplus.framework.util.HttpServletResponseUtil; +package io.geekidea.boot.framework.shiro.jwt; + +import cn.hutool.core.util.ObjectUtil; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.shiro.cache.LoginRedisService; +import io.geekidea.boot.framework.shiro.service.ShiroLoginService; +import io.geekidea.boot.framework.shiro.util.JwtTokenUtil; +import io.geekidea.boot.framework.shiro.util.JwtUtil; +import io.geekidea.boot.framework.shiro.util.SaltUtil; +import io.geekidea.boot.framework.util.HttpServletResponseUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authc.AuthenticationException; @@ -89,6 +91,9 @@ public class JwtFilter extends AuthenticatingFilter { String salt; if (jwtProperties.isSaltCheck()){ salt = loginRedisService.getSalt(username); + if (salt == null) { + salt = SaltUtil.getSalt("666", jwtProperties); + } }else{ salt = jwtProperties.getSecret(); } @@ -133,6 +138,17 @@ public class JwtFilter extends AuthenticatingFilter { return true; } boolean allowed = false; +// String type = WebUtils.toHttp(request).getHeader("type"); +// if ("wechat".equals(type)){ +// String token = WebUtils.toHttp(request).getHeader("token"); +// if (ObjectUtil.isEmpty(token)){ +// return false; +// } +// log.info("token:{}",token); +// String newSalt = SaltUtil.getSalt("666", jwtProperties); +// return JwtUtil.verifyToken(token,newSalt); +// } + try { allowed = executeLogin(request, response); } catch (IllegalStateException e) { //not found any token diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtRealm.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtRealm.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtRealm.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtRealm.java index e9244913cbb4135a2a15a18fb6bb1a1f700d7bad..7037ca7e6b4c0fdf39318658973e2203aefd3321 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtRealm.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtRealm.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.jwt; +package io.geekidea.boot.framework.shiro.jwt; -import io.geekidea.springbootplus.framework.shiro.cache.LoginRedisService; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserRedisVo; +import io.geekidea.boot.framework.shiro.cache.LoginRedisService; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserRedisVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.SetUtils; import org.apache.commons.lang3.StringUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtToken.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtToken.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtToken.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtToken.java index 1eb668f06f0cc2d4a94fd45c80a2267f3564e078..857e4c6a3c32db98f5b6cd4380c313c9088b0853 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtToken.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/jwt/JwtToken.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.jwt; +package io.geekidea.boot.framework.shiro.jwt; import com.auth0.jwt.interfaces.DecodedJWT; -import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; -import io.geekidea.springbootplus.framework.util.IpUtil; +import io.geekidea.boot.framework.shiro.util.JwtUtil; +import io.geekidea.boot.framework.util.IpUtil; import lombok.Data; import lombok.experimental.Accessors; import org.apache.shiro.authc.HostAuthenticationToken; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/LoginToken.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/LoginToken.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/LoginToken.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/service/LoginToken.java index b61bd251ff467dd55d04715766e6f5a35292066e..2635db15c23b02f70f2004d1cb5a4370aba08605 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/LoginToken.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/LoginToken.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.service; +package io.geekidea.boot.framework.shiro.service; import java.io.Serializable; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/LoginUsername.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/LoginUsername.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/LoginUsername.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/service/LoginUsername.java index 52abca9d06cbcb61318d11fc6ae7abbed1c6af30..f49a35a18c921d59950c505e075f12048fbba661 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/LoginUsername.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/LoginUsername.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.service; +package io.geekidea.boot.framework.shiro.service; import java.io.Serializable; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/ShiroLoginService.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/ShiroLoginService.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/ShiroLoginService.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/service/ShiroLoginService.java index 577895dcae854ffc76bb337def1bb0fd568e9efc..1ff95a5efca7513f0d3ea536526bd05da12aa049 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/ShiroLoginService.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/ShiroLoginService.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.service; +package io.geekidea.boot.framework.shiro.service; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; +import io.geekidea.boot.framework.shiro.jwt.JwtToken; import javax.servlet.http.HttpServletResponse; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/impl/ShiroLoginServiceImpl.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/impl/ShiroLoginServiceImpl.java similarity index 85% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/impl/ShiroLoginServiceImpl.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/service/impl/ShiroLoginServiceImpl.java index cfe5cc2c9b5718b2f060db3098e42a613252d61e..6de76157cb16f06d420ac56d46f7494c708c8eb8 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/impl/ShiroLoginServiceImpl.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/service/impl/ShiroLoginServiceImpl.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.service.impl; +package io.geekidea.boot.framework.shiro.service.impl; -import io.geekidea.springbootplus.config.constant.CommonConstant; -import io.geekidea.springbootplus.config.properties.JwtProperties; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.shiro.cache.LoginRedisService; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; -import io.geekidea.springbootplus.framework.shiro.service.ShiroLoginService; -import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil; -import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; +import io.geekidea.boot.config.constant.CommonConstant; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.shiro.cache.LoginRedisService; +import io.geekidea.boot.framework.shiro.jwt.JwtToken; +import io.geekidea.boot.framework.shiro.service.ShiroLoginService; +import io.geekidea.boot.framework.shiro.util.JwtTokenUtil; +import io.geekidea.boot.framework.shiro.util.JwtUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/JwtTokenUtil.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/util/JwtTokenUtil.java similarity index 91% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/JwtTokenUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/util/JwtTokenUtil.java index 74ecc35525ef75c402e865c316ab476033b4c2c1..3d2134c42982a42925e01ba603520d26b37ca359 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/JwtTokenUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/util/JwtTokenUtil.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.util; +package io.geekidea.boot.framework.shiro.util; -import io.geekidea.springbootplus.config.properties.JwtProperties; -import io.geekidea.springbootplus.framework.util.HttpServletRequestUtil; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.framework.util.HttpServletRequestUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/JwtUtil.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/util/JwtUtil.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/JwtUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/util/JwtUtil.java index fe1c53fc968f2604e8e7c6fef3ed9ae1ef7a3102..972907868757fec027afacaecce5d0c9f2f3fa1a 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/JwtUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/util/JwtUtil.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.util; +package io.geekidea.boot.framework.shiro.util; import com.alibaba.fastjson.JSON; import com.auth0.jwt.JWT; import com.auth0.jwt.JWTVerifier; import com.auth0.jwt.algorithms.Algorithm; import com.auth0.jwt.interfaces.DecodedJWT; -import io.geekidea.springbootplus.config.constant.CommonConstant; -import io.geekidea.springbootplus.config.properties.JwtProperties; -import io.geekidea.springbootplus.framework.util.UUIDUtil; +import io.geekidea.boot.config.constant.CommonConstant; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.framework.util.UUIDUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/SaltUtil.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/util/SaltUtil.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/SaltUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/util/SaltUtil.java index 0424cfbc932f5db02f277a8b7284a015f51c5b4a..d5ffaf3a47e8ba700916d5e5ef5133dd09216ab4 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/util/SaltUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/util/SaltUtil.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.util; +package io.geekidea.boot.framework.shiro.util; -import io.geekidea.springbootplus.config.properties.JwtProperties; +import io.geekidea.boot.config.properties.JwtProperties; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.crypto.SecureRandomNumberGenerator; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/JwtTokenRedisVo.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/vo/JwtTokenRedisVo.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/JwtTokenRedisVo.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/vo/JwtTokenRedisVo.java index 085fa41b27a7d220eb6edcf4d66debb765bb7395..7d803b8a1f2678ab647b99cd6562d49bd38210f8 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/JwtTokenRedisVo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/vo/JwtTokenRedisVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.vo; +package io.geekidea.boot.framework.shiro.vo; import lombok.Data; import lombok.experimental.Accessors; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/LoginSysUserRedisVo.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/vo/LoginSysUserRedisVo.java similarity index 90% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/LoginSysUserRedisVo.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/vo/LoginSysUserRedisVo.java index ade7efe1473d9294d3330c0a35855315febf4fa7..73de27339889e9cd98ca8f41504b404cfb787657 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/LoginSysUserRedisVo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/vo/LoginSysUserRedisVo.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.vo; +package io.geekidea.boot.framework.shiro.vo; -import io.geekidea.springbootplus.framework.common.bean.ClientInfo; +import io.geekidea.boot.framework.common.bean.ClientInfo; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/LoginSysUserVo.java b/framework/src/main/java/io/geekidea/boot/framework/shiro/vo/LoginSysUserVo.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/LoginSysUserVo.java rename to framework/src/main/java/io/geekidea/boot/framework/shiro/vo/LoginSysUserVo.java index fa27c147fec2f2165a2e380ea903233974582209..d59be9a1711ef0878a8de1b94a24d0f957ec94b6 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/LoginSysUserVo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/shiro/vo/LoginSysUserVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.shiro.vo; +package io.geekidea.boot.framework.shiro.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/AnsiUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/AnsiUtil.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/AnsiUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/AnsiUtil.java index 9e4c5b1580cb5316c8bb8b7c8814f27e1552f7dd..738698dc4d57fdcc0838c4c761109322962ea2b5 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/AnsiUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/AnsiUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import lombok.extern.slf4j.Slf4j; import org.fusesource.jansi.Ansi; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/BaseEnumUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/BaseEnumUtil.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/BaseEnumUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/BaseEnumUtil.java index 5fd63fdd2fe66a2b2154d7fdb717b8fe9b93d568..75f9ba98f8a137f335cf9dca09f3f7ac3aefb411 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/BaseEnumUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/BaseEnumUtil.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; -import io.geekidea.springbootplus.framework.common.enums.BaseEnum; -import io.geekidea.springbootplus.framework.common.vo.EnumVo; +import io.geekidea.boot.framework.common.enums.BaseEnum; +import io.geekidea.boot.framework.common.vo.EnumVo; import org.apache.commons.collections4.MapUtils; import java.util.Collection; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/BrowserUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/BrowserUtil.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/BrowserUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/BrowserUtil.java index b69f3e09bbdc4f50ad507d3bc4b8c4081060a2bd..738cee4683bd883efa36115378e0426baa84dab9 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/BrowserUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/BrowserUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import javax.servlet.http.HttpServletRequest; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/ClientInfoUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/ClientInfoUtil.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/ClientInfoUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/ClientInfoUtil.java index d3229f522c437fce3dbfd3ca251dc7b56e96febb..ce6adcad4b626c789b787215d23f3b6708d65e13 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/ClientInfoUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/ClientInfoUtil.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import cn.hutool.http.useragent.UserAgent; import cn.hutool.http.useragent.UserAgentUtil; -import io.geekidea.springbootplus.config.constant.CommonConstant; -import io.geekidea.springbootplus.framework.common.bean.ClientInfo; -import io.geekidea.springbootplus.framework.common.bean.DeviceInfo; +import io.geekidea.boot.config.constant.CommonConstant; +import io.geekidea.boot.framework.common.bean.ClientInfo; +import io.geekidea.boot.framework.common.bean.DeviceInfo; import javax.servlet.http.HttpServletRequest; import java.util.regex.Matcher; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/ContentTypeUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/ContentTypeUtil.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/ContentTypeUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/ContentTypeUtil.java index 6d95c519979015018efe4ec37e0991dd338e1170..539edeea5ea0e243fae396e06d88f32680446528 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/ContentTypeUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/ContentTypeUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FilenameUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/DateUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/DateUtil.java similarity index 92% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/DateUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/DateUtil.java index 20c70a7d6dbc564533451629f23c269c54730f75..2df7b97969f834620182cc7b52b76d43b20a901c 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/DateUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/DateUtil.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; -import io.geekidea.springbootplus.config.constant.DatePattern; +import io.geekidea.boot.config.constant.DatePattern; import java.text.SimpleDateFormat; import java.util.Date; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/DownloadUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/DownloadUtil.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/DownloadUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/DownloadUtil.java index 58415ce2d86e76770d2993f527bc0eab2581e0d5..087383fe5eab3b92c30f5abbcef41b98735079db 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/DownloadUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/DownloadUtil.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; -import io.geekidea.springbootplus.config.constant.CommonConstant; +import io.geekidea.boot.config.constant.CommonConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/HttpServletRequestUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/HttpServletRequestUtil.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/HttpServletRequestUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/HttpServletRequestUtil.java index c136140335343e5e88266756e5a6513fe6ef88c1..9c080aceeb17c9e8918403b4a1a75116ee5bf414 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/HttpServletRequestUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/HttpServletRequestUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/HttpServletResponseUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/HttpServletResponseUtil.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/HttpServletResponseUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/HttpServletResponseUtil.java index 5981599319bc2d23f824c8b44287094377430ab2..1b836acf4449afb9ea538e740368096c7f878b04 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/HttpServletResponseUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/HttpServletResponseUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import com.alibaba.fastjson.JSON; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/IniUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/IniUtil.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/IniUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/IniUtil.java index 842b9165b826a3ae7aa64eb968fe28ca9ad228e6..19b372ecc7e5cd72599a58369117a219c801a233 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/IniUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/IniUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import org.ini4j.Config; import org.ini4j.Ini; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/IpUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/IpUtil.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/IpUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/IpUtil.java index e58830ac19e7203db17abad621d209a133d7b3e5..86336db0fd8934e831cb7a38575ad6c7cf3388b0 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/IpUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/IpUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/Jackson.java b/framework/src/main/java/io/geekidea/boot/framework/util/Jackson.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/Jackson.java rename to framework/src/main/java/io/geekidea/boot/framework/util/Jackson.java index 820a483b42aee68e1788b6bafd90aa14a59eb97f..13212f7667978179824f4666edeab9f34dcf01b2 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/Jackson.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/Jackson.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/LambdaColumn.java b/framework/src/main/java/io/geekidea/boot/framework/util/LambdaColumn.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/LambdaColumn.java rename to framework/src/main/java/io/geekidea/boot/framework/util/LambdaColumn.java index 1df3df9c2bafcd362d0656eb3fd398a5d6471ecb..b5a8f04ebc82f342b9360292f8d99bec6fa8574a 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/LambdaColumn.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/LambdaColumn.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/LoginUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/LoginUtil.java similarity index 80% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/LoginUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/LoginUtil.java index e781fb9dd7c124d4e2398b2fe4a366411c59285f..8f44b8404149f6d5eaed97e477ebd0837cda5f17 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/LoginUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/LoginUtil.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; -import io.geekidea.springbootplus.config.constant.CommonRedisKey; -import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil; -import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserRedisVo; +import io.geekidea.boot.config.constant.CommonRedisKey; +import io.geekidea.boot.framework.shiro.util.JwtTokenUtil; +import io.geekidea.boot.framework.shiro.util.JwtUtil; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserRedisVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.data.redis.core.RedisTemplate; @@ -71,6 +71,17 @@ public class LoginUtil { return loginSysUserRedisVo.getId(); } + /** + * 获取小程序用户的ID + * @return + */ + public static String getAppUserId() { + // 获取当前登录用户 + String token = JwtTokenUtil.getToken(); + String username = JwtUtil.getUsername(token); + return username; + } + /** * 获取当前登录用户的账号 * diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/MapUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/MapUtil.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/MapUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/MapUtil.java index 10a2b3a676040519beef6fade9bbed1fbad3ecb1..76b7ed3f2bdd45986f34a971dad00a87b6c86f30 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/MapUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/MapUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import java.util.HashMap; import java.util.Map; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PasswordUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/PasswordUtil.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/PasswordUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/PasswordUtil.java index 91e1f3df414b59462111dbc04d2fe396ed02135f..21df7d25fa85d3d6e6c905e53d646917d2e31ddb 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PasswordUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/PasswordUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PhoneUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/PhoneUtil.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/PhoneUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/PhoneUtil.java index 47e52509cbb9a442ffde09203de6f94f2df93dbb..b52ca6728dcfec71a9937fd4d3a024cfaa6a10e1 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PhoneUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/PhoneUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import lombok.extern.slf4j.Slf4j; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PrintApplicationInfo.java b/framework/src/main/java/io/geekidea/boot/framework/util/PrintApplicationInfo.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/PrintApplicationInfo.java rename to framework/src/main/java/io/geekidea/boot/framework/util/PrintApplicationInfo.java index 0958b1cbc187fbf37948a58692990fb3434a2ecd..d2d204218e9efe65abecce9f19085c5e51826a85 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PrintApplicationInfo.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/PrintApplicationInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import lombok.extern.slf4j.Slf4j; import org.fusesource.jansi.Ansi; @@ -53,6 +53,7 @@ public class PrintApplicationInfo { tip.append(" config: 项目配置模块\n"); tip.append(" distribution:项目打包模块,打包时,请先选中Maven Profiles中的release和对应环境\n"); tip.append(" example: 业务自定义模块,自己的业务代码可在example下进行,也可以再创建模块\n"); + tip.append(" wechat: 微信相关模块\n"); tip.append(" framework: 项目核心框架模块\n"); tip.append(" generator: 代码生成模块,启动类:SpringBootPlusGenerator,请根据实际情况进行配置\n"); tip.append(" scheduled: 任务调度模块\n"); diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PropertyColumnUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/PropertyColumnUtil.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/PropertyColumnUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/PropertyColumnUtil.java index 6296585d1db97747950304d3975ddb4e060e4f57..8c9f98d7cdc652ce8aea2a419846c60f6b14fb87 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/PropertyColumnUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/PropertyColumnUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/RedisCacheUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/RedisCacheUtil.java similarity index 96% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/RedisCacheUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/RedisCacheUtil.java index a0bcf7b2052bd653f8cd4f90358a8faa7ad24733..fa5b91e6bb5abe864fe18a856ee5cc6c4e9060aa 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/RedisCacheUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/RedisCacheUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/SpringContextUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/SpringContextUtil.java similarity index 97% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/SpringContextUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/SpringContextUtil.java index 97cf8cae02c6163aa60eb02f9f7ff8332647fb0d..19f24f02e357c728302811b00305c1540f92b6e3 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/SpringContextUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/SpringContextUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/TokenUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/TokenUtil.java similarity index 95% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/TokenUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/TokenUtil.java index 4c9e25ea9322c5cbea20722d6d82b7e5f2d25848..47785e48b3a0abfd63c7a7659717cf541681e776 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/TokenUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/TokenUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; /** * @author geekidea diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/UUIDUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/UUIDUtil.java similarity index 94% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/UUIDUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/UUIDUtil.java index 15046bb5e5f1ccca717a0d60a20d52d2286787b5..4d275076406401ae9f534611927d94521165be82 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/UUIDUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/UUIDUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import java.util.UUID; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/UploadUtil.java b/framework/src/main/java/io/geekidea/boot/framework/util/UploadUtil.java similarity index 98% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/UploadUtil.java rename to framework/src/main/java/io/geekidea/boot/framework/util/UploadUtil.java index 61332be938621328c90bc31b6d601c1955842d20..f92f72d2be78b709172b1e9486e5a872944017e3 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/UploadUtil.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/UploadUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/VerificationCode.java b/framework/src/main/java/io/geekidea/boot/framework/util/VerificationCode.java similarity index 99% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/VerificationCode.java rename to framework/src/main/java/io/geekidea/boot/framework/util/VerificationCode.java index cd53e8f956be8473906fd7106a2432cd10b54b7e..19832c3e4e2a5b62825014aff24b2029e0dda2d3 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/VerificationCode.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/VerificationCode.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.framework.util; +package io.geekidea.boot.framework.util; import java.awt.*; import java.awt.image.BufferedImage; diff --git a/framework/src/main/java/io/geekidea/springbootplus/framework/util/package-info.java b/framework/src/main/java/io/geekidea/boot/framework/util/package-info.java similarity index 93% rename from framework/src/main/java/io/geekidea/springbootplus/framework/util/package-info.java rename to framework/src/main/java/io/geekidea/boot/framework/util/package-info.java index 624963ce37aeded2d9cf721b70abe1a5c576aa5a..4ffce4a7147f04782c1d30441c2b71c8221d90d3 100644 --- a/framework/src/main/java/io/geekidea/springbootplus/framework/util/package-info.java +++ b/framework/src/main/java/io/geekidea/boot/framework/util/package-info.java @@ -19,4 +19,4 @@ * @author geekidea * @date 2018-11-08 */ -package io.geekidea.springbootplus.framework.util; \ No newline at end of file +package io.geekidea.boot.framework.util; \ No newline at end of file diff --git a/framework/src/main/resources/mapper/ip/IpAddressMapper.xml b/framework/src/main/resources/mapper/ip/IpAddressMapper.xml index b3aab33c93af51544813cea9717fd2f61c067222..e445ead0c15033b2d5b401b0af80fda36b6e08ec 100644 --- a/framework/src/main/resources/mapper/ip/IpAddressMapper.xml +++ b/framework/src/main/resources/mapper/ip/IpAddressMapper.xml @@ -16,9 +16,9 @@ --> - + - select area, operator from ip_address where INET_ATON(#{ip}) > ip_start_num diff --git a/framework/src/main/resources/mapper/log/SysLoginLogMapper.xml b/framework/src/main/resources/mapper/log/SysLoginLogMapper.xml index d461b371c337771be384ee62a7b0fae941722be3..2b9d0b111290bfb2cdc512df811f8b21859c760d 100644 --- a/framework/src/main/resources/mapper/log/SysLoginLogMapper.xml +++ b/framework/src/main/resources/mapper/log/SysLoginLogMapper.xml @@ -16,6 +16,6 @@ --> - + diff --git a/framework/src/main/resources/mapper/log/SysOperationLogMapper.xml b/framework/src/main/resources/mapper/log/SysOperationLogMapper.xml index 3a1a33816abffcbcb933f78811bb9b0fbc4eb581..b31ddc7860435009fe02d58e65c88b42f51cad12 100644 --- a/framework/src/main/resources/mapper/log/SysOperationLogMapper.xml +++ b/framework/src/main/resources/mapper/log/SysOperationLogMapper.xml @@ -16,6 +16,6 @@ --> - + diff --git a/generator/pom.xml b/generator/pom.xml index 47f9ebb4eca2c206114de154b79788c6d4fa9833..6a79128f1d950d6020bcc1e5ac46883250c24580 100644 --- a/generator/pom.xml +++ b/generator/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT generator @@ -32,7 +32,7 @@ - io.geekidea.springbootplus + io.geekidea.boot framework @@ -40,11 +40,6 @@ velocity-engine-core ${velocity.version} - - org.springframework.boot - spring-boot-starter-test - test - com.baomidou diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/CodeGenerator.java b/generator/src/main/java/io/geekidea/boot/generator/CodeGenerator.java similarity index 97% rename from generator/src/main/java/io/geekidea/springbootplus/generator/CodeGenerator.java rename to generator/src/main/java/io/geekidea/boot/generator/CodeGenerator.java index 1c0b29a1f55607e91f9d130a6bd0d7a7de07ab71..70531c55617f72eea95047e266694299820f521c 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/CodeGenerator.java +++ b/generator/src/main/java/io/geekidea/boot/generator/CodeGenerator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator; +package io.geekidea.boot.generator; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.core.toolkit.StringPool; @@ -23,12 +23,12 @@ import com.baomidou.mybatisplus.generator.InjectionConfig; import com.baomidou.mybatisplus.generator.config.*; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import io.geekidea.springbootplus.generator.config.*; -import io.geekidea.springbootplus.generator.config.query.SpringBootPlusMySqlQuery; -import io.geekidea.springbootplus.generator.config.query.SpringBootPlusSqlServerQuery; -import io.geekidea.springbootplus.generator.constant.GeneratorConstant; -import io.geekidea.springbootplus.generator.exception.GeneratorException; -import io.geekidea.springbootplus.generator.properties.GeneratorProperties; +import io.geekidea.boot.generator.config.*; +import io.geekidea.boot.generator.config.query.SpringBootPlusMySqlQuery; +import io.geekidea.boot.generator.config.query.SpringBootPlusSqlServerQuery; +import io.geekidea.boot.generator.constant.GeneratorConstant; +import io.geekidea.boot.generator.exception.GeneratorException; +import io.geekidea.boot.generator.properties.GeneratorProperties; import lombok.Data; import lombok.experimental.Accessors; import lombok.extern.slf4j.Slf4j; diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/SpringBootPlusGenerator.java b/generator/src/main/java/io/geekidea/boot/generator/SpringBootPlusGenerator.java similarity index 86% rename from generator/src/main/java/io/geekidea/springbootplus/generator/SpringBootPlusGenerator.java rename to generator/src/main/java/io/geekidea/boot/generator/SpringBootPlusGenerator.java index 85e6fad7ce798f49b5a57dcf92db9861c44a17a3..ec31e2e0f73c681afada96f859df40015b64fe88 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/SpringBootPlusGenerator.java +++ b/generator/src/main/java/io/geekidea/boot/generator/SpringBootPlusGenerator.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator; +package io.geekidea.boot.generator; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.generator.config.rules.DateType; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import io.geekidea.springbootplus.generator.config.GeneratorStrategy; -import io.geekidea.springbootplus.generator.constant.GeneratorConstant; -import io.geekidea.springbootplus.generator.properties.GeneratorProperties; +import io.geekidea.boot.generator.config.GeneratorStrategy; +import io.geekidea.boot.generator.constant.GeneratorConstant; +import io.geekidea.boot.generator.properties.GeneratorProperties; import org.springframework.stereotype.Component; import java.util.Arrays; @@ -47,14 +47,14 @@ public class SpringBootPlusGenerator { generatorProperties .setMavenModuleName("example") .setParentPackage("com.example") - .setModuleName("foobar") - .setAuthor("geekidea") + .setModuleName("group") + .setAuthor("limg") .setFileOverride(true); // 设置表信息 - generatorProperties.addTable("foo_bar","id"); + generatorProperties.addTable("p_group","id"); // 设置表前缀 - // generatorProperties.setTablePrefix(Arrays.asList("tb_")); + generatorProperties.setTablePrefix(Arrays.asList("p_")); // 数据源配置 generatorProperties.getDataSourceConfig() @@ -62,7 +62,7 @@ public class SpringBootPlusGenerator { .setUsername("root") .setPassword("root") .setDriverName("com.mysql.jdbc.Driver") - .setUrl("jdbc:mysql://localhost:3306/spring_boot_plus?useUnicode=true&characterEncoding=UTF-8&useSSL=false"); + .setUrl("jdbc:mysql://localhost:3306/spring_boot_pmp?useUnicode=true&characterEncoding=UTF-8&useSSL=false"); // 生成配置 generatorProperties.getGeneratorConfig() diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/config/GeneratorConfig.java b/generator/src/main/java/io/geekidea/boot/generator/config/GeneratorConfig.java similarity index 97% rename from generator/src/main/java/io/geekidea/springbootplus/generator/config/GeneratorConfig.java rename to generator/src/main/java/io/geekidea/boot/generator/config/GeneratorConfig.java index e5c5cce1747a3e4b8132b2c84c38687e3b0f5e03..21ce46ceda016ab7f5dff1a0045c1cfa21a30186 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/config/GeneratorConfig.java +++ b/generator/src/main/java/io/geekidea/boot/generator/config/GeneratorConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.config; +package io.geekidea.boot.generator.config; import lombok.Data; import lombok.experimental.Accessors; diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/config/GeneratorStrategy.java b/generator/src/main/java/io/geekidea/boot/generator/config/GeneratorStrategy.java similarity index 94% rename from generator/src/main/java/io/geekidea/springbootplus/generator/config/GeneratorStrategy.java rename to generator/src/main/java/io/geekidea/boot/generator/config/GeneratorStrategy.java index c03621a0b30a25aee566a223f5b8fa241fa5255c..45ca4b75e5786f1da771a4621d61d7cc9a538850 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/config/GeneratorStrategy.java +++ b/generator/src/main/java/io/geekidea/boot/generator/config/GeneratorStrategy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.config; +package io.geekidea.boot.generator.config; /** * 生成策略 diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/config/MybatisPlusGeneratorConfig.java b/generator/src/main/java/io/geekidea/boot/generator/config/MybatisPlusGeneratorConfig.java similarity index 96% rename from generator/src/main/java/io/geekidea/springbootplus/generator/config/MybatisPlusGeneratorConfig.java rename to generator/src/main/java/io/geekidea/boot/generator/config/MybatisPlusGeneratorConfig.java index 1f93d853307f882cb5e8b67c36224ccdcaba0e5c..1d27a2cdcf48ebbce8de6aa79812592bbdd51291 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/config/MybatisPlusGeneratorConfig.java +++ b/generator/src/main/java/io/geekidea/boot/generator/config/MybatisPlusGeneratorConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.config; +package io.geekidea.boot.generator.config; import com.baomidou.mybatisplus.generator.config.GlobalConfig; import com.baomidou.mybatisplus.generator.config.PackageConfig; diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/config/ProjectConfig.java b/generator/src/main/java/io/geekidea/boot/generator/config/ProjectConfig.java similarity index 93% rename from generator/src/main/java/io/geekidea/springbootplus/generator/config/ProjectConfig.java rename to generator/src/main/java/io/geekidea/boot/generator/config/ProjectConfig.java index 463cc01567f2f285712c6607234ed04f75a023ed..e5a0c1f9a3e97408ce14c93eef741b13b5d670ee 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/config/ProjectConfig.java +++ b/generator/src/main/java/io/geekidea/boot/generator/config/ProjectConfig.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.config; +package io.geekidea.boot.generator.config; -import io.geekidea.springbootplus.generator.constant.GeneratorConstant; +import io.geekidea.boot.generator.constant.GeneratorConstant; import lombok.Data; import lombok.experimental.Accessors; diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/config/TableConfig.java b/generator/src/main/java/io/geekidea/boot/generator/config/TableConfig.java similarity index 94% rename from generator/src/main/java/io/geekidea/springbootplus/generator/config/TableConfig.java rename to generator/src/main/java/io/geekidea/boot/generator/config/TableConfig.java index 89fe4303f1bebcf01040c114a760e8e4f97c12ea..8082e2e354fcf38b5cff6ec07c1fbe3e0821795e 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/config/TableConfig.java +++ b/generator/src/main/java/io/geekidea/boot/generator/config/TableConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.config; +package io.geekidea.boot.generator.config; import lombok.Data; import lombok.experimental.Accessors; diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/config/query/SpringBootPlusMySqlQuery.java b/generator/src/main/java/io/geekidea/boot/generator/config/query/SpringBootPlusMySqlQuery.java similarity index 94% rename from generator/src/main/java/io/geekidea/springbootplus/generator/config/query/SpringBootPlusMySqlQuery.java rename to generator/src/main/java/io/geekidea/boot/generator/config/query/SpringBootPlusMySqlQuery.java index e677bc8b9c8da42a11a981229508dbb9a1303bc7..490b9ccc8174f9992dfd06c43293c1f1f8a77d8d 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/config/query/SpringBootPlusMySqlQuery.java +++ b/generator/src/main/java/io/geekidea/boot/generator/config/query/SpringBootPlusMySqlQuery.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.config.query; +package io.geekidea.boot.generator.config.query; import com.baomidou.mybatisplus.generator.config.querys.MySqlQuery; diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/config/query/SpringBootPlusSqlServerQuery.java b/generator/src/main/java/io/geekidea/boot/generator/config/query/SpringBootPlusSqlServerQuery.java similarity index 96% rename from generator/src/main/java/io/geekidea/springbootplus/generator/config/query/SpringBootPlusSqlServerQuery.java rename to generator/src/main/java/io/geekidea/boot/generator/config/query/SpringBootPlusSqlServerQuery.java index 862dabf76641c0fee7ec94fc9276c3e5782eb6b4..f285887a60f19055238dc036828d94a09a7fe85b 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/config/query/SpringBootPlusSqlServerQuery.java +++ b/generator/src/main/java/io/geekidea/boot/generator/config/query/SpringBootPlusSqlServerQuery.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.config.query; +package io.geekidea.boot.generator.config.query; import com.baomidou.mybatisplus.generator.config.querys.SqlServerQuery; diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/constant/GeneratorConstant.java b/generator/src/main/java/io/geekidea/boot/generator/constant/GeneratorConstant.java similarity index 70% rename from generator/src/main/java/io/geekidea/springbootplus/generator/constant/GeneratorConstant.java rename to generator/src/main/java/io/geekidea/boot/generator/constant/GeneratorConstant.java index e2f85e90b7e25761e8cf0b92a4fb1696efe6502c..86ebbbc8bd2de0dcad21d37777730fa2eed12d4a 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/constant/GeneratorConstant.java +++ b/generator/src/main/java/io/geekidea/boot/generator/constant/GeneratorConstant.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.constant; +package io.geekidea.boot.generator.constant; import java.io.File; @@ -93,49 +93,49 @@ public interface GeneratorConstant { /** * 自定义继承的Entity类全称,带包名 */ - String SUPER_ENTITY_CLASS = "io.geekidea.springbootplus.framework.common.entity.BaseEntity"; + String SUPER_ENTITY_CLASS = "io.geekidea.boot.framework.common.entity.BaseEntity"; /** * 自定义继承的Controller类全称,带包名 */ - String SUPER_CONTROLLER_CLASS = "io.geekidea.springbootplus.framework.common.controller.BaseController"; + String SUPER_CONTROLLER_CLASS = "io.geekidea.boot.framework.common.controller.BaseController"; /** * 自定义继承的Service类全称,带包名 */ - String SUPER_SERVICE_CLASS = "io.geekidea.springbootplus.framework.common.service.BaseService"; + String SUPER_SERVICE_CLASS = "io.geekidea.boot.framework.common.service.BaseService"; /** * 自定义继承的ServiceImpl类全称,带包名 */ - String SUPER_SERVICE_IMPL_CLASS = "io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl"; + String SUPER_SERVICE_IMPL_CLASS = "io.geekidea.boot.framework.common.service.impl.BaseServiceImpl"; /** * 分页参数父类全称,带包名 */ - String SUPER_PAGE_PARAM_CLASS = "io.geekidea.springbootplus.framework.core.pagination.BasePageParam"; + String SUPER_PAGE_PARAM_CLASS = "io.geekidea.boot.framework.core.pagination.BasePageParam"; /** * 分页排序参数父类全称,带包名 */ - String SUPER_PAGE_ORDER_PARAM_CLASS = "io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam"; + String SUPER_PAGE_ORDER_PARAM_CLASS = "io.geekidea.boot.framework.core.pagination.BasePageOrderParam"; /** * 公共id参数类全称,带包名 */ - String ID_PARAM_CLASS = "io.geekidea.springbootplus.framework.common.param.IdParam"; + String ID_PARAM_CLASS = "io.geekidea.boot.framework.common.param.IdParam"; /** * 分页对象类全称,带包名 */ - String PAGING_CLASS = "io.geekidea.springbootplus.framework.core.pagination.Paging"; + String PAGING_CLASS = "io.geekidea.boot.framework.core.pagination.Paging"; /** * 分页信息类全称,带包名 */ - String PAGE_INFO_CLASS = "io.geekidea.springbootplus.framework.core.pagination.PageInfo"; + String PAGE_INFO_CLASS = "io.geekidea.boot.framework.core.pagination.PageInfo"; /** * 公共结果类全称,带包名 */ - String API_RESULT_CLASS = "io.geekidea.springbootplus.framework.common.api.ApiResult"; + String API_RESULT_CLASS = "io.geekidea.boot.framework.common.api.ApiResult"; /** * 分组验证Add.class类路径 */ - String VALIDATOR_ADD_PACKAGE = "io.geekidea.springbootplus.framework.core.validator.groups.Add"; + String VALIDATOR_ADD_PACKAGE = "io.geekidea.boot.framework.core.validator.groups.Add"; /** * 分组验证Update.class类路径 */ - String VALIDATOR_UPDATE_PACKAGE = "io.geekidea.springbootplus.framework.core.validator.groups.Update"; + String VALIDATOR_UPDATE_PACKAGE = "io.geekidea.boot.framework.core.validator.groups.Update"; } diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/exception/GeneratorException.java b/generator/src/main/java/io/geekidea/boot/generator/exception/GeneratorException.java similarity index 84% rename from generator/src/main/java/io/geekidea/springbootplus/generator/exception/GeneratorException.java rename to generator/src/main/java/io/geekidea/boot/generator/exception/GeneratorException.java index 2421b141622eee05cd6e4161e2390469418da18a..e95052d0a3d7230413ba8835ced571713da9f37d 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/exception/GeneratorException.java +++ b/generator/src/main/java/io/geekidea/boot/generator/exception/GeneratorException.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.exception; +package io.geekidea.boot.generator.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusException; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.exception.SpringBootPlusException; /** * 代码生成异常 diff --git a/generator/src/main/java/io/geekidea/springbootplus/generator/properties/GeneratorProperties.java b/generator/src/main/java/io/geekidea/boot/generator/properties/GeneratorProperties.java similarity index 90% rename from generator/src/main/java/io/geekidea/springbootplus/generator/properties/GeneratorProperties.java rename to generator/src/main/java/io/geekidea/boot/generator/properties/GeneratorProperties.java index 07d4506f05551227f1f7ac01292fef2b5f571ddc..a1e13e0bbf3936931049db57cb31d6a8da355df6 100644 --- a/generator/src/main/java/io/geekidea/springbootplus/generator/properties/GeneratorProperties.java +++ b/generator/src/main/java/io/geekidea/boot/generator/properties/GeneratorProperties.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.properties; +package io.geekidea.boot.generator.properties; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; -import io.geekidea.springbootplus.generator.config.GeneratorConfig; -import io.geekidea.springbootplus.generator.config.MybatisPlusGeneratorConfig; -import io.geekidea.springbootplus.generator.config.ProjectConfig; -import io.geekidea.springbootplus.generator.config.TableConfig; +import io.geekidea.boot.generator.config.GeneratorConfig; +import io.geekidea.boot.generator.config.MybatisPlusGeneratorConfig; +import io.geekidea.boot.generator.config.ProjectConfig; +import io.geekidea.boot.generator.config.TableConfig; import lombok.Data; import lombok.experimental.Accessors; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/generator/src/main/resources/templates/controller.java.vm b/generator/src/main/resources/templates/controller.java.vm index 1553312909f6ba26bb48c3b962057743a219b05e..85caaf602a1655ce6a56acd4a1c10259d0fe9050 100644 --- a/generator/src/main/resources/templates/controller.java.vm +++ b/generator/src/main/resources/templates/controller.java.vm @@ -17,9 +17,9 @@ import ${cfg.apiResultClass}; import ${cfg.pagingClass}; import ${cfg.idParamClass}; #if(${cfg.operationLog}) -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; #end #if(${cfg.paramValidation}) import ${cfg.validatorAddPackage}; diff --git a/generator/src/test/java/io/geekidea/springbootplus/generator/test/GeneratorPropertiesTest.java b/generator/src/test/java/io/geekidea/boot/generator/test/GeneratorPropertiesTest.java similarity index 87% rename from generator/src/test/java/io/geekidea/springbootplus/generator/test/GeneratorPropertiesTest.java rename to generator/src/test/java/io/geekidea/boot/generator/test/GeneratorPropertiesTest.java index 3b6a14690f5e5d897969c1ad318d8a866838db7b..402495bb2ff0956f170b943935da2a5bfe0823d6 100644 --- a/generator/src/test/java/io/geekidea/springbootplus/generator/test/GeneratorPropertiesTest.java +++ b/generator/src/test/java/io/geekidea/boot/generator/test/GeneratorPropertiesTest.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.test; +package io.geekidea.boot.generator.test; -import io.geekidea.springbootplus.generator.CodeGenerator; -import io.geekidea.springbootplus.generator.properties.GeneratorProperties; +import io.geekidea.boot.generator.CodeGenerator; +import io.geekidea.boot.generator.properties.GeneratorProperties; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/generator/src/test/java/io/geekidea/springbootplus/generator/test/GeneratorTestApplication.java b/generator/src/test/java/io/geekidea/boot/generator/test/GeneratorTestApplication.java similarity index 85% rename from generator/src/test/java/io/geekidea/springbootplus/generator/test/GeneratorTestApplication.java rename to generator/src/test/java/io/geekidea/boot/generator/test/GeneratorTestApplication.java index f17489da44da67f13932cc78f1689a75f7a1ab15..cd5c12d2c9d782873a9982085c8bc6d71c3295b4 100644 --- a/generator/src/test/java/io/geekidea/springbootplus/generator/test/GeneratorTestApplication.java +++ b/generator/src/test/java/io/geekidea/boot/generator/test/GeneratorTestApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.generator.test; +package io.geekidea.boot.generator.test; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -22,6 +22,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * @author geekidea * @date 2020/3/12 **/ -@SpringBootApplication(scanBasePackages = "io.geekidea.springbootplus.generator") +@SpringBootApplication(scanBasePackages = "io.geekidea.boot.generator") public class GeneratorTestApplication { } diff --git a/pom.xml b/pom.xml index a4f929f58e2441be57f8d1668c930cdf9482ca12..399c769f2662c53395109e7ea7cd26c8ad7782a9 100644 --- a/pom.xml +++ b/pom.xml @@ -19,9 +19,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT pom spring-boot-plus @@ -52,7 +52,7 @@ ${utf8} ${utf8} 1.8 - 2.2.5.RELEASE + 2.3.6.RELEASE 2.2.2 3.3.1 2.2 @@ -63,7 +63,7 @@ 3.6 2.8.0 1.8 - 1.2.67 + 1.2.69 5.1.47 0.9.9 1.18 @@ -72,12 +72,14 @@ 4.12 0.5.4 1.3.1.Final - 1.5.1 + 1.7.1 3.10.1 28.2-jre 1.26 2.9.2 2.0.2 + [7.4.0, 7.4.99] + 2.7.2 3.8.1 3.1.0 @@ -97,6 +99,7 @@ generator scheduled system + wechat @@ -108,59 +111,6 @@ pom import - - - org.springframework.boot - spring-boot-starter-web - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-aop - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-tomcat - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-jdbc - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-data-redis - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-json - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-validation - ${spring-boot.version} - - - org.springframework.boot - spring-boot-configuration-processor - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-security - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-test - ${spring-boot.version} - test - - @@ -196,7 +146,6 @@ ${knife4j.version} - com.alibaba fastjson @@ -297,37 +246,42 @@ - io.geekidea.springbootplus + io.geekidea.boot admin ${project.version} - io.geekidea.springbootplus + io.geekidea.boot bootstrap ${project.version} - io.geekidea.springbootplus + io.geekidea.boot config ${project.version} - io.geekidea.springbootplus + io.geekidea.boot example ${project.version} - io.geekidea.springbootplus + io.geekidea.boot + wechat + ${project.version} + + + io.geekidea.boot framework ${project.version} - io.geekidea.springbootplus + io.geekidea.boot system ${project.version} - io.geekidea.springbootplus + io.geekidea.boot scheduled ${project.version} diff --git a/scheduled/pom.xml b/scheduled/pom.xml index 270b6edc1c7fc0da8925562c9a2d941dd5d97598..53bfd9ff747797f445cc62cf33976f720692d857 100644 --- a/scheduled/pom.xml +++ b/scheduled/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT scheduled @@ -32,7 +32,7 @@ - io.geekidea.springbootplus + io.geekidea.boot example diff --git a/scheduled/src/main/java/io/geekidea/springbootplus/scheduled/HelloScheduled.java b/scheduled/src/main/java/io/geekidea/boot/scheduled/HelloScheduled.java similarity index 95% rename from scheduled/src/main/java/io/geekidea/springbootplus/scheduled/HelloScheduled.java rename to scheduled/src/main/java/io/geekidea/boot/scheduled/HelloScheduled.java index 4a0b09878a26125cbaf845c2406c8ccd552e6f9f..853f5c077db45cd725a0d3eab849f059dd720755 100644 --- a/scheduled/src/main/java/io/geekidea/springbootplus/scheduled/HelloScheduled.java +++ b/scheduled/src/main/java/io/geekidea/boot/scheduled/HelloScheduled.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.scheduled; +package io.geekidea.boot.scheduled; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; diff --git a/system/pom.xml b/system/pom.xml index 230daf253faef36d3db069414389d92850411f82..85e9549d629333be54fa9c0cadbfe8937bc58313 100644 --- a/system/pom.xml +++ b/system/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - io.geekidea.springbootplus - parent - 2.0 + io.geekidea.boot + spring-boot-plus + 2.1-SNAPSHOT system @@ -32,7 +32,7 @@ - io.geekidea.springbootplus + io.geekidea.boot framework diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/DownloadController.java b/system/src/main/java/io/geekidea/boot/system/controller/DownloadController.java similarity index 85% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/DownloadController.java rename to system/src/main/java/io/geekidea/boot/system/controller/DownloadController.java index 5a7b8ed456185f16aaf47e23d1c22e3d0f18ce4e..9cbb67f09ade763309e578ada624d7a6e39f6acc 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/DownloadController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/DownloadController.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.framework.util.DownloadUtil; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.util.DownloadUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/HelloWorldController.java b/system/src/main/java/io/geekidea/boot/system/controller/HelloWorldController.java similarity index 88% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/HelloWorldController.java rename to system/src/main/java/io/geekidea/boot/system/controller/HelloWorldController.java index fd8af5ba19c40ced78df2809aa693267b26701b5..ca8b44b4222eea73788968019ab22a55fbf74a75 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/HelloWorldController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/HelloWorldController.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.log.annotation.OperationLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/LoginController.java b/system/src/main/java/io/geekidea/boot/system/controller/LoginController.java similarity index 80% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/LoginController.java rename to system/src/main/java/io/geekidea/boot/system/controller/LoginController.java index 3e131a608416604282f325c42494690b0d40845f..3afeb2ad03a53319b3a1ee44169418145f0ed74d 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/LoginController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/LoginController.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; import com.alibaba.fastjson.JSON; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore; -import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil; -import io.geekidea.springbootplus.system.service.LoginService; -import io.geekidea.springbootplus.system.service.SysUserService; -import io.geekidea.springbootplus.system.vo.LoginSysUserTokenVo; -import io.geekidea.springbootplus.system.vo.SysUserQueryVo; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLogIgnore; +import io.geekidea.boot.framework.shiro.util.JwtTokenUtil; +import io.geekidea.boot.system.service.LoginService; +import io.geekidea.boot.system.service.SysUserService; +import io.geekidea.boot.system.vo.LoginSysUserTokenVo; +import io.geekidea.boot.system.vo.SysUserQueryVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -63,8 +63,8 @@ public class LoginController { @PostMapping("/login") @OperationLogIgnore - @ApiOperation(value = "登录", notes = "系统用户登录", response = io.geekidea.springbootplus.system.vo.LoginSysUserTokenVo.class) - public ApiResult login(@Validated @RequestBody io.geekidea.springbootplus.system.param.LoginParam loginParam, HttpServletResponse response) throws Exception { + @ApiOperation(value = "登录", notes = "系统用户登录", response = io.geekidea.boot.system.vo.LoginSysUserTokenVo.class) + public ApiResult login(@Validated @RequestBody io.geekidea.boot.system.param.LoginParam loginParam, HttpServletResponse response) throws Exception { LoginSysUserTokenVo loginSysUserTokenVo = loginService.login(loginParam); // 设置token响应头 response.setHeader(JwtTokenUtil.getTokenName(), loginSysUserTokenVo.getToken()); diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/ResourceController.java b/system/src/main/java/io/geekidea/boot/system/controller/ResourceController.java similarity index 83% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/ResourceController.java rename to system/src/main/java/io/geekidea/boot/system/controller/ResourceController.java index f9be29a36c312ffe3f76596e8620946cd7dbc022..8b5d2834cb413e6e25d43d0397d95c3aef7b09ed 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/ResourceController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/ResourceController.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysDepartmentController.java b/system/src/main/java/io/geekidea/boot/system/controller/SysDepartmentController.java similarity index 87% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/SysDepartmentController.java rename to system/src/main/java/io/geekidea/boot/system/controller/SysDepartmentController.java index 0566feab88c7af250005c8d74fcd4c4fd42cd5ab..bf3f56f01a416323db14f46de3294bf9d4f8256c 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysDepartmentController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/SysDepartmentController.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.system.entity.SysDepartment; -import io.geekidea.springbootplus.system.param.SysDepartmentPageParam; -import io.geekidea.springbootplus.system.service.SysDepartmentService; -import io.geekidea.springbootplus.system.vo.SysDepartmentQueryVo; -import io.geekidea.springbootplus.system.vo.SysDepartmentTreeVo; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.system.entity.SysDepartment; +import io.geekidea.boot.system.param.SysDepartmentPageParam; +import io.geekidea.boot.system.service.SysDepartmentService; +import io.geekidea.boot.system.vo.SysDepartmentQueryVo; +import io.geekidea.boot.system.vo.SysDepartmentTreeVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysPermissionController.java b/system/src/main/java/io/geekidea/boot/system/controller/SysPermissionController.java similarity index 90% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/SysPermissionController.java rename to system/src/main/java/io/geekidea/boot/system/controller/SysPermissionController.java index 46a5e5c074da4270d09f618eb41c0cd7f6d51306..23cdb128e012179bf036569b6d41ff2d702ce7f9 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysPermissionController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/SysPermissionController.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; - -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.system.entity.SysPermission; -import io.geekidea.springbootplus.system.param.SysPermissionPageParam; -import io.geekidea.springbootplus.system.service.SysPermissionService; -import io.geekidea.springbootplus.system.service.SysRolePermissionService; -import io.geekidea.springbootplus.system.vo.SysPermissionQueryVo; -import io.geekidea.springbootplus.system.vo.SysPermissionTreeVo; +package io.geekidea.boot.system.controller; + +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.system.entity.SysPermission; +import io.geekidea.boot.system.param.SysPermissionPageParam; +import io.geekidea.boot.system.service.SysPermissionService; +import io.geekidea.boot.system.service.SysRolePermissionService; +import io.geekidea.boot.system.vo.SysPermissionQueryVo; +import io.geekidea.boot.system.vo.SysPermissionTreeVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysRoleController.java b/system/src/main/java/io/geekidea/boot/system/controller/SysRoleController.java similarity index 84% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/SysRoleController.java rename to system/src/main/java/io/geekidea/boot/system/controller/SysRoleController.java index c5fbd9ccdb735937350f0698153430cfe34ac9be..1064ddb89f1d58a208499394281814dc1cddd6ba 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysRoleController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/SysRoleController.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.core.validator.groups.Add; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.system.entity.SysRole; -import io.geekidea.springbootplus.system.param.sysrole.SysRolePageParam; -import io.geekidea.springbootplus.system.param.sysrole.UpdateSysRolePermissionParam; -import io.geekidea.springbootplus.system.service.SysRoleService; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.system.entity.SysRole; +import io.geekidea.boot.system.param.sysrole.SysRolePageParam; +import io.geekidea.boot.system.param.sysrole.UpdateSysRolePermissionParam; +import io.geekidea.boot.system.service.SysRoleService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysUserController.java b/system/src/main/java/io/geekidea/boot/system/controller/SysUserController.java similarity index 82% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/SysUserController.java rename to system/src/main/java/io/geekidea/boot/system/controller/SysUserController.java index d010fe8a6f47ebdb131b1ffd3f4ec1f3a91b5dea..4a8fbf3ff61dce1d5f417fb68e4a7414fec0c7f3 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/SysUserController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/SysUserController.java @@ -14,24 +14,24 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.common.controller.BaseController; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.core.validator.groups.Add; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.system.entity.SysUser; -import io.geekidea.springbootplus.system.param.sysuser.ResetPasswordParam; -import io.geekidea.springbootplus.system.param.sysuser.SysUserPageParam; -import io.geekidea.springbootplus.system.param.sysuser.UpdatePasswordParam; -import io.geekidea.springbootplus.system.param.sysuser.UploadHeadParam; -import io.geekidea.springbootplus.system.service.SysUserService; -import io.geekidea.springbootplus.system.vo.SysUserQueryVo; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.system.entity.SysUser; +import io.geekidea.boot.system.param.sysuser.ResetPasswordParam; +import io.geekidea.boot.system.param.sysuser.SysUserPageParam; +import io.geekidea.boot.system.param.sysuser.UpdatePasswordParam; +import io.geekidea.boot.system.param.sysuser.UploadHeadParam; +import io.geekidea.boot.system.service.SysUserService; +import io.geekidea.boot.system.vo.SysUserQueryVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/UploadController.java b/system/src/main/java/io/geekidea/boot/system/controller/UploadController.java similarity index 50% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/UploadController.java rename to system/src/main/java/io/geekidea/boot/system/controller/UploadController.java index 7f22b41163e0958ab1bcf7abf808447514079f5d..dbe750e92d78da58901a196e10561fdd29558e44 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/UploadController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/UploadController.java @@ -14,21 +14,22 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.framework.util.UploadUtil; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.util.UUIDUtil; +import io.geekidea.boot.system.service.UploadService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -36,8 +37,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; +import java.io.InputStream; /** * 上传控制器 @@ -56,6 +56,9 @@ public class UploadController { @Autowired private SpringBootPlusProperties springBootPlusProperties; + @Autowired + private UploadService uploadService; + /** * 上传单个文件 * @return @@ -64,34 +67,48 @@ public class UploadController { @OperationLog(name = "上传单个文件", type = OperationLogType.UPLOAD) @ApiOperation(value = "上传单个文件", response = ApiResult.class) @ApiImplicitParams({ - @ApiImplicitParam(name = "file", value = "文件", required = true,dataType = "__file"), - @ApiImplicitParam(name = "type", value = "类型 head:头像",required = true) + @ApiImplicitParam(name = "file", value = "文件", required = true,dataType = "__file") +// @ApiImplicitParam(name = "type", value = "类型 head:头像",required = false) }) - public ApiResult upload(@RequestParam("file") MultipartFile multipartFile, - @RequestParam("type") String type) throws Exception { + public ApiResult upload(@RequestParam("file") MultipartFile multipartFile) throws Exception { log.info("multipartFile = " + multipartFile); log.info("ContentType = " + multipartFile.getContentType()); log.info("OriginalFilename = " + multipartFile.getOriginalFilename()); log.info("Name = " + multipartFile.getName()); log.info("Size = " + multipartFile.getSize()); - log.info("type = " + type); +// log.info("type = " + type); - // 上传文件,返回保存的文件名称 - String saveFileName = UploadUtil.upload(springBootPlusProperties.getUploadPath(), multipartFile, originalFilename -> { - // 文件后缀 - String fileExtension = FilenameUtils.getExtension(originalFilename); - // 这里可自定义文件名称,比如按照业务类型/文件格式/日期 - String dateString = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssS")) + RandomStringUtils.randomNumeric(6); - String fileName = dateString + "." + fileExtension; - return fileName; - }); + // 获取文件的名称 + String originalFileName = multipartFile.getOriginalFilename(); + // 文件后缀 + String ext = FilenameUtils.getExtension(originalFileName); + String fileName = StringUtils.isNoneEmpty(ext) ? UUIDUtil.getUuid() + '.' + ext : UUIDUtil.getUuid(); - // 上传成功之后,返回访问路径,请根据实际情况设置 + if (!multipartFile.isEmpty()) { + InputStream inputStream = multipartFile.getInputStream(); - String fileAccessPath = springBootPlusProperties.getResourceAccessUrl() + saveFileName; - log.info("fileAccessPath:{}", fileAccessPath); + String path = uploadService.uploadFile(inputStream, fileName); + System.out.print("七牛云返回的图片链接:" + path); + return ApiResult.ok(path); + } + return ApiResult.fail("上传失败"); - return ApiResult.ok(fileAccessPath); + // 上传文件,返回保存的文件名称 +// String saveFileName = UploadUtil.upload(springBootPlusProperties.getUploadPath(), multipartFile, originalFilename -> { +// // 文件后缀 +// String fileExtension = FilenameUtils.getExtension(originalFilename); +// // 这里可自定义文件名称,比如按照业务类型/文件格式/日期 +// String dateString = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssS")) + RandomStringUtils.randomNumeric(6); +// String fileName = dateString + "." + fileExtension; +// return fileName; +// }); +// +// // 上传成功之后,返回访问路径,请根据实际情况设置 +// +// String fileAccessPath = springBootPlusProperties.getResourceAccessUrl() + saveFileName; +// log.info("fileAccessPath:{}", fileAccessPath); +// +// return ApiResult.ok(fileAccessPath); } } diff --git a/system/src/main/java/io/geekidea/springbootplus/system/controller/VerificationCodeController.java b/system/src/main/java/io/geekidea/boot/system/controller/VerificationCodeController.java similarity index 87% rename from system/src/main/java/io/geekidea/springbootplus/system/controller/VerificationCodeController.java rename to system/src/main/java/io/geekidea/boot/system/controller/VerificationCodeController.java index d8366674bab3e65489951e10dec4fc0c704a75a4..bfa65bd84ab087253b7b9d1f59cac94a1f36e6f6 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/controller/VerificationCodeController.java +++ b/system/src/main/java/io/geekidea/boot/system/controller/VerificationCodeController.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.controller; +package io.geekidea.boot.system.controller; -import io.geekidea.springbootplus.config.constant.CommonConstant; -import io.geekidea.springbootplus.config.constant.CommonRedisKey; -import io.geekidea.springbootplus.framework.common.api.ApiResult; -import io.geekidea.springbootplus.framework.log.annotation.Module; -import io.geekidea.springbootplus.framework.log.annotation.OperationLog; -import io.geekidea.springbootplus.framework.log.enums.OperationLogType; -import io.geekidea.springbootplus.framework.util.UUIDUtil; -import io.geekidea.springbootplus.framework.util.VerificationCode; +import io.geekidea.boot.config.constant.CommonConstant; +import io.geekidea.boot.config.constant.CommonRedisKey; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.util.UUIDUtil; +import io.geekidea.boot.framework.util.VerificationCode; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysDepartmentConvert.java b/system/src/main/java/io/geekidea/boot/system/convert/SysDepartmentConvert.java similarity index 88% rename from system/src/main/java/io/geekidea/springbootplus/system/convert/SysDepartmentConvert.java rename to system/src/main/java/io/geekidea/boot/system/convert/SysDepartmentConvert.java index dbb038d39a84c5b71cfb29a420ddafce1c46ad09..24edd07e230f80763b07179ebd87f270c10bc1c7 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysDepartmentConvert.java +++ b/system/src/main/java/io/geekidea/boot/system/convert/SysDepartmentConvert.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.convert; +package io.geekidea.boot.system.convert; -import io.geekidea.springbootplus.system.entity.SysDepartment; -import io.geekidea.springbootplus.system.vo.SysDepartmentTreeVo; +import io.geekidea.boot.system.entity.SysDepartment; +import io.geekidea.boot.system.vo.SysDepartmentTreeVo; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysPermissionConvert.java b/system/src/main/java/io/geekidea/boot/system/convert/SysPermissionConvert.java similarity index 86% rename from system/src/main/java/io/geekidea/springbootplus/system/convert/SysPermissionConvert.java rename to system/src/main/java/io/geekidea/boot/system/convert/SysPermissionConvert.java index 803bf788cdd2519e4f72b8d807d144d7eb143be9..d895bcd77d7c6f41df2ac10161b63ac90a3d9f40 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysPermissionConvert.java +++ b/system/src/main/java/io/geekidea/boot/system/convert/SysPermissionConvert.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.convert; +package io.geekidea.boot.system.convert; -import io.geekidea.springbootplus.system.entity.SysPermission; -import io.geekidea.springbootplus.system.vo.SysPermissionTreeVo; +import io.geekidea.boot.system.entity.SysPermission; +import io.geekidea.boot.system.vo.SysPermissionTreeVo; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysRoleConvert.java b/system/src/main/java/io/geekidea/boot/system/convert/SysRoleConvert.java similarity index 94% rename from system/src/main/java/io/geekidea/springbootplus/system/convert/SysRoleConvert.java rename to system/src/main/java/io/geekidea/boot/system/convert/SysRoleConvert.java index 569eeea47a22d91cbcf72535ffa5edeb889b3054..7677b1470518da9147e5b0c5cddc36994ba13d22 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysRoleConvert.java +++ b/system/src/main/java/io/geekidea/boot/system/convert/SysRoleConvert.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.convert; +package io.geekidea.boot.system.convert; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysUserConvert.java b/system/src/main/java/io/geekidea/boot/system/convert/SysUserConvert.java similarity index 82% rename from system/src/main/java/io/geekidea/springbootplus/system/convert/SysUserConvert.java rename to system/src/main/java/io/geekidea/boot/system/convert/SysUserConvert.java index bd8586297ba3a495751431f2e057dfa5cc78d83c..85a56bec26e178746e453da810ef2335e4a0343f 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/convert/SysUserConvert.java +++ b/system/src/main/java/io/geekidea/boot/system/convert/SysUserConvert.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.convert; +package io.geekidea.boot.system.convert; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserVo; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -37,6 +37,6 @@ public interface SysUserConvert { * @param sysUser * @return */ - LoginSysUserVo sysUserToLoginSysUserVo(io.geekidea.springbootplus.system.entity.SysUser sysUser); + LoginSysUserVo sysUserToLoginSysUserVo(io.geekidea.boot.system.entity.SysUser sysUser); } diff --git a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysDepartment.java b/system/src/main/java/io/geekidea/boot/system/entity/SysDepartment.java similarity index 94% rename from system/src/main/java/io/geekidea/springbootplus/system/entity/SysDepartment.java rename to system/src/main/java/io/geekidea/boot/system/entity/SysDepartment.java index d3aeae6161e1a63753327122c05533b638accbcf..daa37833aa49563a5651700374274d7394a3a8b8 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysDepartment.java +++ b/system/src/main/java/io/geekidea/boot/system/entity/SysDepartment.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.entity; +package io.geekidea.boot.system.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.Version; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.common.entity.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysPermission.java b/system/src/main/java/io/geekidea/boot/system/entity/SysPermission.java similarity index 95% rename from system/src/main/java/io/geekidea/springbootplus/system/entity/SysPermission.java rename to system/src/main/java/io/geekidea/boot/system/entity/SysPermission.java index 40ebeac51ca210671d19e8135be5a4375c084262..288f0caec5d03ed589b487fa3768979aae675ef3 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysPermission.java +++ b/system/src/main/java/io/geekidea/boot/system/entity/SysPermission.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.entity; +package io.geekidea.boot.system.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.Version; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.common.entity.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysRole.java b/system/src/main/java/io/geekidea/boot/system/entity/SysRole.java similarity index 92% rename from system/src/main/java/io/geekidea/springbootplus/system/entity/SysRole.java rename to system/src/main/java/io/geekidea/boot/system/entity/SysRole.java index 3770b591385d15b676d57ec282e546b54e23ace0..8707639663938224b730edea173ca06186cc6275 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysRole.java +++ b/system/src/main/java/io/geekidea/boot/system/entity/SysRole.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.entity; +package io.geekidea.boot.system.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.Version; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.core.validator.groups.Update; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysRolePermission.java b/system/src/main/java/io/geekidea/boot/system/entity/SysRolePermission.java similarity index 94% rename from system/src/main/java/io/geekidea/springbootplus/system/entity/SysRolePermission.java rename to system/src/main/java/io/geekidea/boot/system/entity/SysRolePermission.java index 7e4942c419330b3306bb88b8c42417e5c3eac9d4..b9f3f2557a7cff82eb51346dadbbfe2229da56e9 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysRolePermission.java +++ b/system/src/main/java/io/geekidea/boot/system/entity/SysRolePermission.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.entity; +package io.geekidea.boot.system.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.Version; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.common.entity.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysUser.java b/system/src/main/java/io/geekidea/boot/system/entity/SysUser.java similarity index 92% rename from system/src/main/java/io/geekidea/springbootplus/system/entity/SysUser.java rename to system/src/main/java/io/geekidea/boot/system/entity/SysUser.java index 8f150a7ec4254b429d05839583ecef130d500f21..45bef2dabc74466da6f3fd9680bea82fe198c799 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/entity/SysUser.java +++ b/system/src/main/java/io/geekidea/boot/system/entity/SysUser.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.entity; +package io.geekidea.boot.system.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.Version; -import io.geekidea.springbootplus.framework.common.entity.BaseEntity; -import io.geekidea.springbootplus.framework.core.validator.groups.Add; -import io.geekidea.springbootplus.framework.core.validator.groups.Update; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/enums/MenuLevelEnum.java b/system/src/main/java/io/geekidea/boot/system/enums/MenuLevelEnum.java similarity index 91% rename from system/src/main/java/io/geekidea/springbootplus/system/enums/MenuLevelEnum.java rename to system/src/main/java/io/geekidea/boot/system/enums/MenuLevelEnum.java index 30de05f5259d26bf8fa63ecb8a06b70414773d27..e08dbcf30c9fa841502da6d6a0a5ca5a6abd585e 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/enums/MenuLevelEnum.java +++ b/system/src/main/java/io/geekidea/boot/system/enums/MenuLevelEnum.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.enums; +package io.geekidea.boot.system.enums; -import io.geekidea.springbootplus.framework.common.enums.BaseEnum; +import io.geekidea.boot.framework.common.enums.BaseEnum; /** * 层级枚举 diff --git a/system/src/main/java/io/geekidea/springbootplus/system/enums/StateEnum.java b/system/src/main/java/io/geekidea/boot/system/enums/StateEnum.java similarity index 89% rename from system/src/main/java/io/geekidea/springbootplus/system/enums/StateEnum.java rename to system/src/main/java/io/geekidea/boot/system/enums/StateEnum.java index 54dfd17e2af7863f7b82e2dfab8e056f77dab8c9..285828dd4430669492a01a2000886523ccf0b951 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/enums/StateEnum.java +++ b/system/src/main/java/io/geekidea/boot/system/enums/StateEnum.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.enums; +package io.geekidea.boot.system.enums; -import io.geekidea.springbootplus.framework.common.enums.BaseEnum; +import io.geekidea.boot.framework.common.enums.BaseEnum; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/exception/SysLoginException.java b/system/src/main/java/io/geekidea/boot/system/exception/SysLoginException.java similarity index 84% rename from system/src/main/java/io/geekidea/springbootplus/system/exception/SysLoginException.java rename to system/src/main/java/io/geekidea/boot/system/exception/SysLoginException.java index ee83e8d682d171b50c75756c1be24e3687952bb1..e96e9e902a466f4402a877ba3862fe97412977d5 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/exception/SysLoginException.java +++ b/system/src/main/java/io/geekidea/boot/system/exception/SysLoginException.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.exception; +package io.geekidea.boot.system.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusException; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.exception.SpringBootPlusException; /** * 系统登录异常 diff --git a/system/src/main/java/io/geekidea/springbootplus/system/exception/VerificationCodeException.java b/system/src/main/java/io/geekidea/boot/system/exception/VerificationCodeException.java similarity index 84% rename from system/src/main/java/io/geekidea/springbootplus/system/exception/VerificationCodeException.java rename to system/src/main/java/io/geekidea/boot/system/exception/VerificationCodeException.java index 5ea91ae32a33e2e2a2988cb5efbc1543e08ecbb2..a83f68beffc24deea3b1c7f0819fbb5c5640030f 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/exception/VerificationCodeException.java +++ b/system/src/main/java/io/geekidea/boot/system/exception/VerificationCodeException.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.exception; +package io.geekidea.boot.system.exception; -import io.geekidea.springbootplus.framework.common.api.ApiCode; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusException; +import io.geekidea.boot.framework.common.api.ApiCode; +import io.geekidea.boot.framework.common.exception.SpringBootPlusException; /** * 验证码校验异常 diff --git a/system/src/main/java/io/geekidea/springbootplus/system/interceptor/DownloadInterceptor.java b/system/src/main/java/io/geekidea/boot/system/interceptor/DownloadInterceptor.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/interceptor/DownloadInterceptor.java rename to system/src/main/java/io/geekidea/boot/system/interceptor/DownloadInterceptor.java index 409ecae8e1069a2526ca7062cc3c518c3e14d8c5..4b61bb58c66c33fc6273da6aa68fceab8edf1ef0 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/interceptor/DownloadInterceptor.java +++ b/system/src/main/java/io/geekidea/boot/system/interceptor/DownloadInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.interceptor; +package io.geekidea.boot.system.interceptor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/interceptor/ResourceInterceptor.java b/system/src/main/java/io/geekidea/boot/system/interceptor/ResourceInterceptor.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/interceptor/ResourceInterceptor.java rename to system/src/main/java/io/geekidea/boot/system/interceptor/ResourceInterceptor.java index d02e5a381c1f0f03b3c1554f8d78cd0adffed5be..c02b0b892b7c2c4c8411d3a47a707e8c494b897a 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/interceptor/ResourceInterceptor.java +++ b/system/src/main/java/io/geekidea/boot/system/interceptor/ResourceInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.interceptor; +package io.geekidea.boot.system.interceptor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/interceptor/UploadInterceptor.java b/system/src/main/java/io/geekidea/boot/system/interceptor/UploadInterceptor.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/interceptor/UploadInterceptor.java rename to system/src/main/java/io/geekidea/boot/system/interceptor/UploadInterceptor.java index f5e8343249c7a7bbf03d0eac7c0904887e425bf7..a49f3ffce4bd813bd8fb98d73aab52df1ef96f00 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/interceptor/UploadInterceptor.java +++ b/system/src/main/java/io/geekidea/boot/system/interceptor/UploadInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.interceptor; +package io.geekidea.boot.system.interceptor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysDepartmentMapper.java b/system/src/main/java/io/geekidea/boot/system/mapper/SysDepartmentMapper.java similarity index 85% rename from system/src/main/java/io/geekidea/springbootplus/system/mapper/SysDepartmentMapper.java rename to system/src/main/java/io/geekidea/boot/system/mapper/SysDepartmentMapper.java index abc7cf9bd19eea1b1ba78b0f347ff7383f6a6854..9a7cc58238c75fe1704863dec39737547cc490e7 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysDepartmentMapper.java +++ b/system/src/main/java/io/geekidea/boot/system/mapper/SysDepartmentMapper.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.mapper; +package io.geekidea.boot.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.system.entity.SysDepartment; -import io.geekidea.springbootplus.system.param.SysDepartmentPageParam; -import io.geekidea.springbootplus.system.vo.SysDepartmentQueryVo; +import io.geekidea.boot.system.entity.SysDepartment; +import io.geekidea.boot.system.param.SysDepartmentPageParam; +import io.geekidea.boot.system.vo.SysDepartmentQueryVo; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysPermissionMapper.java b/system/src/main/java/io/geekidea/boot/system/mapper/SysPermissionMapper.java similarity index 88% rename from system/src/main/java/io/geekidea/springbootplus/system/mapper/SysPermissionMapper.java rename to system/src/main/java/io/geekidea/boot/system/mapper/SysPermissionMapper.java index 6e3ff7e7b37b8c954d6ed84e282c9c71d19c84b3..e1c4e0f24f3d52a639213b1620131a1ef5d73dc6 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysPermissionMapper.java +++ b/system/src/main/java/io/geekidea/boot/system/mapper/SysPermissionMapper.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.mapper; +package io.geekidea.boot.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.system.entity.SysPermission; -import io.geekidea.springbootplus.system.param.SysPermissionPageParam; -import io.geekidea.springbootplus.system.vo.SysPermissionQueryVo; +import io.geekidea.boot.system.entity.SysPermission; +import io.geekidea.boot.system.param.SysPermissionPageParam; +import io.geekidea.boot.system.vo.SysPermissionQueryVo; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysRoleMapper.java b/system/src/main/java/io/geekidea/boot/system/mapper/SysRoleMapper.java similarity index 86% rename from system/src/main/java/io/geekidea/springbootplus/system/mapper/SysRoleMapper.java rename to system/src/main/java/io/geekidea/boot/system/mapper/SysRoleMapper.java index 95348b363bc92fa5d5302bc8dd7f28693c3c840d..e5fc22c9902463ab90feed27ecb3caacddc31db3 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysRoleMapper.java +++ b/system/src/main/java/io/geekidea/boot/system/mapper/SysRoleMapper.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.mapper; +package io.geekidea.boot.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.system.entity.SysRole; -import io.geekidea.springbootplus.system.param.sysrole.SysRolePageParam; -import io.geekidea.springbootplus.system.vo.SysRoleQueryVo; +import io.geekidea.boot.system.entity.SysRole; +import io.geekidea.boot.system.param.sysrole.SysRolePageParam; +import io.geekidea.boot.system.vo.SysRoleQueryVo; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysRolePermissionMapper.java b/system/src/main/java/io/geekidea/boot/system/mapper/SysRolePermissionMapper.java similarity index 88% rename from system/src/main/java/io/geekidea/springbootplus/system/mapper/SysRolePermissionMapper.java rename to system/src/main/java/io/geekidea/boot/system/mapper/SysRolePermissionMapper.java index 6fb323f289b654e9a86a96a62a497859db44c17b..8260e414976a8fa848b43224b6058baf84772dc6 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysRolePermissionMapper.java +++ b/system/src/main/java/io/geekidea/boot/system/mapper/SysRolePermissionMapper.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.mapper; +package io.geekidea.boot.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.system.entity.SysRolePermission; -import io.geekidea.springbootplus.system.param.sysrole.SysRolePermissionPageParam; -import io.geekidea.springbootplus.system.vo.SysRolePermissionQueryVo; +import io.geekidea.boot.system.entity.SysRolePermission; +import io.geekidea.boot.system.param.sysrole.SysRolePermissionPageParam; +import io.geekidea.boot.system.vo.SysRolePermissionQueryVo; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysUserMapper.java b/system/src/main/java/io/geekidea/boot/system/mapper/SysUserMapper.java similarity index 86% rename from system/src/main/java/io/geekidea/springbootplus/system/mapper/SysUserMapper.java rename to system/src/main/java/io/geekidea/boot/system/mapper/SysUserMapper.java index 64073d86e52f655402fc0ef52d6cf96ec70da65e..5893fd823d3a69bc4d51458d85c0f12786da6d6e 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/mapper/SysUserMapper.java +++ b/system/src/main/java/io/geekidea/boot/system/mapper/SysUserMapper.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.mapper; +package io.geekidea.boot.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.system.entity.SysUser; -import io.geekidea.springbootplus.system.param.sysuser.SysUserPageParam; -import io.geekidea.springbootplus.system.vo.SysUserQueryVo; +import io.geekidea.boot.system.entity.SysUser; +import io.geekidea.boot.system.param.sysuser.SysUserPageParam; +import io.geekidea.boot.system.vo.SysUserQueryVo; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/LoginParam.java b/system/src/main/java/io/geekidea/boot/system/param/LoginParam.java similarity index 91% rename from system/src/main/java/io/geekidea/springbootplus/system/param/LoginParam.java rename to system/src/main/java/io/geekidea/boot/system/param/LoginParam.java index 259c932e8601202cbf037cbf9d6d0da55559e272..a45305fbc7a852009b1b94cb840b94ff48d4b12e 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/LoginParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/LoginParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param; +package io.geekidea.boot.system.param; -import io.geekidea.springbootplus.framework.shiro.service.LoginUsername; +import io.geekidea.boot.framework.shiro.service.LoginUsername; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/SysDepartmentPageParam.java b/system/src/main/java/io/geekidea/boot/system/param/SysDepartmentPageParam.java similarity index 89% rename from system/src/main/java/io/geekidea/springbootplus/system/param/SysDepartmentPageParam.java rename to system/src/main/java/io/geekidea/boot/system/param/SysDepartmentPageParam.java index 24acea2d528ed5bc20a07a78265dc67805004141..7092a6393b382405b37604a95d939918395b33b6 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/SysDepartmentPageParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/SysDepartmentPageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param; +package io.geekidea.boot.system.param; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/SysPermissionPageParam.java b/system/src/main/java/io/geekidea/boot/system/param/SysPermissionPageParam.java similarity index 89% rename from system/src/main/java/io/geekidea/springbootplus/system/param/SysPermissionPageParam.java rename to system/src/main/java/io/geekidea/boot/system/param/SysPermissionPageParam.java index 98c79bbd319bf6f1e7162685b50dd4f93b9ac077..be888b7935818dc3b30c49fb10926d9dc8ae069c 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/SysPermissionPageParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/SysPermissionPageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param; +package io.geekidea.boot.system.param; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/SysRolePageParam.java b/system/src/main/java/io/geekidea/boot/system/param/sysrole/SysRolePageParam.java similarity index 91% rename from system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/SysRolePageParam.java rename to system/src/main/java/io/geekidea/boot/system/param/sysrole/SysRolePageParam.java index b46a0febc3eab3f3f88785b3176e58a739fb619c..7dfa9c1ed6fa49daa6bcb45004f1bc4c39852213 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/SysRolePageParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/sysrole/SysRolePageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param.sysrole; +package io.geekidea.boot.system.param.sysrole; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/SysRolePermissionPageParam.java b/system/src/main/java/io/geekidea/boot/system/param/sysrole/SysRolePermissionPageParam.java similarity index 89% rename from system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/SysRolePermissionPageParam.java rename to system/src/main/java/io/geekidea/boot/system/param/sysrole/SysRolePermissionPageParam.java index 0782359d11a201f526c32bbf24fe60d0e6b012bf..2faf294a63383d7f70207f0e03e188c43740afa2 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/SysRolePermissionPageParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/sysrole/SysRolePermissionPageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param.sysrole; +package io.geekidea.boot.system.param.sysrole; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/UpdateSysRolePermissionParam.java b/system/src/main/java/io/geekidea/boot/system/param/sysrole/UpdateSysRolePermissionParam.java similarity index 95% rename from system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/UpdateSysRolePermissionParam.java rename to system/src/main/java/io/geekidea/boot/system/param/sysrole/UpdateSysRolePermissionParam.java index 5abcd2e99c05814b52271fbf23c1ecd62444a1f0..61ecae45c137611ef0c640b77dca41212b989c5d 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/sysrole/UpdateSysRolePermissionParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/sysrole/UpdateSysRolePermissionParam.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param.sysrole; +package io.geekidea.boot.system.param.sysrole; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/ResetPasswordParam.java b/system/src/main/java/io/geekidea/boot/system/param/sysuser/ResetPasswordParam.java similarity index 96% rename from system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/ResetPasswordParam.java rename to system/src/main/java/io/geekidea/boot/system/param/sysuser/ResetPasswordParam.java index 58d2b6426aa12355e170392aabb2cc236fcdd14a..52e00afbe41e941febbeabe1cee9cc472a0ad017 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/ResetPasswordParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/sysuser/ResetPasswordParam.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param.sysuser; +package io.geekidea.boot.system.param.sysuser; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/SysUserPageParam.java b/system/src/main/java/io/geekidea/boot/system/param/sysuser/SysUserPageParam.java similarity index 92% rename from system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/SysUserPageParam.java rename to system/src/main/java/io/geekidea/boot/system/param/sysuser/SysUserPageParam.java index ce500026b1b68c938cb811a4e1cb7966377105a0..24e0e9d78ec9d83f02c5bdab4dc8881ffcd62643 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/SysUserPageParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/sysuser/SysUserPageParam.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param.sysuser; +package io.geekidea.boot.system.param.sysuser; -import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/UpdatePasswordParam.java b/system/src/main/java/io/geekidea/boot/system/param/sysuser/UpdatePasswordParam.java similarity index 96% rename from system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/UpdatePasswordParam.java rename to system/src/main/java/io/geekidea/boot/system/param/sysuser/UpdatePasswordParam.java index a6c5286c18bff2cf0b7b7ce60713fb91093dd32d..4eefe5cbbc1af440d35402e28c80f3daa0901197 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/UpdatePasswordParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/sysuser/UpdatePasswordParam.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param.sysuser; +package io.geekidea.boot.system.param.sysuser; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/UploadHeadParam.java b/system/src/main/java/io/geekidea/boot/system/param/sysuser/UploadHeadParam.java similarity index 96% rename from system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/UploadHeadParam.java rename to system/src/main/java/io/geekidea/boot/system/param/sysuser/UploadHeadParam.java index b19c6cd6c308ff3b1af3f1673dafaa376179d21a..42452414da06251b03fd5cc3d57078568b39e8ee 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/param/sysuser/UploadHeadParam.java +++ b/system/src/main/java/io/geekidea/boot/system/param/sysuser/UploadHeadParam.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.param.sysuser; +package io.geekidea.boot.system.param.sysuser; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/LoginService.java b/system/src/main/java/io/geekidea/boot/system/service/LoginService.java similarity index 86% rename from system/src/main/java/io/geekidea/springbootplus/system/service/LoginService.java rename to system/src/main/java/io/geekidea/boot/system/service/LoginService.java index ec2c2c2682411de0d17a1bd57c72ae1331bd14a2..016059ae275a4e96f9013ad4f204e1722e7ad057 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/LoginService.java +++ b/system/src/main/java/io/geekidea/boot/system/service/LoginService.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service; +package io.geekidea.boot.system.service; -import io.geekidea.springbootplus.system.entity.SysUser; -import io.geekidea.springbootplus.system.param.LoginParam; -import io.geekidea.springbootplus.system.vo.LoginSysUserTokenVo; +import io.geekidea.boot.system.entity.SysUser; +import io.geekidea.boot.system.param.LoginParam; +import io.geekidea.boot.system.vo.LoginSysUserTokenVo; import javax.servlet.http.HttpServletRequest; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/SysDepartmentService.java b/system/src/main/java/io/geekidea/boot/system/service/SysDepartmentService.java similarity index 83% rename from system/src/main/java/io/geekidea/springbootplus/system/service/SysDepartmentService.java rename to system/src/main/java/io/geekidea/boot/system/service/SysDepartmentService.java index e1eb45851b587d2d89094a0120515d8a4ca4c863..ca6af2a8f4ea1cdf6c0f3f688e16e4900e289479 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/SysDepartmentService.java +++ b/system/src/main/java/io/geekidea/boot/system/service/SysDepartmentService.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service; +package io.geekidea.boot.system.service; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.system.entity.SysDepartment; -import io.geekidea.springbootplus.system.param.SysDepartmentPageParam; -import io.geekidea.springbootplus.system.vo.SysDepartmentQueryVo; -import io.geekidea.springbootplus.system.vo.SysDepartmentTreeVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.system.entity.SysDepartment; +import io.geekidea.boot.system.param.SysDepartmentPageParam; +import io.geekidea.boot.system.vo.SysDepartmentQueryVo; +import io.geekidea.boot.system.vo.SysDepartmentTreeVo; import java.io.Serializable; import java.util.List; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/SysPermissionService.java b/system/src/main/java/io/geekidea/boot/system/service/SysPermissionService.java similarity index 88% rename from system/src/main/java/io/geekidea/springbootplus/system/service/SysPermissionService.java rename to system/src/main/java/io/geekidea/boot/system/service/SysPermissionService.java index c675185ded68d7c632828c60502cb0a806f4edd6..743fba23957babe9da625462d6febabeeee35768 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/SysPermissionService.java +++ b/system/src/main/java/io/geekidea/boot/system/service/SysPermissionService.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service; - -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.system.entity.SysPermission; -import io.geekidea.springbootplus.system.param.SysPermissionPageParam; -import io.geekidea.springbootplus.system.vo.SysPermissionQueryVo; -import io.geekidea.springbootplus.system.vo.SysPermissionTreeVo; +package io.geekidea.boot.system.service; + +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.system.entity.SysPermission; +import io.geekidea.boot.system.param.SysPermissionPageParam; +import io.geekidea.boot.system.vo.SysPermissionQueryVo; +import io.geekidea.boot.system.vo.SysPermissionTreeVo; import java.io.Serializable; import java.util.List; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/SysRolePermissionService.java b/system/src/main/java/io/geekidea/boot/system/service/SysRolePermissionService.java similarity index 93% rename from system/src/main/java/io/geekidea/springbootplus/system/service/SysRolePermissionService.java rename to system/src/main/java/io/geekidea/boot/system/service/SysRolePermissionService.java index f385e8f26ff45d7c6ac63dab8fe773aed10c733c..2a3702955c5c96a984df1a44ddf18843183d9e62 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/SysRolePermissionService.java +++ b/system/src/main/java/io/geekidea/boot/system/service/SysRolePermissionService.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service; +package io.geekidea.boot.system.service; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.system.entity.SysRolePermission; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.system.entity.SysRolePermission; import org.apache.commons.collections4.SetUtils; import java.util.List; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/SysRoleService.java b/system/src/main/java/io/geekidea/boot/system/service/SysRoleService.java similarity index 83% rename from system/src/main/java/io/geekidea/springbootplus/system/service/SysRoleService.java rename to system/src/main/java/io/geekidea/boot/system/service/SysRoleService.java index abb74800a452b56575039009e221b34604c9504b..c7c1cb14cda71248162132c9e966b8e2b28ca448 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/SysRoleService.java +++ b/system/src/main/java/io/geekidea/boot/system/service/SysRoleService.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service; +package io.geekidea.boot.system.service; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.system.entity.SysRole; -import io.geekidea.springbootplus.system.param.sysrole.SysRolePageParam; -import io.geekidea.springbootplus.system.param.sysrole.UpdateSysRolePermissionParam; -import io.geekidea.springbootplus.system.vo.SysRoleQueryVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.system.entity.SysRole; +import io.geekidea.boot.system.param.sysrole.SysRolePageParam; +import io.geekidea.boot.system.param.sysrole.UpdateSysRolePermissionParam; +import io.geekidea.boot.system.vo.SysRoleQueryVo; import java.io.Serializable; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/SysUserService.java b/system/src/main/java/io/geekidea/boot/system/service/SysUserService.java similarity index 84% rename from system/src/main/java/io/geekidea/springbootplus/system/service/SysUserService.java rename to system/src/main/java/io/geekidea/boot/system/service/SysUserService.java index e13f44c7ab986e770fc52b669f4f2c4999607cd8..d53239cd65c85736ff44b04534a09e61535e3578 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/SysUserService.java +++ b/system/src/main/java/io/geekidea/boot/system/service/SysUserService.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service; +package io.geekidea.boot.system.service; -import io.geekidea.springbootplus.framework.common.service.BaseService; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.system.entity.SysUser; -import io.geekidea.springbootplus.system.param.sysuser.ResetPasswordParam; -import io.geekidea.springbootplus.system.param.sysuser.SysUserPageParam; -import io.geekidea.springbootplus.system.param.sysuser.UpdatePasswordParam; -import io.geekidea.springbootplus.system.vo.SysUserQueryVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.system.entity.SysUser; +import io.geekidea.boot.system.param.sysuser.ResetPasswordParam; +import io.geekidea.boot.system.param.sysuser.SysUserPageParam; +import io.geekidea.boot.system.param.sysuser.UpdatePasswordParam; +import io.geekidea.boot.system.vo.SysUserQueryVo; import java.io.Serializable; diff --git a/system/src/main/java/io/geekidea/boot/system/service/UploadService.java b/system/src/main/java/io/geekidea/boot/system/service/UploadService.java new file mode 100644 index 0000000000000000000000000000000000000000..f14fef51b515adee1279fa2e68ba7fd01b1fad33 --- /dev/null +++ b/system/src/main/java/io/geekidea/boot/system/service/UploadService.java @@ -0,0 +1,28 @@ +package io.geekidea.boot.system.service; + +import com.qiniu.common.QiniuException; + +import java.io.FileInputStream; +import java.io.InputStream; + +public abstract class UploadService { + + public abstract String uploadImg(FileInputStream file, String path); + + /** + * 以流的形式上传 + * + * @param inputStream + * @param fileName: + * @return: java.lang.String + */ + public abstract String uploadFile(InputStream inputStream, String fileName) throws QiniuException; + + /** + * 删除文件 + * + * @param key: + * @return: java.lang.String + */ + public abstract String delete(String key) throws QiniuException; +} diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/LoginServiceImpl.java b/system/src/main/java/io/geekidea/boot/system/service/impl/LoginServiceImpl.java similarity index 83% rename from system/src/main/java/io/geekidea/springbootplus/system/service/impl/LoginServiceImpl.java rename to system/src/main/java/io/geekidea/boot/system/service/impl/LoginServiceImpl.java index c0c565a4d45c99a7ae4a071f8b8dca318b970706..82166c7915249d8d4a79180ceee194d66e4cd640 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/LoginServiceImpl.java +++ b/system/src/main/java/io/geekidea/boot/system/service/impl/LoginServiceImpl.java @@ -14,32 +14,32 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service.impl; +package io.geekidea.boot.system.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import io.geekidea.springbootplus.config.constant.CommonRedisKey; -import io.geekidea.springbootplus.config.properties.JwtProperties; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.shiro.cache.LoginRedisService; -import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; -import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil; -import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; -import io.geekidea.springbootplus.framework.shiro.util.SaltUtil; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo; -import io.geekidea.springbootplus.framework.util.PasswordUtil; -import io.geekidea.springbootplus.system.convert.SysUserConvert; -import io.geekidea.springbootplus.system.entity.SysDepartment; -import io.geekidea.springbootplus.system.entity.SysRole; -import io.geekidea.springbootplus.system.entity.SysUser; -import io.geekidea.springbootplus.system.enums.StateEnum; -import io.geekidea.springbootplus.system.exception.VerificationCodeException; -import io.geekidea.springbootplus.system.mapper.SysUserMapper; -import io.geekidea.springbootplus.system.param.LoginParam; -import io.geekidea.springbootplus.system.service.LoginService; -import io.geekidea.springbootplus.system.service.SysDepartmentService; -import io.geekidea.springbootplus.system.service.SysRolePermissionService; -import io.geekidea.springbootplus.system.service.SysRoleService; -import io.geekidea.springbootplus.system.vo.LoginSysUserTokenVo; +import io.geekidea.boot.config.constant.CommonRedisKey; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.shiro.cache.LoginRedisService; +import io.geekidea.boot.framework.shiro.jwt.JwtToken; +import io.geekidea.boot.framework.shiro.util.JwtTokenUtil; +import io.geekidea.boot.framework.shiro.util.JwtUtil; +import io.geekidea.boot.framework.shiro.util.SaltUtil; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserVo; +import io.geekidea.boot.framework.util.PasswordUtil; +import io.geekidea.boot.system.convert.SysUserConvert; +import io.geekidea.boot.system.entity.SysDepartment; +import io.geekidea.boot.system.entity.SysRole; +import io.geekidea.boot.system.entity.SysUser; +import io.geekidea.boot.system.enums.StateEnum; +import io.geekidea.boot.system.exception.VerificationCodeException; +import io.geekidea.boot.system.mapper.SysUserMapper; +import io.geekidea.boot.system.param.LoginParam; +import io.geekidea.boot.system.service.LoginService; +import io.geekidea.boot.system.service.SysDepartmentService; +import io.geekidea.boot.system.service.SysRolePermissionService; +import io.geekidea.boot.system.service.SysRoleService; +import io.geekidea.boot.system.vo.LoginSysUserTokenVo; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysDepartmentServiceImpl.java b/system/src/main/java/io/geekidea/boot/system/service/impl/SysDepartmentServiceImpl.java similarity index 85% rename from system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysDepartmentServiceImpl.java rename to system/src/main/java/io/geekidea/boot/system/service/impl/SysDepartmentServiceImpl.java index 4158965c38b225056dcd70d3bddb13d3ff43fa3e..740ce17bbbf327be445c01cfe70f707d14532dd2 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysDepartmentServiceImpl.java +++ b/system/src/main/java/io/geekidea/boot/system/service/impl/SysDepartmentServiceImpl.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service.impl; +package io.geekidea.boot.system.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.system.convert.SysDepartmentConvert; -import io.geekidea.springbootplus.system.entity.SysDepartment; -import io.geekidea.springbootplus.system.enums.StateEnum; -import io.geekidea.springbootplus.system.mapper.SysDepartmentMapper; -import io.geekidea.springbootplus.system.param.SysDepartmentPageParam; -import io.geekidea.springbootplus.system.service.SysDepartmentService; -import io.geekidea.springbootplus.system.vo.SysDepartmentQueryVo; -import io.geekidea.springbootplus.system.vo.SysDepartmentTreeVo; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.system.convert.SysDepartmentConvert; +import io.geekidea.boot.system.entity.SysDepartment; +import io.geekidea.boot.system.enums.StateEnum; +import io.geekidea.boot.system.mapper.SysDepartmentMapper; +import io.geekidea.boot.system.param.SysDepartmentPageParam; +import io.geekidea.boot.system.service.SysDepartmentService; +import io.geekidea.boot.system.vo.SysDepartmentQueryVo; +import io.geekidea.boot.system.vo.SysDepartmentTreeVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysPermissionServiceImpl.java b/system/src/main/java/io/geekidea/boot/system/service/impl/SysPermissionServiceImpl.java similarity index 86% rename from system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysPermissionServiceImpl.java rename to system/src/main/java/io/geekidea/boot/system/service/impl/SysPermissionServiceImpl.java index 0075562672dbf47087f6d409b6ca4a001dd71211..9d78815b6269bf651dc0dc513df52c88988a381f 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysPermissionServiceImpl.java +++ b/system/src/main/java/io/geekidea/boot/system/service/impl/SysPermissionServiceImpl.java @@ -14,27 +14,28 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service.impl; +package io.geekidea.boot.system.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.framework.common.exception.BusinessException; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.system.convert.SysPermissionConvert; -import io.geekidea.springbootplus.system.entity.SysPermission; -import io.geekidea.springbootplus.system.enums.MenuLevelEnum; -import io.geekidea.springbootplus.system.enums.StateEnum; -import io.geekidea.springbootplus.system.mapper.SysPermissionMapper; -import io.geekidea.springbootplus.system.param.SysPermissionPageParam; -import io.geekidea.springbootplus.system.service.SysPermissionService; -import io.geekidea.springbootplus.system.service.SysRolePermissionService; -import io.geekidea.springbootplus.system.vo.SysPermissionQueryVo; -import io.geekidea.springbootplus.system.vo.SysPermissionTreeVo; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.system.convert.SysPermissionConvert; +import io.geekidea.boot.system.entity.SysPermission; +import io.geekidea.boot.system.enums.MenuLevelEnum; +import io.geekidea.boot.system.enums.StateEnum; +import io.geekidea.boot.system.mapper.SysPermissionMapper; +import io.geekidea.boot.system.param.SysPermissionPageParam; +import io.geekidea.boot.system.service.SysPermissionService; +import io.geekidea.boot.system.service.SysRolePermissionService; +import io.geekidea.boot.system.vo.SysPermissionQueryVo; +import io.geekidea.boot.system.vo.SysPermissionTreeVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -117,7 +118,9 @@ public class SysPermissionServiceImpl extends BaseServiceImpl getAllMenuList() throws Exception { SysPermission sysPermission = new SysPermission().setState(StateEnum.ENABLE.getCode()); // 获取所有已启用的权限列表 - return sysPermissionMapper.selectList(new QueryWrapper(sysPermission)); +// QueryWrapper queryWrapper = new QueryWrapper(sysPermission); +// queryWrapper.orderByAsc("sort"); + return sysPermissionMapper.selectList(new LambdaQueryWrapper(sysPermission).orderByAsc(SysPermission::getSort)); } @Override diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysRolePermissionServiceImpl.java b/system/src/main/java/io/geekidea/boot/system/service/impl/SysRolePermissionServiceImpl.java similarity index 90% rename from system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysRolePermissionServiceImpl.java rename to system/src/main/java/io/geekidea/boot/system/service/impl/SysRolePermissionServiceImpl.java index d96b029b734f1a95dfe055c892947b485542270b..2d88fa4ee1d49cc7a63639a2c51ea368e5fc1e07 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysRolePermissionServiceImpl.java +++ b/system/src/main/java/io/geekidea/boot/system/service/impl/SysRolePermissionServiceImpl.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service.impl; +package io.geekidea.boot.system.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.system.entity.SysRolePermission; -import io.geekidea.springbootplus.system.enums.StateEnum; -import io.geekidea.springbootplus.system.mapper.SysRoleMapper; -import io.geekidea.springbootplus.system.mapper.SysRolePermissionMapper; -import io.geekidea.springbootplus.system.service.SysRolePermissionService; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.system.entity.SysRolePermission; +import io.geekidea.boot.system.enums.StateEnum; +import io.geekidea.boot.system.mapper.SysRoleMapper; +import io.geekidea.boot.system.mapper.SysRolePermissionMapper; +import io.geekidea.boot.system.service.SysRolePermissionService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.SetUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysRoleServiceImpl.java b/system/src/main/java/io/geekidea/boot/system/service/impl/SysRoleServiceImpl.java similarity index 87% rename from system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysRoleServiceImpl.java rename to system/src/main/java/io/geekidea/boot/system/service/impl/SysRoleServiceImpl.java index 5406c91817bee4a9233c1ffb3b692aa0ecf743f2..7321bd6a7fd2a27c91b7cf7a70cf579551bc5385 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysRoleServiceImpl.java +++ b/system/src/main/java/io/geekidea/boot/system/service/impl/SysRoleServiceImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service.impl; +package io.geekidea.boot.system.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -22,23 +22,23 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.framework.common.exception.BusinessException; -import io.geekidea.springbootplus.framework.common.exception.DaoException; -import io.geekidea.springbootplus.framework.common.exception.SpringBootPlusException; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.system.entity.SysRole; -import io.geekidea.springbootplus.system.entity.SysRolePermission; -import io.geekidea.springbootplus.system.enums.StateEnum; -import io.geekidea.springbootplus.system.mapper.SysRoleMapper; -import io.geekidea.springbootplus.system.param.sysrole.SysRolePageParam; -import io.geekidea.springbootplus.system.param.sysrole.UpdateSysRolePermissionParam; -import io.geekidea.springbootplus.system.service.SysPermissionService; -import io.geekidea.springbootplus.system.service.SysRolePermissionService; -import io.geekidea.springbootplus.system.service.SysRoleService; -import io.geekidea.springbootplus.system.service.SysUserService; -import io.geekidea.springbootplus.system.vo.SysRoleQueryVo; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.common.exception.DaoException; +import io.geekidea.boot.framework.common.exception.SpringBootPlusException; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.system.entity.SysRole; +import io.geekidea.boot.system.entity.SysRolePermission; +import io.geekidea.boot.system.enums.StateEnum; +import io.geekidea.boot.system.mapper.SysRoleMapper; +import io.geekidea.boot.system.param.sysrole.SysRolePageParam; +import io.geekidea.boot.system.param.sysrole.UpdateSysRolePermissionParam; +import io.geekidea.boot.system.service.SysPermissionService; +import io.geekidea.boot.system.service.SysRolePermissionService; +import io.geekidea.boot.system.service.SysRoleService; +import io.geekidea.boot.system.service.SysUserService; +import io.geekidea.boot.system.vo.SysRoleQueryVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.SetUtils; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysUserServiceImpl.java b/system/src/main/java/io/geekidea/boot/system/service/impl/SysUserServiceImpl.java similarity index 87% rename from system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysUserServiceImpl.java rename to system/src/main/java/io/geekidea/boot/system/service/impl/SysUserServiceImpl.java index de36669571c8efc752dc244b29645ccc6c606408..36c15505511ef2a2e4d13d3d01980e9d69693617 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/service/impl/SysUserServiceImpl.java +++ b/system/src/main/java/io/geekidea/boot/system/service/impl/SysUserServiceImpl.java @@ -14,30 +14,30 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.service.impl; +package io.geekidea.boot.system.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; -import io.geekidea.springbootplus.framework.common.exception.BusinessException; -import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; -import io.geekidea.springbootplus.framework.core.pagination.PageInfo; -import io.geekidea.springbootplus.framework.core.pagination.Paging; -import io.geekidea.springbootplus.framework.shiro.util.SaltUtil; -import io.geekidea.springbootplus.framework.util.PasswordUtil; -import io.geekidea.springbootplus.framework.util.PhoneUtil; -import io.geekidea.springbootplus.system.entity.SysUser; -import io.geekidea.springbootplus.system.enums.StateEnum; -import io.geekidea.springbootplus.system.mapper.SysUserMapper; -import io.geekidea.springbootplus.system.param.sysuser.ResetPasswordParam; -import io.geekidea.springbootplus.system.param.sysuser.SysUserPageParam; -import io.geekidea.springbootplus.system.param.sysuser.UpdatePasswordParam; -import io.geekidea.springbootplus.system.service.SysDepartmentService; -import io.geekidea.springbootplus.system.service.SysRoleService; -import io.geekidea.springbootplus.system.service.SysUserService; -import io.geekidea.springbootplus.system.vo.SysUserQueryVo; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.shiro.util.SaltUtil; +import io.geekidea.boot.framework.util.PasswordUtil; +import io.geekidea.boot.framework.util.PhoneUtil; +import io.geekidea.boot.system.entity.SysUser; +import io.geekidea.boot.system.enums.StateEnum; +import io.geekidea.boot.system.mapper.SysUserMapper; +import io.geekidea.boot.system.param.sysuser.ResetPasswordParam; +import io.geekidea.boot.system.param.sysuser.SysUserPageParam; +import io.geekidea.boot.system.param.sysuser.UpdatePasswordParam; +import io.geekidea.boot.system.service.SysDepartmentService; +import io.geekidea.boot.system.service.SysRoleService; +import io.geekidea.boot.system.service.SysUserService; +import io.geekidea.boot.system.vo.SysUserQueryVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; diff --git a/system/src/main/java/io/geekidea/boot/system/service/impl/UploadServiceImpl.java b/system/src/main/java/io/geekidea/boot/system/service/impl/UploadServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..536df7b396b39048f29135c6f030dad7660350b8 --- /dev/null +++ b/system/src/main/java/io/geekidea/boot/system/service/impl/UploadServiceImpl.java @@ -0,0 +1,78 @@ +package io.geekidea.boot.system.service.impl; + +import com.qiniu.common.QiniuException; +import com.qiniu.http.Response; +import com.qiniu.storage.BucketManager; +import com.qiniu.storage.UploadManager; +import com.qiniu.util.Auth; +import com.qiniu.util.StringMap; +import io.geekidea.boot.system.service.UploadService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.io.FileInputStream; +import java.io.InputStream; + +@Slf4j +@Service +public class UploadServiceImpl extends UploadService implements InitializingBean { + @Autowired + private UploadManager uploadManager; + + @Autowired + private BucketManager bucketManager; + + @Autowired + private Auth auth; + + @Value("${qiniu.bucket}") + private String bucket; + + @Value("${qiniu.domain}") + private String domain; + + /** + * 定义七牛云上传的相关策略 + */ + private StringMap putPolicy; + + @Override + public String uploadImg(FileInputStream file, String path) { + return null; + } + + @Override + public String uploadFile(InputStream inputStream, String fileName) throws QiniuException { + Response response = this.uploadManager.put(inputStream, fileName, getUploadToken(), null, null); + int retry = 0; + while (response.needRetry() && retry < 3) { + response = this.uploadManager.put(inputStream, fileName, getUploadToken(), null, null); + retry++; + } + if (response.statusCode == 200) { + return "http://" + domain + "/" + fileName; + } + return "上传失败!"; + } + + @Override + public String delete(String key) throws QiniuException { + return null; + } + + @Override + public void afterPropertiesSet() throws Exception { + this.putPolicy = new StringMap(); + putPolicy.put("returnBody", "{\"key\":\"$(key)\",\"hash\":\"$(etag)\",\"bucket\":\"$(bucket)\",\"width\":$(imageInfo.width), \"height\":${imageInfo.height}}"); + } + + /** + * 获取上传凭证 + */ + private String getUploadToken() { + return this.auth.uploadToken(bucket, null, 3600, putPolicy); + } +} diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/LoginSysUserTokenVo.java b/system/src/main/java/io/geekidea/boot/system/vo/LoginSysUserTokenVo.java similarity index 86% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/LoginSysUserTokenVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/LoginSysUserTokenVo.java index 5a454fac8e46626075915052eba02bd82b7bd98f..94f51a7d9dbd8f1d6d500879618b9bee29603313 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/LoginSysUserTokenVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/LoginSysUserTokenVo.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; -import io.geekidea.springbootplus.framework.shiro.service.LoginToken; -import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo; +import io.geekidea.boot.framework.shiro.service.LoginToken; +import io.geekidea.boot.framework.shiro.vo.LoginSysUserVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysDepartmentQueryVo.java b/system/src/main/java/io/geekidea/boot/system/vo/SysDepartmentQueryVo.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/SysDepartmentQueryVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/SysDepartmentQueryVo.java index b43a175e1cea9f13a79b03ae91cbcee69756e83c..d23e60ad9a7bba44490c39f73b9986023ac450a4 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysDepartmentQueryVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/SysDepartmentQueryVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysDepartmentTreeVo.java b/system/src/main/java/io/geekidea/boot/system/vo/SysDepartmentTreeVo.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/SysDepartmentTreeVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/SysDepartmentTreeVo.java index 58e4c2ff511abb680703e950a517cc2507523469..2e962e9071f1d6b8a4876372da76ff84b867e808 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysDepartmentTreeVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/SysDepartmentTreeVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysPermissionQueryVo.java b/system/src/main/java/io/geekidea/boot/system/vo/SysPermissionQueryVo.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/SysPermissionQueryVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/SysPermissionQueryVo.java index bdf4601e7c05a9ed50f99d54b5c02c76f5d39e77..483ddc265a0090d726ea14ad1bd2c1c3928cf5e7 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysPermissionQueryVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/SysPermissionQueryVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysPermissionTreeVo.java b/system/src/main/java/io/geekidea/boot/system/vo/SysPermissionTreeVo.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/SysPermissionTreeVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/SysPermissionTreeVo.java index e31395c3de0fd7a85a64c9d79e650d6a507ef30c..4bf122e11c476f9f2df3737a022b92bc968339c9 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysPermissionTreeVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/SysPermissionTreeVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysRolePermissionQueryVo.java b/system/src/main/java/io/geekidea/boot/system/vo/SysRolePermissionQueryVo.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/SysRolePermissionQueryVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/SysRolePermissionQueryVo.java index 1a7feb9c32d5a1aabb16c564bb104e4e0f47b61e..abb1e9b7ab7b9032b0d72e60ed4843ea8bbf1bc5 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysRolePermissionQueryVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/SysRolePermissionQueryVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysRoleQueryVo.java b/system/src/main/java/io/geekidea/boot/system/vo/SysRoleQueryVo.java similarity index 97% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/SysRoleQueryVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/SysRoleQueryVo.java index 6b56cc5a86914067301cc46714921c7307e1285f..9955ed94c8f68d8c179403ce3dbf899a5102e9ca 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysRoleQueryVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/SysRoleQueryVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysUserQueryVo.java b/system/src/main/java/io/geekidea/boot/system/vo/SysUserQueryVo.java similarity index 98% rename from system/src/main/java/io/geekidea/springbootplus/system/vo/SysUserQueryVo.java rename to system/src/main/java/io/geekidea/boot/system/vo/SysUserQueryVo.java index 61d12bc20b7e6c30c530da9ccf47b527a4f843b1..2d7bdda5dd85e4d36e4e31ca2d92c4bdb1a3365a 100644 --- a/system/src/main/java/io/geekidea/springbootplus/system/vo/SysUserQueryVo.java +++ b/system/src/main/java/io/geekidea/boot/system/vo/SysUserQueryVo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.geekidea.springbootplus.system.vo; +package io.geekidea.boot.system.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/system/src/main/resources/mapper/system/SysDepartmentMapper.xml b/system/src/main/resources/mapper/system/SysDepartmentMapper.xml index 538436deb80b4918a3dc65374b3dd6af4d21cfe0..322db4236f7f73017a118fb0706dacfdd4c88ad3 100644 --- a/system/src/main/resources/mapper/system/SysDepartmentMapper.xml +++ b/system/src/main/resources/mapper/system/SysDepartmentMapper.xml @@ -16,20 +16,20 @@ --> - + id, name, parent_id, state, sort, remark, version, create_time, update_time - select from sys_department where id = #{id} - select from sys_department diff --git a/system/src/main/resources/mapper/system/SysPermissionMapper.xml b/system/src/main/resources/mapper/system/SysPermissionMapper.xml index f60b935a6980efa7d83ad48e81750d004bf32d2b..3c6fa19fc490b1fde6ee6be47aae301d226a3d36 100644 --- a/system/src/main/resources/mapper/system/SysPermissionMapper.xml +++ b/system/src/main/resources/mapper/system/SysPermissionMapper.xml @@ -16,20 +16,20 @@ --> - + id, name, parent_id, url, code, icon, type, level, state, sort, remark, version, create_time, update_time - select from sys_permission where id = #{id} - select from sys_permission @@ -52,7 +52,7 @@ and u.id = #{userId}; - select p.* from sys_user u inner join sys_role r diff --git a/system/src/main/resources/mapper/system/SysRoleMapper.xml b/system/src/main/resources/mapper/system/SysRoleMapper.xml index ea23291d4d2b391164d13ae6b879a4a0a4837a08..884ce979438f4576c27ca70e72453b3a3c9df118 100644 --- a/system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -16,14 +16,14 @@ --> - + id, name, code, type, state, remark, version, create_time, update_time - select from sys_role where id = #{id} diff --git a/system/src/main/resources/mapper/system/SysRolePermissionMapper.xml b/system/src/main/resources/mapper/system/SysRolePermissionMapper.xml index 7d802dc4ef87430a09b767becd00e5850877d7c9..28fb847479a21d3f37bc9d749433b9a08a4da709 100644 --- a/system/src/main/resources/mapper/system/SysRolePermissionMapper.xml +++ b/system/src/main/resources/mapper/system/SysRolePermissionMapper.xml @@ -16,21 +16,21 @@ --> - + id, role_id, permission_id, state, remark, version, create_time, update_time - select from sys_role_permission where id = #{id} + - and u.department_id = #{param.departmentId} diff --git a/wechat/.gitignore b/wechat/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ccdf702f9235685545f52dfc04c54f935731cbb4 --- /dev/null +++ b/wechat/.gitignore @@ -0,0 +1,36 @@ +/target/ +/classes +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +.DS_Store + +*.log +logs + +*.rdb + + + diff --git a/wechat/pom.xml b/wechat/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..147cb4e74c89aa1410d572380651e2c967de9deb --- /dev/null +++ b/wechat/pom.xml @@ -0,0 +1,27 @@ + + + + spring-boot-plus + io.geekidea.boot + 2.1-SNAPSHOT + + 4.0.0 + + wechat + wechat + 微信相关接口模块 + + + + io.geekidea.boot + framework + + + io.geekidea.boot + example + + + + \ No newline at end of file diff --git a/wechat/src/main/java/com/koronol/invite/controller/InviteController.java b/wechat/src/main/java/com/koronol/invite/controller/InviteController.java new file mode 100644 index 0000000000000000000000000000000000000000..af1e4833f9a76c1ec7ec2d4f1e7fd11b525bdccb --- /dev/null +++ b/wechat/src/main/java/com/koronol/invite/controller/InviteController.java @@ -0,0 +1,72 @@ +package com.koronol.invite.controller; + +import com.koronol.invite.entity.Invite; +import com.koronol.invite.service.InviteService; +import lombok.extern.slf4j.Slf4j; +import com.koronol.invite.param.InvitePageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.common.param.IdParam; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 邀请表 控制器 + * + * @author limg + * @since 2021-02-20 + */ +@Slf4j +@RestController +@RequestMapping("/invite") +@Module("invite") +@Api(value = "邀请表API", tags = {"邀请表"}) +public class InviteController extends BaseController { + + @Autowired + private InviteService inviteService; + + /** + * 添加邀请表 + */ + @PostMapping("/submit") + @OperationLog(name = "添加邀请表", type = OperationLogType.ADD) + @ApiOperation(value = "添加邀请表", response = ApiResult.class) + public ApiResult addInvite(@Validated(Add.class) @RequestBody Invite invite) throws Exception { + boolean flag = inviteService.submit(invite); + return ApiResult.result(flag); + } + + /** + * 获取邀请表详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "邀请表详情", type = OperationLogType.INFO) + @ApiOperation(value = "邀请表详情", response = Invite.class) + public ApiResult getInvite(@PathVariable("id") Long id) throws Exception { + Invite invite = inviteService.getById(id); + return ApiResult.ok(invite); + } + + /** + * 邀请表分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "邀请表分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "邀请表分页列表", response = Invite.class) + public ApiResult> getInvitePageList(@Validated @RequestBody InvitePageParam invitePageParam) throws Exception { + Paging paging = inviteService.getInvitePageList(invitePageParam); + return ApiResult.ok(paging); + } + +} + diff --git a/wechat/src/main/java/com/koronol/invite/entity/Invite.java b/wechat/src/main/java/com/koronol/invite/entity/Invite.java new file mode 100644 index 0000000000000000000000000000000000000000..ddd078e967b9e05b995ee38c411e310b7cd9089a --- /dev/null +++ b/wechat/src/main/java/com/koronol/invite/entity/Invite.java @@ -0,0 +1,66 @@ +package com.koronol.invite.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * 邀请表 + * + * @author limg + * @since 2021-02-20 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_invite") +@ApiModel(value = "Invite对象") +public class Invite extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("ID") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("发起人") + @TableField("USER_A") + @NotNull(message = "用户不存在") + private Integer userA; + + @ApiModelProperty("助力人") + @TableField("USER_B") + @NotNull(message = "您还未登录") + private Integer userB; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField("CREATED_BY") + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/wechat/src/main/java/com/koronol/invite/mapper/InviteMapper.java b/wechat/src/main/java/com/koronol/invite/mapper/InviteMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..78eaf450dc891c11f4f56ce6b416bae2e7b25308 --- /dev/null +++ b/wechat/src/main/java/com/koronol/invite/mapper/InviteMapper.java @@ -0,0 +1,24 @@ +package com.koronol.invite.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.koronol.invite.entity.Invite; +import com.koronol.invite.param.InvitePageParam; + +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; + +/** + * 邀请表 Mapper 接口 + * + * @author limg + * @since 2021-02-20 + */ +@Repository +public interface InviteMapper extends BaseMapper { + + +} diff --git a/wechat/src/main/java/com/koronol/invite/param/InvitePageParam.java b/wechat/src/main/java/com/koronol/invite/param/InvitePageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..8a41bfc915d09856ca0aa239b380195ef4ddd79a --- /dev/null +++ b/wechat/src/main/java/com/koronol/invite/param/InvitePageParam.java @@ -0,0 +1,23 @@ +package com.koronol.invite.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *

+ * 邀请表 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-20 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "邀请表分页参数") +public class InvitePageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; +} diff --git a/wechat/src/main/java/com/koronol/invite/service/InviteService.java b/wechat/src/main/java/com/koronol/invite/service/InviteService.java new file mode 100644 index 0000000000000000000000000000000000000000..7d70c17a6e8292830a80b6ee7f8949b7bf744bd0 --- /dev/null +++ b/wechat/src/main/java/com/koronol/invite/service/InviteService.java @@ -0,0 +1,54 @@ +package com.koronol.invite.service; + +import com.koronol.invite.entity.Invite; +import com.koronol.invite.param.InvitePageParam; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +/** + * 邀请表 服务类 + * + * @author limg + * @since 2021-02-20 + */ +public interface InviteService extends BaseService { + + /** + * 保存 + * + * @param invite + * @return + * @throws Exception + */ + boolean saveInvite(Invite invite) throws Exception; + + /** + * 修改 + * + * @param invite + * @return + * @throws Exception + */ + boolean updateInvite(Invite invite) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteInvite(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param invitePageParam + * @return + * @throws Exception + */ + Paging getInvitePageList(InvitePageParam invitePageParam) throws Exception; + + boolean submit(Invite invite) throws Exception; +} diff --git a/wechat/src/main/java/com/koronol/invite/service/impl/InviteServiceImpl.java b/wechat/src/main/java/com/koronol/invite/service/impl/InviteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..18e9eef80da49ff33073338c86c624389a6dc760 --- /dev/null +++ b/wechat/src/main/java/com/koronol/invite/service/impl/InviteServiceImpl.java @@ -0,0 +1,105 @@ +package com.koronol.invite.service.impl; + +import com.koronol.invite.entity.Invite; +import com.koronol.invite.mapper.InviteMapper; +import com.koronol.invite.service.InviteService; +import com.koronol.invite.param.InvitePageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.koronol.profile.entity.Profile; +import com.koronol.profile.service.ProfileService; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDate; + +/** + * 邀请表 服务实现类 + * + * @author limg + * @since 2021-02-20 + */ +@Slf4j +@Service +public class InviteServiceImpl extends BaseServiceImpl implements InviteService { + + @Autowired + private InviteMapper inviteMapper; + + @Autowired + private ProfileService profileService; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveInvite(Invite invite) throws Exception { + return super.save(invite); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateInvite(Invite invite) throws Exception { + return super.updateById(invite); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteInvite(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getInvitePageList(InvitePageParam invitePageParam) throws Exception { + Page page = new PageInfo<>(invitePageParam, OrderItem.desc(getLambdaColumn(Invite::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + IPage iPage = inviteMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean submit(Invite invite) throws Exception { + Profile profile = profileService.getById(invite.getUserA()); + Profile profile1 = profileService.getById(invite.getUserB()); + if (invite.getUserA() == invite.getUserB()) { + throw new BusinessException(403, "不能给自己助力"); + } + if (profile == null) { + throw new BusinessException(404, "用户不存在"); + } + if (profile1 == null) { + throw new BusinessException(404, "您还未注册"); + } + Invite invite1 = inviteMapper.selectOne(new LambdaQueryWrapper() + .eq(Invite::getUserA, invite.getUserA()) + .eq(Invite::getUserB, invite.getUserB())); + if (invite1 != null) { + throw new BusinessException(400, "您已助力,请勿重复助力"); + } + inviteMapper.insert(invite); + profile.setIsVip("1"); // 设置为会员 + // 如果会员已过期,则设置从今天开始+7天 + if(profile.getValid() == null || LocalDate.now().isAfter(profile.getValid())) { + profile.setValid(LocalDate.now().plusDays(7)); + } else { + profile.setValid(profile.getValid().plusDays(7));// 邀请新用户赠送7天会员 + } + profile1.setIsVip("1"); + if(profile1.getValid() == null || LocalDate.now().isAfter(profile1.getValid())) { + profile1.setValid(LocalDate.now().plusDays(7)); + } else { + profile1.setValid(profile1.getValid().plusDays(7));// 被邀请的新用户也赠送7天会员 + } + profileService.updateProfile(profile1); + boolean flag = profileService.updateProfile(profile); + return flag; + } + +} diff --git a/wechat/src/main/java/com/koronol/profile/controller/ProfileController.java b/wechat/src/main/java/com/koronol/profile/controller/ProfileController.java new file mode 100644 index 0000000000000000000000000000000000000000..48473ebb8d65cff8f979b1eb81c6d4745e6840ec --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/controller/ProfileController.java @@ -0,0 +1,143 @@ +package com.koronol.profile.controller; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.RandomUtil; +import com.example.examDate.service.DateService; +import com.example.examDate.vo.ExamDateGoodVo; +import com.example.order.entity.Order; +import com.example.order.service.OrderService; +import com.koronol.profile.entity.Profile; +import com.koronol.profile.param.PhoneLoginParam; +import com.koronol.profile.param.ProfileQueryParam; +import com.koronol.profile.service.ProfileService; +import com.koronol.profile.vo.ProfileInfoVo; +import com.koronol.profile.vo.ProfileTokenVo; +import io.geekidea.boot.framework.util.LoginUtil; +import lombok.extern.slf4j.Slf4j; +import com.koronol.profile.param.ProfilePageParam; +import io.geekidea.boot.framework.common.controller.BaseController; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.geekidea.boot.framework.core.validator.groups.Add; +import io.geekidea.boot.framework.core.validator.groups.Update; +import org.springframework.validation.annotation.Validated; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 用户信息 控制器 + * + * @author limg + * @since 2021-02-06 + */ +@Slf4j +@RestController +@RequestMapping("/profile") +@Module("profile") +@Api(value = "用户信息API", tags = {"用户信息"}) +public class ProfileController extends BaseController { + + @Autowired + private ProfileService profileService; + + @Autowired + private OrderService orderService; + + @Autowired + private DateService dateService; + + @PostMapping("/recharge") + @OperationLog(name = "会员充值", type = OperationLogType.UPDATE) + @ApiOperation(value = "会员充值", response = ApiResult.class) + public ApiResult recharge(@RequestParam(value = "type", required = false) String type) throws Exception { + String format = DateUtil.format(new Date(),"yyyyMMddHHmmss"); + String numbers = RandomUtil.randomNumbers(5); + String orderId = format+numbers; +// ExamDateGoodVo examDateGoodVo = dateService.calcOrderAmount(); + + Order order = new Order(); + order.setOrderId(orderId); + order.setOrderType("2"); + order.setAmount("2".equals(type) ? new BigDecimal(9.9) : new BigDecimal(19.9)); + order.setUserId(LoginUtil.getAppUserId()); + order.setRemark("会员充值"); + + orderService.saveOrder(order); + order.getId(); + + return ApiResult.ok(order); + } + + /** + * 修改用户信息 + */ + @PostMapping("/update") + @OperationLog(name = "修改用户信息", type = OperationLogType.UPDATE) + @ApiOperation(value = "修改用户信息", response = ApiResult.class) + public ApiResult updateProfile(@Validated(Update.class) @RequestBody Profile profile) throws Exception { + boolean flag = profileService.updateProfile(profile); + return ApiResult.result(flag); + } + + /** + * 获取用户信息详情 + */ + @GetMapping("/info/{id}") + @OperationLog(name = "用户信息详情", type = OperationLogType.INFO) + @ApiOperation(value = "用户信息详情", response = Profile.class) + public ApiResult getProfile(@PathVariable("id") Long id) throws Exception { + ProfileInfoVo profileInfoVo = profileService.getProfileInfo(id); + return ApiResult.ok(profileInfoVo); + } + + /** + * 用户信息分页列表 + */ + @PostMapping("/getPageList") + @OperationLog(name = "用户信息分页列表", type = OperationLogType.PAGE) + @ApiOperation(value = "用户信息分页列表", response = Profile.class) + public ApiResult> getProfilePageList(@Validated @RequestBody ProfilePageParam profilePageParam) throws Exception { + Paging paging = profileService.getProfilePageList(profilePageParam); + return ApiResult.ok(paging); + } + + @PostMapping("/signIn") + @OperationLog(name = "小程序用户登录", type = OperationLogType.OTHER) + @ApiOperation(value = "微信小程序用户登录", response = Profile.class) + public ApiResult signIn(@Validated @RequestBody ProfileQueryParam profileQueryParam) throws Exception { + + ProfileTokenVo profileTokenVo = profileService.signIn(profileQueryParam); + + //JSONObject obj= JSON.parseObject(response);//将json字符串转换为json对 + return ApiResult.ok(profileTokenVo); + } + + @PostMapping("/signInByToutiao") + @OperationLog(name = "小程序用户登录", type = OperationLogType.OTHER) + @ApiOperation(value = "头条小程序用户登录", response = Profile.class) + public ApiResult signInByToutiao(@Validated @RequestBody ProfileQueryParam profileQueryParam) throws Exception { + + ProfileTokenVo profileTokenVo = profileService.signInByToutiao(profileQueryParam); + + //JSONObject obj= JSON.parseObject(response);//将json字符串转换为json对 + return ApiResult.ok(profileTokenVo); + } + + @RequestMapping("/signInByPhone") + @OperationLog(name = "小程序手机号登录", type = OperationLogType.OTHER) + @ApiOperation(value = "微信小程序手机号登录", response = Profile.class) + public ApiResult signInByPhone(@Validated @RequestBody PhoneLoginParam phoneLoginParam) throws Exception { + ProfileTokenVo profileTokenVo = profileService.signInByPhone(phoneLoginParam); + return ApiResult.ok(profileTokenVo); + } + +} + diff --git a/wechat/src/main/java/com/koronol/profile/entity/Profile.java b/wechat/src/main/java/com/koronol/profile/entity/Profile.java new file mode 100644 index 0000000000000000000000000000000000000000..70f7e1c4f4dee9ce49cec291c6abb50cc50ec74f --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/entity/Profile.java @@ -0,0 +1,95 @@ +package com.koronol.profile.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.time.LocalDate; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.geekidea.boot.framework.common.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.geekidea.boot.framework.core.validator.groups.Update; + +/** + * 用户信息 + * + * @author limg + * @since 2021-02-06 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@TableName("p_profile") +@ApiModel(value = "Profile对象") +public class Profile extends BaseEntity { + private static final long serialVersionUID = 1L; + + @NotNull(message = "id不能为空", groups = {Update.class}) + @ApiModelProperty("编号") + @TableId(value = "ID", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("姓名") + @TableField("NAME") + private String name; + + @ApiModelProperty("手机号") + @TableField("PHONE") + private String phone; + + @ApiModelProperty("openid") + @TableField("OPEN_ID") + private String openId; + + @ApiModelProperty("昵称") + @TableField("NICK_NAME") + private String nickName; + + @ApiModelProperty("头像") + @TableField("AVATAR_URL") + private String avatarUrl; + + @ApiModelProperty("状态 0-正常,1-冻结") + @TableField("STATUS") + private String status; + + @ApiModelProperty("是否会员") + @TableField("IS_VIP") + private String isVip; + + @ApiModelProperty("会员有效期") + @TableField("VALID") + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate valid; + + @ApiModelProperty("会员来源渠道") + @TableField("CHANNEL") + private Integer channel; + + @ApiModelProperty("乐观锁") + @TableField("REVISION") + private Integer revision; + + @ApiModelProperty("创建人") + @TableField(value = "CREATED_BY", fill = FieldFill.INSERT) + private String createdBy; + + @ApiModelProperty("创建时间") + @TableField(value = "CREATED_TIME", fill = FieldFill.INSERT) + private Date createdTime; + + @ApiModelProperty("更新人") + @TableField(value = "UPDATED_BY", fill = FieldFill.UPDATE) + private String updatedBy; + + @ApiModelProperty("更新时间") + @TableField(value = "UPDATED_TIME", fill = FieldFill.UPDATE) + private Date updatedTime; + +} diff --git a/wechat/src/main/java/com/koronol/profile/mapper/ProfileMapper.java b/wechat/src/main/java/com/koronol/profile/mapper/ProfileMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..cdad9112b4906d72c5ff5a99db2d468fc3167801 --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/mapper/ProfileMapper.java @@ -0,0 +1,25 @@ +package com.koronol.profile.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.koronol.profile.entity.Profile; +import com.koronol.profile.param.ProfilePageParam; + +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import java.io.Serializable; + +/** + * 用户信息 Mapper 接口 + * + * @author limg + * @since 2021-02-06 + */ +@Repository +public interface ProfileMapper extends BaseMapper { + + @Override + int insert(Profile entity); +} diff --git a/wechat/src/main/java/com/koronol/profile/param/PhoneLoginParam.java b/wechat/src/main/java/com/koronol/profile/param/PhoneLoginParam.java new file mode 100644 index 0000000000000000000000000000000000000000..c119d0e949697c37f829cc84f598efe507f112f2 --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/param/PhoneLoginParam.java @@ -0,0 +1,27 @@ +package com.koronol.profile.param; + +import io.geekidea.boot.framework.shiro.service.LoginUsername; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +@ApiModel("登录参数") +public class PhoneLoginParam implements Serializable { + private static final long serialVersionUID = 1L; + + @NotBlank(message = "请输入code") + @ApiModelProperty(value = "code", example = "admin") + private String code; + + @ApiModelProperty(value = "iv") + @NotBlank(message = "请输入iv") + private String iv; + + @ApiModelProperty(value = "encryptedData") + @NotBlank(message = "请输入encryptedData") + private String encryptedData; +} diff --git a/wechat/src/main/java/com/koronol/profile/param/ProfilePageParam.java b/wechat/src/main/java/com/koronol/profile/param/ProfilePageParam.java new file mode 100644 index 0000000000000000000000000000000000000000..43bc8b4a2ebe81ef0cedf126336d36032b698351 --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/param/ProfilePageParam.java @@ -0,0 +1,33 @@ +package com.koronol.profile.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; + +/** + *
+ * 用户信息 分页参数对象
+ * 
+ * + * @author limg + * @date 2021-02-06 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "用户信息分页参数") +public class ProfilePageParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("是否会员") + private String isVip; + + @ApiModelProperty("昵称") + private String nickName; + + @ApiModelProperty("来源渠道") + private String channel; +} diff --git a/wechat/src/main/java/com/koronol/profile/param/ProfileQueryParam.java b/wechat/src/main/java/com/koronol/profile/param/ProfileQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..011a315c941c51f6b2f47534a03bdb3b2360e0ff --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/param/ProfileQueryParam.java @@ -0,0 +1,32 @@ +package com.koronol.profile.param; + +import io.geekidea.boot.framework.core.pagination.BasePageOrderParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; + +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "用户登录参数") +public class ProfileQueryParam extends BasePageOrderParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("code") + @NotBlank(message = "请输入code") + private String code; + + @ApiModelProperty("anonymousCode") + private String anonymousCode; + + @ApiModelProperty("昵称") + private String nickName; + + @ApiModelProperty("头像") + private String avatarUrl; + +} diff --git a/wechat/src/main/java/com/koronol/profile/service/ProfileService.java b/wechat/src/main/java/com/koronol/profile/service/ProfileService.java new file mode 100644 index 0000000000000000000000000000000000000000..1a94921a0a3f36c4c16c1789a46b2af48422e99d --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/service/ProfileService.java @@ -0,0 +1,86 @@ +package com.koronol.profile.service; + +import com.koronol.profile.entity.Profile; +import com.koronol.profile.param.PhoneLoginParam; +import com.koronol.profile.param.ProfilePageParam; +import com.koronol.profile.param.ProfileQueryParam; +import com.koronol.profile.vo.ProfileInfoVo; +import com.koronol.profile.vo.ProfileTokenVo; +import io.geekidea.boot.framework.common.service.BaseService; +import io.geekidea.boot.framework.core.pagination.Paging; + +import java.math.BigDecimal; + +/** + * 用户信息 服务类 + * + * @author limg + * @since 2021-02-06 + */ +public interface ProfileService extends BaseService { + + /** + * 保存 + * + * @param profile + * @return + * @throws Exception + */ + boolean saveProfile(Profile profile) throws Exception; + + /** + * 修改 + * + * @param profile + * @return + * @throws Exception + */ + boolean updateProfile(Profile profile) throws Exception; + + /** + * 删除 + * + * @param id + * @return + * @throws Exception + */ + boolean deleteProfile(Long id) throws Exception; + + + /** + * 获取分页对象 + * + * @param profilePageParam + * @return + * @throws Exception + */ + Paging getProfilePageList(ProfilePageParam profilePageParam) throws Exception; + + /** + * 小程序通过openId登录 + * @param profileQueryParam + * @return + * @throws Exception + */ + ProfileTokenVo signIn(ProfileQueryParam profileQueryParam) throws Exception; + + ProfileTokenVo signInByToutiao(ProfileQueryParam profileQueryParam) throws Exception; + + /** + * 小程序通过手机号登录 + * @param phoneLoginParam + * @return + */ + ProfileTokenVo signInByPhone(PhoneLoginParam phoneLoginParam) throws Exception; + + ProfileInfoVo getProfileInfo(Long id) throws Exception; + + /** + * 更新会员有效期 + * @param userId + * @param amount + * @return + * @throws Exception + */ + boolean renew(String userId, BigDecimal amount) throws Exception; +} diff --git a/wechat/src/main/java/com/koronol/profile/service/impl/ProfileServiceImpl.java b/wechat/src/main/java/com/koronol/profile/service/impl/ProfileServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4be6763e01c1ae0a53476317d1528d89582805ca --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/service/impl/ProfileServiceImpl.java @@ -0,0 +1,303 @@ +package com.koronol.profile.service.impl; + +import cn.hutool.core.codec.Base64; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.example.history.entity.History; +import com.example.history.service.HistoryService; +import com.example.question.entity.Question; +import com.example.userPaper.service.UserPaperService; +import com.koronol.profile.entity.Profile; +import com.koronol.profile.mapper.ProfileMapper; +import com.koronol.profile.param.PhoneLoginParam; +import com.koronol.profile.param.ProfileQueryParam; +import com.koronol.profile.service.ProfileService; +import com.koronol.profile.param.ProfilePageParam; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.koronol.profile.vo.ProfileInfoVo; +import com.koronol.profile.vo.ProfileTokenVo; +import io.geekidea.boot.config.constant.CommonRedisKey; +import io.geekidea.boot.config.properties.JwtProperties; +import io.geekidea.boot.config.properties.SpringBootPlusProperties; +import io.geekidea.boot.framework.common.service.impl.BaseServiceImpl; +import io.geekidea.boot.framework.core.pagination.Paging; +import io.geekidea.boot.framework.core.pagination.PageInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.geekidea.boot.framework.shiro.cache.LoginRedisService; +import io.geekidea.boot.framework.shiro.jwt.JwtToken; +import io.geekidea.boot.framework.shiro.util.JwtUtil; +import io.geekidea.boot.framework.shiro.util.SaltUtil; +import io.geekidea.boot.framework.util.LoginUtil; +import javafx.beans.property.LongPropertyBase; +import lombok.val; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.subject.Subject; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.transaction.annotation.Transactional; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.math.BigDecimal; +import java.security.spec.AlgorithmParameterSpec; +import java.time.Duration; +import java.time.LocalDate; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 用户信息 服务实现类 + * + * @author limg + * @since 2021-02-06 + */ +@Slf4j +@Service +public class ProfileServiceImpl extends BaseServiceImpl implements ProfileService { + + @Autowired + private ProfileMapper profileMapper; + + @Value("${wechat.appId}") + private String appId; + + @Value("${wechat.secret}") + private String secret; + + @Value("${toutiao.appId}") + private String ttAppId; + + @Value("${toutiao.secret}") + private String ttSecret; + + @Lazy + @Autowired + private JwtProperties jwtProperties; + + @Lazy + @Autowired + private SpringBootPlusProperties springBootPlusProperties; + + @Lazy + @Autowired + private UserPaperService userPaperService; + + @Lazy + @Autowired + private HistoryService historyService; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean saveProfile(Profile profile) throws Exception { + return super.save(profile); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateProfile(Profile profile) throws Exception { + return super.updateById(profile); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean deleteProfile(Long id) throws Exception { + return super.removeById(id); + } + + @Override + public Paging getProfilePageList(ProfilePageParam profilePageParam) throws Exception { + Page page = new PageInfo<>(profilePageParam, OrderItem.desc(getLambdaColumn(Profile::getCreatedTime))); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if(StrUtil.isNotEmpty(profilePageParam.getIsVip())) { + wrapper.eq(Profile::getIsVip, profilePageParam.getIsVip()); + } + if(StrUtil.isNotEmpty(profilePageParam.getNickName())) { + wrapper.like(Profile::getNickName, profilePageParam.getNickName()); + } + if(StrUtil.isNotEmpty(profilePageParam.getChannel())) { + wrapper.eq(Profile::getChannel, profilePageParam.getChannel()); + } + IPage iPage = profileMapper.selectPage(page, wrapper); + return new Paging(iPage); + } + + @Override + public ProfileTokenVo signIn(ProfileQueryParam profileQueryParam) throws Exception { + Map data = new HashMap(); + data.put("appid", appId); + data.put("secret", secret); + data.put("js_code", profileQueryParam.getCode()); + data.put("grant_type", "authorization_code"); + String result = HttpUtil.get("https://api.weixin.qq.com/sns/jscode2session", data); + JSONObject response = JSONUtil.parseObj(result); + if (response.get("errcode") != null && !response.get("errcode").equals(0)) { + throw new AuthenticationException(response.getStr("errmsg")); + } + String openId = response.getStr("openid"); + Profile profile = profileMapper.selectOne(new LambdaQueryWrapper().eq(Profile::getOpenId, openId)); + if (profile == null) { + profile = new Profile(); + } + profile.setOpenId(openId); + if (profileQueryParam.getAvatarUrl() != null) { + profile.setAvatarUrl(profileQueryParam.getAvatarUrl()); + } + if (profileQueryParam.getNickName() != null) { + profile.setNickName(profileQueryParam.getNickName()); + } + ProfileTokenVo profileTokenVo = getProfileTokenVo(profile); + + return profileTokenVo; + } + + @Override + public ProfileTokenVo signInByToutiao(ProfileQueryParam profileQueryParam) throws Exception { + Map data = new HashMap(); + data.put("appid", ttAppId); + data.put("secret", ttSecret); + data.put("code", profileQueryParam.getCode()); + data.put("anonymous_code", profileQueryParam.getAnonymousCode()); + data.put("grant_type", "authorization_code"); + String result = HttpUtil.get("https://developer.toutiao.com/api/apps/jscode2session", data); + JSONObject response = JSONUtil.parseObj(result); + if (response.get("errcode") != null && !response.get("errcode").equals(0)) { + throw new AuthenticationException(response.getStr("errmsg")); + } + String openId = response.getStr("openid"); + Profile profile = profileMapper.selectOne(new LambdaQueryWrapper().eq(Profile::getOpenId, openId)); + if (profile == null) { + profile = new Profile(); + } + profile.setOpenId(openId); + profile.setChannel(2); + if (profileQueryParam.getAvatarUrl() != null) { + profile.setAvatarUrl(profileQueryParam.getAvatarUrl()); + } + if (profileQueryParam.getNickName() != null) { + profile.setNickName(profileQueryParam.getNickName()); + } + ProfileTokenVo profileTokenVo = getProfileTokenVo(profile); + + return profileTokenVo; + } + + @Override + public ProfileTokenVo signInByPhone(PhoneLoginParam phoneLoginParam) throws Exception { + Map data = new HashMap(); + data.put("appid", appId); + data.put("secret", secret); + data.put("js_code", phoneLoginParam.getCode()); + data.put("grant_type", "authorization_code"); + String result = HttpUtil.get("https://api.weixin.qq.com/sns/jscode2session", data); + JSONObject response = JSONUtil.parseObj(result); + if (response.get("errcode") != null && !response.get("errcode").equals(0)) { + throw new AuthenticationException(response.getStr("errmsg")); + } + String openId = response.getStr("openid"); + String sessionKey = response.getStr("session_key"); + Profile profile = profileMapper.selectOne(new LambdaQueryWrapper().eq(Profile::getOpenId, openId)); + if (profile == null) { + profile = new Profile(); + } + System.out.println(phoneLoginParam.getEncryptedData() + "-------" + phoneLoginParam.getIv() + "-------" + sessionKey); + + // 解密手机号 + byte[] encData = Base64.decode(phoneLoginParam.getEncryptedData()); + byte[] keyByte = Base64.decode(phoneLoginParam.getIv()); + byte[] key = Base64.decode(sessionKey); + + AlgorithmParameterSpec ivSpec = new IvParameterSpec(keyByte); + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);// 初始化 + byte[] resultByte = cipher.doFinal(encData); + if (null != resultByte && resultByte.length > 0) { + String phoneStr = new String(resultByte, "UTF-8"); + JSONObject phoneObj = JSONUtil.parseObj(phoneStr); + profile.setPhone(phoneObj.getStr("phoneNumber")); + } + profile.setOpenId(openId); +// profile.setNickName(""); // 设置个空的昵称 + + ProfileTokenVo profileTokenVo = getProfileTokenVo(profile); + + return profileTokenVo; + } + + @Override + public ProfileInfoVo getProfileInfo(Long id) throws Exception { + Integer score = userPaperService.getUserAvgScore(); + Integer count = historyService.count(new LambdaQueryWrapper().eq(History::getUserId, LoginUtil.getAppUserId())); + ProfileInfoVo profileInfoVo = new ProfileInfoVo(); + profileInfoVo.setCount(count); + profileInfoVo.setScore(score == null ? 0 : score); + + return profileInfoVo; + } + + @Override + public boolean renew(String userId, BigDecimal amount) throws Exception { + Profile profile = profileMapper.selectById(userId); + profile.setIsVip("1"); // 设置为会员 + Integer days = new BigDecimal(10).compareTo(BigDecimal.valueOf(amount.intValue())) == 1 ? 30 : 90; // 支付9.9元会员增加30天,其他则增加90天,暂时写死,后续增加配置 + // 如果会员已过期,则设置从今天开始 +90天 + if(profile.getValid() == null || LocalDate.now().isAfter(profile.getValid())) { + profile.setValid(LocalDate.now().plusDays(days)); // 从当天开始往后增加天数 + } else { + profile.setValid(profile.getValid().plusDays(days));// 从会员过期时间往后增加天数 + } + + return profileMapper.updateById(profile) > 0 ? true : false; + } + + private ProfileTokenVo getProfileTokenVo(Profile profile) throws Exception { + // 获取数据库中保存的盐值 + String newSalt = SaltUtil.getSalt("666", jwtProperties); + + if (profile.getId() == null) { + if (profile.getNickName() != null || profile.getPhone() != null) { + profileMapper.insert(profile); + } else { + ProfileTokenVo profileTokenVo = Convert.convert(ProfileTokenVo.class, profile); + profileTokenVo.setToken(""); + return profileTokenVo; + } + } else { + profileMapper.updateById(profile); + } + // 生成token字符串并返回 + Long expireSecond = jwtProperties.getExpireSecond(); + String token = JwtUtil.generateToken(profile.getId().toString(), newSalt, Duration.ofSeconds(expireSecond)); + ProfileTokenVo profileTokenVo = Convert.convert(ProfileTokenVo.class, profile); + profileTokenVo.setToken(token); + + // 创建AuthenticationToken + JwtToken jwtToken = JwtToken.build(token, profile.getId().toString(), newSalt, expireSecond); + + boolean enableShiro = springBootPlusProperties.getShiro().isEnable(); + if (enableShiro) { + // 从SecurityUtils里边创建一个 subject + Subject subject = SecurityUtils.getSubject(); + // 执行认证登录 + subject.login(jwtToken); + } else { + log.warn("未启用Shiro"); + } + + return profileTokenVo; + } + +} diff --git a/wechat/src/main/java/com/koronol/profile/vo/ProfileInfoVo.java b/wechat/src/main/java/com/koronol/profile/vo/ProfileInfoVo.java new file mode 100644 index 0000000000000000000000000000000000000000..fadbe3507a54e7efda9f8416d8c42e9384dd7df3 --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/vo/ProfileInfoVo.java @@ -0,0 +1,21 @@ +package com.koronol.profile.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@Accessors(chain = true) +@ApiModel(value = "ProfileInfoVo对象", description = "小程序用户信息对象") +public class ProfileInfoVo implements Serializable { + private static final long serialVersionUID = 8394435375794488165L; + + @ApiModelProperty("答题数") + private Integer count; + + @ApiModelProperty("平均分") + private Integer score; +} diff --git a/wechat/src/main/java/com/koronol/profile/vo/ProfileTokenVo.java b/wechat/src/main/java/com/koronol/profile/vo/ProfileTokenVo.java new file mode 100644 index 0000000000000000000000000000000000000000..cfdc85fd6848863a96dd4b6997f669f76b7312e1 --- /dev/null +++ b/wechat/src/main/java/com/koronol/profile/vo/ProfileTokenVo.java @@ -0,0 +1,51 @@ +package com.koronol.profile.vo; + + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.Date; + +@Data +@Accessors(chain = true) +@ApiModel(value = "ProfileVo对象", description = "小程序用户对象") +public class ProfileTokenVo implements Serializable { + + private static final long serialVersionUID = -6120449937867930830L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("用户昵称") + private String nickName; + + @ApiModelProperty("openId") + private String openId; + + @ApiModelProperty("手机号") + private String phone; + + @ApiModelProperty("头像") + private String avatarUrl; + + @ApiModelProperty("状态 0-正常,1-冻结") + private String status; + + @ApiModelProperty("是否会员") + private String isVip; + + @ApiModelProperty("会员有效期") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate valid; + + @ApiModelProperty("token") + private String token; + +} diff --git a/wechat/src/main/java/com/koronol/wxpay/controller/AbstractWxPayApiController.java b/wechat/src/main/java/com/koronol/wxpay/controller/AbstractWxPayApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..30d9fa3fa4ede5cc98282ad0e11ed4436136007a --- /dev/null +++ b/wechat/src/main/java/com/koronol/wxpay/controller/AbstractWxPayApiController.java @@ -0,0 +1,12 @@ +package com.koronol.wxpay.controller; + +import com.ijpay.wxpay.WxPayApiConfig; + +public abstract class AbstractWxPayApiController { + /** + * 获取微信支付配置 + * + * @return {@link WxPayApiConfig} 微信支付配置 + */ + public abstract WxPayApiConfig getApiConfig(); +} diff --git a/wechat/src/main/java/com/koronol/wxpay/controller/WxPayController.java b/wechat/src/main/java/com/koronol/wxpay/controller/WxPayController.java new file mode 100644 index 0000000000000000000000000000000000000000..c7883490eb070b6b20c37ba0227f99592539036a --- /dev/null +++ b/wechat/src/main/java/com/koronol/wxpay/controller/WxPayController.java @@ -0,0 +1,238 @@ +package com.koronol.wxpay.controller; + +import cn.hutool.core.convert.Convert; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.order.entity.Order; +import com.example.order.service.OrderService; +import com.ijpay.core.enums.SignType; +import com.ijpay.core.enums.TradeType; +import com.ijpay.core.kit.HttpKit; +import com.ijpay.core.kit.IpKit; +import com.ijpay.core.kit.WxPayKit; +import com.ijpay.wxpay.WxPayApi; +import com.ijpay.wxpay.WxPayApiConfig; +import com.ijpay.wxpay.WxPayApiConfigKit; +import com.ijpay.wxpay.model.OrderQueryModel; +import com.ijpay.wxpay.model.UnifiedOrderModel; +import com.koronol.profile.entity.Profile; +import com.koronol.profile.service.ProfileService; +import com.koronol.wxpay.entity.WxPayBean; +import com.koronol.wxpay.param.WxPayNotifyParam; +import com.koronol.wxpay.param.WxPayParam; +import com.koronol.wxpay.vo.PaymentVo; +import io.geekidea.boot.framework.common.api.ApiResult; +import io.geekidea.boot.framework.common.exception.BusinessException; +import io.geekidea.boot.framework.log.annotation.Module; +import io.geekidea.boot.framework.log.annotation.OperationLog; +import io.geekidea.boot.framework.log.enums.OperationLogType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import static io.geekidea.boot.framework.util.HttpServletRequestUtil.getRequest; + +@Slf4j +@RestController +@RequestMapping("/wxPay") +@Module("wxPay") +@Api(value = "微信支付相关API", tags = {"微信支付"}) +public class WxPayController extends AbstractWxPayApiController { + + private String notifyUrl; + private String refundNotifyUrl; + + @Autowired + private OrderService orderService; + + @Autowired + private ProfileService profileService; + + @Autowired + WxPayBean wxPayBean; + + @Override + public WxPayApiConfig getApiConfig() { + WxPayApiConfig apiConfig; + + try { + apiConfig = WxPayApiConfigKit.getApiConfig(wxPayBean.getAppId()); + } catch (Exception e) { + apiConfig = WxPayApiConfig.builder() + .appId(wxPayBean.getAppId()) + .mchId(wxPayBean.getMchId()) + .partnerKey(wxPayBean.getPartnerKey()) + .certPath(wxPayBean.getCertPath()) + .domain(wxPayBean.getDomain()) + .build(); + } + notifyUrl = apiConfig.getDomain().concat("/wxPay/payNotify"); + refundNotifyUrl = apiConfig.getDomain().concat("/wxPay/refundNotify"); + return apiConfig; + } + + @PostMapping("/getPrePayInfo") + @OperationLog(name = "微信预支付信息", type = OperationLogType.ADD) + @ApiOperation(value = "微信预支付信息", response = ApiResult.class) + public ApiResult> createOrder(@Validated @RequestBody WxPayParam wxPayParam) throws Exception { + + String ip = IpKit.getRealIp(getRequest()); + BigDecimal multiple = new BigDecimal("100"); // 微信支付金额乘以100 + Order order = orderService.getOne(new LambdaQueryWrapper().eq(Order::getOrderId, wxPayParam.getOrderId())); + if (order.getStatus().equals("2")) { + throw new BusinessException("订单已支付,请勿重复支付"); + } + + if (order.getStatus().equals("3")) { + throw new BusinessException("订单已取消"); + } + + WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); + + Map params = UnifiedOrderModel + .builder() + .appid(wxPayApiConfig.getAppId()) + .mch_id(wxPayApiConfig.getMchId()) + .nonce_str(WxPayKit.generateStr()) + .body(order.getRemark()) + .out_trade_no(order.getOrderId()) + .total_fee(Convert.toInt(order.getAmount().multiply(multiple)).toString()) + .spbill_create_ip(ip) + .notify_url(notifyUrl) + .trade_type(TradeType.JSAPI.getTradeType()) + .openid(wxPayParam.getOpenId()) + .build() + .createSign(wxPayApiConfig.getPartnerKey(), SignType.HMACSHA256); + + String xmlResult = WxPayApi.pushOrder(false, params); + + log.info(xmlResult); + Map result = WxPayKit.xmlToMap(xmlResult); + + String returnCode = result.get("return_code"); + String returnMsg = result.get("return_msg"); + if (!WxPayKit.codeIsOk(returnCode)) { + throw new BusinessException(returnMsg); + } + String resultCode = result.get("result_code"); + if (!WxPayKit.codeIsOk(resultCode)) { + throw new BusinessException(returnMsg); + } + // 以下字段在 return_code 和 result_code 都为 SUCCESS 的时候有返回 + String prepayId = result.get("prepay_id"); + Map packageParams = WxPayKit.miniAppPrepayIdCreateSign(wxPayApiConfig.getAppId(), prepayId, + wxPayApiConfig.getPartnerKey(), SignType.HMACSHA256); + String jsonStr = JSON.toJSONString(packageParams); + log.info("小程序支付的参数:" + jsonStr); + return ApiResult.ok(packageParams); + } + + @PostMapping("/payNotify") + @OperationLog(name = "微信支付异步信息", type = OperationLogType.UPDATE) + @ApiOperation(value = "微信支付异步信息", response = ApiResult.class) + public String notify(HttpServletRequest request) throws Exception { + String xmlMsg = HttpKit.readData(request); + log.info("支付通知=" + xmlMsg); + Map params = WxPayKit.xmlToMap(xmlMsg); + + String returnCode = params.get("return_code"); + + // 注意重复通知的情况,同一订单号可能收到多次通知,请注意一定先判断订单状态 + // 注意此处签名方式需与统一下单的签名类型一致 + if (WxPayKit.verifyNotify(params, WxPayApiConfigKit.getWxPayApiConfig().getPartnerKey(), SignType.HMACSHA256)) { + if (WxPayKit.codeIsOk(returnCode)) { + // 更新订单信息 + Order order = orderService.getOne(new LambdaQueryWrapper().eq(Order::getOrderId, params.get("out_trade_no"))); + // 发送通知等 + Map xml = new HashMap(2); + xml.put("return_code", "SUCCESS"); + xml.put("return_msg", "OK"); + + if (order == null) { + return null; + } + // 如果订单已经支付成功则直接返回成功 + if (order.getStatus().equals("2")) { + return WxPayKit.toXml(xml); + } + order.setStatus("2"); // 订单状态设置为成功 + order.setTradeNo(params.get("transaction_id")); // 微信支付订单号 + order.setPayTime(new Date()); + if (order.getOrderType().equals("2")) { + boolean flag = profileService.renew(order.getUserId(), order.getAmount()); + } + orderService.updateOrder(order); + return WxPayKit.toXml(xml); + } + } + return null; + } + + @GetMapping("/queryOrder") + @OperationLog(name = "查询订单", type = OperationLogType.UPDATE) + @ApiOperation(value = "查询订单", response = ApiResult.class) + @Transactional + public ApiResult> queryOrder(@RequestParam(value = "transactionId", required = false) String transactionId, @RequestParam(value = "outTradeNo", required = false) String outTradeNo) throws Exception { + try { + WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); + + Map params = OrderQueryModel.builder() + .appid(wxPayApiConfig.getAppId()) + .mch_id(wxPayApiConfig.getMchId()) + .transaction_id(transactionId) + .out_trade_no(outTradeNo) + .nonce_str(WxPayKit.generateStr()) + .build() + .createSign(wxPayApiConfig.getPartnerKey(), SignType.MD5); + log.info("请求参数:{}", WxPayKit.toXml(params)); + String query = WxPayApi.orderQuery(params); + Map result = WxPayKit.xmlToMap(query); + String returnCode = result.get("return_code"); + String resultCode = result.get("result_code"); + String tradeState = result.get("trade_state"); + + // 交易成功判断条件: return_code、result_code和trade_state都为SUCCESS + if (WxPayKit.codeIsOk(returnCode) && WxPayKit.codeIsOk(resultCode) && WxPayKit.codeIsOk(tradeState)) { + String orderId = result.get("out_trade_no"); + Order order = orderService.getOne(new LambdaQueryWrapper().eq(Order::getOrderId, orderId)); + // 如果订单已被回调更新成功,则不重复更新 + if (order != null && !order.getStatus().equals("2")) { + order.setPayTime(Convert.toDate(result.get("time_end"))); + order.setStatus("2"); + order.setTradeNo(result.get("transaction_id")); + orderService.updateOrder(order); + // 如果是充值订单,则更新用户信息 + if (order.getOrderType().equals("2")) { + profileService.renew(order.getUserId(), order.getAmount()); + } + } + // 返回成功信息 + Map success = new HashMap<>(); + success.put("tradeState", "SUCCESS"); + success.put("orderId", orderId); + success.put("payTime", result.get("time_end")); + return ApiResult.ok(success); + } + log.info("查询结果: {}", query); + Map fail = new HashMap<>(); + fail.put("tradeState", "FAIL"); + fail.put("orderId", result.get("out_trade_no")); + fail.put("returnMsg", result.get("return_msg")); + return ApiResult.ok(fail); + } catch (Exception e) { + e.printStackTrace(); + throw new BusinessException(e.getMessage()); + } + } +} diff --git a/wechat/src/main/java/com/koronol/wxpay/entity/WxPayBean.java b/wechat/src/main/java/com/koronol/wxpay/entity/WxPayBean.java new file mode 100644 index 0000000000000000000000000000000000000000..bfb3d51733a023fa9e862ae0dd3f1fa826266716 --- /dev/null +++ b/wechat/src/main/java/com/koronol/wxpay/entity/WxPayBean.java @@ -0,0 +1,36 @@ +package com.koronol.wxpay.entity; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +import java.io.Serializable; + +@Configuration +@Data +public class WxPayBean implements Serializable { + + @Value("${wechat.appId}") + private String appId; + + @Value("${wechat.secret}") + private String appSecret; + + @Value("${wechat.mchId}") + private String mchId; + + @Value("${wechat.partnerKey}") + private String partnerKey; + + @Value("${wechat.certPath}") + private String certPath; + + @Value("${wechat.notifyUrl}") + private String domain; + + @Override + public String toString() { + return "WxPayBean [appId=" + appId + ", appSecret=" + appSecret + ", mchId=" + mchId + ", partnerKey=" + + partnerKey + ", certPath=" + certPath + ", domain=" + domain + "]"; + } +} diff --git a/wechat/src/main/java/com/koronol/wxpay/interceptor/WxPayInterceptor.java b/wechat/src/main/java/com/koronol/wxpay/interceptor/WxPayInterceptor.java new file mode 100644 index 0000000000000000000000000000000000000000..2e72c460d54e87cd6ce01f5a35b2dba26408be8a --- /dev/null +++ b/wechat/src/main/java/com/koronol/wxpay/interceptor/WxPayInterceptor.java @@ -0,0 +1,25 @@ +package com.koronol.wxpay.interceptor; + +import com.ijpay.wxpay.WxPayApiConfigKit; +import com.koronol.wxpay.controller.AbstractWxPayApiController; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class WxPayInterceptor implements HandlerInterceptor { + @Override + public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object handler) { + if (HandlerMethod.class.equals(handler.getClass())) { + HandlerMethod method = (HandlerMethod) handler; + Object controller = method.getBean(); + if (!(controller instanceof AbstractWxPayApiController)) { + throw new RuntimeException("控制器需要继承 AbstractWxPayApiController"); + } + WxPayApiConfigKit.setThreadLocalWxPayApiConfig(((AbstractWxPayApiController) controller).getApiConfig()); + return true; + } + return false; + } +} diff --git a/wechat/src/main/java/com/koronol/wxpay/param/WxPayNotifyParam.java b/wechat/src/main/java/com/koronol/wxpay/param/WxPayNotifyParam.java new file mode 100644 index 0000000000000000000000000000000000000000..4c0772e94eeac25b36bca9721b45ec8658f03c22 --- /dev/null +++ b/wechat/src/main/java/com/koronol/wxpay/param/WxPayNotifyParam.java @@ -0,0 +1,13 @@ +package com.koronol.wxpay.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("微信支付异步通知参数") +public class WxPayNotifyParam implements Serializable { + + private static final long serialVersionUID = 4833790332276666126L; +} diff --git a/wechat/src/main/java/com/koronol/wxpay/param/WxPayParam.java b/wechat/src/main/java/com/koronol/wxpay/param/WxPayParam.java new file mode 100644 index 0000000000000000000000000000000000000000..e639c69c258b44e6bb5167666c396649f129511e --- /dev/null +++ b/wechat/src/main/java/com/koronol/wxpay/param/WxPayParam.java @@ -0,0 +1,19 @@ +package com.koronol.wxpay.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("微信支付请求参数") +public class WxPayParam implements Serializable { + private static final long serialVersionUID = -3199999494937702812L; + + @ApiModelProperty("openId") + private String openId; + + @ApiModelProperty("商户订单号") + private String orderId; +} diff --git a/wechat/src/main/java/com/koronol/wxpay/vo/PaymentVo.java b/wechat/src/main/java/com/koronol/wxpay/vo/PaymentVo.java new file mode 100644 index 0000000000000000000000000000000000000000..1c4117b0870c308eef1a4d2a5c492185d62be3dd --- /dev/null +++ b/wechat/src/main/java/com/koronol/wxpay/vo/PaymentVo.java @@ -0,0 +1,33 @@ +package com.koronol.wxpay.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@Accessors(chain = true) +@ApiModel(value = "PaymentVo对象", description = "小程序预支付对象") +public class PaymentVo implements Serializable { + private static final long serialVersionUID = -8025859169297714783L; + + @ApiModelProperty("appId") + private String appId; + + @ApiModelProperty("timeStamp") + private String timeStamp; + + @ApiModelProperty("nonceStr") + private String nonceStr; + + @ApiModelProperty("统一下单接口返回的prepay_id参数值,提交格式如:prepay_id=***") + private String prepayId; + + @ApiModelProperty("该接口V3版本仅支持RSA") + private String signType; + + @ApiModelProperty("签名") + private String paySign; +} diff --git a/wechat/src/main/resources/cert/apiclient_cert.p12 b/wechat/src/main/resources/cert/apiclient_cert.p12 new file mode 100644 index 0000000000000000000000000000000000000000..b336c74618cd5aa99613e2639e7c8edb2829205b Binary files /dev/null and b/wechat/src/main/resources/cert/apiclient_cert.p12 differ diff --git a/wechat/src/main/resources/cert/apiclient_key.pem b/wechat/src/main/resources/cert/apiclient_key.pem new file mode 100644 index 0000000000000000000000000000000000000000..88868babf5e0181f98510696973f684ae70c664e --- /dev/null +++ b/wechat/src/main/resources/cert/apiclient_key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC92fL94Bt2i7vk +orS6H1QcVYPAj9PD/IvAz453wngz7/eEpQFTdhr16fUFhbvsMS2KCAeozmiMTYV4 +V17Rg3zbZimW42RJfw6vSTKiXqf82/mO4yWJbhJlkZOR+/GFlCeIQOefCdrQAApu +AU3sf0voEp78xBkw8689Dnc2JHhj5z5EzM1asMdemVWZKcxuHxjMrlgQbXUYC5Dj +qHXGE4IkFAEwF9hb2qGm1Sun9OiKFJmCNCzL5vZ+TCkiP2jW0JYPT5TMp41IuBJr +hgKfzoVojynYowhwiDmM1UK3xWzCZYhJlaXq0b3uqDhNgEDHtKs6uU4vUw+L7fcf +Av8D561pAgMBAAECggEBAKafGCI0hCXgsYESQ6duQ3Wyn7VrBaJmjYklIJZ++Nws +aYHjB2zmpPba5I56NtoutxcDwSUoMp2gk9lwZOlgiz5LRYkF/Uh72LmCdowGo0zL +CxWayaD6F+9IesmO4wQnaSKuRBpSndYbkwvE3U0I0+fUH/EbcjiCRnRBs+Ky025p +S8o8LhZgPNPdombZI+gVEC4Ev44vsgH/Gnf5tyVsB5FkFYnHAnjynVRAPeB0uPtI +WIh+7mhiVFR0Jokgkr8bQIYmPbjNC6fDeydj5cua6L5p8nt0Zv1WETkiuORQaVgm +PXaXOFQgKEYZ8ryCAjHIfuSWJjlgeBpGudR0PiKa2eECgYEA58N82wdPmntF2+XR +6gNPfD6u9ydoLM1/dwk25EXYpkaoRieW53YRl6XFQWfPRR2xPrnnk6ZvPtfJmc9g +CGs5XhfKL7hKVs/W3nJZb/d6Ogt3d8mgs5OKqnJ3h5zN5zGmpYx+ji+/Ditpqc7g +FoVrLZmtKRvvLdDqg92tWZSJVz0CgYEA0bRvIJfyZiIrRlYeiYeabG2S7sd3D7AC +31jxYYHsxRswt8+8aUYKvYJZsMv6nqAb8nYWNu341xrlUXqYZWpcvvPr41NkhNjJ ++Yoj6AjdEwCBHNy6qb2ks3y6h4+JMoLn02E20pqpBfSRIfb6936HnuFo9TJEP3g0 +HVUD/VWMsZ0CgYEAkmKFEArUGqzV+Qh1x6sDn2QwOudnAzVg1xy40QHUz2E9k+IZ +jGSkw/XuW1toLS2N8CKXxEiRZ04AhefXrjmbaHT6PZ3XRnHMM4BiQTg8uUDY2o49 +tG7yXKokGUHPQ8G2kkXlAYXi1N5SxPBn1ZG7mnfASYDdV0DnfxabEUOiY7kCgYEA +sGAzC1XhUZexkBIE0yWTc1jhuSVY9X/TmqjDNIDDdLC+1ArL7Ds181h8OWAGpX4C +o3ZAjuiuX7VGZLZZEQtZgF3F68gLBlUT42cVdiZmUoIdFfpsoTFZIoFonXXTLgG+ +HCJqqs3cFZ8ypj+Fq73nMXFjBr/FeSCPrJABsARRNl0CgYBfC+QgFhQH3fpR3vyh +BNWrK0QpR8dnbVe4V1LEK0rLcpMwzoCcRtXyZpLmuJyl9e/Q9wRbWCqkkty571KC +Kv5AmRbOS88RhJNS1iX6pvo/e5rIlNu2oNRL/+uvQY8s+PGEmPu0YqVi586FhVCk +zOB6q60eZHktJZshkc+iKG0RBQ== +-----END PRIVATE KEY----- diff --git a/wechat/src/main/resources/mapper/invite/InviteMapper.xml b/wechat/src/main/resources/mapper/invite/InviteMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..3aa959099553d7319557a40ff111aaa08e0d626f --- /dev/null +++ b/wechat/src/main/resources/mapper/invite/InviteMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/wechat/src/main/resources/mapper/profile/ProfileMapper.xml b/wechat/src/main/resources/mapper/profile/ProfileMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..365fb8ee0d513a256d2f73217930b56a06e169f2 --- /dev/null +++ b/wechat/src/main/resources/mapper/profile/ProfileMapper.xml @@ -0,0 +1,8 @@ + + + + + insert into p_profile (name, phone, open_id, nick_name, avatar_url) + values (#{name}, #{phone}, #{openId}, #{nickName}, #{avatarUrl}) + +