Mark hace 6 años
padre
commit
bf76658fa1
Se han modificado 100 ficheros con 1387 adiciones y 1833 borrados
  1. 1 1
      README.md
  2. 0 239
      pom-war.xml
  3. 32 21
      pom.xml
  4. 11 14
      src/main/java/io/renren/RenrenApplication.java
  5. 10 4
      src/main/java/io/renren/common/annotation/SysLog.java
  6. 9 3
      src/main/java/io/renren/common/aspect/RedisAspect.java
  7. 11 5
      src/main/java/io/renren/common/aspect/SysLogAspect.java
  8. 10 4
      src/main/java/io/renren/common/exception/RRException.java
  9. 10 4
      src/main/java/io/renren/common/exception/RRExceptionHandler.java
  10. 10 3
      src/main/java/io/renren/common/utils/ConfigConstant.java
  11. 30 5
      src/main/java/io/renren/common/utils/Constant.java
  12. 7 17
      src/main/java/io/renren/common/utils/DateUtils.java
  13. 8 0
      src/main/java/io/renren/common/utils/HttpContextUtils.java
  14. 10 4
      src/main/java/io/renren/common/utils/IPUtils.java
  15. 5 14
      src/main/java/io/renren/common/utils/MapUtils.java
  16. 26 26
      src/main/java/io/renren/common/utils/PageUtils.java
  17. 40 60
      src/main/java/io/renren/common/utils/Query.java
  18. 10 4
      src/main/java/io/renren/common/utils/R.java
  19. 9 3
      src/main/java/io/renren/common/utils/RedisKeys.java
  20. 9 3
      src/main/java/io/renren/common/utils/RedisUtils.java
  21. 10 4
      src/main/java/io/renren/common/utils/ShiroUtils.java
  22. 10 4
      src/main/java/io/renren/common/utils/SpringContextUtils.java
  23. 10 3
      src/main/java/io/renren/common/validator/Assert.java
  24. 9 3
      src/main/java/io/renren/common/validator/ValidatorUtils.java
  25. 10 3
      src/main/java/io/renren/common/validator/group/AddGroup.java
  26. 10 3
      src/main/java/io/renren/common/validator/group/AliyunGroup.java
  27. 10 3
      src/main/java/io/renren/common/validator/group/Group.java
  28. 10 3
      src/main/java/io/renren/common/validator/group/QcloudGroup.java
  29. 10 3
      src/main/java/io/renren/common/validator/group/QiniuGroup.java
  30. 10 3
      src/main/java/io/renren/common/validator/group/UpdateGroup.java
  31. 10 3
      src/main/java/io/renren/common/xss/SQLFilter.java
  32. 10 3
      src/main/java/io/renren/common/xss/XssFilter.java
  33. 10 3
      src/main/java/io/renren/common/xss/XssHttpServletRequestWrapper.java
  34. 8 0
      src/main/java/io/renren/config/CorsConfig.java
  35. 9 3
      src/main/java/io/renren/config/FilterConfig.java
  36. 9 3
      src/main/java/io/renren/config/KaptchaConfig.java
  37. 13 15
      src/main/java/io/renren/config/MybatisPlusConfig.java
  38. 9 3
      src/main/java/io/renren/config/RedisConfig.java
  39. 12 24
      src/main/java/io/renren/config/ShiroConfig.java
  40. 10 11
      src/main/java/io/renren/config/SwaggerConfig.java
  41. 0 28
      src/main/java/io/renren/config/WebConfig.java
  42. 24 0
      src/main/java/io/renren/datasource/annotation/DataSource.java
  43. 71 0
      src/main/java/io/renren/datasource/aspect/DataSourceAspect.java
  44. 57 0
      src/main/java/io/renren/datasource/config/DynamicContextHolder.java
  45. 25 0
      src/main/java/io/renren/datasource/config/DynamicDataSource.java
  46. 63 0
      src/main/java/io/renren/datasource/config/DynamicDataSourceConfig.java
  47. 54 0
      src/main/java/io/renren/datasource/config/DynamicDataSourceFactory.java
  48. 202 0
      src/main/java/io/renren/datasource/properties/DataSourceProperties.java
  49. 33 0
      src/main/java/io/renren/datasource/properties/DynamicDataSourceProperties.java
  50. 0 14
      src/main/java/io/renren/datasources/DataSourceNames.java
  51. 0 40
      src/main/java/io/renren/datasources/DynamicDataSource.java
  52. 0 42
      src/main/java/io/renren/datasources/DynamicDataSourceConfig.java
  53. 0 16
      src/main/java/io/renren/datasources/annotation/DataSource.java
  54. 0 60
      src/main/java/io/renren/datasources/aspect/DataSourceAspect.java
  55. 10 3
      src/main/java/io/renren/modules/app/annotation/Login.java
  56. 9 3
      src/main/java/io/renren/modules/app/annotation/LoginUser.java
  57. 9 3
      src/main/java/io/renren/modules/app/config/WebMvcConfig.java
  58. 9 3
      src/main/java/io/renren/modules/app/controller/AppLoginController.java
  59. 11 4
      src/main/java/io/renren/modules/app/controller/AppRegisterController.java
  60. 9 3
      src/main/java/io/renren/modules/app/controller/AppTestController.java
  61. 8 18
      src/main/java/io/renren/modules/app/dao/UserDao.java
  62. 11 79
      src/main/java/io/renren/modules/app/entity/UserEntity.java
  63. 7 29
      src/main/java/io/renren/modules/app/form/LoginForm.java
  64. 7 29
      src/main/java/io/renren/modules/app/form/RegisterForm.java
  65. 10 3
      src/main/java/io/renren/modules/app/interceptor/AuthorizationInterceptor.java
  66. 11 4
      src/main/java/io/renren/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java
  67. 11 5
      src/main/java/io/renren/modules/app/service/UserService.java
  68. 11 4
      src/main/java/io/renren/modules/app/service/impl/UserServiceImpl.java
  69. 10 3
      src/main/java/io/renren/modules/app/utils/JwtUtils.java
  70. 5 14
      src/main/java/io/renren/modules/job/config/ScheduleConfig.java
  71. 7 16
      src/main/java/io/renren/modules/job/controller/ScheduleJobController.java
  72. 6 15
      src/main/java/io/renren/modules/job/controller/ScheduleJobLogController.java
  73. 6 15
      src/main/java/io/renren/modules/job/dao/ScheduleJobDao.java
  74. 6 15
      src/main/java/io/renren/modules/job/dao/ScheduleJobLogDao.java
  75. 9 110
      src/main/java/io/renren/modules/job/entity/ScheduleJobEntity.java
  76. 9 87
      src/main/java/io/renren/modules/job/entity/ScheduleJobLogEntity.java
  77. 6 15
      src/main/java/io/renren/modules/job/service/ScheduleJobLogService.java
  78. 7 16
      src/main/java/io/renren/modules/job/service/ScheduleJobService.java
  79. 11 19
      src/main/java/io/renren/modules/job/service/impl/ScheduleJobLogServiceImpl.java
  80. 16 24
      src/main/java/io/renren/modules/job/service/impl/ScheduleJobServiceImpl.java
  81. 24 0
      src/main/java/io/renren/modules/job/task/ITask.java
  82. 12 42
      src/main/java/io/renren/modules/job/task/TestTask.java
  83. 14 28
      src/main/java/io/renren/modules/job/utils/ScheduleJob.java
  84. 0 62
      src/main/java/io/renren/modules/job/utils/ScheduleRunnable.java
  85. 5 14
      src/main/java/io/renren/modules/job/utils/ScheduleUtils.java
  86. 7 16
      src/main/java/io/renren/modules/oss/cloud/AliyunCloudStorageService.java
  87. 9 166
      src/main/java/io/renren/modules/oss/cloud/CloudStorageConfig.java
  88. 7 16
      src/main/java/io/renren/modules/oss/cloud/CloudStorageService.java
  89. 7 16
      src/main/java/io/renren/modules/oss/cloud/OSSFactory.java
  90. 7 16
      src/main/java/io/renren/modules/oss/cloud/QcloudCloudStorageService.java
  91. 7 16
      src/main/java/io/renren/modules/oss/cloud/QiniuCloudStorageService.java
  92. 9 19
      src/main/java/io/renren/modules/oss/controller/SysOssController.java
  93. 8 19
      src/main/java/io/renren/modules/oss/dao/SysOssDao.java
  94. 11 55
      src/main/java/io/renren/modules/oss/entity/SysOssEntity.java
  95. 8 18
      src/main/java/io/renren/modules/oss/service/SysOssService.java
  96. 9 17
      src/main/java/io/renren/modules/oss/service/impl/SysOssServiceImpl.java
  97. 10 4
      src/main/java/io/renren/modules/sys/controller/AbstractController.java
  98. 9 19
      src/main/java/io/renren/modules/sys/controller/SysConfigController.java
  99. 7 17
      src/main/java/io/renren/modules/sys/controller/SysLogController.java
  100. 0 0
      src/main/java/io/renren/modules/sys/controller/SysLoginController.java

+ 1 - 1
README.md

@@ -60,7 +60,7 @@ renren-fast
 
 
 **技术选型:** 
-- 核心框架:Spring Boot 2.0
+- 核心框架:Spring Boot 2.1
 - 安全框架:Apache Shiro 1.4
 - 视图框架:Spring MVC 5.0
 - 持久层框架:MyBatis 3.3

+ 0 - 239
pom-war.xml

@@ -1,239 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>io.renren</groupId>
-    <artifactId>renren-fast</artifactId>
-    <version>2.0.0</version>
-    <packaging>war</packaging>
-    <description>war包对应的pom,打war包,执行【mvn clean package -f pom-war.xml】</description>
-
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.0.3.RELEASE</version>
-    </parent>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <java.version>1.8</java.version>
-        <mybatisplus.spring.boot.version>1.0.5</mybatisplus.spring.boot.version>
-        <mybatisplus.version>2.2.0</mybatisplus.version>
-        <mysql.version>5.1.38</mysql.version>
-        <mssql.version>4.0</mssql.version>
-        <oracle.version>11.2.0.3</oracle.version>
-        <druid.version>1.1.10</druid.version>
-        <quartz.version>2.3.0</quartz.version>
-        <commons.lang.version>2.6</commons.lang.version>
-        <commons.fileupload.version>1.2.2</commons.fileupload.version>
-        <commons.io.version>2.5</commons.io.version>
-        <commons.codec.version>1.10</commons.codec.version>
-        <commons.configuration.version>1.10</commons.configuration.version>
-        <shiro.version>1.4.0</shiro.version>
-        <jwt.version>0.7.0</jwt.version>
-        <kaptcha.version>0.0.9</kaptcha.version>
-        <qiniu.version>[7.2.0, 7.2.99]</qiniu.version>
-        <aliyun.oss.version>2.8.3</aliyun.oss.version>
-        <qcloud.cos.version>4.4</qcloud.cos.version>
-        <swagger.version>2.8.0</swagger.version>
-        <joda.time.version>2.9.9</joda.time.version>
-        <fastjson.version>1.2.45</fastjson.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-tomcat</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-aop</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context-support</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-redis</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-configuration-processor</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatisplus-spring-boot-starter</artifactId>
-            <version>${mybatisplus.spring.boot.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus</artifactId>
-            <version>${mybatisplus.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>${mysql.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>druid-spring-boot-starter</artifactId>
-            <version>${druid.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.quartz-scheduler</groupId>
-            <artifactId>quartz</artifactId>
-            <version>${quartz.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.mchange</groupId>
-                    <artifactId>c3p0</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>${commons.lang.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-fileupload</groupId>
-            <artifactId>commons-fileupload</artifactId>
-            <version>${commons.fileupload.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>${commons.io.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>${commons.codec.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-            <version>${commons.configuration.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.shiro</groupId>
-            <artifactId>shiro-core</artifactId>
-            <version>${shiro.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.shiro</groupId>
-            <artifactId>shiro-spring</artifactId>
-            <version>${shiro.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>io.jsonwebtoken</groupId>
-            <artifactId>jjwt</artifactId>
-            <version>${jwt.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.github.axet</groupId>
-            <artifactId>kaptcha</artifactId>
-            <version>${kaptcha.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger2</artifactId>
-            <version>${swagger.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
-            <version>${swagger.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.qiniu</groupId>
-            <artifactId>qiniu-java-sdk</artifactId>
-            <version>${qiniu.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.aliyun.oss</groupId>
-            <artifactId>aliyun-sdk-oss</artifactId>
-            <version>${aliyun.oss.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.qcloud</groupId>
-            <artifactId>cos_api</artifactId>
-            <version>${qcloud.cos.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>joda-time</groupId>
-            <artifactId>joda-time</artifactId>
-            <version>${joda.time.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-            <version>${fastjson.version}</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <finalName>${artifactId}</finalName>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <fork>true</fork>
-                </configuration>
-            </plugin>
-            <!-- 跳过单元测试 -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <skipTests>true</skipTests>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <repositories>
-        <repository>
-            <id>public</id>
-            <name>aliyun nexus</name>
-            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
-            <releases>
-                <enabled>true</enabled>
-            </releases>
-        </repository>
-    </repositories>
-    <pluginRepositories>
-        <pluginRepository>
-            <id>public</id>
-            <name>aliyun nexus</name>
-            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
-            <releases>
-                <enabled>true</enabled>
-            </releases>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-        </pluginRepository>
-    </pluginRepositories>
-</project>

+ 32 - 21
pom.xml

@@ -4,26 +4,25 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>io.renren</groupId>
 	<artifactId>renren-fast</artifactId>
-	<version>2.1.0</version>
+	<version>3.0.0</version>
 	<packaging>jar</packaging>
 	<description>renren-fast</description>
 
 	<parent>
 		<groupId>org.springframework.boot</groupId>
 		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>2.0.3.RELEASE</version>
+		<version>2.1.3.RELEASE</version>
 	</parent>
 
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>
-		<mybatisplus.spring.boot.version>1.0.5</mybatisplus.spring.boot.version>
-		<mybatisplus.version>2.2.0</mybatisplus.version>
+		<mybatisplus.version>3.0.7.1</mybatisplus.version>
 		<mysql.version>5.1.38</mysql.version>
 		<mssql.version>4.0</mssql.version>
 		<oracle.version>11.2.0.3</oracle.version>
-		<druid.version>1.1.10</druid.version>
+		<druid.version>1.1.13</druid.version>
 		<quartz.version>2.3.0</quartz.version>
 		<commons.lang.version>2.6</commons.lang.version>
 		<commons.fileupload.version>1.2.2</commons.fileupload.version>
@@ -40,6 +39,7 @@
 		<joda.time.version>2.9.9</joda.time.version>
 		<fastjson.version>1.2.47</fastjson.version>
 		<hutool.version>4.1.1</hutool.version>
+		<lombok.version>1.18.4</lombok.version>
 
 		<!--wagon plugin 配置-->
 		<service-path>/work/renren</service-path>
@@ -83,8 +83,14 @@
 		<!--</dependency>-->
 		<dependency>
 			<groupId>com.baomidou</groupId>
-			<artifactId>mybatisplus-spring-boot-starter</artifactId>
-			<version>${mybatisplus.spring.boot.version}</version>
+			<artifactId>mybatis-plus-boot-starter</artifactId>
+			<version>${mybatisplus.version}</version>
+			<exclusions>
+				<exclusion>
+					<groupId>com.baomidou</groupId>
+					<artifactId>mybatis-plus-generator</artifactId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>com.baomidou</groupId>
@@ -97,22 +103,22 @@
 			<version>${mysql.version}</version>
 		</dependency>
 		 <!--oracle驱动-->
-		<!--<dependency>-->
-			<!--<groupId>com.oracle</groupId>-->
-			<!--<artifactId>ojdbc6</artifactId>-->
-			<!--<version>${oracle.version}</version>-->
-		<!--</dependency>-->
+		<dependency>
+			<groupId>com.oracle</groupId>
+			<artifactId>ojdbc6</artifactId>
+			<version>${oracle.version}</version>
+		</dependency>
 		 <!--mssql驱动-->
-		<!--<dependency>-->
-			<!--<groupId>com.microsoft.sqlserver</groupId>-->
-			<!--<artifactId>sqljdbc4</artifactId>-->
-			<!--<version>${mssql.version}</version>-->
-		<!--</dependency>-->
+		<dependency>
+			<groupId>com.microsoft.sqlserver</groupId>
+			<artifactId>sqljdbc4</artifactId>
+			<version>${mssql.version}</version>
+		</dependency>
 		 <!--postgresql驱动-->
-		<!--<dependency>-->
-			<!--<groupId>org.postgresql</groupId>-->
-			<!--<artifactId>postgresql</artifactId>-->
-		<!--</dependency>-->
+		<dependency>
+			<groupId>org.postgresql</groupId>
+			<artifactId>postgresql</artifactId>
+		</dependency>
 		<dependency>
 			<groupId>com.alibaba</groupId>
 			<artifactId>druid-spring-boot-starter</artifactId>
@@ -220,6 +226,11 @@
 			<artifactId>hutool-all</artifactId>
 			<version>${hutool.version}</version>
 		</dependency>
+		<dependency>
+			<groupId>org.projectlombok</groupId>
+			<artifactId>lombok</artifactId>
+			<version>${lombok.version}</version>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 11 - 14
src/main/java/io/renren/RenrenApplication.java

@@ -1,25 +1,22 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren;
 
-import io.renren.datasources.DynamicDataSourceConfig;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-import org.springframework.context.annotation.Import;
 
 
-@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
-@Import({DynamicDataSourceConfig.class})
-public class RenrenApplication extends SpringBootServletInitializer {
+@SpringBootApplication
+public class RenrenApplication {
 
 	public static void main(String[] args) {
 		SpringApplication.run(RenrenApplication.class, args);
 	}
 
-	@Override
-	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
-		return application.sources(RenrenApplication.class);
-	}
-}
+}

+ 10 - 4
src/main/java/io/renren/common/annotation/SysLog.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.annotation;
 
 import java.lang.annotation.Documented;
@@ -8,10 +16,8 @@ import java.lang.annotation.Target;
 
 /**
  * 系统日志注解
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017年3月8日 上午10:19:56
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)

+ 9 - 3
src/main/java/io/renren/common/aspect/RedisAspect.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.aspect;
 
 import io.renren.common.exception.RRException;
@@ -12,9 +20,7 @@ import org.springframework.context.annotation.Configuration;
 /**
  * Redis切面处理类
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-07-17 23:30
+ * @author Mark sunlightcs@gmail.com
  */
 @Aspect
 @Configuration

+ 11 - 5
src/main/java/io/renren/common/aspect/SysLogAspect.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.aspect;
 
 import com.google.gson.Gson;
@@ -23,10 +31,8 @@ import java.util.Date;
 
 /**
  * 系统日志,切面处理类
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017年3月8日 上午11:07:35
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Aspect
 @Component
@@ -90,6 +96,6 @@ public class SysLogAspect {
 		sysLog.setTime(time);
 		sysLog.setCreateDate(new Date());
 		//保存系统日志
-		sysLogService.insert(sysLog);
+		sysLogService.save(sysLog);
 	}
 }

+ 10 - 4
src/main/java/io/renren/common/exception/RRException.java

@@ -1,11 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.exception;
 
 /**
  * 自定义异常
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年10月27日 下午10:11:27
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class RRException extends RuntimeException {
 	private static final long serialVersionUID = 1L;

+ 10 - 4
src/main/java/io/renren/common/exception/RRExceptionHandler.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.exception;
 
 import io.renren.common.utils.R;
@@ -11,10 +19,8 @@ import org.springframework.web.servlet.NoHandlerFoundException;
 
 /**
  * 异常处理器
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年10月27日 下午10:16:19
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @RestControllerAdvice
 public class RRExceptionHandler {

+ 10 - 3
src/main/java/io/renren/common/utils/ConfigConstant.java

@@ -1,10 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 /**
  * 系统参数相关Key
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-26 10:33
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class ConfigConstant {
     /**

+ 30 - 5
src/main/java/io/renren/common/utils/Constant.java

@@ -1,16 +1,41 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 /**
  * 常量
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月15日 下午1:23:52
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class Constant {
 	/** 超级管理员ID */
 	public static final int SUPER_ADMIN = 1;
-
+    /**
+     * 当前页码
+     */
+    public static final String PAGE = "page";
+    /**
+     * 每页显示记录数
+     */
+    public static final String LIMIT = "limit";
+    /**
+     * 排序字段
+     */
+    public static final String ORDER_FIELD = "sidx";
+    /**
+     * 排序方式
+     */
+    public static final String ORDER = "order";
+    /**
+     *  升序
+     */
+    public static final String ASC = "asc";
 	/**
 	 * 菜单类型
 	 * 

+ 7 - 17
src/main/java/io/renren/common/utils/DateUtils.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.common.utils;
@@ -27,10 +19,8 @@ import java.util.Date;
 
 /**
  * 日期处理
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年12月21日 下午12:53:33
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class DateUtils {
 	/** 时间格式(yyyy-MM-dd) */

+ 8 - 0
src/main/java/io/renren/common/utils/HttpContextUtils.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 import org.springframework.web.context.request.RequestContextHolder;

+ 10 - 4
src/main/java/io/renren/common/utils/IPUtils.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 import com.alibaba.druid.util.StringUtils;
@@ -8,10 +16,8 @@ import javax.servlet.http.HttpServletRequest;
 
 /**
  * IP地址
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017年3月8日 下午12:57:02
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class IPUtils {
 	private static Logger logger = LoggerFactory.getLogger(IPUtils.class);

+ 5 - 14
src/main/java/io/renren/common/utils/MapUtils.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.common.utils;
@@ -23,7 +15,6 @@ import java.util.HashMap;
  * Map工具类
  *
  * @author Mark sunlightcs@gmail.com
- * @since 2.0.0
  */
 public class MapUtils extends HashMap<String, Object> {
 

+ 26 - 26
src/main/java/io/renren/common/utils/PageUtils.java

@@ -1,44 +1,44 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.common.utils;
 
-import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import java.io.Serializable;
 import java.util.List;
 
 /**
  * 分页工具类
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月4日 下午12:59:00
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class PageUtils implements Serializable {
 	private static final long serialVersionUID = 1L;
-	//总记录数
+	/**
+	 * 总记录数
+	 */
 	private int totalCount;
-	//每页记录数
+	/**
+	 * 每页记录数
+	 */
 	private int pageSize;
-	//总页数
+	/**
+	 * 总页数
+	 */
 	private int totalPage;
-	//当前页数
+	/**
+	 * 当前页数
+	 */
 	private int currPage;
-	//列表数据
+	/**
+	 * 列表数据
+	 */
 	private List<?> list;
 	
 	/**
@@ -59,11 +59,11 @@ public class PageUtils implements Serializable {
 	/**
 	 * 分页
 	 */
-	public PageUtils(Page<?> page) {
+	public PageUtils(IPage<?> page) {
 		this.list = page.getRecords();
 		this.totalCount = (int)page.getTotal();
-		this.pageSize = page.getSize();
-		this.currPage = page.getCurrent();
+		this.pageSize = (int)page.getSize();
+		this.currPage = (int)page.getCurrent();
 		this.totalPage = (int)page.getPages();
 	}
 

+ 40 - 60
src/main/java/io/renren/common/utils/Query.java

@@ -1,90 +1,70 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.common.utils;
 
-import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.renren.common.xss.SQLFilter;
 import org.apache.commons.lang.StringUtils;
 
-import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
  * 查询参数
  *
  * @author Mark sunlightcs@gmail.com
- * @since 2.0.0 2017-03-14
  */
-public class Query<T> extends LinkedHashMap<String, Object> {
-	private static final long serialVersionUID = 1L;
-    /**
-     * mybatis-plus分页参数
-     */
-    private Page<T> page;
-    /**
-     * 当前页码
-     */
-    private int currPage = 1;
-    /**
-     * 每页条数
-     */
-    private int limit = 10;
+public class Query<T> {
 
-    public Query(Map<String, Object> params){
-        this.putAll(params);
+    public IPage<T> getPage(Map<String, Object> params) {
+        return this.getPage(params, null, false);
+    }
 
+    public IPage<T> getPage(Map<String, Object> params, String defaultOrderField, boolean isAsc) {
         //分页参数
-        if(params.get("page") != null){
-            currPage = Integer.parseInt((String)params.get("page"));
+        long curPage = 1;
+        long limit = 10;
+
+        if(params.get(Constant.PAGE) != null){
+            curPage = Long.parseLong((String)params.get(Constant.PAGE));
         }
-        if(params.get("limit") != null){
-            limit = Integer.parseInt((String)params.get("limit"));
+        if(params.get(Constant.LIMIT) != null){
+            limit = Long.parseLong((String)params.get(Constant.LIMIT));
         }
 
-        this.put("offset", (currPage - 1) * limit);
-        this.put("page", currPage);
-        this.put("limit", limit);
+        //分页对象
+        Page<T> page = new Page<>(curPage, limit);
 
-        //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险)
-        String sidx = SQLFilter.sqlInject((String)params.get("sidx"));
-        String order = SQLFilter.sqlInject((String)params.get("order"));
-        this.put("sidx", sidx);
-        this.put("order", order);
+        //分页参数
+        params.put(Constant.PAGE, page);
 
-        //mybatis-plus分页
-        this.page = new Page<>(currPage, limit);
+        //排序字段
+        //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险)
+        String orderField = SQLFilter.sqlInject((String)params.get(Constant.ORDER_FIELD));
+        String order = (String)params.get(Constant.ORDER);
 
-        //排序
-        if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){
-            this.page.setOrderByField(sidx);
-            this.page.setAsc("ASC".equalsIgnoreCase(order));
+        //前端字段排序
+        if(StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)){
+            if(Constant.ASC.equalsIgnoreCase(order)) {
+                return page.setAsc(orderField);
+            }else {
+                return page.setDesc(orderField);
+            }
         }
 
-    }
+        //默认排序
+        if(isAsc) {
+            page.setAsc(defaultOrderField);
+        }else {
+            page.setDesc(defaultOrderField);
+        }
 
-    public Page<T> getPage() {
         return page;
     }
-
-    public int getCurrPage() {
-        return currPage;
-    }
-
-    public int getLimit() {
-        return limit;
-    }
 }

+ 10 - 4
src/main/java/io/renren/common/utils/R.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 import org.apache.http.HttpStatus;
@@ -7,10 +15,8 @@ import java.util.Map;
 
 /**
  * 返回数据
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年10月27日 下午9:59:27
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class R extends HashMap<String, Object> {
 	private static final long serialVersionUID = 1L;

+ 9 - 3
src/main/java/io/renren/common/utils/RedisKeys.java

@@ -1,11 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 /**
  * Redis所有Keys
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-07-18 19:51
+ * @author Mark sunlightcs@gmail.com
  */
 public class RedisKeys {
 

+ 9 - 3
src/main/java/io/renren/common/utils/RedisUtils.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 import com.google.gson.Gson;
@@ -10,9 +18,7 @@ import java.util.concurrent.TimeUnit;
 /**
  * Redis工具类
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-07-17 21:12
+ * @author Mark sunlightcs@gmail.com
  */
 @Component
 public class RedisUtils {

+ 10 - 4
src/main/java/io/renren/common/utils/ShiroUtils.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 import io.renren.common.exception.RRException;
@@ -8,10 +16,8 @@ import org.apache.shiro.subject.Subject;
 
 /**
  * Shiro工具类
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月12日 上午9:49:19
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class ShiroUtils {
 

+ 10 - 4
src/main/java/io/renren/common/utils/SpringContextUtils.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.utils;
 
 import org.springframework.beans.BeansException;
@@ -7,10 +15,8 @@ import org.springframework.stereotype.Component;
 
 /**
  * Spring Context 工具类
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月29日 下午11:45:51
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Component
 public class SpringContextUtils implements ApplicationContextAware {

+ 10 - 3
src/main/java/io/renren/common/validator/Assert.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator;
 
 import io.renren.common.exception.RRException;
@@ -5,9 +13,8 @@ import org.apache.commons.lang.StringUtils;
 
 /**
  * 数据校验
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 15:50
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public abstract class Assert {
 

+ 9 - 3
src/main/java/io/renren/common/validator/ValidatorUtils.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator;
 
 import io.renren.common.exception.RRException;
@@ -12,9 +20,7 @@ import java.util.Set;
  *
  * 参考文档:http://docs.jboss.org/hibernate/validator/5.4/reference/en-US/html_single/
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-15 10:50
+ * @author Mark sunlightcs@gmail.com
  */
 public class ValidatorUtils {
     private static Validator validator;

+ 10 - 3
src/main/java/io/renren/common/validator/group/AddGroup.java

@@ -1,10 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator.group;
 
 /**
  * 新增数据 Group
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-16 0:04
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public interface AddGroup {
 }

+ 10 - 3
src/main/java/io/renren/common/validator/group/AliyunGroup.java

@@ -1,10 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator.group;
 
 /**
  * 阿里云
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-28 13:51
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public interface AliyunGroup {
 }

+ 10 - 3
src/main/java/io/renren/common/validator/group/Group.java

@@ -1,12 +1,19 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator.group;
 
 import javax.validation.GroupSequence;
 
 /**
  * 定义校验顺序,如果AddGroup组失败,则UpdateGroup组不会再校验
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-15 23:15
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @GroupSequence({AddGroup.class, UpdateGroup.class})
 public interface Group {

+ 10 - 3
src/main/java/io/renren/common/validator/group/QcloudGroup.java

@@ -1,10 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator.group;
 
 /**
  * 腾讯云
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-28 13:51
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public interface QcloudGroup {
 }

+ 10 - 3
src/main/java/io/renren/common/validator/group/QiniuGroup.java

@@ -1,10 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator.group;
 
 /**
  * 七牛
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-28 13:51
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public interface QiniuGroup {
 }

+ 10 - 3
src/main/java/io/renren/common/validator/group/UpdateGroup.java

@@ -1,10 +1,17 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.validator.group;
 
 /**
  * 更新数据 Group
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-15 21:21
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 
 public interface UpdateGroup {

+ 10 - 3
src/main/java/io/renren/common/xss/SQLFilter.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.xss;
 
 import io.renren.common.exception.RRException;
@@ -5,9 +13,8 @@ import org.apache.commons.lang.StringUtils;
 
 /**
  * SQL过滤
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-01 16:16
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class SQLFilter {
 

+ 10 - 3
src/main/java/io/renren/common/xss/XssFilter.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.xss;
 
 import javax.servlet.*;
@@ -6,9 +14,8 @@ import java.io.IOException;
 
 /**
  * XSS过滤
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-01 10:20
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class XssFilter implements Filter {
 

+ 10 - 3
src/main/java/io/renren/common/xss/XssHttpServletRequestWrapper.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.common.xss;
 
 import org.apache.commons.io.IOUtils;
@@ -16,9 +24,8 @@ import java.util.Map;
 
 /**
  * XSS过滤处理
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-01 11:29
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
     //没被包装过的HttpServletRequest(特殊场景,需要自己过滤)

+ 8 - 0
src/main/java/io/renren/config/CorsConfig.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.config;
 
 import org.springframework.context.annotation.Configuration;

+ 9 - 3
src/main/java/io/renren/config/FilterConfig.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.config;
 
 import io.renren.common.xss.XssFilter;
@@ -11,9 +19,7 @@ import javax.servlet.DispatcherType;
 /**
  * Filter配置
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-21 21:56
+ * @author Mark sunlightcs@gmail.com
  */
 @Configuration
 public class FilterConfig {

+ 9 - 3
src/main/java/io/renren/config/KaptchaConfig.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.config;
 
 import com.google.code.kaptcha.impl.DefaultKaptcha;
@@ -11,9 +19,7 @@ import java.util.Properties;
 /**
  * 生成验证码配置
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-20 19:22
+ * @author Mark sunlightcs@gmail.com
  */
 @Configuration
 public class KaptchaConfig {

+ 13 - 15
src/main/java/io/renren/config/MybatisPlusConfig.java

@@ -1,22 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.config;
 
-import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
+import com.baomidou.mybatisplus.core.injector.ISqlInjector;
+import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -24,7 +18,6 @@ import org.springframework.context.annotation.Configuration;
  * mybatis-plus配置
  *
  * @author Mark sunlightcs@gmail.com
- * @since 2.0.0 2018-02-05
  */
 @Configuration
 public class MybatisPlusConfig {
@@ -36,4 +29,9 @@ public class MybatisPlusConfig {
     public PaginationInterceptor paginationInterceptor() {
         return new PaginationInterceptor();
     }
+
+    @Bean
+    public ISqlInjector sqlInjector() {
+        return new LogicSqlInjector();
+    }
 }

+ 9 - 3
src/main/java/io/renren/config/RedisConfig.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.config;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -10,9 +18,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
 /**
  * Redis配置
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-07-70 19:22
+ * @author Mark sunlightcs@gmail.com
  */
 @Configuration
 public class RedisConfig {

+ 12 - 24
src/main/java/io/renren/config/ShiroConfig.java

@@ -1,15 +1,20 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.config;
 
 import io.renren.modules.sys.oauth2.OAuth2Filter;
 import io.renren.modules.sys.oauth2.OAuth2Realm;
 import org.apache.shiro.mgt.SecurityManager;
-import org.apache.shiro.session.mgt.SessionManager;
 import org.apache.shiro.spring.LifecycleBeanPostProcessor;
 import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
 import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
 import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
-import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
-import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -21,27 +26,16 @@ import java.util.Map;
 /**
  * Shiro配置
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-20 18:33
+ * @author Mark sunlightcs@gmail.com
  */
 @Configuration
 public class ShiroConfig {
 
-    @Bean("sessionManager")
-    public SessionManager sessionManager(){
-        DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
-        sessionManager.setSessionValidationSchedulerEnabled(true);
-        sessionManager.setSessionIdCookieEnabled(true);
-        return sessionManager;
-    }
-
     @Bean("securityManager")
-    public SecurityManager securityManager(OAuth2Realm oAuth2Realm, SessionManager sessionManager) {
+    public SecurityManager securityManager(OAuth2Realm oAuth2Realm) {
         DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
         securityManager.setRealm(oAuth2Realm);
-        securityManager.setSessionManager(sessionManager);
-
+        securityManager.setRememberMeManager(null);
         return securityManager;
     }
 
@@ -65,6 +59,7 @@ public class ShiroConfig {
         filterMap.put("/swagger-ui.html", "anon");
         filterMap.put("/swagger-resources/**", "anon");
         filterMap.put("/captcha.jpg", "anon");
+        filterMap.put("/aaa.txt", "anon");
         filterMap.put("/**", "oauth2");
         shiroFilter.setFilterChainDefinitionMap(filterMap);
 
@@ -77,13 +72,6 @@ public class ShiroConfig {
     }
 
     @Bean
-    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
-        DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator();
-        proxyCreator.setProxyTargetClass(true);
-        return proxyCreator;
-    }
-
-    @Bean
     public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
         AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
         advisor.setSecurityManager(securityManager);

+ 10 - 11
src/main/java/io/renren/config/SwaggerConfig.java

@@ -1,9 +1,16 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.config;
 
 import io.swagger.annotations.ApiOperation;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.PathSelectors;
@@ -22,14 +29,6 @@ import static com.google.common.collect.Lists.newArrayList;
 @EnableSwagger2
 public class SwaggerConfig implements WebMvcConfigurer {
 
-    @Override
-    public void addResourceHandlers(ResourceHandlerRegistry registry) {
-        registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
-        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
-        registry.addResourceHandler("/swagger/**").addResourceLocations("classpath:/static/swagger/");
-    }
-
-
     @Bean
     public Docket createRestApi() {
         return new Docket(DocumentationType.SWAGGER_2)
@@ -48,8 +47,8 @@ public class SwaggerConfig implements WebMvcConfigurer {
         return new ApiInfoBuilder()
             .title("人人开源")
             .description("renren-fast文档")
-            .termsOfServiceUrl("http://www.renren.io")
-            .version("2.1")
+            .termsOfServiceUrl("https://www.renren.io")
+            .version("3.0.0")
             .build();
     }
 

+ 0 - 28
src/main/java/io/renren/config/WebConfig.java

@@ -1,28 +0,0 @@
-package io.renren.config;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-/**
- * WebMvc配置
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Configuration
-public class WebConfig implements WebMvcConfigurer {
-//    @Override
-//    public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
-//        MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
-//        ObjectMapper objectMapper = jackson2HttpMessageConverter.getObjectMapper();
-//
-//        //生成json时,将所有Long转换成String
-//        SimpleModule simpleModule = new SimpleModule();
-//        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
-//        simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
-//        objectMapper.registerModule(simpleModule);
-//
-//        jackson2HttpMessageConverter.setObjectMapper(objectMapper);
-//        converters.add(0, jackson2HttpMessageConverter);
-//    }
-
-}

+ 24 - 0
src/main/java/io/renren/datasource/annotation/DataSource.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 多数据源注解
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+public @interface DataSource {
+    String value() default "";
+}

+ 71 - 0
src/main/java/io/renren/datasource/aspect/DataSourceAspect.java

@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.aspect;
+
+
+import io.renren.datasource.annotation.DataSource;
+import io.renren.datasource.config.DynamicContextHolder;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Method;
+
+/**
+ * 多数据源,切面处理类
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Aspect
+@Component
+@Order(Ordered.HIGHEST_PRECEDENCE)
+public class DataSourceAspect {
+    protected Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Pointcut("@annotation(io.renren.datasource.annotation.DataSource) " +
+            "|| @within(io.renren.datasource.annotation.DataSource)")
+    public void dataSourcePointCut() {
+
+    }
+
+    @Around("dataSourcePointCut()")
+    public Object around(ProceedingJoinPoint point) throws Throwable {
+        MethodSignature signature = (MethodSignature) point.getSignature();
+        Class targetClass = point.getTarget().getClass();
+        Method method = signature.getMethod();
+
+        DataSource targetDataSource = (DataSource)targetClass.getAnnotation(DataSource.class);
+        DataSource methodDataSource = method.getAnnotation(DataSource.class);
+        if(targetDataSource != null || methodDataSource != null){
+            String value;
+            if(methodDataSource != null){
+                value = methodDataSource.value();
+            }else {
+                value = targetDataSource.value();
+            }
+
+            DynamicContextHolder.push(value);
+            logger.debug("set datasource is {}", value);
+        }
+
+        try {
+            return point.proceed();
+        } finally {
+            DynamicContextHolder.poll();
+            logger.debug("clean datasource");
+        }
+    }
+}

+ 57 - 0
src/main/java/io/renren/datasource/config/DynamicContextHolder.java

@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.config;
+
+import java.util.ArrayDeque;
+import java.util.Deque;
+
+/**
+ * 多数据源上下文
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+public class DynamicContextHolder {
+    @SuppressWarnings("unchecked")
+    private static final ThreadLocal<Deque<String>> CONTEXT_HOLDER = new ThreadLocal() {
+        @Override
+        protected Object initialValue() {
+            return new ArrayDeque();
+        }
+    };
+
+    /**
+     * 获得当前线程数据源
+     *
+     * @return 数据源名称
+     */
+    public static String peek() {
+        return CONTEXT_HOLDER.get().peek();
+    }
+
+    /**
+     * 设置当前线程数据源
+     *
+     * @param dataSource 数据源名称
+     */
+    public static void push(String dataSource) {
+        CONTEXT_HOLDER.get().push(dataSource);
+    }
+
+    /**
+     * 清空当前线程数据源
+     */
+    public static void poll() {
+        Deque<String> deque = CONTEXT_HOLDER.get();
+        deque.poll();
+        if (deque.isEmpty()) {
+            CONTEXT_HOLDER.remove();
+        }
+    }
+
+}

+ 25 - 0
src/main/java/io/renren/datasource/config/DynamicDataSource.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.config;
+
+import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
+
+/**
+ * 多数据源
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+public class DynamicDataSource extends AbstractRoutingDataSource {
+
+    @Override
+    protected Object determineCurrentLookupKey() {
+        return DynamicContextHolder.peek();
+    }
+
+}

+ 63 - 0
src/main/java/io/renren/datasource/config/DynamicDataSourceConfig.java

@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.config;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import io.renren.datasource.properties.DataSourceProperties;
+import io.renren.datasource.properties.DynamicDataSourceProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 配置多数据源
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Configuration
+@EnableConfigurationProperties(DynamicDataSourceProperties.class)
+public class DynamicDataSourceConfig {
+    @Autowired
+    private DynamicDataSourceProperties properties;
+
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource.druid")
+    public DataSourceProperties dataSourceProperties() {
+        return new DataSourceProperties();
+    }
+
+    @Bean
+    public DynamicDataSource dynamicDataSource(DataSourceProperties dataSourceProperties) {
+        DynamicDataSource dynamicDataSource = new DynamicDataSource();
+        dynamicDataSource.setTargetDataSources(getDynamicDataSource());
+
+        //默认数据源
+        DruidDataSource defaultDataSource = DynamicDataSourceFactory.buildDruidDataSource(dataSourceProperties);
+        dynamicDataSource.setDefaultTargetDataSource(defaultDataSource);
+
+        return dynamicDataSource;
+    }
+
+    private Map<Object, Object> getDynamicDataSource(){
+        Map<String, DataSourceProperties> dataSourcePropertiesMap = properties.getDatasource();
+        Map<Object, Object> targetDataSources = new HashMap<>(dataSourcePropertiesMap.size());
+        dataSourcePropertiesMap.forEach((k, v) -> {
+            DruidDataSource druidDataSource = DynamicDataSourceFactory.buildDruidDataSource(v);
+            targetDataSources.put(k, druidDataSource);
+        });
+
+        return targetDataSources;
+    }
+
+}

+ 54 - 0
src/main/java/io/renren/datasource/config/DynamicDataSourceFactory.java

@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.config;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import io.renren.datasource.properties.DataSourceProperties;
+
+import java.sql.SQLException;
+
+/**
+ * DruidDataSource
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+public class DynamicDataSourceFactory {
+
+    public static DruidDataSource buildDruidDataSource(DataSourceProperties properties) {
+        DruidDataSource druidDataSource = new DruidDataSource();
+        druidDataSource.setDriverClassName(properties.getDriverClassName());
+        druidDataSource.setUrl(properties.getUrl());
+        druidDataSource.setUsername(properties.getUsername());
+        druidDataSource.setPassword(properties.getPassword());
+
+        druidDataSource.setInitialSize(properties.getInitialSize());
+        druidDataSource.setMaxActive(properties.getMaxActive());
+        druidDataSource.setMinIdle(properties.getMinIdle());
+        druidDataSource.setMaxWait(properties.getMaxWait());
+        druidDataSource.setTimeBetweenEvictionRunsMillis(properties.getTimeBetweenEvictionRunsMillis());
+        druidDataSource.setMinEvictableIdleTimeMillis(properties.getMinEvictableIdleTimeMillis());
+        druidDataSource.setMaxEvictableIdleTimeMillis(properties.getMaxEvictableIdleTimeMillis());
+        druidDataSource.setValidationQuery(properties.getValidationQuery());
+        druidDataSource.setValidationQueryTimeout(properties.getValidationQueryTimeout());
+        druidDataSource.setTestOnBorrow(properties.isTestOnBorrow());
+        druidDataSource.setTestOnReturn(properties.isTestOnReturn());
+        druidDataSource.setPoolPreparedStatements(properties.isPoolPreparedStatements());
+        druidDataSource.setMaxOpenPreparedStatements(properties.getMaxOpenPreparedStatements());
+        druidDataSource.setSharePreparedStatements(properties.isSharePreparedStatements());
+
+        try {
+            druidDataSource.setFilters(properties.getFilters());
+            druidDataSource.init();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return druidDataSource;
+    }
+}

+ 202 - 0
src/main/java/io/renren/datasource/properties/DataSourceProperties.java

@@ -0,0 +1,202 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.properties;
+
+/**
+ * 多数据源属性
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+public class DataSourceProperties {
+    private String driverClassName;
+    private String url;
+    private String username;
+    private String password;
+
+    /**
+     * Druid默认参数
+     */
+    private int initialSize = 2;
+    private int maxActive = 10;
+    private int minIdle = -1;
+    private long maxWait = 60 * 1000L;
+    private long timeBetweenEvictionRunsMillis = 60 * 1000L;
+    private long minEvictableIdleTimeMillis = 1000L * 60L * 30L;
+    private long maxEvictableIdleTimeMillis = 1000L * 60L * 60L * 7;
+    private String validationQuery = "select 1";
+    private int validationQueryTimeout = -1;
+    private boolean testOnBorrow = false;
+    private boolean testOnReturn = false;
+    private boolean testWhileIdle = true;
+    private boolean poolPreparedStatements = false;
+    private int maxOpenPreparedStatements = -1;
+    private boolean sharePreparedStatements = false;
+    private String filters = "stat,wall";
+
+    public String getDriverClassName() {
+        return driverClassName;
+    }
+
+    public void setDriverClassName(String driverClassName) {
+        this.driverClassName = driverClassName;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public int getInitialSize() {
+        return initialSize;
+    }
+
+    public void setInitialSize(int initialSize) {
+        this.initialSize = initialSize;
+    }
+
+    public int getMaxActive() {
+        return maxActive;
+    }
+
+    public void setMaxActive(int maxActive) {
+        this.maxActive = maxActive;
+    }
+
+    public int getMinIdle() {
+        return minIdle;
+    }
+
+    public void setMinIdle(int minIdle) {
+        this.minIdle = minIdle;
+    }
+
+    public long getMaxWait() {
+        return maxWait;
+    }
+
+    public void setMaxWait(long maxWait) {
+        this.maxWait = maxWait;
+    }
+
+    public long getTimeBetweenEvictionRunsMillis() {
+        return timeBetweenEvictionRunsMillis;
+    }
+
+    public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
+        this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
+    }
+
+    public long getMinEvictableIdleTimeMillis() {
+        return minEvictableIdleTimeMillis;
+    }
+
+    public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
+        this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
+    }
+
+    public long getMaxEvictableIdleTimeMillis() {
+        return maxEvictableIdleTimeMillis;
+    }
+
+    public void setMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis) {
+        this.maxEvictableIdleTimeMillis = maxEvictableIdleTimeMillis;
+    }
+
+    public String getValidationQuery() {
+        return validationQuery;
+    }
+
+    public void setValidationQuery(String validationQuery) {
+        this.validationQuery = validationQuery;
+    }
+
+    public int getValidationQueryTimeout() {
+        return validationQueryTimeout;
+    }
+
+    public void setValidationQueryTimeout(int validationQueryTimeout) {
+        this.validationQueryTimeout = validationQueryTimeout;
+    }
+
+    public boolean isTestOnBorrow() {
+        return testOnBorrow;
+    }
+
+    public void setTestOnBorrow(boolean testOnBorrow) {
+        this.testOnBorrow = testOnBorrow;
+    }
+
+    public boolean isTestOnReturn() {
+        return testOnReturn;
+    }
+
+    public void setTestOnReturn(boolean testOnReturn) {
+        this.testOnReturn = testOnReturn;
+    }
+
+    public boolean isTestWhileIdle() {
+        return testWhileIdle;
+    }
+
+    public void setTestWhileIdle(boolean testWhileIdle) {
+        this.testWhileIdle = testWhileIdle;
+    }
+
+    public boolean isPoolPreparedStatements() {
+        return poolPreparedStatements;
+    }
+
+    public void setPoolPreparedStatements(boolean poolPreparedStatements) {
+        this.poolPreparedStatements = poolPreparedStatements;
+    }
+
+    public int getMaxOpenPreparedStatements() {
+        return maxOpenPreparedStatements;
+    }
+
+    public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements) {
+        this.maxOpenPreparedStatements = maxOpenPreparedStatements;
+    }
+
+    public boolean isSharePreparedStatements() {
+        return sharePreparedStatements;
+    }
+
+    public void setSharePreparedStatements(boolean sharePreparedStatements) {
+        this.sharePreparedStatements = sharePreparedStatements;
+    }
+
+    public String getFilters() {
+        return filters;
+    }
+
+    public void setFilters(String filters) {
+        this.filters = filters;
+    }
+}

+ 33 - 0
src/main/java/io/renren/datasource/properties/DynamicDataSourceProperties.java

@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.datasource.properties;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * 多数据源属性
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@ConfigurationProperties(prefix = "dynamic")
+public class DynamicDataSourceProperties {
+    private Map<String, DataSourceProperties> datasource = new LinkedHashMap<>();
+
+    public Map<String, DataSourceProperties> getDatasource() {
+        return datasource;
+    }
+
+    public void setDatasource(Map<String, DataSourceProperties> datasource) {
+        this.datasource = datasource;
+    }
+}

+ 0 - 14
src/main/java/io/renren/datasources/DataSourceNames.java

@@ -1,14 +0,0 @@
-package io.renren.datasources;
-
-/**
- * 增加多数据源,在此配置
- *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/8/18 23:46
- */
-public interface DataSourceNames {
-    String FIRST = "first";
-    String SECOND = "second";
-
-}

+ 0 - 40
src/main/java/io/renren/datasources/DynamicDataSource.java

@@ -1,40 +0,0 @@
-package io.renren.datasources;
-
-import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
-
-import javax.sql.DataSource;
-import java.util.Map;
-
-/**
- * 动态数据源
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/8/19 1:03
- */
-public class DynamicDataSource extends AbstractRoutingDataSource {
-    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();
-
-    public DynamicDataSource(DataSource defaultTargetDataSource, Map<Object, Object> targetDataSources) {
-        super.setDefaultTargetDataSource(defaultTargetDataSource);
-        super.setTargetDataSources(targetDataSources);
-        super.afterPropertiesSet();
-    }
-
-    @Override
-    protected Object determineCurrentLookupKey() {
-        return getDataSource();
-    }
-
-    public static void setDataSource(String dataSource) {
-        contextHolder.set(dataSource);
-    }
-
-    public static String getDataSource() {
-        return contextHolder.get();
-    }
-
-    public static void clearDataSource() {
-        contextHolder.remove();
-    }
-
-}

+ 0 - 42
src/main/java/io/renren/datasources/DynamicDataSourceConfig.java

@@ -1,42 +0,0 @@
-package io.renren.datasources;
-
-import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-
-import javax.sql.DataSource;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 配置多数据源
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/8/19 0:41
- */
-@Configuration
-public class DynamicDataSourceConfig {
-
-    @Bean
-    @ConfigurationProperties("spring.datasource.druid.first")
-    public DataSource firstDataSource(){
-        return DruidDataSourceBuilder.create().build();
-    }
-
-    @Bean
-    @ConfigurationProperties("spring.datasource.druid.second")
-    public DataSource secondDataSource(){
-        return DruidDataSourceBuilder.create().build();
-    }
-
-    @Bean
-    @Primary
-    public DynamicDataSource dataSource(DataSource firstDataSource, DataSource secondDataSource) {
-        Map<Object, Object> targetDataSources = new HashMap<>();
-        targetDataSources.put(DataSourceNames.FIRST, firstDataSource);
-        targetDataSources.put(DataSourceNames.SECOND, secondDataSource);
-        return new DynamicDataSource(firstDataSource, targetDataSources);
-    }
-}

+ 0 - 16
src/main/java/io/renren/datasources/annotation/DataSource.java

@@ -1,16 +0,0 @@
-package io.renren.datasources.annotation;
-
-import java.lang.annotation.*;
-
-/**
- * 多数据源注解
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/9/16 22:16
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface DataSource {
-    String name() default "";
-}

+ 0 - 60
src/main/java/io/renren/datasources/aspect/DataSourceAspect.java

@@ -1,60 +0,0 @@
-package io.renren.datasources.aspect;
-
-import io.renren.datasources.DataSourceNames;
-import io.renren.datasources.DynamicDataSource;
-import io.renren.datasources.annotation.DataSource;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.Ordered;
-import org.springframework.stereotype.Component;
-
-import java.lang.reflect.Method;
-
-/**
- * 多数据源,切面处理类
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/9/16 22:20
- */
-@Aspect
-@Component
-public class DataSourceAspect implements Ordered {
-    protected Logger logger = LoggerFactory.getLogger(getClass());
-
-    @Pointcut("@annotation(io.renren.datasources.annotation.DataSource)")
-    public void dataSourcePointCut() {
-
-    }
-
-    @Around("dataSourcePointCut()")
-    public Object around(ProceedingJoinPoint point) throws Throwable {
-        MethodSignature signature = (MethodSignature) point.getSignature();
-        Method method = signature.getMethod();
-
-        DataSource ds = method.getAnnotation(DataSource.class);
-        if(ds == null){
-            DynamicDataSource.setDataSource(DataSourceNames.FIRST);
-            logger.debug("set datasource is " + DataSourceNames.FIRST);
-        }else {
-            DynamicDataSource.setDataSource(ds.name());
-            logger.debug("set datasource is " + ds.name());
-        }
-
-        try {
-            return point.proceed();
-        } finally {
-            DynamicDataSource.clearDataSource();
-            logger.debug("clean datasource");
-        }
-    }
-
-    @Override
-    public int getOrder() {
-        return 1;
-    }
-}

+ 10 - 3
src/main/java/io/renren/modules/app/annotation/Login.java

@@ -1,12 +1,19 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.annotation;
 
 import java.lang.annotation.*;
 
 /**
  * app登录效验
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/9/23 14:30
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)

+ 9 - 3
src/main/java/io/renren/modules/app/annotation/LoginUser.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.annotation;
 
 import java.lang.annotation.ElementType;
@@ -8,9 +16,7 @@ import java.lang.annotation.Target;
 /**
  * 登录用户信息
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 20:39
+ * @author Mark sunlightcs@gmail.com
  */
 @Target(ElementType.PARAMETER)
 @Retention(RetentionPolicy.RUNTIME)

+ 9 - 3
src/main/java/io/renren/modules/app/config/WebMvcConfig.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.config;
 
 import io.renren.modules.app.interceptor.AuthorizationInterceptor;
@@ -13,9 +21,7 @@ import java.util.List;
 /**
  * MVC配置
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-20 22:30
+ * @author Mark sunlightcs@gmail.com
  */
 @Configuration
 public class WebMvcConfig implements WebMvcConfigurer {

+ 9 - 3
src/main/java/io/renren/modules/app/controller/AppLoginController.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.controller;
 
 
@@ -20,9 +28,7 @@ import java.util.Map;
 /**
  * APP登录授权
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 15:31
+ * @author Mark sunlightcs@gmail.com
  */
 @RestController
 @RequestMapping("/app")

+ 11 - 4
src/main/java/io/renren/modules/app/controller/AppRegisterController.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.controller;
 
 
@@ -19,9 +27,8 @@ import java.util.Date;
 
 /**
  * 注册
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-26 17:27
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @RestController
 @RequestMapping("/app")
@@ -41,7 +48,7 @@ public class AppRegisterController {
         user.setUsername(form.getMobile());
         user.setPassword(DigestUtils.sha256Hex(form.getPassword()));
         user.setCreateTime(new Date());
-        userService.insert(user);
+        userService.save(user);
 
         return R.ok();
     }

+ 9 - 3
src/main/java/io/renren/modules/app/controller/AppTestController.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.controller;
 
 
@@ -15,9 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
 /**
  * APP测试接口
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 15:47
+ * @author Mark sunlightcs@gmail.com
  */
 @RestController
 @RequestMapping("/app")

+ 8 - 18
src/main/java/io/renren/modules/app/dao/UserDao.java

@@ -1,31 +1,21 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.app.dao;
 
-import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import io.renren.modules.app.entity.UserEntity;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
  * 用户
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 15:22:06
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Mapper
 public interface UserDao extends BaseMapper<UserEntity> {

+ 11 - 79
src/main/java/io/renren/modules/app/entity/UserEntity.java

@@ -1,23 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.app.entity;
 
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -25,11 +18,10 @@ import java.util.Date;
 
 /**
  * 用户
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 15:22:06
+ *
+ * @author Mark sunlightcs@gmail.com
  */
+@Data
 @TableName("tb_user")
 public class UserEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
@@ -56,64 +48,4 @@ public class UserEntity implements Serializable {
 	 */
 	private Date createTime;
 
-	/**
-	 * 设置:用户ID
-	 */
-	public void setUserId(Long userId) {
-		this.userId = userId;
-	}
-	/**
-	 * 获取:用户ID
-	 */
-	public Long getUserId() {
-		return userId;
-	}
-	/**
-	 * 设置:用户名
-	 */
-	public void setUsername(String username) {
-		this.username = username;
-	}
-	/**
-	 * 获取:用户名
-	 */
-	public String getUsername() {
-		return username;
-	}
-	/**
-	 * 设置:手机号
-	 */
-	public void setMobile(String mobile) {
-		this.mobile = mobile;
-	}
-	/**
-	 * 获取:手机号
-	 */
-	public String getMobile() {
-		return mobile;
-	}
-	/**
-	 * 设置:密码
-	 */
-	public void setPassword(String password) {
-		this.password = password;
-	}
-	/**
-	 * 获取:密码
-	 */
-	public String getPassword() {
-		return password;
-	}
-	/**
-	 * 设置:创建时间
-	 */
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
-	/**
-	 * 获取:创建时间
-	 */
-	public Date getCreateTime() {
-		return createTime;
-	}
 }

+ 7 - 29
src/main/java/io/renren/modules/app/form/LoginForm.java

@@ -1,23 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.app.form;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 
@@ -25,8 +18,8 @@ import javax.validation.constraints.NotBlank;
  * 登录表单
  *
  * @author Mark sunlightcs@gmail.com
- * @since 3.1.0 2018-01-25
  */
+@Data
 @ApiModel(value = "登录表单")
 public class LoginForm {
     @ApiModelProperty(value = "手机号")
@@ -37,19 +30,4 @@ public class LoginForm {
     @NotBlank(message="密码不能为空")
     private String password;
 
-    public String getMobile() {
-        return mobile;
-    }
-
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
 }

+ 7 - 29
src/main/java/io/renren/modules/app/form/RegisterForm.java

@@ -1,23 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.app.form;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 
@@ -25,8 +18,8 @@ import javax.validation.constraints.NotBlank;
  * 注册表单
  *
  * @author Mark sunlightcs@gmail.com
- * @since 3.1.0 2018-01-25
  */
+@Data
 @ApiModel(value = "注册表单")
 public class RegisterForm {
     @ApiModelProperty(value = "手机号")
@@ -37,19 +30,4 @@ public class RegisterForm {
     @NotBlank(message="密码不能为空")
     private String password;
 
-    public String getMobile() {
-        return mobile;
-    }
-
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
 }

+ 10 - 3
src/main/java/io/renren/modules/app/interceptor/AuthorizationInterceptor.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.interceptor;
 
 
@@ -17,9 +25,8 @@ import javax.servlet.http.HttpServletResponse;
 
 /**
  * 权限(Token)验证
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 15:38
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Component
 public class AuthorizationInterceptor extends HandlerInterceptorAdapter {

+ 11 - 4
src/main/java/io/renren/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.resolver;
 
 import io.renren.modules.app.annotation.LoginUser;
@@ -15,9 +23,8 @@ import org.springframework.web.method.support.ModelAndViewContainer;
 
 /**
  * 有@LoginUser注解的方法参数,注入当前登录用户
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 22:02
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Component
 public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
@@ -39,7 +46,7 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu
         }
 
         //获取用户信息
-        UserEntity user = userService.selectById((Long)object);
+        UserEntity user = userService.getById((Long)object);
 
         return user;
     }

+ 11 - 5
src/main/java/io/renren/modules/app/service/UserService.java

@@ -1,16 +1,22 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.service;
 
 
-import com.baomidou.mybatisplus.service.IService;
+import com.baomidou.mybatisplus.extension.service.IService;
 import io.renren.modules.app.entity.UserEntity;
 import io.renren.modules.app.form.LoginForm;
 
 /**
  * 用户
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-23 15:22:06
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public interface UserService extends IService<UserEntity> {
 

+ 11 - 4
src/main/java/io/renren/modules/app/service/impl/UserServiceImpl.java

@@ -1,7 +1,16 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.service.impl;
 
 
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.renren.common.exception.RRException;
 import io.renren.common.validator.Assert;
 import io.renren.modules.app.dao.UserDao;
@@ -17,9 +26,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
 
 	@Override
 	public UserEntity queryByMobile(String mobile) {
-		UserEntity userEntity = new UserEntity();
-		userEntity.setMobile(mobile);
-		return baseMapper.selectOne(userEntity);
+		return baseMapper.selectOne(new QueryWrapper<UserEntity>().eq("mobile", mobile));
 	}
 
 	@Override

+ 10 - 3
src/main/java/io/renren/modules/app/utils/JwtUtils.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.app.utils;
 
 import io.jsonwebtoken.Claims;
@@ -12,9 +20,8 @@ import java.util.Date;
 
 /**
  * jwt工具类
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/9/21 22:21
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @ConfigurationProperties(prefix = "renren.jwt")
 @Component

+ 5 - 14
src/main/java/io/renren/modules/job/config/ScheduleConfig.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.config;
@@ -27,7 +19,6 @@ import java.util.Properties;
  * 定时任务配置
  *
  * @author Mark sunlightcs@gmail.com
- * @since 2.0.0 2017-04-20
  */
 @Configuration
 public class ScheduleConfig {

+ 7 - 16
src/main/java/io/renren/modules/job/controller/ScheduleJobController.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.controller;
@@ -32,7 +24,6 @@ import java.util.Map;
  * 定时任务
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 @RestController
 @RequestMapping("/sys/schedule")
@@ -57,7 +48,7 @@ public class ScheduleJobController {
 	@GetMapping("/info/{jobId}")
 	@RequiresPermissions("sys:schedule:info")
 	public R info(@PathVariable("jobId") Long jobId){
-		ScheduleJobEntity schedule = scheduleJobService.selectById(jobId);
+		ScheduleJobEntity schedule = scheduleJobService.getById(jobId);
 		
 		return R.ok().put("schedule", schedule);
 	}
@@ -71,7 +62,7 @@ public class ScheduleJobController {
 	public R save(@RequestBody ScheduleJobEntity scheduleJob){
 		ValidatorUtils.validateEntity(scheduleJob);
 		
-		scheduleJobService.save(scheduleJob);
+		scheduleJobService.saveJob(scheduleJob);
 		
 		return R.ok();
 	}

+ 6 - 15
src/main/java/io/renren/modules/job/controller/ScheduleJobLogController.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.controller;
@@ -30,7 +22,6 @@ import java.util.Map;
  * 定时任务日志
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 @RestController
 @RequestMapping("/sys/scheduleLog")
@@ -54,7 +45,7 @@ public class ScheduleJobLogController {
 	 */
 	@GetMapping("/info/{logId}")
 	public R info(@PathVariable("logId") Long logId){
-		ScheduleJobLogEntity log = scheduleJobLogService.selectById(logId);
+		ScheduleJobLogEntity log = scheduleJobLogService.getById(logId);
 		
 		return R.ok().put("log", log);
 	}

+ 6 - 15
src/main/java/io/renren/modules/job/dao/ScheduleJobDao.java

@@ -1,22 +1,14 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.dao;
 
-import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import io.renren.modules.job.entity.ScheduleJobEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -26,7 +18,6 @@ import java.util.Map;
  * 定时任务
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 @Mapper
 public interface ScheduleJobDao extends BaseMapper<ScheduleJobEntity> {

+ 6 - 15
src/main/java/io/renren/modules/job/dao/ScheduleJobLogDao.java

@@ -1,22 +1,14 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.dao;
 
-import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import io.renren.modules.job.entity.ScheduleJobLogEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -24,7 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
  * 定时任务日志
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 @Mapper
 public interface ScheduleJobLogDao extends BaseMapper<ScheduleJobLogEntity> {

+ 9 - 110
src/main/java/io/renren/modules/job/entity/ScheduleJobEntity.java

@@ -1,23 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.entity;
 
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -27,8 +20,8 @@ import java.util.Date;
  * 定时任务
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
+@Data
 @TableName("schedule_job")
 public class ScheduleJobEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
@@ -82,99 +75,5 @@ public class ScheduleJobEntity implements Serializable {
 	 */
 	private Date createTime;
 
-	/**
-	 * 设置:任务id
-	 * @param jobId 任务id
-	 */
-	public void setJobId(Long jobId) {
-		this.jobId = jobId;
-	}
-
-	/**
-	 * 获取:任务id
-	 * @return Long
-	 */
-	public Long getJobId() {
-		return jobId;
-	}
-	
-	public String getBeanName() {
-		return beanName;
-	}
-
-	public void setBeanName(String beanName) {
-		this.beanName = beanName;
-	}
-
-	public String getMethodName() {
-		return methodName;
-	}
-
-	public void setMethodName(String methodName) {
-		this.methodName = methodName;
-	}
-
-	public String getParams() {
-		return params;
-	}
-
-	public void setParams(String params) {
-		this.params = params;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-	/**
-	 * 设置:任务状态
-	 * @param status 任务状态
-	 */
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	/**
-	 * 获取:任务状态
-	 * @return String
-	 */
-	public Integer getStatus() {
-		return status;
-	}
-	
-	/**
-	 * 设置:cron表达式
-	 * @param cronExpression cron表达式
-	 */
-	public void setCronExpression(String cronExpression) {
-		this.cronExpression = cronExpression;
-	}
 
-	/**
-	 * 获取:cron表达式
-	 * @return String
-	 */
-	public String getCronExpression() {
-		return cronExpression;
-	}
-	
-	/**
-	 * 设置:创建时间
-	 * @param createTime 创建时间
-	 */
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
-
-	/**
-	 * 获取:创建时间
-	 * @return Date
-	 */
-	public Date getCreateTime() {
-		return createTime;
-	}
 }

+ 9 - 87
src/main/java/io/renren/modules/job/entity/ScheduleJobLogEntity.java

@@ -1,23 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.entity;
 
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -26,8 +19,8 @@ import java.util.Date;
  * 定时任务日志
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
+@Data
 @TableName("schedule_job_log")
 public class ScheduleJobLogEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
@@ -78,76 +71,5 @@ public class ScheduleJobLogEntity implements Serializable {
 	 */
 	private Date createTime;
 
-	public Long getLogId() {
-		return logId;
-	}
-
-	public void setLogId(Long logId) {
-		this.logId = logId;
-	}
-
-	public Long getJobId() {
-		return jobId;
-	}
-
-	public void setJobId(Long jobId) {
-		this.jobId = jobId;
-	}
-
-	public String getBeanName() {
-		return beanName;
-	}
-
-	public void setBeanName(String beanName) {
-		this.beanName = beanName;
-	}
-
-	public String getMethodName() {
-		return methodName;
-	}
-
-	public void setMethodName(String methodName) {
-		this.methodName = methodName;
-	}
-
-	public String getParams() {
-		return params;
-	}
-
-	public void setParams(String params) {
-		this.params = params;
-	}
-
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	public String getError() {
-		return error;
-	}
-
-	public void setError(String error) {
-		this.error = error;
-	}
-
-	public Integer getTimes() {
-		return times;
-	}
-
-	public void setTimes(Integer times) {
-		this.times = times;
-	}
-
-	public Date getCreateTime() {
-		return createTime;
-	}
-
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
 	
 }

+ 6 - 15
src/main/java/io/renren/modules/job/service/ScheduleJobLogService.java

@@ -1,22 +1,14 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.service;
 
-import com.baomidou.mybatisplus.service.IService;
+import com.baomidou.mybatisplus.extension.service.IService;
 import io.renren.common.utils.PageUtils;
 import io.renren.modules.job.entity.ScheduleJobLogEntity;
 
@@ -26,7 +18,6 @@ import java.util.Map;
  * 定时任务日志
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 public interface ScheduleJobLogService extends IService<ScheduleJobLogEntity> {
 

+ 7 - 16
src/main/java/io/renren/modules/job/service/ScheduleJobService.java

@@ -1,22 +1,14 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.service;
 
-import com.baomidou.mybatisplus.service.IService;
+import com.baomidou.mybatisplus.extension.service.IService;
 import io.renren.common.utils.PageUtils;
 import io.renren.modules.job.entity.ScheduleJobEntity;
 
@@ -26,7 +18,6 @@ import java.util.Map;
  * 定时任务
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 public interface ScheduleJobService extends IService<ScheduleJobEntity> {
 
@@ -35,7 +26,7 @@ public interface ScheduleJobService extends IService<ScheduleJobEntity> {
 	/**
 	 * 保存定时任务
 	 */
-	void save(ScheduleJobEntity scheduleJob);
+	void saveJob(ScheduleJobEntity scheduleJob);
 	
 	/**
 	 * 更新定时任务

+ 11 - 19
src/main/java/io/renren/modules/job/service/impl/ScheduleJobLogServiceImpl.java

@@ -1,24 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.service.impl;
 
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.renren.common.utils.PageUtils;
 import io.renren.common.utils.Query;
 import io.renren.modules.job.dao.ScheduleJobLogDao;
@@ -36,9 +28,9 @@ public class ScheduleJobLogServiceImpl extends ServiceImpl<ScheduleJobLogDao, Sc
 	public PageUtils queryPage(Map<String, Object> params) {
 		String jobId = (String)params.get("jobId");
 
-		Page<ScheduleJobLogEntity> page = this.selectPage(
-				new Query<ScheduleJobLogEntity>(params).getPage(),
-				new EntityWrapper<ScheduleJobLogEntity>().like(StringUtils.isNotBlank(jobId),"job_id", jobId)
+		IPage<ScheduleJobLogEntity> page = this.page(
+			new Query<ScheduleJobLogEntity>().getPage(params),
+			new QueryWrapper<ScheduleJobLogEntity>().like(StringUtils.isNotBlank(jobId),"job_id", jobId)
 		);
 
 		return new PageUtils(page);

+ 16 - 24
src/main/java/io/renren/modules/job/service/impl/ScheduleJobServiceImpl.java

@@ -1,24 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.service.impl;
 
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.renren.common.utils.Constant;
 import io.renren.common.utils.PageUtils;
 import io.renren.common.utils.Query;
@@ -46,7 +38,7 @@ public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, Schedule
 	 */
 	@PostConstruct
 	public void init(){
-		List<ScheduleJobEntity> scheduleJobList = this.selectList(null);
+		List<ScheduleJobEntity> scheduleJobList = this.list();
 		for(ScheduleJobEntity scheduleJob : scheduleJobList){
 			CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getJobId());
             //如果不存在,则创建
@@ -62,9 +54,9 @@ public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, Schedule
 	public PageUtils queryPage(Map<String, Object> params) {
 		String beanName = (String)params.get("beanName");
 
-		Page<ScheduleJobEntity> page = this.selectPage(
-				new Query<ScheduleJobEntity>(params).getPage(),
-				new EntityWrapper<ScheduleJobEntity>().like(StringUtils.isNotBlank(beanName),"bean_name", beanName)
+		IPage<ScheduleJobEntity> page = this.page(
+			new Query<ScheduleJobEntity>().getPage(params),
+			new QueryWrapper<ScheduleJobEntity>().like(StringUtils.isNotBlank(beanName),"bean_name", beanName)
 		);
 
 		return new PageUtils(page);
@@ -73,10 +65,10 @@ public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, Schedule
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void save(ScheduleJobEntity scheduleJob) {
+	public void saveJob(ScheduleJobEntity scheduleJob) {
 		scheduleJob.setCreateTime(new Date());
 		scheduleJob.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
-        this.insert(scheduleJob);
+        this.save(scheduleJob);
         
         ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
     }
@@ -97,7 +89,7 @@ public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, Schedule
     	}
     	
     	//删除数据
-    	this.deleteBatchIds(Arrays.asList(jobIds));
+    	this.removeByIds(Arrays.asList(jobIds));
 	}
 
 	@Override
@@ -112,7 +104,7 @@ public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, Schedule
 	@Transactional(rollbackFor = Exception.class)
     public void run(Long[] jobIds) {
     	for(Long jobId : jobIds){
-    		ScheduleUtils.run(scheduler, this.selectById(jobId));
+    		ScheduleUtils.run(scheduler, this.getById(jobId));
     	}
     }
 

+ 24 - 0
src/main/java/io/renren/modules/job/task/ITask.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package io.renren.modules.job.task;
+
+/**
+ * 定时任务接口,所有定时任务都要实现该接口
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+public interface ITask {
+
+    /**
+     * 执行定时任务接口
+     *
+     * @param params   参数,多参数使用JSON数据
+     */
+    void run(String params);
+}

+ 12 - 42
src/main/java/io/renren/modules/job/task/TestTask.java

@@ -1,27 +1,15 @@
-package io.renren.modules.job.task;
-
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
-import io.renren.modules.sys.entity.SysUserEntity;
-import io.renren.modules.sys.service.SysUserService;
-import org.apache.commons.lang.builder.ToStringBuilder;
+package io.renren.modules.job.task;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
@@ -30,31 +18,13 @@ import org.springframework.stereotype.Component;
  * testTask为spring bean的名称
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 @Component("testTask")
-public class TestTask {
+public class TestTask implements ITask {
 	private Logger logger = LoggerFactory.getLogger(getClass());
-	
-	@Autowired
-	private SysUserService sysUserService;
-	
-	public void test(String params){
-		logger.info("我是带参数的test方法,正在被执行,参数为:" + params);
-		
-		try {
-			Thread.sleep(1000L);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-		
-		SysUserEntity user = sysUserService.selectById(1L);
-		System.out.println(ToStringBuilder.reflectionToString(user));
-		
-	}
-	
-	
-	public void test2(){
-		logger.info("我是不带参数的test2方法,正在被执行");
+
+	@Override
+	public void run(String params){
+		logger.debug("TestTask定时任务正在执行,参数为:{}", params);
 	}
 }

+ 14 - 28
src/main/java/io/renren/modules/job/utils/ScheduleJob.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.utils;
@@ -27,22 +19,18 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.quartz.QuartzJobBean;
 
+import java.lang.reflect.Method;
 import java.util.Date;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
 
 
 /**
  * 定时任务
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 public class ScheduleJob extends QuartzJobBean {
 	private Logger logger = LoggerFactory.getLogger(getClass());
-	private ExecutorService service = Executors.newSingleThreadExecutor(); 
-	
+
     @Override
     protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
         ScheduleJobEntity scheduleJob = (ScheduleJobEntity) context.getMergedJobDataMap()
@@ -55,7 +43,6 @@ public class ScheduleJob extends QuartzJobBean {
         ScheduleJobLogEntity log = new ScheduleJobLogEntity();
         log.setJobId(scheduleJob.getJobId());
         log.setBeanName(scheduleJob.getBeanName());
-        log.setMethodName(scheduleJob.getMethodName());
         log.setParams(scheduleJob.getParams());
         log.setCreateTime(new Date());
         
@@ -64,12 +51,11 @@ public class ScheduleJob extends QuartzJobBean {
         
         try {
             //执行任务
-        	logger.info("任务准备执行,任务ID:" + scheduleJob.getJobId());
-            ScheduleRunnable task = new ScheduleRunnable(scheduleJob.getBeanName(),
-            		scheduleJob.getMethodName(), scheduleJob.getParams());
-            Future<?> future = service.submit(task);
-            
-			future.get();
+        	logger.debug("任务准备执行,任务ID:" + scheduleJob.getJobId());
+
+			Object target = SpringContextUtils.getBean(scheduleJob.getBeanName());
+			Method method = target.getClass().getDeclaredMethod("run", String.class);
+			method.invoke(target, scheduleJob.getParams());
 			
 			//任务执行总时长
 			long times = System.currentTimeMillis() - startTime;
@@ -77,7 +63,7 @@ public class ScheduleJob extends QuartzJobBean {
 			//任务状态    0:成功    1:失败
 			log.setStatus(0);
 			
-			logger.info("任务执行完毕,任务ID:" + scheduleJob.getJobId() + "  总共耗时:" + times + "毫秒");
+			logger.debug("任务执行完毕,任务ID:" + scheduleJob.getJobId() + "  总共耗时:" + times + "毫秒");
 		} catch (Exception e) {
 			logger.error("任务执行失败,任务ID:" + scheduleJob.getJobId(), e);
 			
@@ -89,7 +75,7 @@ public class ScheduleJob extends QuartzJobBean {
 			log.setStatus(1);
 			log.setError(StringUtils.substring(e.toString(), 0, 2000));
 		}finally {
-			scheduleJobLogService.insert(log);
+			scheduleJobLogService.save(log);
 		}
     }
 }

+ 0 - 62
src/main/java/io/renren/modules/job/utils/ScheduleRunnable.java

@@ -1,62 +0,0 @@
-/**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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 io.renren.modules.job.utils;
-
-import io.renren.common.exception.RRException;
-import io.renren.common.utils.SpringContextUtils;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.util.ReflectionUtils;
-
-import java.lang.reflect.Method;
-
-/**
- * 执行定时任务
- *
- * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
- */
-public class ScheduleRunnable implements Runnable {
-	private Object target;
-	private Method method;
-	private String params;
-	
-	public ScheduleRunnable(String beanName, String methodName, String params) throws NoSuchMethodException, SecurityException {
-		this.target = SpringContextUtils.getBean(beanName);
-		this.params = params;
-		
-		if(StringUtils.isNotBlank(params)){
-			this.method = target.getClass().getDeclaredMethod(methodName, String.class);
-		}else{
-			this.method = target.getClass().getDeclaredMethod(methodName);
-		}
-	}
-
-	@Override
-	public void run() {
-		try {
-			ReflectionUtils.makeAccessible(method);
-			if(StringUtils.isNotBlank(params)){
-				method.invoke(target, params);
-			}else{
-				method.invoke(target);
-			}
-		}catch (Exception e) {
-			throw new RRException("执行定时任务失败", e);
-		}
-	}
-
-}

+ 5 - 14
src/main/java/io/renren/modules/job/utils/ScheduleUtils.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.job.utils;
@@ -25,7 +17,6 @@ import org.quartz.*;
  * 定时任务工具类
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.2.0 2016-11-28
  */
 public class ScheduleUtils {
     private final static String JOB_NAME = "TASK_";

+ 7 - 16
src/main/java/io/renren/modules/oss/cloud/AliyunCloudStorageService.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.cloud;
@@ -24,9 +16,8 @@ import java.io.InputStream;
 
 /**
  * 阿里云存储
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-26 16:22
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class AliyunCloudStorageService extends CloudStorageService {
     private OSSClient client;

+ 9 - 166
src/main/java/io/renren/modules/oss/cloud/CloudStorageConfig.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.cloud;
@@ -20,6 +12,7 @@ package io.renren.modules.oss.cloud;
 import io.renren.common.validator.group.AliyunGroup;
 import io.renren.common.validator.group.QcloudGroup;
 import io.renren.common.validator.group.QiniuGroup;
+import lombok.Data;
 import org.hibernate.validator.constraints.Range;
 import org.hibernate.validator.constraints.URL;
 
@@ -29,10 +22,10 @@ import java.io.Serializable;
 
 /**
  * 云存储配置信息
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-25 16:12
+ *
+ * @author Mark sunlightcs@gmail.com
  */
+@Data
 public class CloudStorageConfig implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -97,155 +90,5 @@ public class CloudStorageConfig implements Serializable {
     @NotBlank(message="所属地区不能为空", groups = QcloudGroup.class)
     private String qcloudRegion;
 
-    public Integer getType() {
-        return type;
-    }
 
-    public void setType(Integer type) {
-        this.type = type;
-    }
-
-    public String getQiniuDomain() {
-        return qiniuDomain;
-    }
-
-    public void setQiniuDomain(String qiniuDomain) {
-        this.qiniuDomain = qiniuDomain;
-    }
-
-    public String getQiniuAccessKey() {
-        return qiniuAccessKey;
-    }
-
-    public void setQiniuAccessKey(String qiniuAccessKey) {
-        this.qiniuAccessKey = qiniuAccessKey;
-    }
-
-    public String getQiniuSecretKey() {
-        return qiniuSecretKey;
-    }
-
-    public void setQiniuSecretKey(String qiniuSecretKey) {
-        this.qiniuSecretKey = qiniuSecretKey;
-    }
-
-    public String getQiniuBucketName() {
-        return qiniuBucketName;
-    }
-
-    public void setQiniuBucketName(String qiniuBucketName) {
-        this.qiniuBucketName = qiniuBucketName;
-    }
-
-    public String getQiniuPrefix() {
-        return qiniuPrefix;
-    }
-
-    public void setQiniuPrefix(String qiniuPrefix) {
-        this.qiniuPrefix = qiniuPrefix;
-    }
-
-    public String getAliyunDomain() {
-        return aliyunDomain;
-    }
-
-    public void setAliyunDomain(String aliyunDomain) {
-        this.aliyunDomain = aliyunDomain;
-    }
-
-    public String getAliyunPrefix() {
-        return aliyunPrefix;
-    }
-
-    public void setAliyunPrefix(String aliyunPrefix) {
-        this.aliyunPrefix = aliyunPrefix;
-    }
-
-    public String getAliyunEndPoint() {
-        return aliyunEndPoint;
-    }
-
-    public void setAliyunEndPoint(String aliyunEndPoint) {
-        this.aliyunEndPoint = aliyunEndPoint;
-    }
-
-    public String getAliyunAccessKeyId() {
-        return aliyunAccessKeyId;
-    }
-
-    public void setAliyunAccessKeyId(String aliyunAccessKeyId) {
-        this.aliyunAccessKeyId = aliyunAccessKeyId;
-    }
-
-    public String getAliyunAccessKeySecret() {
-        return aliyunAccessKeySecret;
-    }
-
-    public void setAliyunAccessKeySecret(String aliyunAccessKeySecret) {
-        this.aliyunAccessKeySecret = aliyunAccessKeySecret;
-    }
-
-    public String getAliyunBucketName() {
-        return aliyunBucketName;
-    }
-
-    public void setAliyunBucketName(String aliyunBucketName) {
-        this.aliyunBucketName = aliyunBucketName;
-    }
-
-    public String getQcloudDomain() {
-        return qcloudDomain;
-    }
-
-    public void setQcloudDomain(String qcloudDomain) {
-        this.qcloudDomain = qcloudDomain;
-    }
-
-    public String getQcloudPrefix() {
-        return qcloudPrefix;
-    }
-
-    public void setQcloudPrefix(String qcloudPrefix) {
-        this.qcloudPrefix = qcloudPrefix;
-    }
-
-    public Integer getQcloudAppId() {
-        return qcloudAppId;
-    }
-
-    public void setQcloudAppId(Integer qcloudAppId) {
-        this.qcloudAppId = qcloudAppId;
-    }
-
-    public String getQcloudSecretId() {
-        return qcloudSecretId;
-    }
-
-    public void setQcloudSecretId(String qcloudSecretId) {
-        this.qcloudSecretId = qcloudSecretId;
-    }
-
-    public String getQcloudSecretKey() {
-        return qcloudSecretKey;
-    }
-
-    public void setQcloudSecretKey(String qcloudSecretKey) {
-        this.qcloudSecretKey = qcloudSecretKey;
-    }
-
-    public String getQcloudBucketName() {
-        return qcloudBucketName;
-    }
-
-    public void setQcloudBucketName(String qcloudBucketName) {
-        this.qcloudBucketName = qcloudBucketName;
-    }
-
-	public String getQcloudRegion() {
-		return qcloudRegion;
-	}
-
-	public void setQcloudRegion(String qcloudRegion) {
-		this.qcloudRegion = qcloudRegion;
-	}
 }

+ 7 - 16
src/main/java/io/renren/modules/oss/cloud/CloudStorageService.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.cloud;
@@ -25,9 +17,8 @@ import java.util.UUID;
 
 /**
  * 云存储(支持七牛、阿里云、腾讯云、又拍云)
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-25 14:58
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public abstract class CloudStorageService {
     /** 云存储配置信息 */

+ 7 - 16
src/main/java/io/renren/modules/oss/cloud/OSSFactory.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.cloud;
@@ -24,9 +16,8 @@ import io.renren.modules.sys.service.SysConfigService;
 
 /**
  * 文件上传Factory
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-26 10:18
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public final class OSSFactory {
     private static SysConfigService sysConfigService;

+ 7 - 16
src/main/java/io/renren/modules/oss/cloud/QcloudCloudStorageService.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.cloud;
@@ -30,9 +22,8 @@ import java.io.InputStream;
 
 /**
  * 腾讯云存储
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-26 20:51
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class QcloudCloudStorageService extends CloudStorageService {
     private COSClient client;

+ 7 - 16
src/main/java/io/renren/modules/oss/cloud/QiniuCloudStorageService.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.cloud;
@@ -29,9 +21,8 @@ import java.io.InputStream;
 
 /**
  * 七牛云存储
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-25 15:41
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public class QiniuCloudStorageService extends CloudStorageService {
     private UploadManager uploadManager;

+ 9 - 19
src/main/java/io/renren/modules/oss/controller/SysOssController.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.controller;
@@ -42,10 +34,8 @@ import java.util.Map;
 
 /**
  * 文件上传
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-25 12:13:26
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @RestController
 @RequestMapping("sys/oss")
@@ -125,7 +115,7 @@ public class SysOssController {
 		SysOssEntity ossEntity = new SysOssEntity();
 		ossEntity.setUrl(url);
 		ossEntity.setCreateDate(new Date());
-		sysOssService.insert(ossEntity);
+		sysOssService.save(ossEntity);
 
 		return R.ok().put("url", url);
 	}
@@ -137,7 +127,7 @@ public class SysOssController {
 	@PostMapping("/delete")
 	@RequiresPermissions("sys:oss:all")
 	public R delete(@RequestBody Long[] ids){
-		sysOssService.deleteBatchIds(Arrays.asList(ids));
+		sysOssService.removeByIds(Arrays.asList(ids));
 
 		return R.ok();
 	}

+ 8 - 19
src/main/java/io/renren/modules/oss/dao/SysOssDao.java

@@ -1,32 +1,21 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.dao;
 
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import io.renren.modules.oss.entity.SysOssEntity;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
  * 文件上传
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-25 12:13:26
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Mapper
 public interface SysOssDao extends BaseMapper<SysOssEntity> {

+ 11 - 55
src/main/java/io/renren/modules/oss/entity/SysOssEntity.java

@@ -1,23 +1,16 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.entity;
 
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -25,11 +18,10 @@ import java.util.Date;
 
 /**
  * 文件上传
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-25 12:13:26
+ *
+ * @author Mark sunlightcs@gmail.com
  */
+@Data
 @TableName("sys_oss")
 public class SysOssEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
@@ -41,40 +33,4 @@ public class SysOssEntity implements Serializable {
 	//创建时间
 	private Date createDate;
 
-	/**
-	 * 设置:
-	 */
-	public void setId(Long id) {
-		this.id = id;
-	}
-	/**
-	 * 获取:
-	 */
-	public Long getId() {
-		return id;
-	}
-	/**
-	 * 设置:URL地址
-	 */
-	public void setUrl(String url) {
-		this.url = url;
-	}
-	/**
-	 * 获取:URL地址
-	 */
-	public String getUrl() {
-		return url;
-	}
-	/**
-	 * 设置:创建时间
-	 */
-	public void setCreateDate(Date createDate) {
-		this.createDate = createDate;
-	}
-	/**
-	 * 获取:创建时间
-	 */
-	public Date getCreateDate() {
-		return createDate;
-	}
 }

+ 8 - 18
src/main/java/io/renren/modules/oss/service/SysOssService.java

@@ -1,22 +1,14 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.service;
 
-import com.baomidou.mybatisplus.service.IService;
+import com.baomidou.mybatisplus.extension.service.IService;
 import io.renren.common.utils.PageUtils;
 import io.renren.modules.oss.entity.SysOssEntity;
 
@@ -24,10 +16,8 @@ import java.util.Map;
 
 /**
  * 文件上传
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-25 12:13:26
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public interface SysOssService extends IService<SysOssEntity> {
 

+ 9 - 17
src/main/java/io/renren/modules/oss/service/impl/SysOssServiceImpl.java

@@ -1,23 +1,15 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.oss.service.impl;
 
-import com.baomidou.mybatisplus.plugins.Page;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.renren.common.utils.PageUtils;
 import io.renren.common.utils.Query;
 import io.renren.modules.oss.dao.SysOssDao;
@@ -33,8 +25,8 @@ public class SysOssServiceImpl extends ServiceImpl<SysOssDao, SysOssEntity> impl
 
 	@Override
 	public PageUtils queryPage(Map<String, Object> params) {
-		Page<SysOssEntity> page = this.selectPage(
-				new Query<SysOssEntity>(params).getPage()
+		IPage<SysOssEntity> page = this.page(
+			new Query<SysOssEntity>().getPage(params)
 		);
 
 		return new PageUtils(page);

+ 10 - 4
src/main/java/io/renren/modules/sys/controller/AbstractController.java

@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
 package io.renren.modules.sys.controller;
 
 import io.renren.modules.sys.entity.SysUserEntity;
@@ -7,10 +15,8 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Controller公共组件
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月9日 下午9:42:26
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 public abstract class AbstractController {
 	protected Logger logger = LoggerFactory.getLogger(getClass());

+ 9 - 19
src/main/java/io/renren/modules/sys/controller/SysConfigController.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.sys.controller;
@@ -31,10 +23,8 @@ import java.util.Map;
 
 /**
  * 系统配置信息
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年12月4日 下午6:55:53
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @RestController
 @RequestMapping("/sys/config")
@@ -60,7 +50,7 @@ public class SysConfigController extends AbstractController {
 	@GetMapping("/info/{id}")
 	@RequiresPermissions("sys:config:info")
 	public R info(@PathVariable("id") Long id){
-		SysConfigEntity config = sysConfigService.selectById(id);
+		SysConfigEntity config = sysConfigService.getById(id);
 		
 		return R.ok().put("config", config);
 	}
@@ -74,7 +64,7 @@ public class SysConfigController extends AbstractController {
 	public R save(@RequestBody SysConfigEntity config){
 		ValidatorUtils.validateEntity(config);
 
-		sysConfigService.save(config);
+		sysConfigService.saveConfig(config);
 		
 		return R.ok();
 	}

+ 7 - 17
src/main/java/io/renren/modules/sys/controller/SysLogController.java

@@ -1,17 +1,9 @@
 /**
- * Copyright 2018 人人开源 http://www.renren.io
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
  */
 
 package io.renren.modules.sys.controller;
@@ -32,10 +24,8 @@ import java.util.Map;
 
 /**
  * 系统日志
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-08 10:40:56
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Controller
 @RequestMapping("/sys/log")

+ 0 - 0
src/main/java/io/renren/modules/sys/controller/SysLoginController.java


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio