From 0562eb4dc8fb1c47d9185e3ae9687a1e15543a77 Mon Sep 17 00:00:00 2001 From: Peng Hu Date: Wed, 27 Nov 2019 13:52:42 +0900 Subject: [PATCH 01/17] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 5b50b894..36de67a3 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: #houko/SpringBootUnity otechie: # Replace with a single Otechie username -custom: https:blog.xiaomo.info +custom: #https:blog.xiaomo.info From ed92380850252c781ae75f32339fef8de3b0a87c Mon Sep 17 00:00:00 2001 From: Peng Hu Date: Sun, 8 Dec 2019 20:22:41 +0900 Subject: [PATCH 02/17] Update Readme.md --- Readme.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 3310d9da..ba5bcf39 100644 --- a/Readme.md +++ b/Readme.md @@ -9,9 +9,8 @@ ### 环境 - `maven` latest - `jdk1.8` -- `spring boot 1.5.8 release`(目前最新版) -- 个人推荐`idea`来代替eclipse(希望不要被说成异教徒必须死) -- mysql5.5+ +- `spring boot 2.x release` +- 个人推荐`idea`来代替eclipse - git: 版本管理 - nginx: 反向代理服务器 From 88019adb2bb8685487b42b3f456a822d3874f645 Mon Sep 17 00:00:00 2001 From: Peng Hu Date: Sun, 8 Dec 2019 20:23:45 +0900 Subject: [PATCH 03/17] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index ba5bcf39..0dfd9aa5 100644 --- a/Readme.md +++ b/Readme.md @@ -16,7 +16,7 @@ ### 注意事项 -- 本项目代码托管在[github](https://github.com/houko/SpringBootUnity)和[码云](http://git.oschina.net/hupeng/SpringBootUnity)两个地方,最新代码会先推送在github上,码云上会在github上更新完之后进行同步。 +- 本项目代码托管在[github](https://github.com/houko/SpringBootUnity)和[码云](http://git.oschina.net/hupeng_admin/SpringBootUnity)两个地方,最新代码会先推送在github上,码云上会在github上更新完之后进行同步。 - 本项目多数数据库都用到了`hibernate`,如果没有提供`sql`文件。则启动时会根据代码映射自动生成数据库表,请在启动前修改`application.properties`中的数据库连接信息 From e5865ef596973883f3c799ad0e486a28b740d036 Mon Sep 17 00:00:00 2001 From: Peng Hu Date: Fri, 5 Jun 2020 13:36:15 +0800 Subject: [PATCH 04/17] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 0dfd9aa5..c9e6929a 100644 --- a/Readme.md +++ b/Readme.md @@ -121,7 +121,7 @@ http://localhost:808/doc.html bootstrap-ui MIT License - Copyright (c) 2019 Peng Hu + Copyright (c) 2020 Peng Hu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 31ce2884d5a880248d595009681a8ec07116ced3 Mon Sep 17 00:00:00 2001 From: houko Date: Fri, 9 Oct 2020 19:15:47 +0900 Subject: [PATCH 05/17] upgrade version to 2020.1 --- Readme.md | 2 +- async/pom.xml | 4 +- .../resources/config/application.properties | 2 +- core/pom.xml | 2 +- crawler/pom.xml | 4 +- .../resources/config/application.properties | 3 +- freemarker/pom.xml | 4 +- .../resources/config/application.properties | 2 +- javase/pom.xml | 4 +- .../javase/controller/QuestionController.java | 6 +- .../resources/config/application.properties | 17 ++- mongodb/pom.xml | 4 +- .../controller/MongoUserController.java | 2 +- .../resources/config/application.properties | 2 +- multipleSource/pom.xml | 4 +- .../resources/config/application.properties | 6 +- mybatis/pom.xml | 4 +- .../resources/config/application.properties | 4 +- order/pom.xml | 4 +- .../order/controller/OrderController.java | 2 +- pom.xml | 34 ++---- rabbitmq/pom.xml | 4 +- .../resources/config/application.properties | 2 +- redis/pom.xml | 4 +- .../resources/config/application.properties | 2 +- scheduled/pom.xml | 4 +- .../resources/config/application.properties | 2 +- security/pom.xml | 4 +- .../resources/config/application.properties | 2 +- socket/pom.xml | 4 +- .../resources/config/application.properties | 2 +- thymeleaf/pom.xml | 4 +- .../resources/config/application.properties | 2 +- website/pom.xml | 16 ++- .../controller/AdminUserController.java | 36 +++--- .../controller/ChangeLogController.java | 24 ++-- .../website/controller/LinkController.java | 12 +- .../controller/TechnologyController.java | 27 ++--- .../website/controller/UserController.java | 40 +++--- .../website/controller/WorksController.java | 114 +++--------------- .../website/interceptor/LoginInterceptor.java | 2 +- .../service/impl/AdminUserServiceImpl.java | 2 +- .../service/impl/ChangeLogServiceImpl.java | 2 +- .../website/service/impl/LinkServiceImpl.java | 3 +- .../website/service/impl/UserServiceImpl.java | 2 +- .../resources/config/application.properties | 4 +- .../test/java/info/xiaomo/test/MailTests.java | 71 ----------- .../src/test/resources/application.properties | 33 ----- 48 files changed, 181 insertions(+), 359 deletions(-) delete mode 100644 website/src/test/java/info/xiaomo/test/MailTests.java delete mode 100644 website/src/test/resources/application.properties diff --git a/Readme.md b/Readme.md index c9e6929a..207b7268 100644 --- a/Readme.md +++ b/Readme.md @@ -59,7 +59,7 @@ http://localhost:808/doc.html bootstrap-ui - 2017-09-08 crawler模块(网络爬虫):修复本地文件目录不存在会报错的bug。处理方式为:不存在则自动创建 - 2017-11-02 开源协议从apache更换到MIT - 2017-11-02 添加本地运行方式的说明 -- 2017-11-02 版本更新到2017.2 +- 2017-11-02 版本更新到2020.1 - 2017-11-02 spring boot版本更新到1.5.8 - 2017-11-03 添加kotlin环境配置 - 2017-11-03 按照阿里巴巴编程规范插件P3C优化代码 diff --git a/async/pom.xml b/async/pom.xml index ae7c1344..60d54b74 100644 --- a/async/pom.xml +++ b/async/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -14,7 +14,7 @@ info.xiaomo core - 2017.2 + 2020.1 diff --git a/async/src/main/resources/config/application.properties b/async/src/main/resources/config/application.properties index 464af148..79ef9397 100644 --- a/async/src/main/resources/config/application.properties +++ b/async/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 diff --git a/core/pom.xml b/core/pom.xml index 94636319..8e3af9eb 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ info.xiaomo xiaomo - 2017.2 + 2020.1 4.0.0 diff --git a/crawler/pom.xml b/crawler/pom.xml index d8cde5a4..157ff6a3 100644 --- a/crawler/pom.xml +++ b/crawler/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/crawler/src/main/resources/config/application.properties b/crawler/src/main/resources/config/application.properties index 1a4a1da6..8d5bd3e7 100644 --- a/crawler/src/main/resources/config/application.properties +++ b/crawler/src/main/resources/config/application.properties @@ -1,6 +1,5 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 server.max-http-header-size=20971520 #datasource @@ -8,7 +7,7 @@ spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true # ?useUnicode=true&characterEncoding=UTF-8 spring.datasource.username=username spring.datasource.password=password -spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss #spring.jackson.time-zone=GMT+8 diff --git a/freemarker/pom.xml b/freemarker/pom.xml index 856c083f..d866ff82 100644 --- a/freemarker/pom.xml +++ b/freemarker/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -14,7 +14,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/freemarker/src/main/resources/config/application.properties b/freemarker/src/main/resources/config/application.properties index 8ac071cd..ae76e147 100644 --- a/freemarker/src/main/resources/config/application.properties +++ b/freemarker/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss diff --git a/javase/pom.xml b/javase/pom.xml index 14560de4..e3a3c480 100644 --- a/javase/pom.xml +++ b/javase/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/javase/src/main/java/info/xiaomo/javase/controller/QuestionController.java b/javase/src/main/java/info/xiaomo/javase/controller/QuestionController.java index 90bb52c3..d76c4876 100644 --- a/javase/src/main/java/info/xiaomo/javase/controller/QuestionController.java +++ b/javase/src/main/java/info/xiaomo/javase/controller/QuestionController.java @@ -44,7 +44,7 @@ public QuestionController(QuestionService service) { * @param id id * @return result */ - @ApiOperation(value = "查找问题", notes = "查找问题", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "查找问题", notes = "查找问题", httpMethod = "GET") @RequestMapping(value = "findById/{id}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"), @@ -52,7 +52,7 @@ public QuestionController(QuestionService service) { public Result findUserById(@PathVariable("id") Long id) { QuestionModel questionModel = service.findById(id); if (questionModel == null) { - return new Result(CodeConst.NOT_FOUNT.getResultCode(), CodeConst.NOT_FOUNT.getMessage()); + return new Result<>(CodeConst.NOT_FOUNT.getResultCode(), CodeConst.NOT_FOUNT.getMessage()); } return new Result<>(questionModel); } @@ -62,7 +62,7 @@ public Result findUserById(@PathVariable("id") Long id) { * * @return result */ - @ApiOperation(value = "添加", notes = "添加", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "添加", notes = "添加", httpMethod = "POST") @RequestMapping(value = "findById/{id}", method = RequestMethod.POST) public Result addQuestion(@RequestBody QuestionModel questionModel) { boolean add = service.add(questionModel); diff --git a/javase/src/main/resources/config/application.properties b/javase/src/main/resources/config/application.properties index d83fc3f2..34b74282 100644 --- a/javase/src/main/resources/config/application.properties +++ b/javase/src/main/resources/config/application.properties @@ -1,13 +1,12 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 server.max-http-header-size=20971520 #datasource spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true # ?useUnicode=true&characterEncoding=UTF-8 spring.datasource.username=xiaomo spring.datasource.password=password -spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss #spring.jackson.time-zone=GMT+8 @@ -23,12 +22,12 @@ spring.redis.host=ip spring.redis.port=6379 spring.redis.password= # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 -spring.redis.pool.max-active=8 -# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 -spring.redis.pool.max-wait=-1 -# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5 -spring.redis.pool.max-idle=8 -# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5 -spring.redis.pool.min-idle=0 +#spring.redis.pool.max-active=8 +## \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 +#spring.redis.pool.max-wait=-1 +## \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5 +#spring.redis.pool.max-idle=8 +## \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5 +#spring.redis.pool.min-idle=0 # \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 spring.redis.timeout=0 diff --git a/mongodb/pom.xml b/mongodb/pom.xml index 5a17eca2..f3ade783 100644 --- a/mongodb/pom.xml +++ b/mongodb/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -14,7 +14,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/mongodb/src/main/java/info/xiaomo/mongodb/controller/MongoUserController.java b/mongodb/src/main/java/info/xiaomo/mongodb/controller/MongoUserController.java index 58f1dbdb..a7056409 100644 --- a/mongodb/src/main/java/info/xiaomo/mongodb/controller/MongoUserController.java +++ b/mongodb/src/main/java/info/xiaomo/mongodb/controller/MongoUserController.java @@ -54,7 +54,7 @@ public Result add(@RequestBody MongoUser user) { @RequestMapping(value = "delete/{id}", method = RequestMethod.GET) public Result delete(@PathVariable("id") Long id) { service.delete(id); - return new Result(CodeConst.SUCCESS.getResultCode(), CodeConst.SUCCESS.getMessage()); + return new Result<>(CodeConst.SUCCESS.getResultCode(), CodeConst.SUCCESS.getMessage()); } } diff --git a/mongodb/src/main/resources/config/application.properties b/mongodb/src/main/resources/config/application.properties index 8676bc6c..192ebb13 100644 --- a/mongodb/src/main/resources/config/application.properties +++ b/mongodb/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 #mongodb diff --git a/multipleSource/pom.xml b/multipleSource/pom.xml index dced9ad7..52e3b92d 100644 --- a/multipleSource/pom.xml +++ b/multipleSource/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/multipleSource/src/main/resources/config/application.properties b/multipleSource/src/main/resources/config/application.properties index 1f0a93a5..f1910361 100644 --- a/multipleSource/src/main/resources/config/application.properties +++ b/multipleSource/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss @@ -10,13 +10,13 @@ spring.jackson.time-zone=GMT+8 spring.datasource.primary.url=jdbc:mysql://ip:3306/test1?characterEncoding=utf8&useSSL=true spring.datasource.primary.username=\u4F60\u7684\u5E10\u53F7 spring.datasource.primary.password=\u4F60\u7684\u5BC6\u7801 -spring.datasource.primary.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.primary.driver-class-name=com.mysql.cj.jdbc.Driver #database2 spring.datasource.secondary.url=jdbc:mysql://ip:3306/test2?characterEncoding=utf8&useSSL=true spring.datasource.secondary.username=\u5E10\u53F7 spring.datasource.secondary.password=\u4F60\u7684\u5BC6\u7801 -spring.datasource.secondary.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver diff --git a/mybatis/pom.xml b/mybatis/pom.xml index 1f021924..aca5b38b 100644 --- a/mybatis/pom.xml +++ b/mybatis/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.mybatis.spring.boot diff --git a/mybatis/src/main/resources/config/application.properties b/mybatis/src/main/resources/config/application.properties index c75522bf..b138051d 100644 --- a/mybatis/src/main/resources/config/application.properties +++ b/mybatis/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss @@ -11,7 +11,7 @@ spring.jackson.time-zone=GMT+8 spring.datasource.url=jdbc:mysql://ip:3306/db?characterEncoding=utf8&useSSL=true spring.datasource.username=username spring.datasource.password=password -spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver diff --git a/order/pom.xml b/order/pom.xml index 7c8e3fb7..fed4e2b0 100644 --- a/order/pom.xml +++ b/order/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -14,7 +14,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/order/src/main/java/info/xiaomo/order/controller/OrderController.java b/order/src/main/java/info/xiaomo/order/controller/OrderController.java index f215d9ff..416d1c4d 100644 --- a/order/src/main/java/info/xiaomo/order/controller/OrderController.java +++ b/order/src/main/java/info/xiaomo/order/controller/OrderController.java @@ -28,7 +28,7 @@ public OrderController(OrderService orderService) { @RequestMapping(value = "forbid/{id}", method = RequestMethod.GET) - @ApiOperation(value = "封号", notes = "根据传入的id对修改对应帐号状态", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "封号", notes = "根据传入的id对修改对应帐号状态", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "后台用户唯一id", required = true, dataType = "Long", paramType = "path") }) diff --git a/pom.xml b/pom.xml index 8dd1ca77..ff5ee3a0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 info.xiaomo xiaomo - 2017.2 + 2020.1 @@ -36,7 +36,9 @@ multipleSource crawler + javase + order pom @@ -48,30 +50,18 @@ - - - - - - - - - - - - UTF-8 - 1.8 + 11 3.5 4.12 - 5.1.38 + 8.0.21 1.7.21 @@ -85,7 +75,7 @@ 1.10.1 - 2.0.3.RELEASE + 2.3.0.RELEASE 3.5.1 @@ -93,7 +83,7 @@ 1.4.7 - 1.16.10 + 1.18.14 2.2.2 @@ -123,6 +113,11 @@ pom import + + dom4j + dom4j + 1.6.1 + junit junit @@ -246,16 +241,13 @@ maven-source-plugin - 2.1 + 3.2.0 true compile - - jar - diff --git a/rabbitmq/pom.xml b/rabbitmq/pom.xml index 5237d5c8..eed80ec6 100644 --- a/rabbitmq/pom.xml +++ b/rabbitmq/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/rabbitmq/src/main/resources/config/application.properties b/rabbitmq/src/main/resources/config/application.properties index e2c21445..b3ab7a48 100644 --- a/rabbitmq/src/main/resources/config/application.properties +++ b/rabbitmq/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 diff --git a/redis/pom.xml b/redis/pom.xml index 348bf85a..3ed31182 100644 --- a/redis/pom.xml +++ b/redis/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/redis/src/main/resources/config/application.properties b/redis/src/main/resources/config/application.properties index b25e5713..7721fe42 100644 --- a/redis/src/main/resources/config/application.properties +++ b/redis/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 # redis diff --git a/scheduled/pom.xml b/scheduled/pom.xml index b4bff7da..fa18839a 100644 --- a/scheduled/pom.xml +++ b/scheduled/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -14,7 +14,7 @@ info.xiaomo core - 2017.2 + 2020.1 diff --git a/scheduled/src/main/resources/config/application.properties b/scheduled/src/main/resources/config/application.properties index 2bbf0e38..7d2d7151 100644 --- a/scheduled/src/main/resources/config/application.properties +++ b/scheduled/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 diff --git a/security/pom.xml b/security/pom.xml index bf01534e..2c3b2bda 100644 --- a/security/pom.xml +++ b/security/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/security/src/main/resources/config/application.properties b/security/src/main/resources/config/application.properties index e32aee62..8d858203 100644 --- a/security/src/main/resources/config/application.properties +++ b/security/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss diff --git a/socket/pom.xml b/socket/pom.xml index c7509645..3739f943 100644 --- a/socket/pom.xml +++ b/socket/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/socket/src/main/resources/config/application.properties b/socket/src/main/resources/config/application.properties index 453a78fb..d1e72d0f 100644 --- a/socket/src/main/resources/config/application.properties +++ b/socket/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8081 -server.session.timeout=1800 + server.max-http-header-size=20971520 diff --git a/thymeleaf/pom.xml b/thymeleaf/pom.xml index 6a7376b3..6d1b1f53 100644 --- a/thymeleaf/pom.xml +++ b/thymeleaf/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -14,7 +14,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot diff --git a/thymeleaf/src/main/resources/config/application.properties b/thymeleaf/src/main/resources/config/application.properties index 9a461544..fec3b903 100644 --- a/thymeleaf/src/main/resources/config/application.properties +++ b/thymeleaf/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss diff --git a/website/pom.xml b/website/pom.xml index 5e3a88d4..3a00bf4f 100644 --- a/website/pom.xml +++ b/website/pom.xml @@ -5,7 +5,7 @@ xiaomo info.xiaomo - 2017.2 + 2020.1 4.0.0 @@ -15,7 +15,7 @@ info.xiaomo core - 2017.2 + 2020.1 org.springframework.boot @@ -43,6 +43,18 @@ swagger-bootstrap-ui 1.5 + + org.springframework + spring-webmvc + + + org.projectlombok + lombok + + + org.springframework.boot + spring-boot-starter-web + diff --git a/website/src/main/java/info/xiaomo/website/controller/AdminUserController.java b/website/src/main/java/info/xiaomo/website/controller/AdminUserController.java index 0756bbdc..c79e934b 100644 --- a/website/src/main/java/info/xiaomo/website/controller/AdminUserController.java +++ b/website/src/main/java/info/xiaomo/website/controller/AdminUserController.java @@ -56,7 +56,7 @@ public AdminUserController(AdminUserService service) { * @return Result */ @RequestMapping(value = "login/{userName}/{password}", method = RequestMethod.POST) - @ApiOperation(value = "获取用户信息", notes = "根据用户帐号和密码登录后台", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "获取用户信息", notes = "根据用户帐号和密码登录后台", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "userName", value = "用户名", required = true, dataType = "Result", paramType = "path"), @ApiImplicitParam(name = "password", value = "用户名", required = true, dataType = "Result", paramType = "path") @@ -65,13 +65,13 @@ public AdminUserController(AdminUserService service) { @ApiResponse(code = 404, message = "Not Found"), @ApiResponse(code = 400, message = "No Name Provided"), }) - public Result login(@PathVariable("userName") String userName, @PathVariable("password") String password) { + public Result login(@PathVariable("userName") String userName, @PathVariable("password") String password) { AdminModel adminModel = service.findAdminUserByUserName(userName); if (adminModel == null) { - return new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); + return new Result<>(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); } if (!Md5Util.encode(password, adminModel.getSalt()).equals(adminModel.getPassword())) { - return new Result(CodeConst.AUTH_FAILED.getResultCode(), CodeConst.AUTH_FAILED.getMessage()); + return new Result<>(CodeConst.AUTH_FAILED.getResultCode(), CodeConst.AUTH_FAILED.getMessage()); } return new Result<>(adminModel); } @@ -82,7 +82,7 @@ public Result login(@PathVariable("userName") String userName, @PathVariable("pa * * @return Result */ - @ApiOperation(value = "添加后台用户", notes = "传一个管理员用户模型过来然后保存到数据库", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "添加后台用户", notes = "传一个管理员用户模型过来然后保存到数据库", httpMethod = "POST") @RequestMapping(value = "add", method = RequestMethod.POST) @ApiResponses(value = { @ApiResponse(code = 404, message = "Not Found"), @@ -91,7 +91,7 @@ public Result login(@PathVariable("userName") String userName, @PathVariable("pa public Result add(@RequestBody AdminModel model) { AdminModel adminModel = service.findAdminUserByUserName(model.getUserName()); if (adminModel != null) { - return new Result(CodeConst.ADMIN_USER_REPEAT.getResultCode(), CodeConst.ADMIN_USER_REPEAT.getMessage()); + return new Result<>(CodeConst.ADMIN_USER_REPEAT.getResultCode(), CodeConst.ADMIN_USER_REPEAT.getMessage()); } String salt = RandomUtil.createSalt(); model.setSalt(salt); @@ -106,7 +106,7 @@ public Result add(@RequestBody AdminModel model) { * @param id id * @return Result */ - @ApiOperation(value = "查找用户", notes = "根据传来的id查找用户并返回", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "查找用户", notes = "根据传来的id查找用户并返回", httpMethod = "GET") @RequestMapping(value = "findById/{id}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "后台用户唯一id", required = true, dataType = "Long", paramType = "path") @@ -118,7 +118,7 @@ public Result add(@RequestBody AdminModel model) { public Result findUserById(@PathVariable("id") Long id) { AdminModel adminModel = service.findAdminUserById(id); if (adminModel == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(adminModel); } @@ -163,7 +163,7 @@ public Result findById(@PathVariable Long id) { * @return Result */ @Override - @ApiOperation(value = "查找用户", notes = "根据传来的用户名查找用户并返回", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "查找用户", notes = "根据传来的用户名查找用户并返回", httpMethod = "GET") @RequestMapping(value = "findByName/{userName}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "userName", value = "用户名", required = true, dataType = "String", paramType = "path") @@ -175,7 +175,7 @@ public Result findById(@PathVariable Long id) { public Result findByName(@PathVariable("userName") String userName) { AdminModel adminModel = service.findAdminUserByUserName(userName); if (adminModel == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(adminModel); } @@ -242,7 +242,7 @@ public Result delByIds(@PathVariable List ids) { * @throws UserNotFoundException UserNotFoundException */ @RequestMapping(value = "changePassword", method = RequestMethod.POST) - @ApiOperation(value = "修改用户密码", notes = "传来模型验证并修改密码", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "修改用户密码", notes = "传来模型验证并修改密码", httpMethod = "POST") @ApiResponses(value = { @ApiResponse(code = 404, message = "Not Found"), @ApiResponse(code = 400, message = "No Name Provided"), @@ -250,7 +250,7 @@ public Result delByIds(@PathVariable List ids) { public Result changePassword(@RequestBody AdminModel model) throws UserNotFoundException { AdminModel adminModel = service.findAdminUserByUserName(model.getUserName()); if (adminModel == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } String salt = RandomUtil.createSalt(); adminModel.setSalt(salt); @@ -266,7 +266,7 @@ public Result changePassword(@RequestBody AdminModel model) throws UserNotFoundE * @return 不分页 */ @RequestMapping(value = "findAll", method = RequestMethod.GET) - @ApiOperation(value = "返回所有用户信息", notes = "不分页", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "返回所有用户信息", notes = "不分页", httpMethod = "GET") @ApiResponses(value = { @ApiResponse(code = 404, message = "Not Found"), @ApiResponse(code = 400, message = "No Name Provided"), @@ -287,7 +287,7 @@ public Result getAll() { * @throws UserNotFoundException UserNotFoundException */ @RequestMapping(value = "delete/{id}", method = RequestMethod.GET) - @ApiOperation(value = "删除用户", notes = "根据传入的id删除对应的用户", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "删除用户", notes = "根据传入的id删除对应的用户", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "用户唯一id", required = true, dataType = "Long", paramType = "path") }) @@ -298,7 +298,7 @@ public Result getAll() { public Result deleteUserById(@PathVariable("id") Long id) throws UserNotFoundException { AdminModel adminModel = service.findAdminUserById(id); if (adminModel == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } service.deleteAdminUserById(id); return new Result<>(adminModel); @@ -312,7 +312,7 @@ public Result deleteUserById(@PathVariable("id") Long id) throws UserNotFoundExc * @throws UserNotFoundException UserNotFoundException */ @RequestMapping(value = "update/{userName}", method = RequestMethod.POST) - @ApiOperation(value = "更新用户信息", notes = "根据传入的模型更新用户信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "更新用户信息", notes = "根据传入的模型更新用户信息", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "userName", value = "用户名", required = true, dataType = "String", paramType = "path") }) @@ -338,7 +338,7 @@ public Result update(@PathVariable("userName") String userName) throws UserNotFo * @throws UserNotFoundException UserNotFoundException */ @RequestMapping(value = "forbid/{id}", method = RequestMethod.GET) - @ApiOperation(value = "封号", notes = "根据传入的id对修改对应帐号状态", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "封号", notes = "根据传入的id对修改对应帐号状态", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "后台用户唯一id", required = true, dataType = "Long", paramType = "path") }) @@ -349,7 +349,7 @@ public Result update(@PathVariable("userName") String userName) throws UserNotFo public Result forbid(@PathVariable("id") Long id) throws UserNotFoundException { AdminModel model = service.findAdminUserById(id); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } model = service.forbidAdminUserById(id); return new Result<>(model); diff --git a/website/src/main/java/info/xiaomo/website/controller/ChangeLogController.java b/website/src/main/java/info/xiaomo/website/controller/ChangeLogController.java index 0d8783cb..86452ba6 100644 --- a/website/src/main/java/info/xiaomo/website/controller/ChangeLogController.java +++ b/website/src/main/java/info/xiaomo/website/controller/ChangeLogController.java @@ -50,14 +50,14 @@ public ChangeLogController(ChangeLogService service) { */ @Override @RequestMapping(value = "findById/{id}", method = RequestMethod.GET) - @ApiOperation(value = "通过id查找", notes = "通过id查找", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "通过id查找", notes = "通过id查找", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path") }) public Result findById(@PathVariable("id") Long id) { ChangeLogModel changeLogModel = service.findById(id); if (changeLogModel == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(changeLogModel); } @@ -69,14 +69,14 @@ public Result findById(@PathVariable("id") Long id) { */ @Override @RequestMapping(value = "findByName/{name}", method = RequestMethod.GET) - @ApiOperation(value = "通过名字查找", notes = "通过名字查找", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "通过名字查找", notes = "通过名字查找", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "更新日志内容", required = true, dataType = "String", paramType = "path") }) public Result findByName(@PathVariable("name") String name) { ChangeLogModel model = service.findByName(name); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(model); } @@ -143,11 +143,11 @@ public Result delByIds(@PathVariable List ids) { */ @Override @RequestMapping(value = "findAll", method = RequestMethod.GET) - @ApiOperation(value = "分页查询更新日志", notes = "分页查询更新日志", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "分页查询更新日志", notes = "分页查询更新日志", httpMethod = "GET") public Result findAll() { List pages = service.findAll(); if (pages == null || pages.size() <= 0) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(pages); } @@ -169,12 +169,12 @@ public Result findAll(@PathVariable int start, @PathVariable int pageSize) * * @return result */ - @ApiOperation(value = "增加更新日志", notes = "增加更新日志", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "增加更新日志", notes = "增加更新日志", httpMethod = "POST") @RequestMapping(value = "add", method = RequestMethod.POST) public Result add(@RequestBody ChangeLogModel model) { ChangeLogModel changeLogModel = service.findByName(model.getName()); if (changeLogModel != null) { - return new Result(CodeConst.REPEAT.getResultCode(), CodeConst.REPEAT.getMessage()); + return new Result<>(CodeConst.REPEAT.getResultCode(), CodeConst.REPEAT.getMessage()); } changeLogModel = new ChangeLogModel(); changeLogModel.setName(model.getName()); @@ -189,12 +189,12 @@ public Result add(@RequestBody ChangeLogModel model) { * * @return result */ - @ApiOperation(value = "修改更新日志", notes = "修改更新日志", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "修改更新日志", notes = "修改更新日志", httpMethod = "POST") @RequestMapping(value = "update", method = RequestMethod.POST) public Result update(@RequestBody ChangeLogModel model) { ChangeLogModel changeLogModel = service.findByName(model.getName()); if (changeLogModel == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } changeLogModel.setName(model.getName()); changeLogModel.setOnlineTime(model.getOnlineTime()); @@ -207,14 +207,14 @@ public Result update(@RequestBody ChangeLogModel model) { * 删除更新日志 */ @RequestMapping(value = "delete/{id}", method = RequestMethod.GET) - @ApiOperation(value = "删除更新日志", notes = "删除更新日志", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "删除更新日志", notes = "删除更新日志", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path") }) public Result deleteById(@PathVariable("id") Long id) { ChangeLogModel changeLogModel = service.findById(id); if (changeLogModel == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } ChangeLogModel delModel = service.delete(id); return new Result<>(delModel); diff --git a/website/src/main/java/info/xiaomo/website/controller/LinkController.java b/website/src/main/java/info/xiaomo/website/controller/LinkController.java index 6aa52756..1afd6385 100644 --- a/website/src/main/java/info/xiaomo/website/controller/LinkController.java +++ b/website/src/main/java/info/xiaomo/website/controller/LinkController.java @@ -49,7 +49,7 @@ public LinkController(LinkService service) { * @return model */ @RequestMapping(value = "findById/{id}", method = RequestMethod.GET) - @ApiOperation(value = "通过id查找", notes = "通过id查找", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "通过id查找", notes = "通过id查找", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path") }) @@ -69,7 +69,7 @@ public Result findLinkById(@PathVariable("id") Long id) { */ @Override @RequestMapping(value = "findByName/{name}", method = RequestMethod.GET) - @ApiOperation(value = "根据名字查找", notes = "根据名字查找", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "根据名字查找", notes = "根据名字查找", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "友情链接名字", required = true, dataType = "String", paramType = "path") }) @@ -144,7 +144,7 @@ public Result delByIds(@PathVariable List ids) { */ @Override @RequestMapping(value = "findAll", method = RequestMethod.GET) - @ApiOperation(value = "返回所有数据", notes = "返回所有数据", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "返回所有数据", notes = "返回所有数据", httpMethod = "GET") public Result findAll() { List pages = service.findAll(); if (pages == null || pages.size() == 0) { @@ -182,7 +182,7 @@ public Result findById(@PathVariable Long id) { * @return model */ @RequestMapping(value = "add", method = RequestMethod.POST) - @ApiOperation(value = "添加链接", notes = "添加链接", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "添加链接", notes = "添加链接", httpMethod = "POST") public Result add(@RequestBody LinkModel model) { LinkModel linkModel = service.findByName(model.getName()); if (linkModel != null) { @@ -200,7 +200,7 @@ public Result add(@RequestBody LinkModel model) { * * @return model */ - @ApiOperation(value = "更新链接", notes = "更新链接", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "更新链接", notes = "更新链接", httpMethod = "POST") @RequestMapping(value = "update", method = RequestMethod.POST) public Result update(@RequestBody LinkModel model) { LinkModel linkModel = service.findById(model.getId()); @@ -220,7 +220,7 @@ public Result update(@RequestBody LinkModel model) { * @return model */ @RequestMapping(value = "delete/{id}", method = RequestMethod.GET) - @ApiOperation(value = "删除链接", notes = "删除链接", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "删除链接", notes = "删除链接", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path") }) diff --git a/website/src/main/java/info/xiaomo/website/controller/TechnologyController.java b/website/src/main/java/info/xiaomo/website/controller/TechnologyController.java index 409c0337..46601a9a 100644 --- a/website/src/main/java/info/xiaomo/website/controller/TechnologyController.java +++ b/website/src/main/java/info/xiaomo/website/controller/TechnologyController.java @@ -20,7 +20,6 @@ * 把今天最好的表现当作明天最新的起点..~ * いま 最高の表現 として 明日最新の始発..~ * Today the best performance as tomorrow newest starter! - * * @author : xiaomo * github: https://github.com/houko @@ -45,21 +44,21 @@ public TechnologyController(TechnologyService service) { @Override - @ApiOperation(value = "根据id查找技术", notes = "根据id查找技术", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "根据id查找技术", notes = "根据id查找技术", httpMethod = "GET") @RequestMapping(value = "/findById/{id}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一Id", required = true, dataType = "Long", paramType = "path") }) - public Result findById(@PathVariable Long id) { + public Result findById(@PathVariable Long id) { TechnologyModel model = service.findById(id); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(model); } @Override - @ApiOperation(value = "根据名字查找技术", notes = "根据名字查找技术", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "根据名字查找技术", notes = "根据名字查找技术", httpMethod = "GET") @RequestMapping(value = "/findByName/{name}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "技术名字", required = true, dataType = "name", paramType = "path") @@ -67,7 +66,7 @@ public Result findById(@PathVariable Long id) { public Result findByName(@PathVariable String name) { TechnologyModel model = service.findByName(name); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(model); } @@ -128,12 +127,12 @@ public Result delByIds(@PathVariable List ids) { } @Override - @ApiOperation(value = "查找所有", notes = "查找所有", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "查找所有", notes = "查找所有", httpMethod = "GET") @RequestMapping(value = "/findAll", method = RequestMethod.GET) public Result findAll() { List all = service.findAll(); if (all == null || all.isEmpty()) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(all); } @@ -151,23 +150,23 @@ public Result findAll(@PathVariable int start, @PathVariable int pageSize) } - @ApiOperation(value = "添加链接", notes = "添加链接", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "添加链接", notes = "添加链接", httpMethod = "POST") @RequestMapping(value = "/add", method = RequestMethod.POST) public Result add(@RequestBody TechnologyModel model) { TechnologyModel addModel = service.findByName(model.getName()); if (addModel != null) { - return new Result(CodeConst.REPEAT.getResultCode(), CodeConst.REPEAT.getMessage()); + return new Result<>(CodeConst.REPEAT.getResultCode(), CodeConst.REPEAT.getMessage()); } addModel = service.add(model); return new Result<>(addModel); } - @ApiOperation(value = "更新链接", notes = "更新链接", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "更新链接", notes = "更新链接", httpMethod = "POST") @RequestMapping(value = "/update", method = RequestMethod.POST) public Result update(@RequestBody TechnologyModel model) { TechnologyModel update = service.findById(model.getId()); if (update == null) { - return new Result(CodeConst.CodeOR.getResultCode(), CodeConst.CodeOR.getMessage()); + return new Result<>(CodeConst.CodeOR.getResultCode(), CodeConst.CodeOR.getMessage()); } update = service.update(model); return new Result<>(update); @@ -175,14 +174,14 @@ public Result update(@RequestBody TechnologyModel model) { @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET) - @ApiOperation(value = "删除链接", notes = "删除链接", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "删除链接", notes = "删除链接", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path") }) public Result delete(@PathVariable Long id) { TechnologyModel model = service.findById(id); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } service.del(id); return new Result<>(model); diff --git a/website/src/main/java/info/xiaomo/website/controller/UserController.java b/website/src/main/java/info/xiaomo/website/controller/UserController.java index 1ab1b414..5a4ca6d9 100644 --- a/website/src/main/java/info/xiaomo/website/controller/UserController.java +++ b/website/src/main/java/info/xiaomo/website/controller/UserController.java @@ -56,7 +56,7 @@ public UserController(UserService service) { * @param id id * @return result */ - @ApiOperation(value = "查找用户", notes = "查找用户", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "查找用户", notes = "查找用户", httpMethod = "GET") @RequestMapping(value = "findById/{id}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"), @@ -64,18 +64,18 @@ public UserController(UserService service) { @SuppressWarnings("unchecked") public Result findUserById(@PathVariable("id") Long id) { Optional optional = service.findUserById(id); - return optional.map(Result::new).orElseGet(() -> new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage())); + return optional.map(Result::new).orElseGet(() -> new Result<>(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage())); } /** * 添加用户 */ - @ApiOperation(value = "添加用户", notes = "添加用户", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "添加用户", notes = "添加用户", httpMethod = "POST") @RequestMapping(value = "addUser", method = RequestMethod.POST) public Result addUser(@RequestBody UserModel user) { UserModel userModel = service.findUserByEmail(user.getEmail()); if (userModel != null) { - return new Result(CodeConst.USER_REPEAT.getResultCode(), CodeConst.USER_REPEAT.getMessage()); + return new Result<>(CodeConst.USER_REPEAT.getResultCode(), CodeConst.USER_REPEAT.getMessage()); } String salt = RandomUtil.createSalt(); user.setPassword(Md5Util.encode(user.getPassword(), salt)); @@ -90,7 +90,7 @@ public Result addUser(@RequestBody UserModel user) { * * @return result */ - @ApiOperation(value = "注册", notes = "注册用户并发送验证链接到邮箱", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "注册", notes = "注册用户并发送验证链接到邮箱", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "用户名", required = true, dataType = "String", paramType = "path"), @ApiImplicitParam(name = "密码", required = true, dataType = "String", paramType = "path") @@ -100,7 +100,7 @@ public Result register(@PathVariable("email") String email, @PathVariable("passw UserModel userModel = service.findUserByEmail(email); //邮箱被占用 if (userModel != null) { - return new Result(CodeConst.USER_REPEAT.getResultCode(), CodeConst.USER_REPEAT.getMessage()); + return new Result<>(CodeConst.USER_REPEAT.getResultCode(), CodeConst.USER_REPEAT.getMessage()); } String redirectValidateUrl = MailUtil.redirectValidateUrl(email, password); MailUtil.send(email, "帐号激活邮件", redirectValidateUrl); @@ -113,7 +113,7 @@ public Result register(@PathVariable("email") String email, @PathVariable("passw * * @return result */ - @ApiOperation(value = "登录", notes = "登录", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "登录", notes = "登录", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "email", value = "邮箱", required = true, dataType = "String", paramType = "path"), @ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String", paramType = "path") @@ -123,11 +123,11 @@ public Result login(@PathVariable("email") String email, @PathVariable("password UserModel userModel = service.findUserByEmail(email); //找不到用户 if (userModel == null) { - return new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); + return new Result<>(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); } //密码不正确 if (!Md5Util.encode(password, userModel.getSalt()).equals(userModel.getPassword())) { - return new Result(CodeConst.AUTH_FAILED.getResultCode(), CodeConst.AUTH_FAILED.getMessage()); + return new Result<>(CodeConst.AUTH_FAILED.getResultCode(), CodeConst.AUTH_FAILED.getMessage()); } return new Result<>(userModel); } @@ -139,12 +139,12 @@ public Result login(@PathVariable("email") String email, @PathVariable("password * @return model * @throws UserNotFoundException UserNotFoundException */ - @ApiOperation(value = "修改密码", notes = "修改密码", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "修改密码", notes = "修改密码", httpMethod = "POST") @RequestMapping(value = "changePassword", method = RequestMethod.POST) public Result changePassword(@RequestBody UserModel user) throws UserNotFoundException { UserModel userByEmail = service.findUserByEmail(user.getEmail()); if (userByEmail == null) { - return new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); + return new Result<>(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); } String salt = RandomUtil.createSalt(); userByEmail.setPassword(Md5Util.encode(user.getPassword(), salt)); @@ -160,12 +160,12 @@ public Result changePassword(@RequestBody UserModel user) throws UserNotFoundExc * @return model * @throws UserNotFoundException UserNotFoundException */ - @ApiOperation(value = "更新用户信息", notes = "更新用户信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "更新用户信息", notes = "更新用户信息", httpMethod = "POST") @RequestMapping(value = "update", method = RequestMethod.POST) public Result update(@RequestBody UserModel user) throws UserNotFoundException { UserModel userModel = service.findUserByEmail(user.getEmail()); if (userModel == null) { - return new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); + return new Result<>(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); } userModel = new UserModel(); userModel.setEmail(user.getEmail()); @@ -183,12 +183,12 @@ public Result update(@RequestBody UserModel user) throws UserNotFoundException { * * @return result */ - @ApiOperation(value = "返回所有用户数据", notes = "返回所有用户数据", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "返回所有用户数据", notes = "返回所有用户数据", httpMethod = "GET") @RequestMapping(value = "findAll", method = RequestMethod.GET) public Result getAll() { List pages = service.findAll(); if (pages == null || pages.size() <= 0) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(pages); } @@ -201,14 +201,14 @@ public Result getAll() { * @return result */ @RequestMapping(value = "delete/{id}", method = RequestMethod.GET) - @ApiOperation(value = "根据id删除用户", notes = "根据id删除用户", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "根据id删除用户", notes = "根据id删除用户", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"), }) public Result deleteUserById(@PathVariable("id") Long id) throws UserNotFoundException { UserModel userModel = service.deleteUserById(id); if (userModel == null) { - return new Result(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); + return new Result<>(CodeConst.USER_NOT_FOUND.getResultCode(), CodeConst.USER_NOT_FOUND.getMessage()); } return new Result<>(userModel); } @@ -216,19 +216,19 @@ public Result deleteUserById(@PathVariable("id") Long id) throws UserNotFoundExc /** * 处理激活 */ - @ApiOperation(value = "处理激活", notes = "处理激活", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "处理激活", notes = "处理激活", httpMethod = "POST") @RequestMapping(value = "validateEmail", method = RequestMethod.POST) public Result validateEmail(@RequestBody UserModel user ) throws ServiceException { //数据访问层,通过email获取用户信息 UserModel userModel = service.findUserByEmail(user.getEmail()); if (userModel != null) { - return new Result(CodeConst.USER_REPEAT.getResultCode(), CodeConst.USER_REPEAT.getMessage()); + return new Result<>(CodeConst.USER_REPEAT.getResultCode(), CodeConst.USER_REPEAT.getMessage()); } //验证码是否过期 if (user.getRegisterTime() + TimeUtil.ONE_DAY_IN_MILLISECONDS < TimeUtil.getNowOfMills()) { LOGGER.info("用户{}使用己过期的激活码{}激活邮箱失败!", user.getEmail(), user.getEmail()); - return new Result(CodeConst.TIME_PASSED.getResultCode(), CodeConst.TIME_PASSED.getMessage()); + return new Result<>(CodeConst.TIME_PASSED.getResultCode(), CodeConst.TIME_PASSED.getMessage()); } //激活 String salt = RandomUtil.createSalt(); diff --git a/website/src/main/java/info/xiaomo/website/controller/WorksController.java b/website/src/main/java/info/xiaomo/website/controller/WorksController.java index 6ce9f784..9817f244 100644 --- a/website/src/main/java/info/xiaomo/website/controller/WorksController.java +++ b/website/src/main/java/info/xiaomo/website/controller/WorksController.java @@ -1,6 +1,5 @@ package info.xiaomo.website.controller; -import info.xiaomo.core.base.BaseController; import info.xiaomo.core.base.Result; import info.xiaomo.core.constant.CodeConst; import info.xiaomo.website.model.WorksModel; @@ -10,8 +9,6 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -20,7 +17,6 @@ * 把今天最好的表现当作明天最新的起点..~ * いま 最高の表現 として 明日最新の始発..~ * Today the best performance as tomorrow newest starter! - * * @author : xiaomo * github: https://github.com/houko @@ -34,8 +30,8 @@ @RequestMapping("/works") @RestController -@Api(value = "作品相关api", description = "作品相关api") -public class WorksController extends BaseController { +@Api(value = "作品相关api") +public class WorksController { private final WorksService service; @@ -45,145 +41,75 @@ public WorksController(WorksService service) { } - @Override @RequestMapping(value = "/findById/{id}", method = RequestMethod.GET) - @ApiOperation(value = "根据id查找作品", notes = "根据id查找作品", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "根据id查找作品", notes = "根据id查找作品", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"), }) - public Result findById(@PathVariable Long id) { + public Result findById(@PathVariable Long id) { WorksModel model = service.findById(id); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(model); } - @Override @RequestMapping(value = "/findAll", method = RequestMethod.GET) - @ApiOperation(value = "查找所有", notes = "查找所有", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public Result findAll() { + @ApiOperation(value = "查找所有", notes = "查找所有", httpMethod = "GET") + public Result> findAll() { List all = service.findAll(); if (all == null || all.isEmpty()) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(all); } - /** - * 带分页 - * - * @param start 起始页 - * @param pageSize 页码数 - * @return result - */ - @Override - public Result findAll(@PathVariable int start, @PathVariable int pageSize) { - return null; - } - - @Override @RequestMapping(value = "/findByName/{name}", method = RequestMethod.GET) - @ApiOperation(value = "根据名字查找作品", notes = "根据名字查找作品", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "根据名字查找作品", notes = "根据名字查找作品", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "作品名字", required = true, dataType = "String", paramType = "path"), }) - public Result findByName(@PathVariable String name) { + public Result findByName(@PathVariable String name) { WorksModel model = service.findByName(name); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } return new Result<>(model); } - /** - * 根据名字删除模型 - * - * @param name name - * @return result - */ - @Override - public Result delByName(@PathVariable String name) { - return null; - } - - /** - * 根据id删除模型 - * - * @param id id - * @return result - */ - @Override - public Result delById(@PathVariable Long id) { - return null; - } - - /** - * 添加模型 - * - * @param model model - * @return result - */ - @Override - public Result add(@RequestBody Object model) { - return null; - } - - /** - * 更新 - * - * @param model model - * @return result - */ - @Override - public Result update(@RequestBody Object model) { - return null; - } - - /** - * 批量删除 - * - * @param ids ids - * @return result - */ - @Override - public Result delByIds(@PathVariable List ids) { - return null; - } - - @ApiOperation(value = "添加作品", notes = "添加作品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "添加作品", notes = "添加作品", httpMethod = "POST") @RequestMapping(value = "/add", method = RequestMethod.POST) - public Result add(@RequestBody WorksModel model) { + public Result add(@RequestBody WorksModel model) { WorksModel addModel = service.findByName(model.getName()); if (addModel != null) { - return new Result(CodeConst.REPEAT.getResultCode(), CodeConst.REPEAT.getMessage()); + return new Result<>(CodeConst.REPEAT.getResultCode(), CodeConst.REPEAT.getMessage()); } addModel = service.add(model); return new Result<>(addModel); } - @ApiOperation(value = "更新作品", notes = "更新作品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "更新作品", notes = "更新作品", httpMethod = "POST") @RequestMapping(value = "/update", method = RequestMethod.POST) - public Result update(@RequestBody WorksModel model) { + public Result update(@RequestBody WorksModel model) { WorksModel worksModel = service.findById(model.getId()); if (worksModel == null) { - return new Result(CodeConst.CodeOR.getResultCode(), CodeConst.CodeOR.getMessage()); + return new Result<>(CodeConst.CodeOR.getResultCode(), CodeConst.CodeOR.getMessage()); } worksModel = service.update(worksModel); return new Result<>(worksModel); } - @ApiOperation(value = "根据id删除作品", notes = "根据id删除作品", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "根据id删除作品", notes = "根据id删除作品", httpMethod = "GET") @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"), }) - public Result delete(@PathVariable Long id) { + public Result delete(@PathVariable Long id) { WorksModel model = service.findById(id); if (model == null) { - return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); + return new Result<>(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage()); } service.del(id); return new Result<>(model); diff --git a/website/src/main/java/info/xiaomo/website/interceptor/LoginInterceptor.java b/website/src/main/java/info/xiaomo/website/interceptor/LoginInterceptor.java index f3eff131..a981ef75 100644 --- a/website/src/main/java/info/xiaomo/website/interceptor/LoginInterceptor.java +++ b/website/src/main/java/info/xiaomo/website/interceptor/LoginInterceptor.java @@ -7,11 +7,11 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + /** * 把今天最好的表现当作明天最新的起点..~ * いま 最高の表現 として 明日最新の始発..~ * Today the best performance as tomorrow newest starter! - * * @author : xiaomo * github: https://github.com/houko diff --git a/website/src/main/java/info/xiaomo/website/service/impl/AdminUserServiceImpl.java b/website/src/main/java/info/xiaomo/website/service/impl/AdminUserServiceImpl.java index eb252a50..dcebc65b 100644 --- a/website/src/main/java/info/xiaomo/website/service/impl/AdminUserServiceImpl.java +++ b/website/src/main/java/info/xiaomo/website/service/impl/AdminUserServiceImpl.java @@ -84,7 +84,7 @@ public AdminModel updateAdminUser(AdminModel model) throws UserNotFoundException @Override public Page getAdminUsers(int start, int pageSize) { - Sort sort = new Sort(Sort.Direction.DESC, "createTime"); + Sort sort = Sort.by(Sort.Direction.DESC, "createTime"); return dao.findAll(PageRequest.of(start - 1, pageSize, sort)); } diff --git a/website/src/main/java/info/xiaomo/website/service/impl/ChangeLogServiceImpl.java b/website/src/main/java/info/xiaomo/website/service/impl/ChangeLogServiceImpl.java index a7526f51..aa603bd1 100644 --- a/website/src/main/java/info/xiaomo/website/service/impl/ChangeLogServiceImpl.java +++ b/website/src/main/java/info/xiaomo/website/service/impl/ChangeLogServiceImpl.java @@ -49,7 +49,7 @@ public ChangeLogModel findByName(String name) { @Override public Page findAll(int start, int pageSize) { - Sort sort = new Sort(Sort.Direction.DESC, "createTime"); + Sort sort = Sort.by(Sort.Direction.DESC, "createTime"); return dao.findAll(PageRequest.of(start - 1, pageSize, sort)); } diff --git a/website/src/main/java/info/xiaomo/website/service/impl/LinkServiceImpl.java b/website/src/main/java/info/xiaomo/website/service/impl/LinkServiceImpl.java index e592b225..1742a9e7 100644 --- a/website/src/main/java/info/xiaomo/website/service/impl/LinkServiceImpl.java +++ b/website/src/main/java/info/xiaomo/website/service/impl/LinkServiceImpl.java @@ -17,7 +17,6 @@ * 把今天最好的表现当作明天最新的起点..~ * いま 最高の表現 として 明日最新の始発..~ * Today the best performance as tomorrow newest starter! - * * @author : xiaomo * github: https://github.com/houko @@ -49,7 +48,7 @@ public LinkModel findByName(String name) { @Override public Page findAll(int start, int pageSize) { - Sort sort = new Sort(Sort.Direction.DESC, "order"); + Sort sort = Sort.by(Sort.Direction.DESC, "order"); return dao.findAll(PageRequest.of(start - 1, pageSize, sort)); } diff --git a/website/src/main/java/info/xiaomo/website/service/impl/UserServiceImpl.java b/website/src/main/java/info/xiaomo/website/service/impl/UserServiceImpl.java index 220fb3a1..f971ce79 100644 --- a/website/src/main/java/info/xiaomo/website/service/impl/UserServiceImpl.java +++ b/website/src/main/java/info/xiaomo/website/service/impl/UserServiceImpl.java @@ -86,7 +86,7 @@ public UserModel updateUser(UserModel model) throws UserNotFoundException { @Override public Page findAll(int start, int pageSize) { - Sort sort = new Sort(Sort.Direction.DESC, "createTime"); + Sort sort = Sort.by(Sort.Direction.DESC, "createTime"); return dao.findAll(PageRequest.of(start - 1, pageSize, sort)); } diff --git a/website/src/main/resources/config/application.properties b/website/src/main/resources/config/application.properties index 71bb2fbe..f830f53d 100644 --- a/website/src/main/resources/config/application.properties +++ b/website/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ logging.config=classpath:config/logback-dev.xml server.port=8080 -server.session.timeout=1800 + server.max-http-header-size=20971520 #datasource @@ -8,7 +8,7 @@ spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true # ?useUnicode=true&characterEncoding=UTF-8 spring.datasource.username=username spring.datasource.password=password -spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss #spring.jackson.time-zone=GMT+8 diff --git a/website/src/test/java/info/xiaomo/test/MailTests.java b/website/src/test/java/info/xiaomo/test/MailTests.java deleted file mode 100644 index 3bff1dd0..00000000 --- a/website/src/test/java/info/xiaomo/test/MailTests.java +++ /dev/null @@ -1,71 +0,0 @@ -package info.xiaomo.test; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.FileSystemResource; -import org.springframework.mail.SimpleMailMessage; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.MimeMessageHelper; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import javax.mail.internet.MimeMessage; -import java.io.File; - - -@RunWith(SpringJUnit4ClassRunner.class) -public class MailTests { - - @Autowired - private JavaMailSender mailSender; - - - @Test - public void sendSimpleMail() throws Exception { - - SimpleMailMessage message = new SimpleMailMessage(); - message.setFrom("dyc87112@qq.com"); - message.setTo("dyc87112@qq.com"); - message.setSubject("主题:简单邮件"); - message.setText("测试邮件内容"); - - mailSender.send(message); - } - - @Test - public void sendAttachmentsMail() throws Exception { - - MimeMessage mimeMessage = mailSender.createMimeMessage(); - - MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); - helper.setFrom("dyc87112@qq.com"); - helper.setTo("dyc87112@qq.com"); - helper.setSubject("主题:有附件"); - helper.setText("有附件的邮件"); - - FileSystemResource file = new FileSystemResource(new File("weixin.jpg")); - helper.addAttachment("附件-1.jpg", file); - helper.addAttachment("附件-2.jpg", file); - - mailSender.send(mimeMessage); - } - - @Test - public void sendInlineMail() throws Exception { - - MimeMessage mimeMessage = mailSender.createMimeMessage(); - - MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); - helper.setFrom("dyc87112@qq.com"); - helper.setTo("dyc87112@qq.com"); - helper.setSubject("主题:嵌入静态资源"); - helper.setText("", true); - - FileSystemResource file = new FileSystemResource(new File("weixin.jpg")); - helper.addInline("weixin", file); - - mailSender.send(mimeMessage); - } - - -} diff --git a/website/src/test/resources/application.properties b/website/src/test/resources/application.properties deleted file mode 100644 index 41c59d16..00000000 --- a/website/src/test/resources/application.properties +++ /dev/null @@ -1,33 +0,0 @@ -logging.config=classpath:config/logback-dev.xml -server.port=8080 -server.session.timeout=1800 -server.max-http-header-size=20971520 - -#datasource -spring.datasource.url=jdbc:mysql://ip/\u6570\u636E\u5E93?characterEncoding=utf8&useSSL=true -# ?useUnicode=true&characterEncoding=UTF-8 -spring.datasource.username=\u4F60\u7684\u5E10\u53F7 -spring.datasource.password=\u4F60\u7684\u5BC6\u7801 -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -# \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 -#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss -#spring.jackson.time-zone=GMT+8 - -#jpa -spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true -spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - - -#\u90AE\u4EF6 -spring.mail.host=smtp.qq.com -spring.mail.username=83387856@qq.com -spring.mail.password=, -spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.starttls.enable=true -spring.mail.properties.mail.smtp.starttls.required=true - -#spring.data.mongodb.uri=mongodb://name:pass@localhost:27017/test - - From abb8e9b8a0cac101c4eee0c89b360cfb0a38947c Mon Sep 17 00:00:00 2001 From: houko Date: Fri, 9 Oct 2020 19:23:57 +0900 Subject: [PATCH 06/17] jdk 11 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7851aebe..34d145f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: java jdk: - - oraclejdk8 + - oraclejdk11 dist: trusty \ No newline at end of file From 6738a539b13d4b27b66bc3ae92922f2afc7a3018 Mon Sep 17 00:00:00 2001 From: houko Date: Fri, 9 Oct 2020 19:27:02 +0900 Subject: [PATCH 07/17] jdk 11 --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 207b7268..8c676685 100644 --- a/Readme.md +++ b/Readme.md @@ -8,7 +8,7 @@ ### 环境 - `maven` latest -- `jdk1.8` +- `jdk11` - `spring boot 2.x release` - 个人推荐`idea`来代替eclipse - git: 版本管理 From 8002dfbdfe7055e7de1ab376a89b39d1443da607 Mon Sep 17 00:00:00 2001 From: houko Date: Fri, 9 Oct 2020 19:32:37 +0900 Subject: [PATCH 08/17] =?UTF-8?q?=E6=B7=BB=E5=8A=A02020.2=20=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Readme.md b/Readme.md index 8c676685..0692e4dd 100644 --- a/Readme.md +++ b/Readme.md @@ -66,6 +66,12 @@ http://localhost:808/doc.html bootstrap-ui - 2017-11-03 合并`api`和`website`模块,访问`localhost:8080`会显示网站主页,访问`localhost:8080/api`会显示api管理界面 - 2018-04-09 将整个项目升级到spring boot2.0 release版本,api有较大变动 - 2019-08-06 travis-ci指定jdk版本 +- 2020-10-09 升级版本到2020.2 +- 2020-10-09 升级jdk版本到11 +- 2020-10-09 升级mysql connector到8 +- 2020-10-09 升级spring boot到2.3.0 +- 2020-10-09 修复了升级后API的破坏性变动,修复了一些了编辑器警告 + From 073cb8ef5e32ad195c60bb52f54b94ec31e5410d Mon Sep 17 00:00:00 2001 From: houko Date: Tue, 13 Oct 2020 14:23:44 +0900 Subject: [PATCH 09/17] upgrade junit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff5ee3a0..b17e93b6 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ 3.5 - 4.12 + 4.13.1 8.0.21 From 2ab460a6192ff39aaf1af5380250a845fef8b6af Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 22 Jun 2022 17:59:46 +0900 Subject: [PATCH 10/17] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 0692e4dd..6f137c59 100644 --- a/Readme.md +++ b/Readme.md @@ -127,7 +127,7 @@ http://localhost:808/doc.html bootstrap-ui MIT License - Copyright (c) 2020 Peng Hu + Copyright (c) 2022 Peng Hu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 59a23ad0d7c5e55ddc6a16baaa377238250eeb56 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:00:16 +0000 Subject: [PATCH 11/17] Bump mysql-connector-java from 8.0.21 to 8.0.28 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.21 to 8.0.28. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.21...8.0.28) --- updated-dependencies: - dependency-name: mysql:mysql-connector-java dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b17e93b6..23674d2a 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 4.13.1 - 8.0.21 + 8.0.28 1.7.21 From a670542f40b8ebd4500418f49494b316ba5267bc Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 22 Jun 2022 18:00:28 +0900 Subject: [PATCH 12/17] Create codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..1620e2e5 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '24 7 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'java' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 From e8da169f8e11955e62e3ef94833387275d0fb145 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:00:34 +0000 Subject: [PATCH 13/17] Bump spring-boot-starter-web from 2.3.0.RELEASE to 2.5.12 Bumps [spring-boot-starter-web](https://github.com/spring-projects/spring-boot) from 2.3.0.RELEASE to 2.5.12. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.3.0.RELEASE...v2.5.12) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-starter-web dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b17e93b6..49c58294 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ 1.10.1 - 2.3.0.RELEASE + 2.5.12 3.5.1 From 3acc7cd514e6caed4afa1708f56241f20781413e Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 22 Jun 2022 18:00:54 +0900 Subject: [PATCH 14/17] Create SECURITY.md --- SECURITY.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..034e8480 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. From 31888c7068f20d7e5972cc89ac3bea7fd5325edb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:01:05 +0000 Subject: [PATCH 15/17] Bump poi from 3.10-beta2 to 3.17 Bumps poi from 3.10-beta2 to 3.17. --- updated-dependencies: - dependency-name: org.apache.poi:poi dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b17e93b6..14815c7a 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ 2.6.12 - 3.10-beta2 + 3.17 From b783f976e19d418149ddf59fc736b709abf0f1aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:02:18 +0000 Subject: [PATCH 16/17] Bump jsoup from 1.10.1 to 1.14.2 Bumps [jsoup](https://github.com/jhy/jsoup) from 1.10.1 to 1.14.2. - [Release notes](https://github.com/jhy/jsoup/releases) - [Changelog](https://github.com/jhy/jsoup/blob/master/CHANGES) - [Commits](https://github.com/jhy/jsoup/compare/jsoup-1.10.1...jsoup-1.14.2) --- updated-dependencies: - dependency-name: org.jsoup:jsoup dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5f61043c..4b280e7e 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ [1.2.31,) - 1.10.1 + 1.14.2 2.5.12 From fbbceec7f7fdd907884b6ae43f67dc0258d38b27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:05:19 +0000 Subject: [PATCH 17/17] Bump commons-io from 2.5 to 2.7 Bumps commons-io from 2.5 to 2.7. --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4b280e7e..5b1f7919 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 1.1.7 - 2.5 + 2.7 [1.3.3,)