xusl před 3 roky
revize
e7c567fe96
100 změnil soubory, kde provedl 7171 přidání a 0 odebrání
  1. 3 0
      README.md
  2. 43 0
      ipfcst-common/ipfcst-common-bom/pom.xml
  3. 79 0
      ipfcst-common/ipfcst-common-core/pom.xml
  4. 20 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/config/EncryptionConfig.java
  5. 36 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/config/JacksonConfig.java
  6. 19 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/config/RestTemplateConfig.java
  7. 18 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/CommonConstants.java
  8. 14 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/SecurityConstants.java
  9. 25 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/enums/ResponseEnum.java
  10. 21 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/enums/SysUserRoleEnum.java
  11. 21 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/enums/SysUserStatusEnum.java
  12. 30 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/exception/BusinessException.java
  13. 35 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/jackson/JavaTimeModule.java
  14. 44 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/BeanMapUtil.java
  15. 96 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/ClassUtil.java
  16. 206 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/CommonUtil.java
  17. 89 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/CronUtils.java
  18. 159 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/DateMomentUtil.java
  19. 234 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/DateTimeUtil.java
  20. 41 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/JsonBeanUtil.java
  21. 123 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/JwtUtil.java
  22. 141 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/NumberUtils.java
  23. 186 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/ProduceSql.java
  24. 56 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/RSAEncrypt.java
  25. 83 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/SpringContextHolder.java
  26. 40 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/StringUtil.java
  27. 328 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/SunRiseSet.java
  28. 177 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/WebUtil.java
  29. 60 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/GlobalExceptionHandler.java
  30. 38 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/vo/RequestVO.java
  31. 87 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/vo/ResponseVO.java
  32. 122 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/xss/RequestWrapper.java
  33. 25 0
      ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/xss/RequestWrapperFilter.java
  34. 1 0
      ipfcst-common/ipfcst-common-core/src/main/resources/META-INF/build-info.properties
  35. 4 0
      ipfcst-common/ipfcst-common-core/src/main/resources/META-INF/spring.factories
  36. 6 0
      ipfcst-common/ipfcst-common-core/src/main/resources/banner.txt
  37. 83 0
      ipfcst-common/ipfcst-common-data/README.md
  38. 111 0
      ipfcst-common/ipfcst-common-data/pom.xml
  39. 62 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/Quartz.java
  40. 26 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/id/CustomIDGenerator.java
  41. 28 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/id/CustomUUIDGenerator.java
  42. 79 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzBlobTriggersEntity.java
  43. 63 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzBlobTriggersEntityPK.java
  44. 67 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCalendarsEntity.java
  45. 51 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCalendarsEntityPK.java
  46. 88 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCronTriggersEntity.java
  47. 63 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCronTriggersEntityPK.java
  48. 184 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzFiredTriggersEntity.java
  49. 51 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzFiredTriggersEntityPK.java
  50. 152 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzJobDetailsEntity.java
  51. 63 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzJobDetailsEntityPK.java
  52. 52 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzLocksEntity.java
  53. 51 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzLocksEntityPK.java
  54. 52 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzPausedTriggerGrpsEntity.java
  55. 51 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzPausedTriggerGrpsEntityPK.java
  56. 76 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSchedulerStateEntity.java
  57. 51 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSchedulerStateEntityPK.java
  58. 100 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpleTriggersEntity.java
  59. 63 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpleTriggersEntityPK.java
  60. 197 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpropTriggersEntity.java
  61. 63 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpropTriggersEntityPK.java
  62. 223 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzTriggersEntity.java
  63. 63 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzTriggersEntityPK.java
  64. 35 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/id/IdGenerator.java
  65. 17 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/BaseRepository.java
  66. 17 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/QuartzRepository.java
  67. 98 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/strategy/IpfcstNamingStrategy.java
  68. 359 0
      ipfcst-common/ipfcst-common-data/src/main/java/org/hibernate/cfg/InheritanceState.java
  69. 395 0
      ipfcst-common/ipfcst-common-data/src/main/java/org/hibernate/cfg/PropertyContainer.java
  70. 51 0
      ipfcst-common/ipfcst-common-security/pom.xml
  71. 14 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/AuthorizeConfigurerProvider.java
  72. 28 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/SecurityAuthorizeConfigurerProvider.java
  73. 27 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/SysAuthorizeConfigurerManager.java
  74. 24 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/SystemAuthorizeConfigurerProvider.java
  75. 115 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/config/WebSecurityConfig.java
  76. 55 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/filter/JwtAuthenticationTokenFilter.java
  77. 78 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/CustomAuthenticationFailureHandler.java
  78. 47 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/CustomAuthenticationSuccessHandler.java
  79. 26 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/EntryPointUnauthorizedHandler.java
  80. 25 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/RestAccessDeniedHandler.java
  81. 64 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/JwtUserDetailsServiceImpl.java
  82. 40 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/SysUser.java
  83. 14 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/SysUserRepository.java
  84. 51 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/SysUserService.java
  85. 135 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/util/JwtTokenUtil.java
  86. 27 0
      ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/util/SecurityUtil.java
  87. 2 0
      ipfcst-common/ipfcst-common-security/src/main/resources/META-INF/spring.factories
  88. 23 0
      ipfcst-common/pom.xml
  89. 14 0
      ipfcst-console/.editorconfig
  90. 14 0
      ipfcst-console/.env.development
  91. 6 0
      ipfcst-console/.env.production
  92. 8 0
      ipfcst-console/.env.staging
  93. 4 0
      ipfcst-console/.eslintignore
  94. 198 0
      ipfcst-console/.eslintrc.js
  95. 17 0
      ipfcst-console/.gitignore
  96. 5 0
      ipfcst-console/.travis.yml
  97. 21 0
      ipfcst-console/LICENSE
  98. 98 0
      ipfcst-console/README-zh.md
  99. 91 0
      ipfcst-console/README.md
  100. 5 0
      ipfcst-console/babel.config.js

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# focus
+
+集中预测系统【focus forecast】

+ 43 - 0
ipfcst-common/ipfcst-common-bom/pom.xml

@@ -0,0 +1,43 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.jiayue.focus</groupId>
+    <artifactId>ipfcst-common-bom</artifactId>
+    <packaging>pom</packaging>
+    <version>3.0</version>
+    <description>ipfcst 公共版本控制</description>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>com.jiayue.focus</groupId>
+                <artifactId>ipfcst-common-core</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.jiayue.focus</groupId>
+                <artifactId>ipfcst-common-data</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.jiayue.focus</groupId>
+                <artifactId>ipfcst-common-security</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <!--上传配置 必须 -->
+    <distributionManagement>
+        <repository>
+            <id>jiayue-releases</id>
+            <url>http://49.4.68.219:8888/nexus/content/repositories/jiayue-releases</url>
+        </repository>
+        <snapshotRepository>
+            <id>jiayue-snapshots</id>
+            <url>http://49.4.68.219:8888/nexus/content/repositories/jiayue-snapshots</url>
+        </snapshotRepository>
+    </distributionManagement>
+
+</project>

+ 79 - 0
ipfcst-common/ipfcst-common-core/pom.xml

@@ -0,0 +1,79 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.jiayue.focus</groupId>
+        <artifactId>ipfcst-common</artifactId>
+        <version>3.0</version>
+    </parent>
+
+    <artifactId>ipfcst-common-core</artifactId>
+    <packaging>jar</packaging>
+
+    <description>ipfcst 公共工具类核心包</description>
+
+    <dependencies>
+        <!--hutool-->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>${hutool.version}</version>
+        </dependency>
+        <!--server-api-->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+        </dependency>
+        <!--hibernate-validator-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
+        <!--json模块-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-json</artifactId>
+        </dependency>
+        <!--TTL-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>transmittable-thread-local</artifactId>
+            <version>${ttl.version}</version>
+        </dependency>
+        <!--swagger 依赖-->
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-annotations</artifactId>
+        </dependency>
+        <!-- JWT -->
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>${javajwt.version}</version>
+        </dependency>
+        <!-- base64加密 -->
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.13</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+        </dependency>
+        <!--任务调度-->
+        <dependency>
+            <groupId>org.quartz-scheduler</groupId>
+            <artifactId>quartz</artifactId>
+            <version>${quartz.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>slf4j-api</artifactId>
+                    <groupId>org.slf4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+</project>

+ 20 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/config/EncryptionConfig.java

@@ -0,0 +1,20 @@
+package com.jiayue.ipfcst.common.core.config;
+
+import com.jiayue.ipfcst.common.core.util.RSAEncrypt;
+import org.jasypt.encryption.StringEncryptor;
+import org.springframework.context.annotation.Bean;
+
+/**
+ * 自定义加密解密器,用于数据库账号密码解密
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/8 10:57
+ */
+//@Configuration
+//@EnableEncryptableProperties
+public class EncryptionConfig {
+    @Bean("jasyptStringEncryptor") public StringEncryptor stringEncryptor() {
+        return new RSAEncrypt();
+    }
+}

+ 36 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/config/JacksonConfig.java

@@ -0,0 +1,36 @@
+package com.jiayue.ipfcst.common.core.config;
+
+//import cn.hutool.core.date.DatePattern;
+//import com.fasterxml.jackson.databind.ObjectMapper;
+//import com.jiayue.ipfcst.common.core.jackson.JavaTimeModule;
+//import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+//import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
+//import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//
+//import java.time.ZoneId;
+//import java.util.Locale;
+//import java.util.TimeZone;
+//
+///**
+// * JacksonConfig
+// *
+// * @author L.ym
+// * @version 3.0
+// **/
+//@Configuration
+//@ConditionalOnClass(ObjectMapper.class)
+//@AutoConfigureBefore(JacksonAutoConfiguration.class)
+//public class JacksonConfig {
+//    @Bean
+//    public Jackson2ObjectMapperBuilderCustomizer customizer() {
+//        return builder -> {
+//            builder.locale(Locale.CHINA);
+//            builder.timeZone(TimeZone.getTimeZone(ZoneId.systemDefault()));
+//            builder.simpleDateFormat(DatePattern.NORM_DATETIME_PATTERN);
+//            builder.modules(new JavaTimeModule());
+//        };
+//    }
+//}

+ 19 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/config/RestTemplateConfig.java

@@ -0,0 +1,19 @@
+package com.jiayue.ipfcst.common.core.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * RestTemplateConfig
+ *
+ * @author L.ym
+ * @version 3.0
+ **/
+@Configuration
+public class RestTemplateConfig {
+    @Bean
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
+}

+ 18 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/CommonConstants.java

@@ -0,0 +1,18 @@
+package com.jiayue.ipfcst.common.core.constant;
+
+/**
+ * CommonConstants
+ *
+ * @author L.ym
+ * @version 3.0
+ **/
+public interface CommonConstants {
+    /**
+     * 成功标记
+     */
+    Integer SUCCESS = 0;
+    /**
+     * 失败标记
+     */
+    Integer FAIL = 1;
+}

+ 14 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/SecurityConstants.java

@@ -0,0 +1,14 @@
+package com.jiayue.ipfcst.common.core.constant;
+
+/**
+ * SecurityConstants
+ *
+ * @author L.ym
+ * @version 3.0
+ **/
+public interface SecurityConstants {
+    /**
+     * 刷新
+     */
+    String REFRESH_TOKEN = "refresh_token";
+}

+ 25 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/enums/ResponseEnum.java

@@ -0,0 +1,25 @@
+package com.jiayue.ipfcst.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 数据信息状态枚举类
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/6/24 9:34
+ */
+@Getter
+@AllArgsConstructor
+public enum ResponseEnum {
+    /**
+     * 0 表示返回成功
+     */
+    SUCCESS(0, "操作成功!"),
+    FAILED(1, "操作失败!"),
+    ERROR(-1, "系统错误!");
+
+    private Integer code;
+    private String message;
+}

+ 21 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/enums/SysUserRoleEnum.java

@@ -0,0 +1,21 @@
+package com.jiayue.ipfcst.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 系统用户角色枚举
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/6 14:49
+ */
+@Getter
+@AllArgsConstructor
+public enum SysUserRoleEnum {
+    E1(1, "系统管理员"),
+    E2(2, "场站管理员"),
+    E3(3, "场站业务员");
+    private Integer code;
+    private String message;
+}

+ 21 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/constant/enums/SysUserStatusEnum.java

@@ -0,0 +1,21 @@
+package com.jiayue.ipfcst.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 系统用户状态枚举
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/5 15:05
+ */
+@Getter
+@AllArgsConstructor
+public enum SysUserStatusEnum {
+    E1(1, "正常"),
+    E2(2, "锁定"),
+    E3(3, "禁用");
+    private Integer code;
+    private String message;
+}

+ 30 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/exception/BusinessException.java

@@ -0,0 +1,30 @@
+package com.jiayue.ipfcst.common.core.exception;
+
+import lombok.NoArgsConstructor;
+
+/**
+ * 业务异常
+ *
+ * @author zzy
+ * @version 2.0
+ * @since 2018/10/11 11:08
+ */
+@NoArgsConstructor
+public class BusinessException extends Exception{
+
+    public BusinessException(String message) {
+        super(message);
+    }
+
+    public BusinessException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public BusinessException(Throwable cause) {
+        super(cause);
+    }
+
+    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

+ 35 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/jackson/JavaTimeModule.java

@@ -0,0 +1,35 @@
+package com.jiayue.ipfcst.common.core.jackson;
+
+import cn.hutool.core.date.DatePattern;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.datatype.jsr310.PackageVersion;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * java 8 时间默认序列化
+ *
+ * @author L.ym
+ * @version 3.0
+ **/
+public class JavaTimeModule extends SimpleModule {
+
+    public JavaTimeModule() {
+        super(PackageVersion.VERSION);
+        this.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+        this.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
+        this.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
+        this.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+        this.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
+        this.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
+    }
+}

+ 44 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/BeanMapUtil.java

@@ -0,0 +1,44 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import org.springframework.cglib.beans.BeanMap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * bean和map互转工具
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/10/11 14:30
+ */
+public class BeanMapUtil {
+    /**
+     * 将对象装换为map
+     * @param bean 实体对象
+     * @param <T> 实体对象泛型
+     * @return map
+     */
+    public static <T> Map<String, Object> beanToMap(T bean) {
+        Map<String, Object> map = new HashMap<>();
+        if (bean != null) {
+            BeanMap beanMap = BeanMap.create(bean);
+            for (Object key : beanMap.keySet()) {
+                map.put(key+"", beanMap.get(key));
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 将map装换为javabean对象
+     * @param map map
+     * @param bean bean 类
+     * @return bean对象
+     */
+    public static <T> T mapToBean(Map<String, Object> map,T bean) {
+        BeanMap beanMap = BeanMap.create(bean);
+        beanMap.putAll(map);
+        return bean;
+    }
+}

+ 96 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/ClassUtil.java

@@ -0,0 +1,96 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import lombok.experimental.UtilityClass;
+import org.springframework.core.BridgeMethodResolver;
+import org.springframework.core.DefaultParameterNameDiscoverer;
+import org.springframework.core.MethodParameter;
+import org.springframework.core.ParameterNameDiscoverer;
+import org.springframework.core.annotation.AnnotatedElementUtils;
+import org.springframework.core.annotation.SynthesizingMethodParameter;
+import org.springframework.util.ClassUtils;
+import org.springframework.web.method.HandlerMethod;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * 类工具类
+ *
+ * @author L.cm
+ */
+@UtilityClass
+public class ClassUtil extends org.springframework.util.ClassUtils {
+	private final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
+
+	/**
+	 * 获取方法参数信息
+	 *
+	 * @param constructor    构造器
+	 * @param parameterIndex 参数序号
+	 * @return {MethodParameter}
+	 */
+	public MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
+		MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
+		methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
+		return methodParameter;
+	}
+
+	/**
+	 * 获取方法参数信息
+	 *
+	 * @param method         方法
+	 * @param parameterIndex 参数序号
+	 * @return {MethodParameter}
+	 */
+	public MethodParameter getMethodParameter(Method method, int parameterIndex) {
+		MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
+		methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
+		return methodParameter;
+	}
+
+	/**
+	 * 获取Annotation
+	 *
+	 * @param method         Method
+	 * @param annotationType 注解类
+	 * @param <A>            泛型标记
+	 * @return {Annotation}
+	 */
+	public <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
+		Class<?> targetClass = method.getDeclaringClass();
+		// The method may be on an interface, but we need attributes from the target class.
+		// If the target class is null, the method will be unchanged.
+		Method specificMethod = ClassUtils.getMostSpecificMethod(method, targetClass);
+		// If we are dealing with method with generic parameters, find the original method.
+		specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod);
+		// 先找方法,再找方法上的类
+		A annotation = AnnotatedElementUtils.findMergedAnnotation(specificMethod, annotationType);
+		;
+		if (null != annotation) {
+			return annotation;
+		}
+		// 获取类上面的Annotation,可能包含组合注解,故采用spring的工具类
+		return AnnotatedElementUtils.findMergedAnnotation(specificMethod.getDeclaringClass(), annotationType);
+	}
+
+	/**
+	 * 获取Annotation
+	 *
+	 * @param handlerMethod  HandlerMethod
+	 * @param annotationType 注解类
+	 * @param <A>            泛型标记
+	 * @return {Annotation}
+	 */
+	public <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
+		// 先找方法,再找方法上的类
+		A annotation = handlerMethod.getMethodAnnotation(annotationType);
+		if (null != annotation) {
+			return annotation;
+		}
+		// 获取类上面的Annotation,可能包含组合注解,故采用spring的工具类
+		Class<?> beanType = handlerMethod.getBeanType();
+		return AnnotatedElementUtils.findMergedAnnotation(beanType, annotationType);
+	}
+
+}

+ 206 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/CommonUtil.java

@@ -0,0 +1,206 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.*;
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.*;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * 通用工具类
+ *
+ * @author zzy
+ * @version 2.0
+ * @since 2018/11/20 17:27
+ */
+@Slf4j
+public abstract class CommonUtil {
+
+    private static final int BUFFER_SIZE = 2 * 1024;
+    public static Properties props = System.getProperties();
+    public static String osName = props.getProperty("os.name");
+
+    /**
+     * 获取随机数
+     *
+     * @param min 最小值
+     * @param max 最大值
+     * @return 随机数
+     */
+    public static long getRandom(int min, int max) {
+        return Math.round(Math.random() * (max - min) + min);
+    }
+
+    /**
+     * 功能描述: 获取异常堆栈信息
+     *
+     * @param t 异常
+     * @return String 异常堆栈信息
+     */
+    public static String printStackTraceToString(Throwable t) {
+        StringWriter sw = new StringWriter();
+        t.printStackTrace(new PrintWriter(sw, true));
+        return sw.getBuffer().toString();
+    }
+
+    /**
+     * 获取目录下所有文件(按时间排序)
+     *
+     * @param path
+     * @return
+     */
+    public static List<File> getFileSort(String path) {
+
+        List<File> list = getFiles(path, new ArrayList<>());
+
+        if (list != null && list.size() > 0) {
+
+            Collections.sort(list, new Comparator<File>() {
+                @Override
+                public int compare(File file, File newFile) {
+                    if (file.lastModified() < newFile.lastModified()) {
+                        return 1;
+                    } else if (file.lastModified() == newFile.lastModified()) {
+                        return 0;
+                    } else {
+                        return -1;
+                    }
+
+                }
+            });
+
+        }
+
+        return list;
+    }
+
+    /**
+     * 获取目录下所有文件
+     *
+     * @param realpath 文件路径
+     * @param files    返回的文件集合
+     * @return files
+     */
+    public static List<File> getFiles(String realpath, List<File> files) {
+
+        File realFile = new File(realpath);
+        File[] subfiles = realFile.listFiles();
+        for (File file : subfiles) {
+            files.add(file);
+        }
+        return files;
+    }
+
+    /**
+     * 压缩成ZIP 方法1
+     *
+     * @param srcDir           压缩文件夹路径
+     * @param out              压缩文件输出流
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
+     *                         false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws RuntimeException 压缩失败会抛出运行时异常
+     */
+    public static void toZip(String srcDir, OutputStream out, boolean KeepDirStructure)
+            throws RuntimeException {
+
+        long start = System.currentTimeMillis();
+        ZipOutputStream zos = null;
+        try {
+            zos = new ZipOutputStream(out);
+            File sourceFile = new File(srcDir);
+            compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure);
+            long end = System.currentTimeMillis();
+            System.out.println("压缩完成,耗时:" + (end - start) + " ms");
+        } catch (Exception e) {
+            throw new RuntimeException("zip error from ZipUtils", e);
+        } finally {
+            if (zos != null) {
+                try {
+                    zos.close();
+                } catch (IOException e) {
+                    log.error("系统错误", e);
+                }
+            }
+        }
+
+    }
+
+    /**
+     * 递归压缩方法
+     *
+     * @param sourceFile       源文件
+     * @param zos              zip输出流
+     * @param name             压缩后的名称
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
+     *                         false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws Exception
+     */
+    private static void compress(File sourceFile, ZipOutputStream zos, String name,
+                                 boolean KeepDirStructure) throws Exception {
+        byte[] buf = new byte[BUFFER_SIZE];
+        if (sourceFile.isFile()) {
+            // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
+            zos.putNextEntry(new ZipEntry(name));
+            // copy文件到zip输出流中
+            int len;
+            FileInputStream in = new FileInputStream(sourceFile);
+            while ((len = in.read(buf)) != -1) {
+                zos.write(buf, 0, len);
+            }
+            zos.closeEntry();
+            in.close();
+        } else {
+            File[] listFiles = sourceFile.listFiles();
+            if (listFiles == null || listFiles.length == 0) {
+                // 需要保留原来的文件结构时,需要对空文件夹进行处理
+                if (KeepDirStructure) {
+                    // 空文件夹的处理
+                    zos.putNextEntry(new ZipEntry(name + "/"));
+                    // 没有文件,不需要文件的copy
+                    zos.closeEntry();
+                }
+            } else {
+                for (File file : listFiles) {
+                    // 判断是否需要保留原来的文件结构
+                    if (KeepDirStructure) {
+                        // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
+                        // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
+                        compress(file, zos, name + "/" + file.getName(), KeepDirStructure);
+                    } else {
+                        compress(file, zos, file.getName(), KeepDirStructure);
+                    }
+
+                }
+            }
+        }
+    }
+
+    /**
+     * 参数1:原始路径
+     * 参数2:.zip结束后的路径:例:D:\\temp\\playbook_1936_拍照商品照片.zip\\11\\22。此时11\\22\\文件名称就是参数2
+     * 参数3:固定写死的zip路径
+     * 注意: 1:zip压缩包不能动态的添加文件夹,所以在压缩之前需要生成好全部的文件夹。
+     * 2:在往zip包下不同文件夹添加数据时,需要注意:完整路径。例:D:/temp/playbook_1936_拍照商品照片.zip/33/44/时toUrl的路径开始地必须时zip之后第一个开始
+     */
+    public static boolean addZip(String zipUrl, String fromUrl, String toUrl) throws IOException {
+        Map<String, String> env = new HashMap<>();
+        env.put("create", "true");
+        //使用语法定位文件系统
+        //在java.net.JarURLConnection中定义
+        Path path = Paths.get(zipUrl);
+        URI uri = URI.create("jar:" + path.toUri());
+        try (FileSystem zipfs = FileSystems.newFileSystem(uri, env)) {
+            Path externalTxtFile = Paths.get(fromUrl);
+            Path pathInZipfile = zipfs.getPath(toUrl);
+            //将文件复制到zip文件中
+            Files.copy(externalTxtFile, pathInZipfile, StandardCopyOption.REPLACE_EXISTING);
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+}

+ 89 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/CronUtils.java

@@ -0,0 +1,89 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import org.quartz.CronExpression;
+import org.quartz.CronScheduleBuilder;
+import org.quartz.CronTrigger;
+import org.quartz.TriggerBuilder;
+
+import java.text.ParseException;
+import java.util.Date;
+
+/**
+ * cron表达式工具类
+ */
+public class CronUtils {
+    /**
+     * 返回一个布尔值代表一个给定的Cron表达式的有效性
+     *
+     * @param cronExpression Cron表达式
+     * @return boolean 表达式是否有效
+     */
+    public static boolean isValid(String cronExpression) {
+        return CronExpression.isValidExpression(cronExpression);
+    }
+
+    /**
+     * 返回一个字符串值,表示该消息无效Cron表达式给出有效性
+     *
+     * @param cronExpression Cron表达式
+     * @return String 无效时返回表达式错误描述,如果有效返回null
+     */
+    public static String getInvalidMessage(String cronExpression) {
+        try {
+            new CronExpression(cronExpression);
+            return null;
+        } catch (ParseException pe) {
+            return pe.getMessage();
+        }
+    }
+
+    /**
+     * 返回下一个执行时间根据给定的Cron表达式
+     *
+     * @param cronExpression Cron表达式
+     * @return Date 下次Cron表达式执行时间
+     */
+    public static Date getNextExecution(String cronExpression) {
+        try {
+            CronExpression cron = new CronExpression(cronExpression);
+            return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis()));
+        } catch (ParseException e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
+    }
+
+
+    /**
+     * 上次执行时间
+     *
+     * @param cron 表达式
+     * @return 上次时间
+     */
+    public static Date getLastTriggerTime(String cron) {
+
+        CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("Caclulate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
+        Date time0 = trigger.getStartTime();
+        Date time1 = trigger.getFireTimeAfter(time0);
+        Date time2 = trigger.getFireTimeAfter(time1);
+        Date time3 = trigger.getFireTimeAfter(time2);
+        long l = time1.getTime() - (time3.getTime() - time2.getTime());
+//		Date date = new Date(l);
+//		SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = new Date();
+        date.setTime(l);
+        return date;
+    }
+
+    /**
+     * 获取下次执行时间(getFireTimeAfter,也可以下下次...)
+     *
+     * @param cron 表达式
+     * @return 下次执行时间
+     */
+    public static Date getNextTriggerTime(String cron) {
+        CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("Caclulate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
+        Date time0 = trigger.getStartTime();
+        Date time1 = trigger.getFireTimeAfter(time0);
+        return time1;
+    }
+}

+ 159 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/DateMomentUtil.java

@@ -0,0 +1,159 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import com.sun.istack.internal.NotNull;
+import java.util.Calendar;
+
+/**
+ * 时刻工具类
+ *
+ * @author zzy
+ * @version 2.0
+ * @since 2018/11/2 11:31
+ */
+public abstract class DateMomentUtil {
+
+
+    /**
+     * 获取月份
+     *
+     * @param dateTime 时间,单位毫秒
+     * @return 月份
+     */
+    public static Integer getMonth(@NotNull final Long dateTime) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis(dateTime);
+        return calendar.get(Calendar.MONTH) + 1;
+    }
+
+    /**
+     * 获取指定时间在当天所处于的时刻
+     * 例如:dateTime:2018-10-22 16:44:00 momentLength: 15分钟,既 15*60*1000毫秒
+     * 从0点0分开始计算,0点0分-0点15为第一个时刻,依次类推该时间的时刻数为67
+     *
+     * @param dateTime     时间毫秒
+     * @param momentLength 时刻长度,单位毫秒
+     * @return 时刻
+     */
+    public static int getMoment(@NotNull final Long dateTime, @NotNull final Long momentLength) {
+        return (int) ((dateTime - com.jiayue.ipfcst.common.core.util.DateMomentUtil.getDayStartTime(dateTime)) / momentLength) + 1;
+    }
+
+    /**
+     * 获取指定时间所在时刻的标记时间 <br>
+     * 例如:dateTime:2018-10-22 16:44:00 momentLength: 15*60*1000 <br>
+     * 当前标记signType:1 那么该时刻的标记时间为2018-10-22 16:30:00
+     * 当后标记singType:2 那么该时刻的标记时间为2018-10-22 16:45:00
+     *
+     * @param dateTime     时间毫秒
+     * @param signType     标记方式:1前标记 2后标记
+     * @param momentLength 时刻长度,单位:毫秒
+     * @return 指定时间所在时刻的标记时间,单位:毫秒
+     */
+    public static long getMomentTime(@NotNull final Long dateTime, @NotNull final int signType, @NotNull final Long momentLength) throws Exception {
+        if (24 * 3600 * 1000L % momentLength != 0)
+            throw new Exception("时刻长度非法,时刻长度需要能够被一天整除");
+        int moment = com.jiayue.ipfcst.common.core.util.DateMomentUtil.getMoment(dateTime, momentLength);// 获取指定时间所在时刻数
+        long differentTime = moment * momentLength;// 获取从0分0秒开始到现在的时间间隔,单位:毫秒
+        long dayStartTime = com.jiayue.ipfcst.common.core.util.DateMomentUtil.getDayStartTime(dateTime);
+        switch (signType) {
+            case 2:
+                return dayStartTime + differentTime;
+            default:
+                return dayStartTime + differentTime - momentLength;
+        }
+    }
+
+    /**
+     * 获取指定时间所在天第一个时刻的标记时间 <br>
+     * 例如:dateTime:2018-10-22 16:44:00 momentLength: 15*60*1000 <br>
+     * 当前标记signType:1 那么第一个时刻的标记时间为2018-10-22 00:00:00
+     * 当后标记singType:2 那么第一个时刻的标记时间为2018-10-22 00:15:00
+     *
+     * @param dateTime     时间毫秒
+     * @param signType     标记方式:1前标记 2后标记
+     * @param momentLength 时刻长度,单位:毫秒
+     * @return 一天第一个时刻的标记时间,单位:毫秒
+     */
+    public static long getDayFirstMomentTime(@NotNull final Long dateTime, @NotNull final int signType, @NotNull final Long momentLength) throws Exception {
+        if (24 * 3600 * 1000L % momentLength != 0)
+            throw new Exception("时刻长度非法,时刻长度需要能够被一天整除");
+        long dayStartTime = com.jiayue.ipfcst.common.core.util.DateMomentUtil.getDayStartTime(dateTime);
+        switch (signType) {
+            case 2:
+                return dayStartTime + momentLength;
+            default:
+                return dayStartTime;
+        }
+    }
+
+    /**
+     * 获取指定时间所在天的最后一个时刻的标记时间 <br>
+     * 例如:dateTime:2018-10-22 16:44:00 momentLength: 15*60*1000 <br>
+     * 当前标记signType:1 那么最后一个时刻的标记时间为2018-10-22 23:45:00
+     * 当后标记singType:2 那么最后一个时刻的标记时间为2018-10-23 00:00:00
+     *
+     * @param dateTime     时间毫秒
+     * @param signType     标记方式:1前标记 2后标记, 当null时按照前标记1处理
+     * @param momentLength 时刻长度,单位:毫秒
+     * @return 一天第一个时刻的标记时间,单位:毫秒
+     */
+    public static long getDayLastMomentTime(@NotNull final Long dateTime, @NotNull final int signType, @NotNull final Long momentLength) throws Exception {
+        if (24 * 3600 * 1000L % momentLength != 0)
+            throw new Exception("时刻长度非法,时刻长度需要能够被一天整除");
+        Calendar date = Calendar.getInstance();
+        date.setTimeInMillis(dateTime);
+        date.add(Calendar.DATE, 1);
+        date.set(Calendar.HOUR_OF_DAY, 0);
+        date.set(Calendar.MINUTE, 0);
+        date.set(Calendar.SECOND, 0);
+        date.set(Calendar.MILLISECOND, 0);
+        switch (signType) {
+            case 2:
+                return date.getTimeInMillis();
+            default:
+                return date.getTimeInMillis() - momentLength;
+        }
+    }
+
+    /**
+     * 获取指定时间所在天的0点0分
+     *
+     * @param dateTime 时间毫秒
+     * @return 0点0分的毫秒
+     */
+    public static long getDayStartTime(@NotNull final Long dateTime) {
+        Calendar date = Calendar.getInstance();
+        date.setTimeInMillis(dateTime);
+        date.set(Calendar.HOUR_OF_DAY, 0);
+        date.set(Calendar.MINUTE, 0);
+        date.set(Calendar.SECOND, 0);
+        date.set(Calendar.MILLISECOND, 0);
+        return date.getTimeInMillis();
+    }
+
+    /**
+     * 获取指定时间所在天的23点59分59秒
+     *
+     * @param dateTime 时间毫秒
+     * @return 23点59分59秒的毫秒
+     */
+    public static long getDayLastTime(@NotNull final Long dateTime) {
+        Calendar date = Calendar.getInstance();
+        date.setTimeInMillis(dateTime);
+        date.set(Calendar.HOUR_OF_DAY, 23);
+        date.set(Calendar.MINUTE, 59);
+        date.set(Calendar.SECOND, 59);
+        date.set(Calendar.MILLISECOND, 999);
+        return date.getTimeInMillis();
+    }
+
+    /**
+     * 获取两个时间间的间隔天数(自然天)
+     * @param dateFrom 开始时间
+     * @param dateTo 结束时间
+     * @return 自然天数
+     */
+    public static Integer getDaysBetweenTwoDate(Long dateFrom, Long dateTo) {
+        return (int) ((com.jiayue.ipfcst.common.core.util.DateMomentUtil.getDayStartTime(dateTo) - com.jiayue.ipfcst.common.core.util.DateMomentUtil.getDayStartTime(dateFrom)) / (1000 * 60 * 60 * 24L));
+    }
+}

+ 234 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/DateTimeUtil.java

@@ -0,0 +1,234 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import com.sun.istack.internal.NotNull;
+import org.apache.commons.lang.time.DateUtils;
+
+import java.math.BigDecimal;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * 时间工具类
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/2 13:09
+ */
+@SuppressWarnings("WeakerAccess")
+public class DateTimeUtil {
+
+    /**
+     * 获取月份
+     *
+     * @param dateTime 时间,单位:毫秒
+     * @return 月份
+     */
+    public static int getMonth(@NotNull final Long dateTime) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis(dateTime);
+        return calendar.get(Calendar.MONTH) + 1;
+    }
+
+    /**
+     * 获取指定时间在当天所处于的时刻(15分钟为一个时刻)
+     * 例如:dateTime:2018-10-22 16:44:00
+     * 从0点0分开始计算,0点0分-0点15为第一个时刻,依次类推该时间的时刻数为67
+     *
+     * @param dateTime 时间,单位:毫秒
+     * @return 时刻
+     */
+    public static int getMomentFor15Minute(@NotNull final Long dateTime) {
+        return (int) ((dateTime - DateTimeUtil.getDayStartTime(dateTime).getTime()) / (15 * 60 * 1000)) + 1;
+    }
+
+    /**
+     * 获取指定时间在当天所处于的时刻(5分钟为一个时刻)
+     * 例如:dateTime:2018-10-22 01:44:00
+     * 从0点0分开始计算,0点0分-0点5为第一个时刻,依次类推该时间的时刻数为
+     *
+     * @param dateTime 时间,单位:毫秒
+     * @return 时刻
+     */
+    public static int getMomentFor5Minute(@NotNull final Long dateTime) {
+        return (int) ((dateTime - DateTimeUtil.getDayStartTime(dateTime).getTime()) / (5 * 60 * 1000)) + 1;
+    }
+
+    /**
+     * 获取指定时间所在时刻的标记时间(15分钟为一个时刻)<br>
+     * 例如:dateTime:2018-10-22 16:44:00 <br>
+     * 标记时间为2018-10-22 16:30:00
+     *
+     * @param dateTime 时间,单位:毫秒
+     * @return 指定时间所在时刻的标记时间,单位:毫秒
+     */
+    public static Date getMomentTimeFor15Minute(@NotNull final Long dateTime) {
+        int moment = DateTimeUtil.getMomentFor15Minute(dateTime);// 获取指定时间所在时刻数
+        long differentTime = moment * 15 * 60 * 1000;// 获取从0分0秒开始到现在的时间间隔,单位:毫秒
+        long dayStartTime = DateTimeUtil.getDayStartTime(dateTime).getTime();
+        return new Date(dayStartTime + differentTime - 15 * 60 * 1000);
+    }
+
+    /**
+     * 获取指定时间所在时刻的标记时间(5分钟为一个时刻)<br>
+     * 例如:dateTime:2018-10-22 16:44:00 <br>
+     * 标记时间为2018-10-22 16:40:00
+     *
+     * @param dateTime 时间,单位:毫秒
+     * @return 指定时间所在时刻的标记时间,单位:毫秒
+     */
+    public static Date getMomentTimeFor5Minute(@NotNull final Long dateTime) {
+        int moment = DateTimeUtil.getMomentFor15Minute(dateTime);// 获取指定时间所在时刻数
+        long differentTime = moment * 5 * 60 * 1000;// 获取从0分0秒开始到现在的时间间隔,单位:毫秒
+        long dayStartTime = DateTimeUtil.getDayStartTime(dateTime).getTime();
+        return new Date(dayStartTime + differentTime - 5 * 60 * 1000);
+    }
+
+    /**
+     * 获取当前时间(时间粒度分钟)
+     *
+     * @return 当前时间
+     */
+    public static Date getCurrentTimeForMinute() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        return calendar.getTime();
+    }
+
+    /**
+     * 获取指定时间所在天的0点0分
+     *
+     * @param dateTime 时间毫秒
+     * @return 0点0分的毫秒
+     */
+    public static Date getDayStartTime(@NotNull final Long dateTime) {
+        Calendar date = Calendar.getInstance();
+        date.setTimeInMillis(dateTime);
+        date.set(Calendar.HOUR_OF_DAY, 0);
+        date.set(Calendar.MINUTE, 0);
+        date.set(Calendar.SECOND, 0);
+        date.set(Calendar.MILLISECOND, 0);
+        return date.getTime();
+    }
+
+    /**
+     * 今日凌晨 毫秒
+     *
+     * @return 时间
+     */
+    public static long getMillisecondsSubDay() {
+
+        Calendar c = Calendar.getInstance();
+
+        return c.getTimeInMillis() - DateUtils.getFragmentInMilliseconds(c, Calendar.DAY_OF_MONTH);
+    }
+
+    /**
+     * 获取指定时间所在天的23点59分59秒
+     *
+     * @param dateTime 时间毫秒
+     * @return 23点59分59秒的毫秒
+     */
+    public static Date getDayLastTime(@NotNull final Long dateTime) {
+        Calendar date = Calendar.getInstance();
+        date.setTimeInMillis(dateTime);
+        date.set(Calendar.HOUR_OF_DAY, 23);
+        date.set(Calendar.MINUTE, 59);
+        date.set(Calendar.SECOND, 59);
+        date.set(Calendar.MILLISECOND, 999);
+        return date.getTime();
+    }
+
+    /**
+     * 获取两个时间间的间隔天数(自然天)
+     *
+     * @param dateFrom 开始时间
+     * @param dateTo   结束时间
+     * @return 自然天数
+     */
+    public static int getDaysBetweenTwoDate(Long dateFrom, Long dateTo) {
+        return (int) ((DateTimeUtil.getDayStartTime(dateTo).getTime() - DateTimeUtil.getDayStartTime(dateFrom).getTime()) / (1000 * 60 * 60 * 24L));
+    }
+
+    /**
+     * 获取两个时间间的间隔间隔时刻数(15分钟一个时刻)
+     *
+     * @param dateFrom 开始时间
+     * @param dateTo   结束时间
+     * @return 间隔时刻数
+     */
+    public static int getMomentsBetweenTwoDate(Long dateFrom, Long dateTo) {
+        return (int) ((dateTo - dateFrom) / (15 * 60 * 1000));
+    }
+
+
+    /**
+     * 获取现在时间
+     *
+     * @return 返回字符串格式 yyyy-MM-dd HH:mm:ss
+     */
+    public static String getStringDate() {
+        Date currentTime = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String dateString = formatter.format(currentTime);
+        return dateString;
+    }
+
+    /**
+     * 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
+     *
+     * @param dateDate
+     * @return
+     */
+    public static String dateToStrLong(java.util.Date dateDate) {
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String dateString = formatter.format(dateDate);
+        return dateString;
+    }
+
+    /**
+     * 将时间格式字符串转换为时间 HH:mm
+     *
+     * @param strDate
+     * @return
+     */
+    public static Date strToDateLongHM(String strDate) {
+        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
+        ParsePosition pos = new ParsePosition(0);
+        Date strtodate = formatter.parse(strDate, pos);
+        return strtodate;
+    }
+
+    /**
+     * 判断tunnel日落
+     *
+     * @param time
+     * @param dfLonIn
+     * @param dfLatIn
+     * @return boolean 返回true,说明时间在日升日落之间,返回false,说明时间在日升之前或者日落之后。
+     */
+    public static boolean checkInSunriseAndSunset(Long time, double dfLonIn, double dfLatIn) {
+        Date date = new Date(time);
+
+        String str1 = SunRiseSet.getSunrise(new BigDecimal(dfLonIn), new BigDecimal(dfLatIn), date);
+        String str2 = SunRiseSet.getSunset(new BigDecimal(dfLonIn), new BigDecimal(dfLatIn), date);
+
+        Date dt1 = null;
+        Date dt2 = null;
+        Date dt3 = null;
+        try {
+            dt1 = strToDateLongHM(dateToStrLong(date).substring(11, 16));
+            dt2 = strToDateLongHM(str1);
+            dt3 = strToDateLongHM(str2);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (dt1.getTime() > dt2.getTime() && dt1.getTime() < dt3.getTime()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+}

+ 41 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/JsonBeanUtil.java

@@ -0,0 +1,41 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONUtil;
+
+import java.util.List;
+
+/**
+ * Json和bean相互转换
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class JsonBeanUtil {
+
+    /**
+     * json转bean
+     *
+     * @param json json字符串
+     * @param t    泛型
+     * @param <T>  泛型Class对象
+     * @return 泛型集合
+     */
+    public static <T> List<T> jsonToBean(String json, Class<T> t) {
+        JSONArray array = JSONUtil.parseArray(json);
+        List<T> list = array.toList(t);
+        return list;
+    }
+
+    /**
+     * bean转json
+     *
+     * @param list bean集合
+     * @param <T>
+     * @return 返回string对象
+     */
+    public static <T> String beanToJson(List<T> list) {
+        JSONArray jsonArray = JSONUtil.parseArray(list);
+        return jsonArray.toString();
+    }
+}

+ 123 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/JwtUtil.java

@@ -0,0 +1,123 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTVerifier;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.auth0.jwt.exceptions.JWTCreationException;
+import com.auth0.jwt.exceptions.JWTDecodeException;
+import com.auth0.jwt.exceptions.JWTVerificationException;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import lombok.experimental.UtilityClass;
+
+/**
+ * JwtToken
+ *
+ * @author L.ym
+ * @version 3.0
+ **/
+@UtilityClass
+public class JwtUtil {
+
+    public static final String TOKEN_AUTHORIZATION_HEADER = "Authorization";
+    public static final String TOKEN_INNER_HEADER = "X-Token";
+    public static final String TOKEN_PREFIX = "Bearer ";
+
+    private final String SECRET = "!@#xwexe3@!#ds123";
+    private final String ISSUER = "jiayue";
+
+    private final String ROLE_CLAIMS = "role";
+
+    /**
+     * @Description: 单位秒,即过期时间是24个小时
+     */
+    private final long EXPIRATION = 24 * 60 * 60L;
+
+    /**
+     * @Description: 生成 token
+     * @param: [username]
+     * @return: java.lang.String
+     * @Author: Liyiming
+     * @Date: 2019/1/10
+     */
+    public String generateToken(String username) throws IllegalArgumentException, JWTCreationException {
+        Algorithm algorithm = Algorithm.HMAC256(SECRET);
+        String token = JWT.create().withJWTId(IdUtil.fastSimpleUUID())
+                .withSubject(username)
+                .withIssuer(ISSUER)
+                .withIssuedAt(DateUtil.date())
+                .withExpiresAt(DateUtil.date(System.currentTimeMillis() + EXPIRATION * 1000))
+                // 创建一个新的JWT,并使用给定的算法进行标记
+                .sign(algorithm);
+        return TOKEN_PREFIX + token;
+    }
+
+    /**
+     * @Description: 校验 token 是否正确
+     * @param: [token, username]
+     * @return: boolean
+     * @Author: Liyiming
+     * @Date: 2019/1/10
+     */
+    public boolean verify(String token, String username) throws JWTVerificationException {
+        token = tokenToJwt(token);
+        Algorithm algorithm = Algorithm.HMAC256(SECRET);
+        // 在token中附带了username信息
+        JWTVerifier verifier = JWT.require(algorithm).withSubject(username).withIssuer(ISSUER).build();
+        // 验证 token
+        verifier.verify(token);
+        return true;
+    }
+
+    /**
+     * @Description: 校验 token 是否过期
+     * @param: [token]
+     * @return: boolean
+     * @Author: Liyiming
+     * @Date: 2019/1/13
+     */
+    public boolean isTokenExpired(String token) throws JWTDecodeException {
+        token = tokenToJwt(token);
+        DecodedJWT jwt = JWT.decode(token);
+        return jwt.getExpiresAt().before(DateUtil.date());
+    }
+
+    /**
+     * @Description: 获得token中的信息,无需secret解密也能获得
+     * @param: [token]
+     * @return: java.lang.String
+     * @Author: Liyiming
+     * @Date: 2019/1/10
+     */
+    public String getUsername(String token) throws JWTDecodeException {
+        token = tokenToJwt(token);
+        DecodedJWT jwt = JWT.decode(token);
+        return jwt.getSubject();
+    }
+
+    /**
+     * @Description: 获取JWT ID
+     * @param: [token]
+     * @return: java.lang.String
+     * @Author: Liyiming
+     * @Date: 2019/1/10
+     */
+    public String getJwtId(String token) throws JWTDecodeException {
+        token = tokenToJwt(token);
+        DecodedJWT jwt = JWT.decode(token);
+        return jwt.getId();
+    }
+
+    /**
+     * @Description: 获取JWT
+     * @param: [token]
+     * @return: java.lang.String
+     * @Author: Liyiming
+     * @Date: 2019/1/14
+     */
+    public String tokenToJwt(String token) {
+        return StrUtil.removePrefix(token, TOKEN_PREFIX);
+    }
+}

+ 141 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/NumberUtils.java

@@ -0,0 +1,141 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.math.BigDecimal;
+
+/**
+ * 提供高精度的运算支持
+ *
+ * @author bizy
+ * @version 2.0
+ */
+@Slf4j
+public class NumberUtils {
+    private NumberUtils() {
+    }
+
+    /**
+     * 精确的加法运算.
+     *
+     * @param b1    加数
+     * @param b2    加数
+     * @param scale 运算结果小数后精确的位数
+     * @return 结果
+     */
+    public static BigDecimal add(BigDecimal b1, BigDecimal b2, int scale) {
+        return b1.add(b2).setScale(scale, BigDecimal.ROUND_HALF_UP);
+    }
+
+    /**
+     * 精确的加法运算.
+     *
+     * @param b1 加数
+     * @param b2 加数
+     * @return 保留2位小数
+     */
+    public static BigDecimal add(BigDecimal b1, BigDecimal b2) {
+        return b1.add(b2).setScale(2, BigDecimal.ROUND_HALF_UP);
+    }
+
+    /**
+     * 精确的减法运算.
+     *
+     * @param b1    被减数
+     * @param b2    减数
+     * @param scale 运算结果小数后精确的位数
+     * @return 结果
+     */
+    public static BigDecimal subtract(BigDecimal b1, BigDecimal b2, int scale) {
+        return b1.subtract(b2).setScale(scale, BigDecimal.ROUND_HALF_UP);
+    }
+
+
+    /**
+     * 精确的减法运算.
+     *
+     * @param b1 被减数
+     * @param b2 减数
+     * @return 结果 保留2位小数
+     */
+    public static BigDecimal subtract(BigDecimal b1, BigDecimal b2) {
+        return b1.subtract(b2).setScale(2, BigDecimal.ROUND_HALF_UP);
+    }
+
+    /**
+     * 提供精确的乘法运算,并对运算结果截位.
+     *
+     * @param b1    乘数
+     * @param b2    乘数
+     * @param scale 运算结果小数后精确的位数
+     * @return 结果
+     */
+    public static BigDecimal multiply(BigDecimal b1, BigDecimal b2, int scale) {
+        if (scale < 0) {
+            throw new IllegalArgumentException("The scale must be a positive integer or zero");
+        }
+        return b1.multiply(b2).setScale(scale, BigDecimal.ROUND_HALF_UP);
+    }
+
+    /**
+     * 提供精确的乘法运算,并对运算结果截位.
+     *
+     * @param b1 乘数
+     * @param b2 乘数
+     * @return 结果 保留2位小数
+     */
+    public static BigDecimal multiply(BigDecimal b1, BigDecimal b2) {
+        return b1.multiply(b2).setScale(2, BigDecimal.ROUND_HALF_UP);
+    }
+
+
+    /**
+     * 提供(相对)精确的除法运算. 由scale参数指定精度,以后的数字四舍五入.
+     *
+     * @param b1    被除数
+     * @param b2    除数
+     * @param scale 表示表示需要精确到小数点以后几位
+     * @return 结果
+     */
+    public static BigDecimal divide(BigDecimal b1, BigDecimal b2, int scale) {
+        if (scale < 0) {
+            throw new IllegalArgumentException("The scale must be a positive integer or zero");
+        }
+        return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP);
+    }
+
+    /**
+     * 提供(相对)精确的除法运算. 由scale参数指定精度,以后的数字四舍五入.
+     *
+     * @param b1 被除数
+     * @param b2 除数
+     * @return 结果 保留2位小数
+     */
+    public static BigDecimal divide(BigDecimal b1, BigDecimal b2) {
+        return b1.divide(b2, 2, BigDecimal.ROUND_HALF_UP);
+    }
+
+    /**
+     * 提供精确的小数位四舍五入处理.
+     *
+     * @param b     需要四舍五入的数字
+     * @param scale 小数点后保留几位
+     * @return TODO
+     */
+    public static BigDecimal round(BigDecimal b, int scale) {
+        if (scale < 0) {
+            throw new IllegalArgumentException("The scale must be a positive integer or zero");
+        }
+        return b.setScale(scale, BigDecimal.ROUND_HALF_UP);
+    }
+
+    /**
+     * 提供精确的小数位四舍五入处理.
+     *
+     * @param b 需要四舍五入的数字
+     * @return 保留2位小数
+     */
+    public static BigDecimal round(BigDecimal b) {
+        return b.setScale(2, BigDecimal.ROUND_HALF_UP);
+    }
+}

+ 186 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/ProduceSql.java

@@ -0,0 +1,186 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
+
+import java.lang.reflect.Field;
+
+/**
+ * TODO
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class ProduceSql {
+    /**
+     * 生成插入语句
+     *
+     * @param tablename 表明
+     * @param t         有数据的实体
+     * @param <T>       数据实体类型 如 User
+     */
+    public static <T> String getInsertSql(String tablename, T t) throws IllegalArgumentException {
+        //insert into table_name (column_name1,column_name2, ...) values (value1,value2, ...)
+        boolean flag = false;
+        String sql = "";
+        Field[] fields = ReflectUtil.getFieldsDirectly(t.getClass(), false);
+        StringBuffer topHalf = new StringBuffer("insert into " + tablename + " (");
+        StringBuffer afterAalf = new StringBuffer("values (");
+        for (Field field : fields) {
+//            if ("ID".equals(field.getName()) || "id".equals(field.getName())) {
+//                continue;   //id 自动生成无需手动插入
+//            }
+            String underScoreCaseColumn = field.getName();
+            for (int i = 0; i < field.getName().length(); i++) {
+                if (Character.isUpperCase(field.getName().charAt(i)))
+                // 将javabean中小驼峰命名变量的“大写字母”转换为“_小写字母”
+                {
+                    underScoreCaseColumn = field.getName().substring(0, i) + '_' + field.getName().substring(i, i + 1).toLowerCase() + field.getName().substring(i + 1, field.getName().length());
+                }
+            }
+            topHalf.append(underScoreCaseColumn + ",");
+            if (ReflectUtil.getFieldValue(t, underScoreCaseColumn) instanceof String) {
+                afterAalf.append("'" + ReflectUtil.getFieldValue(t, underScoreCaseColumn) + "',");
+                flag = true;
+            } else {
+                afterAalf.append(ReflectUtil.getFieldValue(t, underScoreCaseColumn) + ",");
+                flag = true;
+            }
+        }
+        if (!flag) {
+            throw new IllegalArgumentException(t.getClass() + "NullException.\nThere is no attribute that is not empty.You must provide an object with at least one attribute.");
+        }
+        topHalf = new StringBuffer(StrUtil.removeSuffix(topHalf.toString(), ","));
+        afterAalf = new StringBuffer(StrUtil.removeSuffix(afterAalf.toString(), ","));
+        topHalf.append(") ");
+        afterAalf.append(") ");
+        sql = topHalf.toString() + afterAalf.toString();
+        return sql;
+    }
+
+    /**
+     * 生成更新语句
+     * 必须含有id
+     * 数据实体中 null 与 空字段不参与更新
+     *
+     * @param tablename 数据库中的表明
+     * @param t         有数据的实体
+     * @param <T>       数据实体类型,如 User
+     */
+    public static <T> String getUpdateSql(String tablename, T t) throws IllegalArgumentException {
+        //UPDATE table_name SET column_name1 = value1, column_name2 = value2, ... where ID=xxx
+        //or
+        //UPDATE table_name SET column_name1 = value1, column_name2 = value2, ... where id=xxx
+        boolean flag = false;
+        String sql = "";
+        String id = ""; //保存id列名:ID or id
+        Field[] fields = ReflectUtil.getFieldsDirectly(t.getClass(), false);
+        sql = "update " + tablename + " set ";
+        for (Field field : fields) {
+            StringBuffer tmp = new StringBuffer();
+            if ("ID".equals(field.getName()) || "id".equals(field.getName())) {
+                id = field.getName();
+                continue;//更新的时候无需set id=xxx
+            }
+            if (ReflectUtil.getFieldValue(t, field.getName()) != null && (String) ReflectUtil.getFieldValue(t, field.getName()) != "") {
+
+                String underScoreCaseColumn = field.getName();
+                for (int i = 0; i < field.getName().length(); i++) {
+                    if (Character.isUpperCase(field.getName().charAt(i)))
+                    // 将javabean中小驼峰命名变量的“大写字母”转换为“_小写字母”
+                    {
+                        underScoreCaseColumn = field.getName().substring(0, i) + '_' + field.getName().substring(i, i + 1).toLowerCase() + field.getName().substring(i + 1, field.getName().length());
+                    }
+                }
+
+                tmp.append(underScoreCaseColumn + "=");
+                if (ReflectUtil.getFieldValue(t, underScoreCaseColumn) instanceof String) {
+                    tmp.append("'" + ReflectUtil.getFieldValue(t, underScoreCaseColumn) + "',");
+                    flag = true;
+                } else {
+                    tmp.append(ReflectUtil.getFieldValue(t, underScoreCaseColumn) + ",");
+                    flag = true;
+                }
+                sql += tmp;
+            }
+        }
+        if (!flag) {
+            throw new IllegalArgumentException(t.getClass() + "NullException.\nThere is no attribute that is not empty except for ID.You must provide an object with at least one attribute exclude ID.");
+        }
+        sql = StrUtil.removeSuffix(sql, ",") + " where " + id + "='" + ReflectUtil.getFieldValue(t, id) + "'";
+        return sql;
+    }
+
+    /**
+     * 生成删除语句
+     * 根据 user 中第一个不为空的字段删除,应该尽量使用 id,提供至少一个非空属性
+     *
+     * @param tablename 表明
+     * @param t         有数据的实体
+     * @param <T>       数据实体类型 如 User
+     */
+    public static <T> String getDeleteSql(String tablename, T t) throws IllegalArgumentException {
+        //delete from table_name where column_name = value
+        return getSelectOrDeleteSql(tablename, t, "delete");
+    }
+
+    /**
+     * 生成查询语句
+     * 根据 user 中第一个不为空的字段查询
+     *
+     * @param tablename 表名
+     * @param t         有数据的实体
+     * @param <T>       数据实体类型 如 User
+     */
+    public static <T> String getSelectSql(String tablename, T t) throws IllegalArgumentException {
+        //delete from table_name where column_name = value
+        return getSelectOrDeleteSql(tablename, t, "select *");
+    }
+
+    /**
+     * 根据 operation 生成一个如:operation from table_name where column_name = value 的sql语句
+     *
+     * @param tablename
+     * @param t
+     * @param operation "select *"  or "delete"
+     * @param <T>
+     * @return
+     * @throws IllegalArgumentException
+     */
+    private static <T> String getSelectOrDeleteSql(String tablename, T t, String operation) throws IllegalArgumentException {
+        //operation from table_name where column_name = value
+        boolean flag = false;
+        String sql = "";
+        Field[] fields = ReflectUtil.getFieldsDirectly(t.getClass(), false);
+        StringBuffer topHalf = new StringBuffer(operation + " from " + tablename + " where ");
+        for (Field field : fields) {
+            String underScoreCaseColumn = field.getName();
+            for (int i = 0; i < field.getName().length(); i++) {
+                if (Character.isUpperCase(field.getName().charAt(i)))
+                // 将javabean中小驼峰命名变量的“大写字母”转换为“_小写字母”
+                {
+                    underScoreCaseColumn = field.getName().substring(0, i) + '_' + field.getName().substring(i, i + 1).toLowerCase() + field.getName().substring(i + 1, field.getName().length());
+                }
+            }
+            if ("ID".equals(underScoreCaseColumn) || "id".equals(underScoreCaseColumn)) {
+                if (ReflectUtil.getFieldValue(t, underScoreCaseColumn) != null && (int) ReflectUtil.getFieldValue(t, underScoreCaseColumn) != 0) {
+                    //id 不为空
+                    topHalf.append(underScoreCaseColumn + " = " + ReflectUtil.getFieldValue(t, underScoreCaseColumn));
+                    flag = true;
+                    break;
+                }
+            } else {
+                if (ReflectUtil.getFieldValue(t, underScoreCaseColumn) != null && (String) ReflectUtil.getFieldValue(t, underScoreCaseColumn) != "") {
+                    topHalf.append(underScoreCaseColumn + " = '" + ReflectUtil.getFieldValue(t, underScoreCaseColumn) + "'");
+                    flag = true;
+                    break;
+                }
+            }
+        }
+        if (!flag) {
+            throw new IllegalArgumentException(t.getClass() + "NullException.\nThere is no attribute that is not empty.You must provide an object with at least one attribute.");
+        }
+        sql = topHalf.toString();
+        return sql;
+    }
+}

+ 56 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/RSAEncrypt.java

@@ -0,0 +1,56 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.jasypt.encryption.StringEncryptor;
+
+import javax.crypto.Cipher;
+import java.security.KeyFactory;
+import java.security.PublicKey;
+import java.security.spec.X509EncodedKeySpec;
+
+/**
+ * 非对称加密
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/8 11:17
+ */
+@Slf4j
+public class RSAEncrypt implements StringEncryptor {
+
+
+    //非对称密钥算法
+    private static final String KEY_ALGORITHM = "RSA";
+
+    private static final String CHARSET_NAME = "UTF-8";
+
+    //公钥
+    private static final String PUBLIC_KEY = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJG5x3e0r4/cgU/8cy158AzhPf1huiMDqPnazaIzjMId3N43dST5ODOvxe5I63/s8E2cC83lucZm33Dw8K9syK8CAwEAAQ==";
+
+    @Override
+    public String encrypt(String message) {
+        return null;
+    }
+
+    @Override
+    public String decrypt(String encryptedMessage) {
+        String message = "";
+        try {
+            //实例化密钥工厂
+            KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+            //初始化公钥
+            //密钥材料转换
+            X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(PUBLIC_KEY));
+            //产生公钥
+            PublicKey pubKey = keyFactory.generatePublic(x509KeySpec);
+            //数据解密
+            Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+            cipher.init(Cipher.DECRYPT_MODE, pubKey);
+            message = new String(cipher.doFinal(Base64.decodeBase64(encryptedMessage)), CHARSET_NAME);
+        } catch (Exception e) {
+            log.error("解码失败:", e);
+        }
+        return message;
+    }
+}

+ 83 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/SpringContextHolder.java

@@ -0,0 +1,83 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author
+ * @date 2018/6/27
+ * Spring 工具类
+ */
+@Slf4j
+@Service
+@Lazy(false)
+public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
+
+    private static ApplicationContext applicationContext = null;
+
+    /**
+     * 取得存储在静态变量中的ApplicationContext.
+     */
+    public static ApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    /**
+     * 实现ApplicationContextAware接口, 注入Context到静态变量中.
+     */
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) {
+        SpringContextHolder.applicationContext = applicationContext;
+    }
+
+    /**
+     * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T getBean(String name) {
+        return (T) applicationContext.getBean(name);
+    }
+
+    /**
+     * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
+     */
+    public static <T> T getBean(Class<T> requiredType) {
+        return applicationContext.getBean(requiredType);
+    }
+
+    /**
+     * 清除SpringContextHolder中的ApplicationContext为Null.
+     */
+    public static void clearHolder() {
+        if (log.isDebugEnabled()) {
+            log.debug("清除SpringContextHolder中的ApplicationContext:" + applicationContext);
+        }
+        applicationContext = null;
+    }
+
+    /**
+     * 发布事件
+     *
+     * @param event
+     */
+    public static void publishEvent(ApplicationEvent event) {
+        if (applicationContext == null) {
+            return;
+        }
+        applicationContext.publishEvent(event);
+    }
+
+    /**
+     * 实现DisposableBean接口, 在Context关闭时清理静态变量.
+     */
+    @Override
+    public void destroy() {
+        SpringContextHolder.clearHolder();
+    }
+
+}

+ 40 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/StringUtil.java

@@ -0,0 +1,40 @@
+package com.jiayue.ipfcst.common.core.util;
+
+/**
+ * 字符串工具类
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/6/24 10:07
+ */
+public class StringUtil {
+
+    /**
+     * 首字母转小写
+     *
+     * @param s 字符串
+     * @return 首字母小写字符串
+     */
+    public static String toLowerCaseFirstOne(String s) {
+        if (Character.isLowerCase(s.charAt(0))) {
+            return s;
+        } else {
+            return (new StringBuilder()).append(Character.toLowerCase(s.charAt(0))).append(s.substring(1)).toString();
+        }
+    }
+
+
+    /**
+     * 首字母转大写
+     *
+     * @param s 字符串
+     * @return 首字母大写字符串
+     */
+    public static String toUpperCaseFirstOne(String s) {
+        if (Character.isUpperCase(s.charAt(0))) {
+            return s;
+        } else {
+            return (new StringBuilder()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString();
+        }
+    }
+}

+ 328 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/SunRiseSet.java

@@ -0,0 +1,328 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class SunRiseSet {
+
+    private static int[] days_of_month_1 = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+    private static int[] days_of_month_2 = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+    private final static double h = -0.833;//日出日落时太阳的位置
+
+    private final static double UTo = 180.0;//上次计算的日落日出时间,初始迭代值180.0
+
+    //输入日期
+
+//输入经纬度
+
+//判断是否为闰年:若为闰年,返回1;若不是闰年,返回0
+
+    public static boolean leap_year(int year) {
+
+        if (((year % 400 == 0) || (year % 100 != 0) && (year % 4 == 0))) return true;
+
+        else return false;
+
+    }
+
+//求从格林威治时间公元2000年1月1日到计算日天数days
+
+    public static int days(int year, int month, int date) {
+
+        int i, a = 0;
+
+        for (i = 2000; i < year; i++) {
+
+            if (leap_year(i)) a = a + 366;
+
+            else a = a + 365;
+
+        }
+
+        if (leap_year(year)) {
+
+            for (i = 0; i < month - 1; i++) {
+
+                a = a + days_of_month_2[i];
+
+            }
+
+        } else {
+
+            for (i = 0; i < month - 1; i++) {
+
+                a = a + days_of_month_1[i];
+
+            }
+
+        }
+
+        a = a + date;
+
+        return a;
+
+    }
+
+//求格林威治时间公元2000年1月1日到计算日的世纪数t
+
+    public static double t_century(int days, double UTo) {
+
+        return ((double) days + UTo / 360) / 36525;
+
+    }
+
+//求太阳的平黄径
+
+    public static double L_sun(double t_century) {
+
+        return (280.460 + 36000.770 * t_century);
+
+    }
+
+//求太阳的平近点角
+
+    public static double G_sun(double t_century) {
+
+        return (357.528 + 35999.050 * t_century);
+
+    }
+
+//求黄道经度
+
+    public static double ecliptic_longitude(double L_sun, double G_sun) {
+
+        return (L_sun + 1.915 * Math.sin(G_sun * Math.PI / 180) + 0.02 * Math.sin(2 * G_sun * Math.PI / 180));
+
+    }
+
+//求地球倾角
+
+    public static double earth_tilt(double t_century) {
+
+        return (23.4393 - 0.0130 * t_century);
+
+    }
+
+//求太阳偏差
+
+    public static double sun_deviation(double earth_tilt, double ecliptic_longitude) {
+
+        return (180 / Math.PI * Math.asin(Math.sin(Math.PI / 180 * earth_tilt) * Math.sin(Math.PI / 180 * ecliptic_longitude)));
+
+    }
+
+//求格林威治时间的太阳时间角GHA
+
+    public static double GHA(double UTo, double G_sun, double ecliptic_longitude) {
+
+        return (UTo - 180 - 1.915 * Math.sin(G_sun * Math.PI / 180) - 0.02 * Math.sin(2 * G_sun * Math.PI / 180) + 2.466 * Math.sin(2 * ecliptic_longitude * Math.PI / 180) - 0.053 * Math.sin(4 * ecliptic_longitude * Math.PI / 180));
+
+    }
+
+//求修正值e
+
+    public static double e(double h, double glat, double sun_deviation) {
+
+        return 180 / Math.PI * Math.acos((Math.sin(h * Math.PI / 180) - Math.sin(glat * Math.PI / 180) * Math.sin(sun_deviation * Math.PI / 180)) / (Math.cos(glat * Math.PI / 180) * Math.cos(sun_deviation * Math.PI / 180)));
+
+    }
+
+//求日出时间
+
+    public static double UT_rise(double UTo, double GHA, double glong, double e) {
+
+        return (UTo - (GHA + glong + e));
+
+    }
+
+//求日落时间
+
+    public static double UT_set(double UTo, double GHA, double glong, double e) {
+
+        return (UTo - (GHA + glong - e));
+
+    }
+
+//判断并返回结果(日出)
+
+    public static double result_rise(double UT, double UTo, double glong, double glat, int year, int month, int date) {
+
+        double d;
+
+        if (UT >= UTo) d = UT - UTo;
+
+        else d = UTo - UT;
+
+        if (d >= 0.1) {
+
+            UTo = UT;
+
+            UT = UT_rise(UTo,
+
+                    GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo)))),
+
+                    glong,
+
+                    e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo))))));
+
+            result_rise(UT, UTo, glong, glat, year, month, date);
+
+
+        }
+
+        return UT;
+
+    }
+
+//判断并返回结果(日落)
+
+    public static double result_set(double UT, double UTo, double glong, double glat, int year, int month, int date) {
+
+        double d;
+
+        if (UT >= UTo) d = UT - UTo;
+
+        else d = UTo - UT;
+
+        if (d >= 0.1) {
+
+            UTo = UT;
+
+            UT = UT_set(UTo,
+
+                    GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo)))),
+
+                    glong,
+
+                    e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo))))));
+
+            result_set(UT, UTo, glong, glat, year, month, date);
+
+        }
+
+        return UT;
+
+    }
+
+//求时区
+
+    public static int Zone(double glong) {
+
+        if (glong >= 0) return (int) ((int) (glong / 15.0) + 1);
+
+        else return (int) ((int) (glong / 15.0) - 1);
+
+    }
+
+    public static String getSunrise(BigDecimal longitude, BigDecimal latitude, Date sunTime) {
+        if (sunTime != null && longitude != null && latitude != null) {
+            double sunrise, glong, glat;
+            int year, month, date;
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            String dateTime = sdf.format(sunTime);
+            String[] rq = dateTime.split("-");
+            String y = rq[0];
+            String m = rq[1];
+            String d = rq[2];
+            year = Integer.parseInt(y);
+            if (m != null && m != "" && m.indexOf("0") == -1) {
+                m = m.replaceAll("0", "");
+            }
+            month = Integer.parseInt(m);
+
+            date = Integer.parseInt(d);
+
+            glong = longitude.doubleValue();
+
+            glat = latitude.doubleValue();
+
+            sunrise = result_rise(UT_rise(UTo,
+
+                    GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo)))),
+
+                    glong,
+
+                    e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo)))))), UTo, glong, glat, year, month, date);
+
+//System.out.println("Sunrise is: "+(int)(sunrise/15+Zone(glong))+":"+(int)(60*(sunrise/15+Zone(glong)-(int)(sunrise/15+Zone(glong))))+" .\n");
+
+//        Log.d("Sunrise", "Sunrise is: "+(int)(sunrise/15+8)+":"+(int)(60*(sunrise/15+8-(int)(sunrise/15+8)))+" .\n");
+
+            //return "Sunrise is: "+(int)(sunrise/15+Zone(glong))+":"+(int)(60*(sunrise/15+Zone(glong)-(int)(sunrise/15+Zone(glong))))+" .\n";
+
+            return (int) (sunrise / 15 + 8) + ":" + (int) (60 * (sunrise / 15 + 8 - (int) (sunrise / 15 + 8)));
+        }
+        return null;
+    }
+
+
+    public static String getSunset(BigDecimal longitude, BigDecimal latitude, Date sunTime) {
+        if (sunTime != null && latitude != null && longitude != null) {
+            double sunset, glong, glat;
+            int year, month, date;
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            String dateTime = sdf.format(sunTime);
+            String[] rq = dateTime.split("-");
+            String y = rq[0];
+            String m = rq[1];
+            String d = rq[2];
+            year = Integer.parseInt(y);
+            if (m != null && m != "" && m.indexOf("0") == -1) {
+                m = m.replaceAll("0", "");
+            }
+            month = Integer.parseInt(m);
+
+            date = Integer.parseInt(d);
+
+            glong = longitude.doubleValue();
+
+            glat = latitude.doubleValue();
+
+            sunset = result_set(UT_set(UTo,
+
+                    GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo)))),
+
+                    glong,
+
+                    e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+
+                            ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+                                    G_sun(t_century(days(year, month, date), UTo)))))), UTo, glong, glat, year, month, date);
+
+            return (int) (sunset / 15 + 8) + ":" + (int) (60 * (sunset / 15 + 8 - (int) (sunset / 15 + 8)));
+        }
+        return null;
+    }
+}

+ 177 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/util/WebUtil.java

@@ -0,0 +1,177 @@
+package com.jiayue.ipfcst.common.core.util;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
+import lombok.experimental.UtilityClass;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.MediaType;
+import org.springframework.util.Assert;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.method.HandlerMethod;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+
+/**
+ * Miscellaneous utilities for web applications.
+ *
+ * @author L.cm
+ */
+@Slf4j
+@UtilityClass
+public class WebUtil extends org.springframework.web.util.WebUtils {
+    private final String BASIC_ = "Basic ";
+    private final String UNKNOWN = "unknown";
+
+    /**
+     * 判断是否ajax请求
+     * spring ajax 返回含有 ResponseBody 或者 RestController注解
+     *
+     * @param handlerMethod HandlerMethod
+     * @return 是否ajax请求
+     */
+    public boolean isBody(HandlerMethod handlerMethod) {
+        ResponseBody responseBody = ClassUtil.getAnnotation(handlerMethod, ResponseBody.class);
+        return responseBody != null;
+    }
+
+    /**
+     * 读取cookie
+     *
+     * @param name cookie name
+     * @return cookie value
+     */
+    public String getCookieVal(String name) {
+        HttpServletRequest request = WebUtil.getRequest();
+        Assert.notNull(request, "request from RequestContextHolder is null");
+        return getCookieVal(request, name);
+    }
+
+    /**
+     * 读取cookie
+     *
+     * @param request HttpServletRequest
+     * @param name    cookie name
+     * @return cookie value
+     */
+    public String getCookieVal(HttpServletRequest request, String name) {
+        Cookie cookie = getCookie(request, name);
+        return cookie != null ? cookie.getValue() : null;
+    }
+
+    /**
+     * 清除 某个指定的cookie
+     *
+     * @param response HttpServletResponse
+     * @param key      cookie key
+     */
+    public void removeCookie(HttpServletResponse response, String key) {
+        setCookie(response, key, null, 0);
+    }
+
+    /**
+     * 设置cookie
+     *
+     * @param response        HttpServletResponse
+     * @param name            cookie name
+     * @param value           cookie value
+     * @param maxAgeInSeconds maxage
+     */
+    public void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
+        Cookie cookie = new Cookie(name, value);
+        cookie.setPath("/");
+        cookie.setMaxAge(maxAgeInSeconds);
+        cookie.setHttpOnly(true);
+        response.addCookie(cookie);
+    }
+
+    /**
+     * 获取 HttpServletRequest
+     *
+     * @return {HttpServletRequest}
+     */
+    public HttpServletRequest getRequest() {
+        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+    }
+
+    /**
+     * 获取 HttpServletResponse
+     *
+     * @return {HttpServletResponse}
+     */
+    public HttpServletResponse getResponse() {
+        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
+    }
+
+    /**
+     * 返回json
+     *
+     * @param response HttpServletResponse
+     * @param result   结果对象
+     */
+    public void renderJson(HttpServletResponse response, Object result) {
+        renderJson(response, result, MediaType.APPLICATION_JSON_VALUE);
+    }
+
+    /**
+     * 返回json
+     *
+     * @param response    HttpServletResponse
+     * @param result      结果对象
+     * @param contentType contentType
+     */
+    public void renderJson(HttpServletResponse response, Object result, String contentType) {
+        response.setCharacterEncoding("UTF-8");
+        response.setContentType(contentType);
+        try (PrintWriter out = response.getWriter()) {
+            out.append(JSONUtil.toJsonStr(result));
+        } catch (IOException e) {
+            log.error(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 获取ip
+     *
+     * @return {String}
+     */
+    public String getIP() {
+        return getIP(WebUtil.getRequest());
+    }
+
+    /**
+     * 获取ip
+     *
+     * @param request HttpServletRequest
+     * @return {String}
+     */
+    public String getIP(HttpServletRequest request) {
+        Assert.notNull(request, "HttpServletRequest is null");
+        String ip = request.getHeader("X-Requested-For");
+        if (StrUtil.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("X-Forwarded-For");
+        }
+        if (StrUtil.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+        if (StrUtil.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+        if (StrUtil.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_CLIENT_IP");
+        }
+        if (StrUtil.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+        }
+        if (StrUtil.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+        }
+        return StrUtil.isBlank(ip) ? null : ip.split(",")[0];
+    }
+}

+ 60 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/GlobalExceptionHandler.java

@@ -0,0 +1,60 @@
+package com.jiayue.ipfcst.common.core.web;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
+/**
+ * 全局异常处理
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/11/25 14:35
+ */
+@Slf4j
+@ControllerAdvice(
+        annotations = {RestController.class, Controller.class}
+)
+public class GlobalExceptionHandler {
+    private static final String ERROR_MSG_TPL = "ip: %s, path: %s, message: %s";
+
+    /**
+     * 处理业务异常
+     *
+     * @param request
+     * @param exception
+     * @return com.jiayue.ipfcst.common.core.web.vo.ResponseVO
+     * @author L.ym
+     * @date 2020/1/14
+     **/
+    @ResponseBody
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    @ExceptionHandler({BusinessException.class})
+    public ResponseVO handleExceptionInternal(HttpServletRequest request, BusinessException exception) {
+        log.error(String.format(ERROR_MSG_TPL, request.getRemoteAddr(), request.getRequestURI() + Optional.ofNullable(request.getQueryString()).orElse(""), exception.getMessage()), exception);
+        return ResponseVO.fail(exception);
+    }
+
+    /**
+     * 处理全局异常
+     *
+     * @param request
+     * @param throwable
+     * @return com.jiayue.ipfcst.common.core.web.vo.ResponseVO
+     * @author L.ym
+     * @date 2020/1/14
+     **/
+    @ResponseBody
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    @ExceptionHandler({Throwable.class})
+    public ResponseVO defaultErrorHandler(HttpServletRequest request, Throwable throwable) {
+        log.error(String.format(ERROR_MSG_TPL, request.getRemoteAddr(), request.getRequestURI() + Optional.ofNullable(request.getQueryString()).orElse(""), throwable.getMessage()), throwable);
+        return ResponseVO.error(throwable);
+    }
+}

+ 38 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/vo/RequestVO.java

@@ -0,0 +1,38 @@
+package com.jiayue.ipfcst.common.core.web.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * 数据格式请求统一
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/5/10 16:34
+ */
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class RequestVO<T> implements Serializable {
+
+    private static final long serialVersionUID = -437839076132402939L;
+
+    private Map<String,Object> parameters;
+    /**
+     * 页码
+     */
+    private Integer page;
+
+    /**
+     * 每页记录数
+     */
+    private Integer size;
+
+    /**
+     * 数据
+     */
+    private T data;
+
+}

+ 87 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/vo/ResponseVO.java

@@ -0,0 +1,87 @@
+package com.jiayue.ipfcst.common.core.web.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.jiayue.ipfcst.common.core.constant.enums.ResponseEnum;
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import lombok.*;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 数据格式返回统一
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/5/10 16:34
+ */
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ResponseVO<T> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 状态码
+     */
+    @Getter
+    @Setter
+    private Integer code;
+
+    /**
+     * 描述
+     */
+    @Getter
+    @Setter
+    private String message;
+
+    /**
+     * 数据
+     */
+    @Getter
+    @Setter
+    private T data;
+
+    public static <T> ResponseVO<T> success() {
+        return restResult(ResponseEnum.SUCCESS.getCode(), null, null);
+    }
+
+    public static <T> ResponseVO<T> success(T data) {
+        return restResult(ResponseEnum.SUCCESS.getCode(), data, ResponseEnum.SUCCESS.getMessage());
+    }
+
+    public static <T> ResponseVO<T> success(T data, String message) {
+        return restResult(ResponseEnum.SUCCESS.getCode(), data, message);
+    }
+
+    public static <T> ResponseVO<T> fail() {
+        return restResult(ResponseEnum.FAILED.getCode(), null, null);
+    }
+
+    public static <T> ResponseVO<T> fail(T data) {
+        return restResult(ResponseEnum.FAILED.getCode(), data, ResponseEnum.FAILED.getMessage());
+    }
+
+    public static <T> ResponseVO<T> fail(T data, String msg) {
+        return restResult(ResponseEnum.FAILED.getCode(), data, msg);
+    }
+
+    public static ResponseVO fail(BusinessException exception) {
+        return restResult(ResponseEnum.FAILED.getCode(), null, exception.getMessage());
+    }
+
+    public static ResponseVO error(Throwable exception) {
+        return restResult(ResponseEnum.ERROR.getCode(), null, exception.getMessage());
+    }
+
+    private static <T> ResponseVO<T> restResult(Integer code, T data, String message) {
+        ResponseVO<T> apiResult = new ResponseVO<>();
+        apiResult.setCode(code);
+        apiResult.setData(data);
+        apiResult.setMessage(message);
+        return apiResult;
+    }
+}

+ 122 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/xss/RequestWrapper.java

@@ -0,0 +1,122 @@
+package com.jiayue.ipfcst.common.core.web.xss;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StreamUtils;
+import org.springframework.web.util.HtmlUtils;
+
+import javax.servlet.ReadListener;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * 1. XSS过滤 2. body重复读
+ *
+ * @author L.ym
+ * @version 3.0
+ */
+@Slf4j
+public class RequestWrapper extends HttpServletRequestWrapper {
+    private final byte[] body;
+
+    RequestWrapper(HttpServletRequest request) {
+        super(request);
+        this.body = getByteBody(request);
+    }
+
+    @Override
+    public BufferedReader getReader() {
+        return ObjectUtils.isEmpty(body) ? null : new BufferedReader(new InputStreamReader(getInputStream()));
+    }
+
+    @Override
+    public ServletInputStream getInputStream() {
+        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body);
+        return new ServletInputStream() {
+            @Override
+            public boolean isFinished() {
+                return false;
+            }
+
+            @Override
+            public boolean isReady() {
+                return false;
+            }
+
+            @Override
+            public void setReadListener(ReadListener readListener) {
+
+            }
+
+            @Override
+            public int read() {
+                return byteArrayInputStream.read();
+            }
+        };
+    }
+
+    @Override
+    public String[] getParameterValues(String name) {
+        String[] values = super.getParameterValues(name);
+        if (values == null) {
+            return null;
+        }
+        int count = values.length;
+        String[] encodedValues = new String[count];
+        for (int i = 0; i < count; i++) {
+            encodedValues[i] = HtmlUtils.htmlEscape(values[i]);
+        }
+        return encodedValues;
+    }
+
+    @Override
+    public String getParameter(String name) {
+        String value = super.getParameter(name);
+        if (value == null) {
+            return null;
+        }
+        return HtmlUtils.htmlEscape(value);
+    }
+
+    @Override
+    public Object getAttribute(String name) {
+        Object value = super.getAttribute(name);
+        if (value instanceof String) {
+            HtmlUtils.htmlEscape((String) value);
+        }
+        return value;
+    }
+
+    @Override
+    public String getHeader(String name) {
+        String value = super.getHeader(name);
+        if (value == null) {
+            return null;
+        }
+        return HtmlUtils.htmlEscape(value);
+    }
+
+    @Override
+    public String getQueryString() {
+        String value = super.getQueryString();
+        if (value == null) {
+            return null;
+        }
+        return HtmlUtils.htmlEscape(value);
+    }
+
+    private static byte[] getByteBody(HttpServletRequest request) {
+        byte[] body = new byte[0];
+        try {
+            body = StreamUtils.copyToByteArray(request.getInputStream());
+        } catch (IOException e) {
+            log.error("解析流中数据异常", e);
+        }
+        return body;
+    }
+}

+ 25 - 0
ipfcst-common/ipfcst-common-core/src/main/java/com/jiayue/ipfcst/common/core/web/xss/RequestWrapperFilter.java

@@ -0,0 +1,25 @@
+package com.jiayue.ipfcst.common.core.web.xss;
+
+import org.springframework.lang.NonNull;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * request 处理过滤器
+ *
+ * @author L.ym
+ * @version 3.0
+ */
+public class RequestWrapperFilter extends OncePerRequestFilter {
+
+    @Override
+    protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response,
+                                    @NonNull FilterChain filterChain) throws ServletException, IOException {
+        filterChain.doFilter(new RequestWrapper(request), response);
+    }
+}

+ 1 - 0
ipfcst-common/ipfcst-common-core/src/main/resources/META-INF/build-info.properties

@@ -0,0 +1 @@
+build.version=test

+ 4 - 0
ipfcst-common/ipfcst-common-core/src/main/resources/META-INF/spring.factories

@@ -0,0 +1,4 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+  com.jiayue.ipfcst.common.core.config.EncryptionConfig,\
+  com.jiayue.ipfcst.common.core.config.RestTemplateConfig,\
+  com.jiayue.ipfcst.common.core.util.SpringContextHolder

+ 6 - 0
ipfcst-common/ipfcst-common-core/src/main/resources/banner.txt

@@ -0,0 +1,6 @@
+====================================
+************************************
+******沈阳嘉越电力科技有限公司******
+************************************
+    启动【智能功率预测系统V3.0】
+====================================

+ 83 - 0
ipfcst-common/ipfcst-common-data/README.md

@@ -0,0 +1,83 @@
+# druid datasource configuration demo
+#spring:
+#  datasource:
+#    type: com.alibaba.druid.pool.DruidDataSource
+#    druid:
+#      driver-class-name: com.mysql.cj.jdbc.Driver
+#      username: ${MYSQL-USER:用户名}
+#      password: ${MYSQL-PWD:密码}
+#      url: jdbc:mysql://${MYSQL-HOST:数据库地址}:${MYSQL-PORT:3306}/${MYSQL-DB:数据库名}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true
+#      # 初始连接数
+#      initialSize: 5
+#      # 最小连接池数量
+#      minIdle: 10
+#      # 最大连接池数量
+#      maxActive: 20
+#      # 配置获取连接等待超时的时间
+#      maxWait: 60000
+#      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+#      timeBetweenEvictionRunsMillis: 60000
+#      # 配置一个连接在池中最小生存的时间,单位是毫秒
+#      minEvictableIdleTimeMillis: 300000
+#      # 配置一个连接在池中最大生存的时间,单位是毫秒
+#      maxEvictableIdleTimeMillis: 900000
+#      # 配置检测连接是否有效
+#      validationQuery: SELECT 1 FROM DUAL
+#      testWhileIdle: true
+#      testOnBorrow: false
+#      testOnReturn: false
+#      webStatFilter:
+#        enabled: true
+#      statViewServlet:
+#        enabled: true
+#        # 设置白名单,不填则允许所有访问
+#        allow:
+#        url-pattern: /druid/*
+#        # 控制台管理用户名和密码
+#        login-username:
+#        login-password:
+#      filter:
+#        stat:
+#          enabled: true
+#          # 慢SQL记录
+#          log-slow-sql: true
+#          slow-sql-millis: 1000
+#          merge-sql: true
+#        wall:
+#          config:
+#            multi-statement-allow: true
+
+
+省份代号
+北京:E11
+天津:E12
+河北:E13
+山西:E14
+蒙东:E15
+蒙西:E16
+辽宁:E21
+吉林:E22
+黑龙江:E23
+上海:E31
+江苏:E32
+浙江:E33
+安徽:E34
+福建:E35
+江西:E36
+山东:E37
+河南:E41
+湖北:E42
+湖南:E43
+广东:E44
+广西:E45
+海南:E46
+重庆:E50
+四川:E51
+贵州:E52
+云南:E53
+西藏:E54
+陕西:E61
+甘肃:E62
+青海:E63
+宁夏:E64
+新疆:E65

+ 111 - 0
ipfcst-common/ipfcst-common-data/pom.xml

@@ -0,0 +1,111 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.jiayue.focus</groupId>
+        <artifactId>ipfcst-common</artifactId>
+        <version>3.0</version>
+    </parent>
+
+    <artifactId>ipfcst-common-data</artifactId>
+    <packaging>jar</packaging>
+
+    <description>ipfcst 数据相关</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.jiayue.focus</groupId>
+            <artifactId>ipfcst-common-core</artifactId>
+        </dependency>
+        <!--mysql 驱动-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <!-- druid 连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.20</version>
+        </dependency>
+        <!--JPA-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+            <version>5.2.3.Final</version>
+        </dependency>
+        <!--任务调度-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-quartz</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.quartz-scheduler</groupId>
+            <artifactId>quartz-jobs</artifactId>
+            <version>${quartz.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-core</artifactId>
+            <version>5.0.4.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- 缓存依赖-->
+        <dependency>
+            <groupId>net.sf.ehcache</groupId>
+            <artifactId>ehcache</artifactId>
+            <version>2.10.5</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <version>2.4</version>
+            <classifier>jdk15</classifier>
+        </dependency>
+
+        <!-- h2数据库-->
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <!-- 金昌数据库-->
+        <dependency>
+            <groupId>kingbasejdbc4</groupId>
+            <artifactId>kingbasejdbc4</artifactId>
+            <version>1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>openjpadictionary</groupId>
+            <artifactId>openjpadictionary</artifactId>
+            <version>1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hibernate.core</groupId>
+            <artifactId>hibernate</artifactId>
+            <version>5.4.6.Finaldialect</version>
+        </dependency>
+
+        <dependency>
+            <groupId>wei.yigulu</groupId>
+            <artifactId>protocol-all</artifactId>
+            <version>1.2.10</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 62 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/Quartz.java

@@ -0,0 +1,62 @@
+package com.jiayue.ipfcst.common.data.entity;
+
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+import org.springframework.core.annotation.Order;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * Quartz
+ *
+ * @author bizy
+ * @version 1.0
+ * @since 2018/12/7 16:22
+ */
+@Data
+@Entity
+public class Quartz {
+
+    @Id
+    @Order(1)
+    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
+    @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
+    private Integer id;
+    /*任务名称*/
+    @Column(length = 64)
+    private String jobName;
+    /*任务状态*/
+    @Column(length = 64)
+    private String jobState;
+    /*执行类*/
+    @Column(length = 128)
+    private String executeClass;
+    /*任务描述*/
+    @Column(length = 256)
+    private String description;
+    /*cron时间表达式或轮询时间*/
+    @Column(length = 64)
+    private String cronExpression;
+    /*类型*/
+    @Column
+    private String jobType;
+    /*开始时间*/
+    @Column
+    private Long startTime;
+
+    /**
+     * 场站标识
+     */
+    @Column
+    private String stationCode;
+
+    @Transient
+    private Date nextFireTime;//下次执行时间
+    @Transient
+    private Date prevFireTime;//上次执行时间
+    @Transient
+    private Date laetFireTime;//最后执行时间
+
+
+}

+ 26 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/id/CustomIDGenerator.java

@@ -0,0 +1,26 @@
+package com.jiayue.ipfcst.common.data.entity.id;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
+import org.hibernate.id.IdentityGenerator;
+
+import java.io.Serializable;
+
+/**
+ * int类型主键工具类,实体主键有值的时候,保存实体会保存主键的值
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class CustomIDGenerator extends IdentityGenerator {
+    @Override
+    public Serializable generate(SharedSessionContractImplementor s, Object obj) throws HibernateException {
+        Serializable id = s.getEntityPersister(null, obj).getClassMetadata().getIdentifier(obj, s);
+
+        if (id != null && Integer.valueOf(id.toString()) > 0) {
+            return id;
+        } else {
+            return super.generate(s, obj);
+        }
+    }
+}

+ 28 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/id/CustomUUIDGenerator.java

@@ -0,0 +1,28 @@
+package com.jiayue.ipfcst.common.data.entity.id;
+
+import com.jiayue.ipfcst.common.data.id.IdGenerator;
+import lombok.extern.slf4j.Slf4j;
+import org.hibernate.HibernateException;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
+
+import java.io.Serializable;
+
+/**
+ * uuid类型主键工具类,实体主键有值的时候,保存实体会保存主键的值
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Slf4j
+public class CustomUUIDGenerator extends IdGenerator {
+    @Override
+    public Serializable generate(SharedSessionContractImplementor s, Object obj) throws HibernateException {
+        Serializable id = s.getEntityPersister(null, obj).getClassMetadata().getIdentifier(obj, s);
+        if (id != null && !id.toString().isEmpty()) {
+        } else {
+            id=super.generate(s, obj);
+            log.debug("新生成的uuid="+id.toString());
+        }
+	    return id;
+    }
+}

+ 79 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzBlobTriggersEntity.java

@@ -0,0 +1,79 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_blob_triggers", catalog = "")
+@IdClass(QrtzBlobTriggersEntityPK.class)
+public class QrtzBlobTriggersEntity {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+    private byte[] blobData;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_NAME")
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_GROUP")
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Basic
+    @Column(name = "BLOB_DATA")
+    public byte[] getBlobData() {
+        return blobData;
+    }
+
+    public void setBlobData(byte[] blobData) {
+        this.blobData = blobData;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzBlobTriggersEntity that = (QrtzBlobTriggersEntity) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup) &&
+                Arrays.equals(blobData, that.blobData);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = Objects.hash(schedName, triggerName, triggerGroup);
+        result = 31 * result + Arrays.hashCode(blobData);
+        return result;
+    }
+}

+ 63 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzBlobTriggersEntityPK.java

@@ -0,0 +1,63 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzBlobTriggersEntityPK implements Serializable {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "TRIGGER_NAME")
+    @Id
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Column(name = "TRIGGER_GROUP")
+    @Id
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzBlobTriggersEntityPK that = (QrtzBlobTriggersEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup);
+    }
+}

+ 67 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCalendarsEntity.java

@@ -0,0 +1,67 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_calendars", catalog = "")
+@IdClass(QrtzCalendarsEntityPK.class)
+public class QrtzCalendarsEntity {
+    private String schedName;
+    private String calendarName;
+    private byte[] calendar;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "CALENDAR_NAME")
+    public String getCalendarName() {
+        return calendarName;
+    }
+
+    public void setCalendarName(String calendarName) {
+        this.calendarName = calendarName;
+    }
+
+    @Basic
+    @Column(name = "CALENDAR")
+    public byte[] getCalendar() {
+        return calendar;
+    }
+
+    public void setCalendar(byte[] calendar) {
+        this.calendar = calendar;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzCalendarsEntity that = (QrtzCalendarsEntity) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(calendarName, that.calendarName) &&
+                Arrays.equals(calendar, that.calendar);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = Objects.hash(schedName, calendarName);
+        result = 31 * result + Arrays.hashCode(calendar);
+        return result;
+    }
+}

+ 51 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCalendarsEntityPK.java

@@ -0,0 +1,51 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzCalendarsEntityPK implements Serializable {
+    private String schedName;
+    private String calendarName;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "CALENDAR_NAME")
+    @Id
+    public String getCalendarName() {
+        return calendarName;
+    }
+
+    public void setCalendarName(String calendarName) {
+        this.calendarName = calendarName;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzCalendarsEntityPK that = (QrtzCalendarsEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(calendarName, that.calendarName);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, calendarName);
+    }
+}

+ 88 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCronTriggersEntity.java

@@ -0,0 +1,88 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_cron_triggers", catalog = "")
+@IdClass(QrtzCronTriggersEntityPK.class)
+public class QrtzCronTriggersEntity {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+    private String cronExpression;
+    private String timeZoneId;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_NAME")
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_GROUP")
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Basic
+    @Column(name = "CRON_EXPRESSION")
+    public String getCronExpression() {
+        return cronExpression;
+    }
+
+    public void setCronExpression(String cronExpression) {
+        this.cronExpression = cronExpression;
+    }
+
+    @Basic
+    @Column(name = "TIME_ZONE_ID")
+    public String getTimeZoneId() {
+        return timeZoneId;
+    }
+
+    public void setTimeZoneId(String timeZoneId) {
+        this.timeZoneId = timeZoneId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzCronTriggersEntity that = (QrtzCronTriggersEntity) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup) &&
+                Objects.equals(cronExpression, that.cronExpression) &&
+                Objects.equals(timeZoneId, that.timeZoneId);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup, cronExpression, timeZoneId);
+    }
+}

+ 63 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzCronTriggersEntityPK.java

@@ -0,0 +1,63 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzCronTriggersEntityPK implements Serializable {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "TRIGGER_NAME")
+    @Id
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Column(name = "TRIGGER_GROUP")
+    @Id
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzCronTriggersEntityPK that = (QrtzCronTriggersEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup);
+    }
+}

+ 184 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzFiredTriggersEntity.java

@@ -0,0 +1,184 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_fired_triggers", catalog = "")
+@IdClass(QrtzFiredTriggersEntityPK.class)
+public class QrtzFiredTriggersEntity {
+    private String schedName;
+    private String entryId;
+    private String triggerName;
+    private String triggerGroup;
+    private String instanceName;
+    private long firedTime;
+    private long schedTime;
+    private int priority;
+    private String state;
+    private String jobName;
+    private String jobGroup;
+    private String isNonconcurrent;
+    private String requestsRecovery;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "ENTRY_ID")
+    public String getEntryId() {
+        return entryId;
+    }
+
+    public void setEntryId(String entryId) {
+        this.entryId = entryId;
+    }
+
+    @Basic
+    @Column(name = "TRIGGER_NAME")
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Basic
+    @Column(name = "TRIGGER_GROUP")
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Basic
+    @Column(name = "INSTANCE_NAME")
+    public String getInstanceName() {
+        return instanceName;
+    }
+
+    public void setInstanceName(String instanceName) {
+        this.instanceName = instanceName;
+    }
+
+    @Basic
+    @Column(name = "FIRED_TIME")
+    public long getFiredTime() {
+        return firedTime;
+    }
+
+    public void setFiredTime(long firedTime) {
+        this.firedTime = firedTime;
+    }
+
+    @Basic
+    @Column(name = "SCHED_TIME")
+    public long getSchedTime() {
+        return schedTime;
+    }
+
+    public void setSchedTime(long schedTime) {
+        this.schedTime = schedTime;
+    }
+
+    @Basic
+    @Column(name = "PRIORITY")
+    public int getPriority() {
+        return priority;
+    }
+
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+
+    @Basic
+    @Column(name = "STATE")
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    @Basic
+    @Column(name = "JOB_NAME")
+    public String getJobName() {
+        return jobName;
+    }
+
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    @Basic
+    @Column(name = "JOB_GROUP")
+    public String getJobGroup() {
+        return jobGroup;
+    }
+
+    public void setJobGroup(String jobGroup) {
+        this.jobGroup = jobGroup;
+    }
+
+    @Basic
+    @Column(name = "IS_NONCONCURRENT")
+    public String getIsNonconcurrent() {
+        return isNonconcurrent;
+    }
+
+    public void setIsNonconcurrent(String isNonconcurrent) {
+        this.isNonconcurrent = isNonconcurrent;
+    }
+
+    @Basic
+    @Column(name = "REQUESTS_RECOVERY")
+    public String getRequestsRecovery() {
+        return requestsRecovery;
+    }
+
+    public void setRequestsRecovery(String requestsRecovery) {
+        this.requestsRecovery = requestsRecovery;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzFiredTriggersEntity that = (QrtzFiredTriggersEntity) o;
+        return firedTime == that.firedTime &&
+                schedTime == that.schedTime &&
+                priority == that.priority &&
+                Objects.equals(schedName, that.schedName) &&
+                Objects.equals(entryId, that.entryId) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup) &&
+                Objects.equals(instanceName, that.instanceName) &&
+                Objects.equals(state, that.state) &&
+                Objects.equals(jobName, that.jobName) &&
+                Objects.equals(jobGroup, that.jobGroup) &&
+                Objects.equals(isNonconcurrent, that.isNonconcurrent) &&
+                Objects.equals(requestsRecovery, that.requestsRecovery);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, entryId, triggerName, triggerGroup, instanceName, firedTime, schedTime, priority, state, jobName, jobGroup, isNonconcurrent, requestsRecovery);
+    }
+}

+ 51 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzFiredTriggersEntityPK.java

@@ -0,0 +1,51 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzFiredTriggersEntityPK implements Serializable {
+    private String schedName;
+    private String entryId;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "ENTRY_ID")
+    @Id
+    public String getEntryId() {
+        return entryId;
+    }
+
+    public void setEntryId(String entryId) {
+        this.entryId = entryId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzFiredTriggersEntityPK that = (QrtzFiredTriggersEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(entryId, that.entryId);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, entryId);
+    }
+}

+ 152 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzJobDetailsEntity.java

@@ -0,0 +1,152 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_job_details", catalog = "")
+@IdClass(QrtzJobDetailsEntityPK.class)
+public class QrtzJobDetailsEntity {
+    private String schedName;
+    private String jobName;
+    private String jobGroup;
+    private String description;
+    private String jobClassName;
+    private String isDurable;
+    private String isNonconcurrent;
+    private String isUpdateData;
+    private String requestsRecovery;
+    private byte[] jobData;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "JOB_NAME")
+    public String getJobName() {
+        return jobName;
+    }
+
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    @Id
+    @Column(name = "JOB_GROUP")
+    public String getJobGroup() {
+        return jobGroup;
+    }
+
+    public void setJobGroup(String jobGroup) {
+        this.jobGroup = jobGroup;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "JOB_CLASS_NAME")
+    public String getJobClassName() {
+        return jobClassName;
+    }
+
+    public void setJobClassName(String jobClassName) {
+        this.jobClassName = jobClassName;
+    }
+
+    @Basic
+    @Column(name = "IS_DURABLE")
+    public String getIsDurable() {
+        return isDurable;
+    }
+
+    public void setIsDurable(String isDurable) {
+        this.isDurable = isDurable;
+    }
+
+    @Basic
+    @Column(name = "IS_NONCONCURRENT")
+    public String getIsNonconcurrent() {
+        return isNonconcurrent;
+    }
+
+    public void setIsNonconcurrent(String isNonconcurrent) {
+        this.isNonconcurrent = isNonconcurrent;
+    }
+
+    @Basic
+    @Column(name = "IS_UPDATE_DATA")
+    public String getIsUpdateData() {
+        return isUpdateData;
+    }
+
+    public void setIsUpdateData(String isUpdateData) {
+        this.isUpdateData = isUpdateData;
+    }
+
+    @Basic
+    @Column(name = "REQUESTS_RECOVERY")
+    public String getRequestsRecovery() {
+        return requestsRecovery;
+    }
+
+    public void setRequestsRecovery(String requestsRecovery) {
+        this.requestsRecovery = requestsRecovery;
+    }
+
+
+    @Basic
+    @Column(name = "JOB_DATA", columnDefinition = "BLOB")
+    public byte[] getJobData() {
+        return jobData;
+    }
+
+    public void setJobData(byte[] jobData) {
+        this.jobData = jobData;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzJobDetailsEntity that = (QrtzJobDetailsEntity) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(jobName, that.jobName) &&
+                Objects.equals(jobGroup, that.jobGroup) &&
+                Objects.equals(description, that.description) &&
+                Objects.equals(jobClassName, that.jobClassName) &&
+                Objects.equals(isDurable, that.isDurable) &&
+                Objects.equals(isNonconcurrent, that.isNonconcurrent) &&
+                Objects.equals(isUpdateData, that.isUpdateData) &&
+                Objects.equals(requestsRecovery, that.requestsRecovery) &&
+                Arrays.equals(jobData, that.jobData);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = Objects.hash(schedName, jobName, jobGroup, description, jobClassName, isDurable, isNonconcurrent, isUpdateData, requestsRecovery);
+        result = 31 * result + Arrays.hashCode(jobData);
+        return result;
+    }
+}

+ 63 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzJobDetailsEntityPK.java

@@ -0,0 +1,63 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzJobDetailsEntityPK implements Serializable {
+    private String schedName;
+    private String jobName;
+    private String jobGroup;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "JOB_NAME")
+    @Id
+    public String getJobName() {
+        return jobName;
+    }
+
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    @Column(name = "JOB_GROUP")
+    @Id
+    public String getJobGroup() {
+        return jobGroup;
+    }
+
+    public void setJobGroup(String jobGroup) {
+        this.jobGroup = jobGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzJobDetailsEntityPK that = (QrtzJobDetailsEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(jobName, that.jobName) &&
+                Objects.equals(jobGroup, that.jobGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, jobName, jobGroup);
+    }
+}

+ 52 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzLocksEntity.java

@@ -0,0 +1,52 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_locks", catalog = "")
+@IdClass(QrtzLocksEntityPK.class)
+public class QrtzLocksEntity {
+    private String schedName;
+    private String lockName;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "LOCK_NAME")
+    public String getLockName() {
+        return lockName;
+    }
+
+    public void setLockName(String lockName) {
+        this.lockName = lockName;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzLocksEntity that = (QrtzLocksEntity) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(lockName, that.lockName);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, lockName);
+    }
+}

+ 51 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzLocksEntityPK.java

@@ -0,0 +1,51 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzLocksEntityPK implements Serializable {
+    private String schedName;
+    private String lockName;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "LOCK_NAME")
+    @Id
+    public String getLockName() {
+        return lockName;
+    }
+
+    public void setLockName(String lockName) {
+        this.lockName = lockName;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzLocksEntityPK that = (QrtzLocksEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(lockName, that.lockName);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, lockName);
+    }
+}

+ 52 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzPausedTriggerGrpsEntity.java

@@ -0,0 +1,52 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_paused_trigger_grps", catalog = "")
+@IdClass(QrtzPausedTriggerGrpsEntityPK.class)
+public class QrtzPausedTriggerGrpsEntity {
+    private String schedName;
+    private String triggerGroup;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_GROUP")
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzPausedTriggerGrpsEntity that = (QrtzPausedTriggerGrpsEntity) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerGroup);
+    }
+}

+ 51 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzPausedTriggerGrpsEntityPK.java

@@ -0,0 +1,51 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzPausedTriggerGrpsEntityPK implements Serializable {
+    private String schedName;
+    private String triggerGroup;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "TRIGGER_GROUP")
+    @Id
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzPausedTriggerGrpsEntityPK that = (QrtzPausedTriggerGrpsEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerGroup);
+    }
+}

+ 76 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSchedulerStateEntity.java

@@ -0,0 +1,76 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_scheduler_state", catalog = "")
+@IdClass(QrtzSchedulerStateEntityPK.class)
+public class QrtzSchedulerStateEntity {
+    private String schedName;
+    private String instanceName;
+    private long lastCheckinTime;
+    private long checkinInterval;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "INSTANCE_NAME")
+    public String getInstanceName() {
+        return instanceName;
+    }
+
+    public void setInstanceName(String instanceName) {
+        this.instanceName = instanceName;
+    }
+
+    @Basic
+    @Column(name = "LAST_CHECKIN_TIME")
+    public long getLastCheckinTime() {
+        return lastCheckinTime;
+    }
+
+    public void setLastCheckinTime(long lastCheckinTime) {
+        this.lastCheckinTime = lastCheckinTime;
+    }
+
+    @Basic
+    @Column(name = "CHECKIN_INTERVAL")
+    public long getCheckinInterval() {
+        return checkinInterval;
+    }
+
+    public void setCheckinInterval(long checkinInterval) {
+        this.checkinInterval = checkinInterval;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzSchedulerStateEntity that = (QrtzSchedulerStateEntity) o;
+        return lastCheckinTime == that.lastCheckinTime &&
+                checkinInterval == that.checkinInterval &&
+                Objects.equals(schedName, that.schedName) &&
+                Objects.equals(instanceName, that.instanceName);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, instanceName, lastCheckinTime, checkinInterval);
+    }
+}

+ 51 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSchedulerStateEntityPK.java

@@ -0,0 +1,51 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzSchedulerStateEntityPK implements Serializable {
+    private String schedName;
+    private String instanceName;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "INSTANCE_NAME")
+    @Id
+    public String getInstanceName() {
+        return instanceName;
+    }
+
+    public void setInstanceName(String instanceName) {
+        this.instanceName = instanceName;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzSchedulerStateEntityPK that = (QrtzSchedulerStateEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(instanceName, that.instanceName);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, instanceName);
+    }
+}

+ 100 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpleTriggersEntity.java

@@ -0,0 +1,100 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_simple_triggers", catalog = "")
+@IdClass(QrtzSimpleTriggersEntityPK.class)
+public class QrtzSimpleTriggersEntity {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+    private long repeatCount;
+    private long repeatInterval;
+    private long timesTriggered;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_NAME")
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_GROUP")
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Basic
+    @Column(name = "REPEAT_COUNT")
+    public long getRepeatCount() {
+        return repeatCount;
+    }
+
+    public void setRepeatCount(long repeatCount) {
+        this.repeatCount = repeatCount;
+    }
+
+    @Basic
+    @Column(name = "REPEAT_INTERVAL")
+    public long getRepeatInterval() {
+        return repeatInterval;
+    }
+
+    public void setRepeatInterval(long repeatInterval) {
+        this.repeatInterval = repeatInterval;
+    }
+
+    @Basic
+    @Column(name = "TIMES_TRIGGERED")
+    public long getTimesTriggered() {
+        return timesTriggered;
+    }
+
+    public void setTimesTriggered(long timesTriggered) {
+        this.timesTriggered = timesTriggered;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzSimpleTriggersEntity that = (QrtzSimpleTriggersEntity) o;
+        return repeatCount == that.repeatCount &&
+                repeatInterval == that.repeatInterval &&
+                timesTriggered == that.timesTriggered &&
+                Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup, repeatCount, repeatInterval, timesTriggered);
+    }
+}

+ 63 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpleTriggersEntityPK.java

@@ -0,0 +1,63 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzSimpleTriggersEntityPK implements Serializable {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "TRIGGER_NAME")
+    @Id
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Column(name = "TRIGGER_GROUP")
+    @Id
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzSimpleTriggersEntityPK that = (QrtzSimpleTriggersEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup);
+    }
+}

+ 197 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpropTriggersEntity.java

@@ -0,0 +1,197 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.math.BigDecimal;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_simprop_triggers", catalog = "")
+@IdClass(QrtzSimpropTriggersEntityPK.class)
+public class QrtzSimpropTriggersEntity {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+    private String strProp1;
+    private String strProp2;
+    private String strProp3;
+    private Integer intProp1;
+    private Integer intProp2;
+    private Long longProp1;
+    private Long longProp2;
+    private BigDecimal decProp1;
+    private BigDecimal decProp2;
+    private String boolProp1;
+    private String boolProp2;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_NAME")
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_GROUP")
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Basic
+    @Column(name = "STR_PROP_1")
+    public String getStrProp1() {
+        return strProp1;
+    }
+
+    public void setStrProp1(String strProp1) {
+        this.strProp1 = strProp1;
+    }
+
+    @Basic
+    @Column(name = "STR_PROP_2")
+    public String getStrProp2() {
+        return strProp2;
+    }
+
+    public void setStrProp2(String strProp2) {
+        this.strProp2 = strProp2;
+    }
+
+    @Basic
+    @Column(name = "STR_PROP_3")
+    public String getStrProp3() {
+        return strProp3;
+    }
+
+    public void setStrProp3(String strProp3) {
+        this.strProp3 = strProp3;
+    }
+
+    @Basic
+    @Column(name = "INT_PROP_1")
+    public Integer getIntProp1() {
+        return intProp1;
+    }
+
+    public void setIntProp1(Integer intProp1) {
+        this.intProp1 = intProp1;
+    }
+
+    @Basic
+    @Column(name = "INT_PROP_2")
+    public Integer getIntProp2() {
+        return intProp2;
+    }
+
+    public void setIntProp2(Integer intProp2) {
+        this.intProp2 = intProp2;
+    }
+
+    @Basic
+    @Column(name = "LONG_PROP_1")
+    public Long getLongProp1() {
+        return longProp1;
+    }
+
+    public void setLongProp1(Long longProp1) {
+        this.longProp1 = longProp1;
+    }
+
+    @Basic
+    @Column(name = "LONG_PROP_2")
+    public Long getLongProp2() {
+        return longProp2;
+    }
+
+    public void setLongProp2(Long longProp2) {
+        this.longProp2 = longProp2;
+    }
+
+    @Basic
+    @Column(name = "DEC_PROP_1")
+    public BigDecimal getDecProp1() {
+        return decProp1;
+    }
+
+    public void setDecProp1(BigDecimal decProp1) {
+        this.decProp1 = decProp1;
+    }
+
+    @Basic
+    @Column(name = "DEC_PROP_2")
+    public BigDecimal getDecProp2() {
+        return decProp2;
+    }
+
+    public void setDecProp2(BigDecimal decProp2) {
+        this.decProp2 = decProp2;
+    }
+
+    @Basic
+    @Column(name = "BOOL_PROP_1")
+    public String getBoolProp1() {
+        return boolProp1;
+    }
+
+    public void setBoolProp1(String boolProp1) {
+        this.boolProp1 = boolProp1;
+    }
+
+    @Basic
+    @Column(name = "BOOL_PROP_2")
+    public String getBoolProp2() {
+        return boolProp2;
+    }
+
+    public void setBoolProp2(String boolProp2) {
+        this.boolProp2 = boolProp2;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzSimpropTriggersEntity that = (QrtzSimpropTriggersEntity) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup) &&
+                Objects.equals(strProp1, that.strProp1) &&
+                Objects.equals(strProp2, that.strProp2) &&
+                Objects.equals(strProp3, that.strProp3) &&
+                Objects.equals(intProp1, that.intProp1) &&
+                Objects.equals(intProp2, that.intProp2) &&
+                Objects.equals(longProp1, that.longProp1) &&
+                Objects.equals(longProp2, that.longProp2) &&
+                Objects.equals(decProp1, that.decProp1) &&
+                Objects.equals(decProp2, that.decProp2) &&
+                Objects.equals(boolProp1, that.boolProp1) &&
+                Objects.equals(boolProp2, that.boolProp2);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup, strProp1, strProp2, strProp3, intProp1, intProp2, longProp1, longProp2, decProp1, decProp2, boolProp1, boolProp2);
+    }
+}

+ 63 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzSimpropTriggersEntityPK.java

@@ -0,0 +1,63 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzSimpropTriggersEntityPK implements Serializable {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "TRIGGER_NAME")
+    @Id
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Column(name = "TRIGGER_GROUP")
+    @Id
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzSimpropTriggersEntityPK that = (QrtzSimpropTriggersEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup);
+    }
+}

+ 223 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzTriggersEntity.java

@@ -0,0 +1,223 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.*;
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Entity
+@Table(name = "qrtz_triggers", catalog = "")
+@IdClass(QrtzTriggersEntityPK.class)
+public class QrtzTriggersEntity {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+    private String jobName;
+    private String jobGroup;
+    private String description;
+    private Long nextFireTime;
+    private Long prevFireTime;
+    private Integer priority;
+    private String triggerState;
+    private String triggerType;
+    private long startTime;
+    private Long endTime;
+    private String calendarName;
+    private Short misfireInstr;
+    private byte[] jobData;
+
+    @Id
+    @Column(name = "SCHED_NAME")
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_NAME")
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Id
+    @Column(name = "TRIGGER_GROUP")
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Basic
+    @Column(name = "JOB_NAME")
+    public String getJobName() {
+        return jobName;
+    }
+
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    @Basic
+    @Column(name = "JOB_GROUP")
+    public String getJobGroup() {
+        return jobGroup;
+    }
+
+    public void setJobGroup(String jobGroup) {
+        this.jobGroup = jobGroup;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "NEXT_FIRE_TIME")
+    public Long getNextFireTime() {
+        return nextFireTime;
+    }
+
+    public void setNextFireTime(Long nextFireTime) {
+        this.nextFireTime = nextFireTime;
+    }
+
+    @Basic
+    @Column(name = "PREV_FIRE_TIME")
+    public Long getPrevFireTime() {
+        return prevFireTime;
+    }
+
+    public void setPrevFireTime(Long prevFireTime) {
+        this.prevFireTime = prevFireTime;
+    }
+
+    @Basic
+    @Column(name = "PRIORITY")
+    public Integer getPriority() {
+        return priority;
+    }
+
+    public void setPriority(Integer priority) {
+        this.priority = priority;
+    }
+
+    @Basic
+    @Column(name = "TRIGGER_STATE")
+    public String getTriggerState() {
+        return triggerState;
+    }
+
+    public void setTriggerState(String triggerState) {
+        this.triggerState = triggerState;
+    }
+
+    @Basic
+    @Column(name = "TRIGGER_TYPE")
+    public String getTriggerType() {
+        return triggerType;
+    }
+
+    public void setTriggerType(String triggerType) {
+        this.triggerType = triggerType;
+    }
+
+    @Basic
+    @Column(name = "START_TIME")
+    public long getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(long startTime) {
+        this.startTime = startTime;
+    }
+
+    @Basic
+    @Column(name = "END_TIME")
+    public Long getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Long endTime) {
+        this.endTime = endTime;
+    }
+
+    @Basic
+    @Column(name = "CALENDAR_NAME")
+    public String getCalendarName() {
+        return calendarName;
+    }
+
+    public void setCalendarName(String calendarName) {
+        this.calendarName = calendarName;
+    }
+
+    @Basic
+    @Column(name = "MISFIRE_INSTR")
+    public Short getMisfireInstr() {
+        return misfireInstr;
+    }
+
+    public void setMisfireInstr(Short misfireInstr) {
+        this.misfireInstr = misfireInstr;
+    }
+
+    @Basic
+    @Column(name = "JOB_DATA", columnDefinition = "BLOB")
+    public byte[] getJobData() {
+        return jobData;
+    }
+
+    public void setJobData(byte[] jobData) {
+        this.jobData = jobData;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzTriggersEntity that = (QrtzTriggersEntity) o;
+        return startTime == that.startTime &&
+                Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup) &&
+                Objects.equals(jobName, that.jobName) &&
+                Objects.equals(jobGroup, that.jobGroup) &&
+                Objects.equals(description, that.description) &&
+                Objects.equals(nextFireTime, that.nextFireTime) &&
+                Objects.equals(prevFireTime, that.prevFireTime) &&
+                Objects.equals(priority, that.priority) &&
+                Objects.equals(triggerState, that.triggerState) &&
+                Objects.equals(triggerType, that.triggerType) &&
+                Objects.equals(endTime, that.endTime) &&
+                Objects.equals(calendarName, that.calendarName) &&
+                Objects.equals(misfireInstr, that.misfireInstr) &&
+                Arrays.equals(jobData, that.jobData);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = Objects.hash(schedName, triggerName, triggerGroup, jobName, jobGroup, description, nextFireTime, prevFireTime, priority, triggerState, triggerType, startTime, endTime, calendarName, misfireInstr);
+        result = 31 * result + Arrays.hashCode(jobData);
+        return result;
+    }
+}

+ 63 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/qrtz/QrtzTriggersEntityPK.java

@@ -0,0 +1,63 @@
+package com.jiayue.ipfcst.common.data.entity.qrtz;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * 定时任务实体
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public class QrtzTriggersEntityPK implements Serializable {
+    private String schedName;
+    private String triggerName;
+    private String triggerGroup;
+
+    @Column(name = "SCHED_NAME")
+    @Id
+    public String getSchedName() {
+        return schedName;
+    }
+
+    public void setSchedName(String schedName) {
+        this.schedName = schedName;
+    }
+
+    @Column(name = "TRIGGER_NAME")
+    @Id
+    public String getTriggerName() {
+        return triggerName;
+    }
+
+    public void setTriggerName(String triggerName) {
+        this.triggerName = triggerName;
+    }
+
+    @Column(name = "TRIGGER_GROUP")
+    @Id
+    public String getTriggerGroup() {
+        return triggerGroup;
+    }
+
+    public void setTriggerGroup(String triggerGroup) {
+        this.triggerGroup = triggerGroup;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        QrtzTriggersEntityPK that = (QrtzTriggersEntityPK) o;
+        return Objects.equals(schedName, that.schedName) &&
+                Objects.equals(triggerName, that.triggerName) &&
+                Objects.equals(triggerGroup, that.triggerGroup);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(schedName, triggerName, triggerGroup);
+    }
+}

+ 35 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/id/IdGenerator.java

@@ -0,0 +1,35 @@
+package com.jiayue.ipfcst.common.data.id;
+
+import cn.hutool.core.util.IdUtil;
+import org.hibernate.HibernateException;
+import org.hibernate.MappingException;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
+import org.hibernate.id.Configurable;
+import org.hibernate.id.IdentifierGenerator;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.type.Type;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+
+/**
+ * 主键生成策略
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2018/10/11 11:16
+ */
+@SuppressWarnings("unused")
+public class IdGenerator implements IdentifierGenerator, Configurable {
+
+    @Override
+    public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException {
+
+    }
+
+    @Override
+    public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException {
+        return IdUtil.fastSimpleUUID();
+    }
+}

+ 17 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/BaseRepository.java

@@ -0,0 +1,17 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.NoRepositoryBean;
+
+/**
+ * 基础信息仓储,减少仓储繁琐代码
+ *
+ * @author bizy
+ * @version 1.0
+ * @since 2020.04.23 11:13
+ */
+@NoRepositoryBean
+public interface BaseRepository<T, I> extends JpaRepository<T, I>, JpaSpecificationExecutor<T> {
+
+}

+ 17 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/QuartzRepository.java

@@ -0,0 +1,17 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+import com.jiayue.ipfcst.common.data.entity.Quartz;
+
+/**
+ * 定时任务实体仓储
+ *
+ * @author bizy
+ * @version 1.0
+ * @since 2018/12/10 11:24
+ */
+public interface QuartzRepository extends BaseRepository<Quartz, Integer> {
+
+	Quartz findByJobName(String jobName);
+
+	Quartz findByExecuteClass(String executeClass);
+}

+ 98 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/strategy/IpfcstNamingStrategy.java

@@ -0,0 +1,98 @@
+package com.jiayue.ipfcst.common.data.strategy;
+
+import org.hibernate.boot.model.naming.Identifier;
+import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
+import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
+
+/**
+ * 命名策略
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/5/10 14:08
+ */
+public class IpfcstNamingStrategy extends SpringPhysicalNamingStrategy {
+    private static final String PREFIX = "T_";
+    private String tableName = "";
+
+    @Override
+    public Identifier toPhysicalCatalogName(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
+        String name;
+        Identifier physicalCatalogName = super.toPhysicalCatalogName(identifier, jdbcEnvironment);
+        if (physicalCatalogName != null) {
+            name = PREFIX + physicalCatalogName.getText().toUpperCase();
+            //判断是否为定时任务实体
+            if (physicalCatalogName.getText().toUpperCase().startsWith("QRTZ_")) {
+                name = physicalCatalogName.getText().toUpperCase();
+            }
+            return new Identifier(name, identifier.isQuoted());
+        } else {
+            return identifier;
+        }
+    }
+
+    @Override
+    public Identifier toPhysicalSchemaName(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
+        String name;
+        Identifier physicalSchemaName = super.toPhysicalSchemaName(identifier, jdbcEnvironment);
+        if (physicalSchemaName != null) {
+            name = PREFIX + physicalSchemaName.getText().toUpperCase();
+            //判断是否为定时任务实体
+            if (physicalSchemaName.getText().toUpperCase().startsWith("QRTZ_")) {
+                name = physicalSchemaName.getText().toUpperCase();
+            }
+            return new Identifier(name, identifier.isQuoted());
+        } else {
+            return identifier;
+        }
+    }
+
+    @Override
+    public Identifier toPhysicalTableName(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
+        String name;
+        Identifier physicalTableName = super.toPhysicalTableName(identifier, jdbcEnvironment);
+        if (physicalTableName != null) {
+            tableName = physicalTableName.getText().toUpperCase();
+            name = PREFIX + physicalTableName.getText().toUpperCase();
+            //判断是否为定时任务实体
+            if (physicalTableName.getText().toUpperCase().startsWith("QRTZ_")) {
+                name = physicalTableName.getText().toUpperCase();
+            }
+            return new Identifier(name, identifier.isQuoted());
+        } else {
+            return identifier;
+        }
+    }
+
+    @Override
+    public Identifier toPhysicalSequenceName(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
+        String name;
+        Identifier physicalSequenceName = super.toPhysicalSequenceName(identifier, jdbcEnvironment);
+        if (physicalSequenceName != null) {
+            name = PREFIX + physicalSequenceName.getText().toUpperCase();
+            //判断是否为定时任务实体
+            if (physicalSequenceName.getText().toUpperCase().startsWith("QRTZ_")) {
+                name = physicalSequenceName.getText().toUpperCase();
+            }
+            return new Identifier(name, identifier.isQuoted());
+        } else {
+            return identifier;
+        }
+    }
+
+    @Override
+    public Identifier toPhysicalColumnName(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
+        String name;
+        Identifier physicalColumnName = super.toPhysicalColumnName(identifier, jdbcEnvironment);
+        if (physicalColumnName != null) {
+            name = "C_" + physicalColumnName.getText().toUpperCase();
+            if (tableName.startsWith("QRTZ_")) {
+                name = physicalColumnName.getText().toUpperCase();
+            }
+
+            return new Identifier(name, identifier.isQuoted());
+        } else {
+            return identifier;
+        }
+    }
+}

+ 359 - 0
ipfcst-common/ipfcst-common-data/src/main/java/org/hibernate/cfg/InheritanceState.java

@@ -0,0 +1,359 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ */
+package org.hibernate.cfg;
+
+import org.hibernate.AnnotationException;
+import org.hibernate.annotations.common.reflection.XAnnotatedElement;
+import org.hibernate.annotations.common.reflection.XClass;
+import org.hibernate.annotations.common.reflection.XProperty;
+import org.hibernate.boot.spi.MetadataBuildingContext;
+import org.hibernate.cfg.annotations.EntityBinder;
+import org.hibernate.mapping.PersistentClass;
+import org.springframework.core.annotation.Order;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Some extra data to the inheritance position of a class.
+ *
+ * @author Emmanuel Bernard
+ */
+@SuppressWarnings("ALL")
+public class InheritanceState {
+    private XClass clazz;
+
+    /**
+     * Has sibling (either mappedsuperclass entity)
+     */
+    private boolean hasSiblings = false;
+
+    /**
+     * a mother entity is available
+     */
+    private boolean hasParents = false;
+    private InheritanceType type;
+    private boolean isEmbeddableSuperclass = false;
+    private Map<XClass, org.hibernate.cfg.InheritanceState> inheritanceStatePerClass;
+    private List<XClass> classesToProcessForMappedSuperclass = new ArrayList<XClass>();
+    private MetadataBuildingContext buildingContext;
+    private AccessType accessType;
+    private ElementsToProcess elementsToProcess;
+    private Boolean hasIdClassOrEmbeddedId;
+
+    public InheritanceState(
+            XClass clazz,
+            Map<XClass, org.hibernate.cfg.InheritanceState> inheritanceStatePerClass,
+            MetadataBuildingContext buildingContext) {
+        this.setClazz( clazz );
+        this.buildingContext = buildingContext;
+        this.inheritanceStatePerClass = inheritanceStatePerClass;
+        extractInheritanceType();
+    }
+
+    private void extractInheritanceType() {
+        XAnnotatedElement element = getClazz();
+        Inheritance inhAnn = element.getAnnotation( Inheritance.class );
+        MappedSuperclass mappedSuperClass = element.getAnnotation( MappedSuperclass.class );
+        if ( mappedSuperClass != null ) {
+            setEmbeddableSuperclass( true );
+            setType( inhAnn == null ? null : inhAnn.strategy() );
+        }
+        else {
+            setType( inhAnn == null ? InheritanceType.SINGLE_TABLE : inhAnn.strategy() );
+        }
+    }
+
+    boolean hasTable() {
+        return !hasParents() || !InheritanceType.SINGLE_TABLE.equals( getType() );
+    }
+
+    boolean hasDenormalizedTable() {
+        return hasParents() && InheritanceType.TABLE_PER_CLASS.equals( getType() );
+    }
+
+    public static org.hibernate.cfg.InheritanceState getInheritanceStateOfSuperEntity(
+            XClass clazz, Map<XClass, org.hibernate.cfg.InheritanceState> states
+    ) {
+        XClass superclass = clazz;
+        do {
+            superclass = superclass.getSuperclass();
+            org.hibernate.cfg.InheritanceState currentState = states.get( superclass );
+            if ( currentState != null && !currentState.isEmbeddableSuperclass() ) {
+                return currentState;
+            }
+        }
+        while ( superclass != null && !Object.class.getName().equals( superclass.getName() ) );
+        return null;
+    }
+
+    public static org.hibernate.cfg.InheritanceState getSuperclassInheritanceState(XClass clazz, Map<XClass, org.hibernate.cfg.InheritanceState> states) {
+        XClass superclass = clazz;
+        do {
+            superclass = superclass.getSuperclass();
+            org.hibernate.cfg.InheritanceState currentState = states.get( superclass );
+            if ( currentState != null ) {
+                return currentState;
+            }
+        }
+        while ( superclass != null && !Object.class.getName().equals( superclass.getName() ) );
+        return null;
+    }
+
+    public XClass getClazz() {
+        return clazz;
+    }
+
+    public void setClazz(XClass clazz) {
+        this.clazz = clazz;
+    }
+
+    public boolean hasSiblings() {
+        return hasSiblings;
+    }
+
+    public void setHasSiblings(boolean hasSiblings) {
+        this.hasSiblings = hasSiblings;
+    }
+
+    public boolean hasParents() {
+        return hasParents;
+    }
+
+    public void setHasParents(boolean hasParents) {
+        this.hasParents = hasParents;
+    }
+
+    public InheritanceType getType() {
+        return type;
+    }
+
+    public void setType(InheritanceType type) {
+        this.type = type;
+    }
+
+    public boolean isEmbeddableSuperclass() {
+        return isEmbeddableSuperclass;
+    }
+
+    public void setEmbeddableSuperclass(boolean embeddableSuperclass) {
+        isEmbeddableSuperclass = embeddableSuperclass;
+    }
+
+    void postProcess(PersistentClass persistenceClass, EntityBinder entityBinder) {
+        //make sure we run elements to process
+        getElementsToProcess();
+        addMappedSuperClassInMetadata( persistenceClass );
+        entityBinder.setPropertyAccessType( accessType );
+    }
+
+    public XClass getClassWithIdClass(boolean evenIfSubclass) {
+        if ( !evenIfSubclass && hasParents() ) {
+            return null;
+        }
+        if ( clazz.isAnnotationPresent( IdClass.class ) ) {
+            return clazz;
+        }
+        else {
+            org.hibernate.cfg.InheritanceState state = getSuperclassInheritanceState( clazz, inheritanceStatePerClass );
+            if ( state != null ) {
+                return state.getClassWithIdClass( true );
+            }
+            else {
+                return null;
+            }
+        }
+    }
+
+    public Boolean hasIdClassOrEmbeddedId() {
+        if ( hasIdClassOrEmbeddedId == null ) {
+            hasIdClassOrEmbeddedId = false;
+            if ( getClassWithIdClass( true ) != null ) {
+                hasIdClassOrEmbeddedId = true;
+            }
+            else {
+                final ElementsToProcess process = getElementsToProcess();
+                for ( PropertyData property : process.getElements() ) {
+                    if ( property.getProperty().isAnnotationPresent( EmbeddedId.class ) ) {
+                        hasIdClassOrEmbeddedId = true;
+                        break;
+                    }
+                }
+            }
+        }
+        return hasIdClassOrEmbeddedId;
+    }
+
+	/*
+     * Get the annotated elements and determine access type from hierarchy, guessing from @Id or @EmbeddedId presence if not
+     * specified.
+     * Change EntityBinder by side effect
+     */
+
+    public ElementsToProcess getElementsToProcess() {
+        if ( elementsToProcess == null ) {
+            org.hibernate.cfg.InheritanceState inheritanceState = inheritanceStatePerClass.get( clazz );
+            assert !inheritanceState.isEmbeddableSuperclass();
+
+
+            getMappedSuperclassesTillNextEntityOrdered();
+
+            accessType = determineDefaultAccessType();
+
+            ArrayList<PropertyData> elements = new ArrayList<PropertyData>();
+            int idPropertyCount = 0;
+
+            for ( XClass classToProcessForMappedSuperclass : classesToProcessForMappedSuperclass ) {
+                PropertyContainer propertyContainer = new PropertyContainer(
+                        classToProcessForMappedSuperclass,
+                        clazz,
+                        accessType
+                );
+                int currentIdPropertyCount = AnnotationBinder.addElementsOfClass(
+                        elements,
+                        propertyContainer,
+                        buildingContext
+                );
+                idPropertyCount += currentIdPropertyCount;
+            }
+
+            if ( idPropertyCount == 0 && !inheritanceState.hasParents() ) {
+                throw new AnnotationException( "No identifier specified for entity: " + clazz.getName() );
+            }
+            /*********添加根据order注解进行字段排序功能  zzy 2019-06-20************/
+            Collections.sort(elements, (o1, o2) -> {
+                int n1 = 50;
+                int n2 = 50;
+                Order order1 = o1.getProperty().getAnnotation(Order.class);
+                if(order1 != null) {
+                    n1 = order1.value();
+                    if(n1 == 2147483647) {
+                        n1 = 50;
+                    }
+                }
+                Order order2 = o2.getProperty().getAnnotation(Order.class);
+                if(order2 != null) {
+                    n2 = order2.value();
+                    if(n2 == 2147483647) {
+                        n2 = 50;
+                    }
+                }
+                int result = 0;
+                if(n1 > n2)
+                    result = 1;
+                else if(n1 < n2)
+                    result = -1;
+                return result;
+            });
+
+            /*****************************************************************/
+            elements.trimToSize();
+            elementsToProcess = new ElementsToProcess( elements, idPropertyCount );
+        }
+        return elementsToProcess;
+    }
+
+    private AccessType determineDefaultAccessType() {
+        for (XClass xclass = clazz; xclass != null; xclass = xclass.getSuperclass()) {
+            if ( ( xclass.getSuperclass() == null || Object.class.getName().equals( xclass.getSuperclass().getName() ) )
+                    && ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) )
+                    && xclass.isAnnotationPresent( Access.class ) ) {
+                return AccessType.getAccessStrategy( xclass.getAnnotation( Access.class ).value() );
+            }
+        }
+        // Guess from identifier.
+        // FIX: Shouldn't this be determined by the first attribute (i.e., field or property) with annotations, but without an
+        //      explicit Access annotation, according to JPA 2.0 spec 2.3.1: Default Access Type?
+        for (XClass xclass = clazz; xclass != null && !Object.class.getName().equals(xclass.getName()); xclass = xclass.getSuperclass()) {
+            if ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) ) {
+                for ( XProperty prop : xclass.getDeclaredProperties( AccessType.PROPERTY.getType() ) ) {
+                    final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class );
+                    if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) {
+                        return AccessType.PROPERTY;
+                    }
+                }
+                for ( XProperty prop : xclass.getDeclaredProperties( AccessType.FIELD.getType() ) ) {
+                    final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class );
+                    if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) {
+                        return AccessType.FIELD;
+                    }
+                }
+            }
+        }
+        throw new AnnotationException( "No identifier specified for entity: " + clazz );
+    }
+
+    private void getMappedSuperclassesTillNextEntityOrdered() {
+
+        //ordered to allow proper messages on properties subclassing
+        XClass currentClassInHierarchy = clazz;
+        org.hibernate.cfg.InheritanceState superclassState;
+        do {
+            classesToProcessForMappedSuperclass.add( 0, currentClassInHierarchy );
+            XClass superClass = currentClassInHierarchy;
+            do {
+                superClass = superClass.getSuperclass();
+                superclassState = inheritanceStatePerClass.get( superClass );
+            }
+            while ( superClass != null
+                    && !buildingContext.getBootstrapContext().getReflectionManager().equals( superClass, Object.class )
+                    && superclassState == null );
+
+            currentClassInHierarchy = superClass;
+        }
+        while ( superclassState != null && superclassState.isEmbeddableSuperclass() );
+    }
+
+    private void addMappedSuperClassInMetadata(PersistentClass persistentClass) {
+        //add @MappedSuperclass in the metadata
+        // classes from 0 to n-1 are @MappedSuperclass and should be linked
+        org.hibernate.mapping.MappedSuperclass mappedSuperclass = null;
+        final org.hibernate.cfg.InheritanceState superEntityState =
+                getInheritanceStateOfSuperEntity( clazz, inheritanceStatePerClass );
+        PersistentClass superEntity =
+                superEntityState != null ?
+                        buildingContext.getMetadataCollector().getEntityBinding( superEntityState.getClazz().getName() ) :
+                        null;
+        final int lastMappedSuperclass = classesToProcessForMappedSuperclass.size() - 1;
+        for ( int index = 0; index < lastMappedSuperclass; index++ ) {
+            org.hibernate.mapping.MappedSuperclass parentSuperclass = mappedSuperclass;
+            final Class<?> type = buildingContext.getBootstrapContext().getReflectionManager()
+                    .toClass( classesToProcessForMappedSuperclass.get( index ) );
+            //add MAppedSuperclass if not already there
+            mappedSuperclass = buildingContext.getMetadataCollector().getMappedSuperclass( type );
+            if ( mappedSuperclass == null ) {
+                mappedSuperclass = new org.hibernate.mapping.MappedSuperclass( parentSuperclass, superEntity );
+                mappedSuperclass.setMappedClass( type );
+                buildingContext.getMetadataCollector().addMappedSuperclass( type, mappedSuperclass );
+            }
+        }
+        if ( mappedSuperclass != null ) {
+            persistentClass.setSuperMappedSuperclass( mappedSuperclass );
+        }
+    }
+
+    static final class ElementsToProcess {
+        private final List<PropertyData> properties;
+        private final int idPropertyCount;
+
+        public List<PropertyData> getElements() {
+            return properties;
+        }
+
+        public int getIdPropertyCount() {
+            return idPropertyCount;
+        }
+
+        private ElementsToProcess(List<PropertyData> properties, int idPropertyCount) {
+            this.properties = properties;
+            this.idPropertyCount = idPropertyCount;
+        }
+    }
+}

+ 395 - 0
ipfcst-common/ipfcst-common-data/src/main/java/org/hibernate/cfg/PropertyContainer.java

@@ -0,0 +1,395 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ */
+
+// $Id$
+
+package org.hibernate.cfg;
+
+import org.hibernate.AnnotationException;
+import org.hibernate.MappingException;
+import org.hibernate.annotations.ManyToAny;
+import org.hibernate.annotations.Target;
+import org.hibernate.annotations.Type;
+import org.hibernate.annotations.common.reflection.XClass;
+import org.hibernate.annotations.common.reflection.XProperty;
+import org.hibernate.boot.jaxb.Origin;
+import org.hibernate.boot.jaxb.SourceType;
+import org.hibernate.cfg.annotations.HCANNHelper;
+import org.hibernate.internal.CoreMessageLogger;
+import org.hibernate.internal.util.StringHelper;
+import org.jboss.logging.Logger;
+
+import javax.persistence.*;
+import java.util.*;
+
+/**
+ * A helper class to keep the {@code XProperty}s of a class ordered by access type.
+ *
+ * @author Hardy Ferentschik
+ *
+ * 修改treeMap 为LinkedHashMap 使字段生成顺序与实体定义顺序一致
+ */
+@SuppressWarnings("unused")
+class PropertyContainer {
+//
+//    static {
+//        System.setProperty("jboss.i18n.generate-proxies", "true");
+//    }
+
+    private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, org.hibernate.cfg.PropertyContainer.class.getName());
+
+    /**
+     * The class for which this container is created.
+     */
+    private final XClass xClass;
+    private final XClass entityAtStake;
+
+    /**
+     * Holds the AccessType indicated for use at the class/container-level for cases where persistent attribute
+     * did not specify.
+     */
+    private final org.hibernate.cfg.AccessType classLevelAccessType;
+
+    private final LinkedHashMap<String, XProperty> persistentAttributeMap;
+
+    PropertyContainer(XClass clazz, XClass entityAtStake, org.hibernate.cfg.AccessType defaultClassLevelAccessType) {
+        this.xClass = clazz;
+        this.entityAtStake = entityAtStake;
+
+        if ( defaultClassLevelAccessType == org.hibernate.cfg.AccessType.DEFAULT ) {
+            // this is effectively what the old code did when AccessType.DEFAULT was passed in
+            // to getProperties(AccessType) from AnnotationBinder and InheritanceState
+            defaultClassLevelAccessType = org.hibernate.cfg.AccessType.PROPERTY;
+        }
+
+        org.hibernate.cfg.AccessType localClassLevelAccessType = determineLocalClassDefinedAccessStrategy();
+        assert localClassLevelAccessType != null;
+
+        this.classLevelAccessType = localClassLevelAccessType != org.hibernate.cfg.AccessType.DEFAULT
+                ? localClassLevelAccessType
+                : defaultClassLevelAccessType;
+        assert classLevelAccessType == org.hibernate.cfg.AccessType.FIELD || classLevelAccessType == org.hibernate.cfg.AccessType.PROPERTY;
+
+        this.persistentAttributeMap = new LinkedHashMap<>();
+
+        final List<XProperty> fields = xClass.getDeclaredProperties( org.hibernate.cfg.AccessType.FIELD.getType() );
+
+        final List<XProperty> getters = xClass.getDeclaredProperties( org.hibernate.cfg.AccessType.PROPERTY.getType() );
+
+        preFilter( fields, getters );
+
+        final Map<String,XProperty> persistentAttributesFromGetters = new HashMap<>();
+
+        collectPersistentAttributesUsingLocalAccessType(
+                persistentAttributeMap,
+                persistentAttributesFromGetters,
+                fields,
+                getters
+        );
+        collectPersistentAttributesUsingClassLevelAccessType(
+                persistentAttributeMap,
+                persistentAttributesFromGetters,
+                fields,
+                getters
+        );
+    }
+
+    private void preFilter(List<XProperty> fields, List<XProperty> getters) {
+        Iterator<XProperty> propertyIterator = fields.iterator();
+        while ( propertyIterator.hasNext() ) {
+            final XProperty property = propertyIterator.next();
+            if ( mustBeSkipped( property ) ) {
+                propertyIterator.remove();
+            }
+        }
+
+        propertyIterator = getters.iterator();
+        while ( propertyIterator.hasNext() ) {
+            final XProperty property = propertyIterator.next();
+            if ( mustBeSkipped( property ) ) {
+                propertyIterator.remove();
+            }
+        }
+    }
+
+    private void collectPersistentAttributesUsingLocalAccessType(
+            LinkedHashMap<String, XProperty> persistentAttributeMap,
+            Map<String,XProperty> persistentAttributesFromGetters,
+            List<XProperty> fields,
+            List<XProperty> getters) {
+
+        // Check fields...
+        Iterator<XProperty> propertyIterator = fields.iterator();
+        while ( propertyIterator.hasNext() ) {
+            final XProperty xProperty = propertyIterator.next();
+            final Access localAccessAnnotation = xProperty.getAnnotation( Access.class );
+            if ( localAccessAnnotation == null
+                    || localAccessAnnotation.value() != javax.persistence.AccessType.FIELD ) {
+                continue;
+            }
+
+            propertyIterator.remove();
+            persistentAttributeMap.put( xProperty.getName(), xProperty );
+        }
+
+        // Check getters...
+        propertyIterator = getters.iterator();
+        while ( propertyIterator.hasNext() ) {
+            final XProperty xProperty = propertyIterator.next();
+            final Access localAccessAnnotation = xProperty.getAnnotation( Access.class );
+            if ( localAccessAnnotation == null
+                    || localAccessAnnotation.value() != javax.persistence.AccessType.PROPERTY ) {
+                continue;
+            }
+
+            propertyIterator.remove();
+
+            final String name = xProperty.getName();
+
+            // HHH-10242 detect registration of the same property getter twice - eg boolean isId() + UUID getId()
+            final XProperty previous = persistentAttributesFromGetters.get( name );
+            if ( previous != null ) {
+                throw new org.hibernate.boot.MappingException(
+                        LOG.ambiguousPropertyMethods(
+                                xClass.getName(),
+                                HCANNHelper.annotatedElementSignature( previous ),
+                                HCANNHelper.annotatedElementSignature( xProperty )
+                        ),
+                        new Origin( SourceType.ANNOTATION, xClass.getName() )
+                );
+            }
+
+            persistentAttributeMap.put( name, xProperty );
+            persistentAttributesFromGetters.put( name, xProperty );
+        }
+    }
+
+    private void collectPersistentAttributesUsingClassLevelAccessType(
+            LinkedHashMap<String, XProperty> persistentAttributeMap,
+            Map<String,XProperty> persistentAttributesFromGetters,
+            List<XProperty> fields,
+            List<XProperty> getters) {
+        if ( classLevelAccessType == org.hibernate.cfg.AccessType.FIELD ) {
+            for ( XProperty field : fields ) {
+                if ( persistentAttributeMap.containsKey( field.getName() ) ) {
+                    continue;
+                }
+
+                persistentAttributeMap.put( field.getName(), field );
+            }
+        }
+        else {
+            for ( XProperty getter : getters ) {
+                final String name = getter.getName();
+
+                // HHH-10242 detect registration of the same property getter twice - eg boolean isId() + UUID getId()
+                final XProperty previous = persistentAttributesFromGetters.get( name );
+                if ( previous != null ) {
+                    throw new org.hibernate.boot.MappingException(
+                            LOG.ambiguousPropertyMethods(
+                                    xClass.getName(),
+                                    HCANNHelper.annotatedElementSignature( previous ),
+                                    HCANNHelper.annotatedElementSignature( getter )
+                            ),
+                            new Origin( SourceType.ANNOTATION, xClass.getName() )
+                    );
+                }
+
+                if ( persistentAttributeMap.containsKey( name ) ) {
+                    continue;
+                }
+
+                persistentAttributeMap.put( getter.getName(), getter );
+                persistentAttributesFromGetters.put( name, getter );
+            }
+        }
+    }
+
+    public XClass getEntityAtStake() {
+        return entityAtStake;
+    }
+
+    public XClass getDeclaringClass() {
+        return xClass;
+    }
+
+    public org.hibernate.cfg.AccessType getClassLevelAccessType() {
+        return classLevelAccessType;
+    }
+
+    public Collection<XProperty> getProperties() {
+        assertTypesAreResolvable();
+        return Collections.unmodifiableCollection( persistentAttributeMap.values() );
+    }
+
+    private void assertTypesAreResolvable() {
+        for ( XProperty xProperty : persistentAttributeMap.values() ) {
+            if ( !xProperty.isTypeResolved() && !discoverTypeWithoutReflection( xProperty ) ) {
+                String msg = "Property " + StringHelper.qualify( xClass.getName(), xProperty.getName() ) +
+                        " has an unbound type and no explicit target entity. Resolve this Generic usage issue" +
+                        " or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type";
+                throw new AnnotationException( msg );
+            }
+        }
+    }
+//
+//	private void considerExplicitFieldAndPropertyAccess() {
+//		for ( XProperty property : fieldAccessMap.values() ) {
+//			Access access = property.getAnnotation( Access.class );
+//			if ( access == null ) {
+//				continue;
+//			}
+//
+//			// see "2.3.2 Explicit Access Type" of JPA 2 spec
+//			// the access type for this property is explicitly set to AccessType.FIELD, hence we have to
+//			// use field access for this property even if the default access type for the class is AccessType.PROPERTY
+//			AccessType accessType = AccessType.getAccessStrategy( access.value() );
+//            if (accessType == AccessType.FIELD) {
+//				propertyAccessMap.put(property.getName(), property);
+//			}
+//            else {
+//				LOG.debug( "Placing @Access(AccessType.FIELD) on a field does not have any effect." );
+//			}
+//		}
+//
+//		for ( XProperty property : propertyAccessMap.values() ) {
+//			Access access = property.getAnnotation( Access.class );
+//			if ( access == null ) {
+//				continue;
+//			}
+//
+//			AccessType accessType = AccessType.getAccessStrategy( access.value() );
+//
+//			// see "2.3.2 Explicit Access Type" of JPA 2 spec
+//			// the access type for this property is explicitly set to AccessType.PROPERTY, hence we have to
+//			// return use method access even if the default class access type is AccessType.FIELD
+//            if (accessType == AccessType.PROPERTY) {
+//				fieldAccessMap.put(property.getName(), property);
+//			}
+//            else {
+//				LOG.debug( "Placing @Access(AccessType.PROPERTY) on a field does not have any effect." );
+//			}
+//		}
+//	}
+
+//	/**
+//	 * Retrieves all properties from the {@code xClass} with the specified access type. This method does not take
+//	 * any jpa access rules/annotations into account yet.
+//	 *
+//	 * @param access The access type - {@code AccessType.FIELD}  or {@code AccessType.Property}
+//	 *
+//	 * @return A maps of the properties with the given access type keyed against their property name
+//	 */
+//	private TreeMap<String, XProperty> initProperties(AccessType access) {
+//		if ( !( AccessType.PROPERTY.equals( access ) || AccessType.FIELD.equals( access ) ) ) {
+//			throw new IllegalArgumentException( "Access type has to be AccessType.FIELD or AccessType.Property" );
+//		}
+//
+//		//order so that property are used in the same order when binding native query
+//		TreeMap<String, XProperty> propertiesMap = new TreeMap<String, XProperty>();
+//		List<XProperty> properties = xClass.getDeclaredProperties( access.getType() );
+//		for ( XProperty property : properties ) {
+//			if ( mustBeSkipped( property ) ) {
+//				continue;
+//			}
+//			// HHH-10242 detect registration of the same property twice eg boolean isId() + UUID getId()
+//			XProperty oldProperty = propertiesMap.get( property.getName() );
+//			if ( oldProperty != null ) {
+//				throw new org.hibernate.boot.MappingException(
+//						LOG.ambiguousPropertyMethods(
+//								xClass.getName(),
+//								HCANNHelper.annotatedElementSignature( oldProperty ),
+//								HCANNHelper.annotatedElementSignature( property )
+//						),
+//						new Origin( SourceType.ANNOTATION, xClass.getName() )
+//				);
+//			}
+//
+//			propertiesMap.put( property.getName(), property );
+//		}
+//		return propertiesMap;
+//	}
+
+    @SuppressWarnings("deprecation")
+    private org.hibernate.cfg.AccessType determineLocalClassDefinedAccessStrategy() {
+        org.hibernate.cfg.AccessType classDefinedAccessType;
+
+        org.hibernate.cfg.AccessType hibernateDefinedAccessType = org.hibernate.cfg.AccessType.DEFAULT;
+        org.hibernate.cfg.AccessType jpaDefinedAccessType = org.hibernate.cfg.AccessType.DEFAULT;
+
+        org.hibernate.annotations.AccessType accessType = xClass.getAnnotation( org.hibernate.annotations.AccessType.class );
+        if ( accessType != null ) {
+            hibernateDefinedAccessType = org.hibernate.cfg.AccessType.getAccessStrategy( accessType.value() );
+        }
+
+        Access access = xClass.getAnnotation( Access.class );
+        if ( access != null ) {
+            jpaDefinedAccessType = org.hibernate.cfg.AccessType.getAccessStrategy( access.value() );
+        }
+
+        if ( hibernateDefinedAccessType != org.hibernate.cfg.AccessType.DEFAULT
+                && jpaDefinedAccessType != org.hibernate.cfg.AccessType.DEFAULT
+                && hibernateDefinedAccessType != jpaDefinedAccessType ) {
+            throw new MappingException(
+                    "@AccessType and @Access specified with contradicting values. Use of @Access only is recommended. "
+            );
+        }
+
+        if ( hibernateDefinedAccessType != org.hibernate.cfg.AccessType.DEFAULT ) {
+            classDefinedAccessType = hibernateDefinedAccessType;
+        }
+        else {
+            classDefinedAccessType = jpaDefinedAccessType;
+        }
+        return classDefinedAccessType;
+    }
+
+    private static boolean discoverTypeWithoutReflection(XProperty p) {
+        if ( p.isAnnotationPresent( OneToOne.class ) && !p.getAnnotation( OneToOne.class )
+                .targetEntity()
+                .equals( void.class ) ) {
+            return true;
+        }
+        else if ( p.isAnnotationPresent( OneToMany.class ) && !p.getAnnotation( OneToMany.class )
+                .targetEntity()
+                .equals( void.class ) ) {
+            return true;
+        }
+        else if ( p.isAnnotationPresent( ManyToOne.class ) && !p.getAnnotation( ManyToOne.class )
+                .targetEntity()
+                .equals( void.class ) ) {
+            return true;
+        }
+        else if ( p.isAnnotationPresent( ManyToMany.class ) && !p.getAnnotation( ManyToMany.class )
+                .targetEntity()
+                .equals( void.class ) ) {
+            return true;
+        }
+        else if ( p.isAnnotationPresent( org.hibernate.annotations.Any.class ) ) {
+            return true;
+        }
+        else if ( p.isAnnotationPresent( ManyToAny.class ) ) {
+            if ( !p.isCollection() && !p.isArray() ) {
+                throw new AnnotationException( "@ManyToAny used on a non collection non array property: " + p.getName() );
+            }
+            return true;
+        }
+        else if ( p.isAnnotationPresent( Type.class ) ) {
+            return true;
+        }
+        else if ( p.isAnnotationPresent( Target.class ) ) {
+            return true;
+        }
+        return false;
+    }
+
+    private static boolean mustBeSkipped(XProperty property) {
+        return property.isAnnotationPresent( Transient.class )
+                || "net.sf.cglib.transform.impl.InterceptFieldCallback".equals( property.getType().getName() )
+                || "org.hibernate.bytecode.internal.javassist.FieldHandler".equals( property.getType().getName() );
+    }
+}

+ 51 - 0
ipfcst-common/ipfcst-common-security/pom.xml

@@ -0,0 +1,51 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>com.jiayue.focus</groupId>
+		<artifactId>ipfcst-common</artifactId>
+		<version>3.0</version>
+	</parent>
+
+	<artifactId>ipfcst-common-security</artifactId>
+	<packaging>jar</packaging>
+
+	<description>ipfcst 安全工具类</description>
+
+	<properties>
+		<java.version>1.8</java.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>com.jiayue.focus</groupId>
+			<artifactId>ipfcst-common-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-security</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-aop</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-data-jpa</artifactId>
+		</dependency>
+		<!--JWT-->
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>${javajwt.version}</version>
+        </dependency>
+
+		<dependency>
+			<groupId>io.jsonwebtoken</groupId>
+			<artifactId>jjwt</artifactId>
+			<version>0.9.0</version>
+		</dependency>
+	</dependencies>
+
+</project>

+ 14 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/AuthorizeConfigurerProvider.java

@@ -0,0 +1,14 @@
+package com.jiayue.ipfcst.common.security.authorize;
+
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
+
+/**
+ * Security授权和配置统一接口,所有模块的授权配置类都要实现这个接口
+ *
+ */
+public interface AuthorizeConfigurerProvider {
+
+    void confiure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config);
+
+}

+ 28 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/SecurityAuthorizeConfigurerProvider.java

@@ -0,0 +1,28 @@
+package com.jiayue.ipfcst.common.security.authorize;
+
+import org.springframework.core.annotation.Order;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
+import org.springframework.stereotype.Component;
+
+/**
+ * Security身份认证相关的授权配置
+ *
+ */
+@Component
+@Order(Integer.MAX_VALUE) // 值越小加载越优先,值越大加载越靠后
+public class SecurityAuthorizeConfigurerProvider implements AuthorizeConfigurerProvider {
+
+
+
+
+    @Override
+    public void confiure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
+       /* config.antMatchers(""
+        ).permitAll(); // 放行登录页面访问*/
+
+        // 其他请求都要通过身份认证
+        config.anyRequest().authenticated();
+
+    }
+}

+ 27 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/SysAuthorizeConfigurerManager.java

@@ -0,0 +1,27 @@
+package com.jiayue.ipfcst.common.security.authorize;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 管理security配置
+ *
+ *
+ */
+@Component
+public class SysAuthorizeConfigurerManager  {
+
+    @Autowired
+    List<AuthorizeConfigurerProvider> authorizeConfigurerProviders;
+
+    // 将一个个AuthorizeConfigurerProvider的实现类,传入配置的参数 ExpressionInterceptUrlRegistry
+    public void configure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
+        for(AuthorizeConfigurerProvider provider: authorizeConfigurerProviders) {
+            provider.confiure(config);
+        }
+    }
+}

+ 24 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/authorize/SystemAuthorizeConfigurerProvider.java

@@ -0,0 +1,24 @@
+package com.jiayue.ipfcst.common.security.authorize;
+
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
+import org.springframework.stereotype.Component;
+
+/**
+ * Security授权配置
+ *
+ */
+@Component
+public class SystemAuthorizeConfigurerProvider implements AuthorizeConfigurerProvider {
+
+    @Override
+    public void confiure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
+//        // 有 sys:user 权限的可以访问任意请求方式的/role
+//        config.antMatchers("/user").hasAuthority("sys:user")
+//        // 有 sys:role 权限的可以访问 get方式的/role
+//        .antMatchers(HttpMethod.GET,"/role").hasAuthority("sys:role")
+//        .antMatchers(HttpMethod.GET, "/permission")
+//        // ADMIN 注意角色会在前面加上前缀 ROLE_ , 也就是完整的是 ROLE_ADMIN, ROLE_ROOT
+//        .access("hasAuthority('sys:permission') or hasAnyRole('ADMIN', 'ROOT')");
+    }
+}

+ 115 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/config/WebSecurityConfig.java

@@ -0,0 +1,115 @@
+package com.jiayue.ipfcst.common.security.config;
+
+
+import com.jiayue.ipfcst.common.security.filter.JwtAuthenticationTokenFilter;
+import com.jiayue.ipfcst.common.security.handle.CustomAuthenticationFailureHandler;
+import com.jiayue.ipfcst.common.security.handle.CustomAuthenticationSuccessHandler;
+import com.jiayue.ipfcst.common.security.handle.EntryPointUnauthorizedHandler;
+import com.jiayue.ipfcst.common.security.handle.RestAccessDeniedHandler;
+import com.jiayue.ipfcst.common.security.user.JwtUserDetailsServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.domain.AuditorAware;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
+import org.springframework.http.HttpMethod;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+
+import java.util.Optional;
+
+/**
+ * @description:
+ * @author: yh
+ * @create: 2020-03-18 16:43
+ **/
+@Configuration
+@EnableWebSecurity // 开启springsecurity过滤链 filter
+@EnableJpaAuditing
+@EnableGlobalMethodSecurity(prePostEnabled = true) // 开启注解方法级别权限控制
+@Slf4j
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter implements AuditorAware<String> {
+
+    @Bean
+    public PasswordEncoder passwordEncoder() {
+        // 明文+随机盐值》加密存储
+        return new BCryptPasswordEncoder();
+    }
+
+    @Autowired
+    private JwtUserDetailsServiceImpl jwtUserDetailsServiceImpl;
+
+    //用户查询
+    @Override
+    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+        auth.userDetailsService(jwtUserDetailsServiceImpl);
+    }
+
+    @Autowired
+    private CustomAuthenticationFailureHandler customAuthenticationFailureHandler;
+    @Autowired
+    private CustomAuthenticationSuccessHandler customAuthenticationSuccessHandler;
+    @Autowired
+    private EntryPointUnauthorizedHandler entryPointUnauthorizedHandler;
+    @Autowired
+    private RestAccessDeniedHandler restAccessDeniedHandler;
+    @Autowired
+    private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter;
+
+    //配置
+    @Override
+    protected void configure(HttpSecurity http) throws Exception {
+
+        http.headers().frameOptions().sameOrigin();
+        http.cors().and()
+                // 由于使用的是JWT,我们这里不需要csrf
+                .csrf().disable()
+                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
+                .and().authorizeRequests()
+                .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
+                .antMatchers("/pushSocket/**").permitAll()
+                .antMatchers("/druid/**").permitAll()
+                .antMatchers("/h2-console/**").permitAll()
+                .antMatchers("/uploadFileOpenInterface/**").permitAll()
+                .antMatchers("/consoleOpenInterface/**").permitAll()
+                .antMatchers("/uploadFileLog/**").permitAll()
+                .antMatchers("/consoleVersion/**").permitAll()
+                .antMatchers("/qrCode/**").permitAll()
+            .antMatchers("/powerStationDataPacker/**").permitAll()
+                .antMatchers("/reportVersion/**").permitAll().anyRequest().authenticated()
+            .and()
+                .formLogin().loginProcessingUrl("/user/login")
+                .successHandler(customAuthenticationSuccessHandler)
+                .failureHandler(customAuthenticationFailureHandler)
+                .and().headers().cacheControl();
+
+        http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
+        http.exceptionHandling().authenticationEntryPoint(entryPointUnauthorizedHandler).accessDeniedHandler(restAccessDeniedHandler);
+
+    }
+
+    //针对静态资源放行
+    @Override
+    public void configure(WebSecurity web) throws Exception {
+        /*super.configure(web);*/
+        web.ignoring().antMatchers("/static/**", "/assets/**", "/audio/**", "/");
+    }
+
+    @Override
+    public Optional<String> getCurrentAuditor() {
+//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+        return Optional.of(authentication == null ? "admin" : authentication.getName());
+    }
+}

+ 55 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/filter/JwtAuthenticationTokenFilter.java

@@ -0,0 +1,55 @@
+package com.jiayue.ipfcst.common.security.filter;
+
+
+import com.jiayue.ipfcst.common.security.user.JwtUserDetailsServiceImpl;
+import com.jiayue.ipfcst.common.security.util.JwtTokenUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @description:
+ * @author: yh
+ * @create: 2020-03-19 13:05
+ **/
+@Component
+public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
+
+    @Autowired
+    private JwtUserDetailsServiceImpl jwtUserDetailsServiceImpl;
+    @Autowired
+    private JwtTokenUtil jwtTokenUtil;
+
+    @Override
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws
+        ServletException, IOException {
+         SecurityContextHolder.getContext().getAuthentication();
+        String token = request.getHeader("Authorization");
+        if (!StringUtils.isEmpty(token)) {
+            String username = jwtTokenUtil.getUsernameFromToken(token);
+            if (username != null && SecurityContextHolder.getContext().getAuthentication() == null){
+                UserDetails userDetails = jwtUserDetailsServiceImpl.loadUserByUsername(username);
+                if (jwtTokenUtil.validateToken(token, userDetails)){
+                    // 将用户信息存入 authentication,方便后续校验
+                    UsernamePasswordAuthenticationToken
+                            authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
+                    authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
+                    // 将 authentication 存入 ThreadLocal,方便后续获取用户信息
+                    SecurityContextHolder.getContext().setAuthentication(authentication);
+                }
+            }
+        }
+        chain.doFilter(request, response);
+    }
+}

+ 78 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/CustomAuthenticationFailureHandler.java

@@ -0,0 +1,78 @@
+package com.jiayue.ipfcst.common.security.handle;
+
+import cn.hutool.json.JSONUtil;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.security.user.SysUser;
+import com.jiayue.ipfcst.common.security.user.SysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 失败认证处理
+ */
+@Component("customAuthenticationFailureHandler")
+public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
+
+    @Autowired
+    SysUserService sysUserService;
+
+    @Override
+    public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
+                                        AuthenticationException e) throws IOException, ServletException {
+        String username = httpServletRequest.getParameter("username");
+        String errorTips = "";
+        SysUser user = sysUserService.findByUserName(username);
+        if (username.equals("admin") || username.equals("consumer")) {
+            errorTips = "用户名或密码不正常";
+        } else {
+            errorTips = "用户名或密码不正常";
+        }
+
+        if (user == null) {
+            errorTips = "用户名或密码不正常";
+        } else {
+            if (user.getStatus().equals("1")) {
+                Long xz = (user.getLockTime() + 300000 - System.currentTimeMillis()) / 1000;
+                if (xz < 0) {
+                    user.setStatus("0");
+                    user.setPwdErrNum(1);
+                    errorTips = "用户名或密码不正常,还有4次机会";
+                    sysUserService.save(user);
+                } else {
+                    //锁定状态
+                    errorTips = "用户已锁定,请隔" + xz + "秒再登录";
+                }
+            } else {
+                int errCount = 5;
+                int errNum = user.getPwdErrNum();
+                if (errNum < 5) {
+                    errorTips = "用户名或密码不正常,还有" + (errCount - errNum) + "次机会";
+                    errNum++;
+                    user.setPwdErrNum(errNum);
+                    sysUserService.save(user);
+                } else {
+                    errorTips = "用户锁定,稍后再试";
+                    user.setPwdErrNum(0);
+                    user.setStatus("1");
+                    user.setLockTime(System.currentTimeMillis());
+                    sysUserService.save(user);
+                }
+
+            }
+
+        }
+        httpServletResponse.addHeader("Access-Control-Allow-Origin", "*");
+        httpServletResponse.setContentType("application/json;charset=UTF-8");
+        httpServletResponse.setStatus(401);
+        httpServletResponse.getWriter().write(JSONUtil.toJsonStr(ResponseVO.fail(errorTips)));
+
+    }
+
+}

+ 47 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/CustomAuthenticationSuccessHandler.java

@@ -0,0 +1,47 @@
+package com.jiayue.ipfcst.common.security.handle;
+
+import cn.hutool.json.JSONUtil;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.security.user.SysUser;
+import com.jiayue.ipfcst.common.security.user.SysUserService;
+import com.jiayue.ipfcst.common.security.util.JwtTokenUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 认证成功处理器
+ */
+@Component("customAuthenticationSuccessHandler")
+public class CustomAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
+
+    @Autowired
+    private JwtTokenUtil jwtTokenUtil;
+
+    @Autowired
+    SysUserService sysUserService;
+
+    @Override
+    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
+        User user = (User) authentication.getPrincipal();
+        SecurityContextHolder.getContext().setAuthentication(authentication);
+        String token = jwtTokenUtil.generateToken(user);
+        SysUser sysUser = sysUserService.findByUserName(user.getUsername());
+        sysUser.setPwdErrNum(0);
+        sysUser.setStatus("0");
+        sysUserService.save(sysUser);
+        httpServletResponse.addHeader("Access-Control-Allow-Origin", "*");
+        httpServletResponse.setContentType("application/json;charset=UTF-8");
+        httpServletResponse.getWriter().write(JSONUtil.toJsonStr(ResponseVO.success(token)));
+    }
+
+
+}

+ 26 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/EntryPointUnauthorizedHandler.java

@@ -0,0 +1,26 @@
+package com.jiayue.ipfcst.common.security.handle;
+
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 登录失败:解决匿名用户访问无权限资源时的异常
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2018/8/23 14:39
+ */
+@Service
+public class EntryPointUnauthorizedHandler implements AuthenticationEntryPoint {
+
+    @Override
+    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {
+          response.setHeader("Access-Control-Allow-Origin", "*");
+        response.setStatus(403);
+    }
+
+}

+ 25 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/handle/RestAccessDeniedHandler.java

@@ -0,0 +1,25 @@
+package com.jiayue.ipfcst.common.security.handle;
+
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.web.access.AccessDeniedHandler;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 权限不足:认证过的用户访问无权限资源时的异常
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2018/8/23 14:45
+ */
+@Service
+public class RestAccessDeniedHandler implements AccessDeniedHandler {
+
+    @Override
+    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) {
+        System.out.println("qunxianbuzu");
+    }
+
+}

+ 64 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/JwtUserDetailsServiceImpl.java

@@ -0,0 +1,64 @@
+package com.jiayue.ipfcst.common.security.user;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.authority.AuthorityUtils;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Yh
+ */
+@Service
+@Slf4j
+public class JwtUserDetailsServiceImpl implements UserDetailsService {
+
+
+    @Autowired
+    PasswordEncoder passwordEncoder;
+
+    @Autowired
+    SysUserService sysUserService;
+
+    @Override
+    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+        User user = null;
+        String password = null;
+        SysUser sysUser = sysUserService.findByUserName(username);
+//        if ("admin".equals(username)) {
+//            if (sysUser == null || sysUser.getUserName().isEmpty()) {
+//                sysUser = new SysUser();
+//                sysUser.setUserName("admin");
+//                sysUser.setPassWord("!QAZ2wsx");
+//                sysUser.setName("admin");
+//                sysUser.setPwdErrNum(0);
+//                sysUser.setLockTime(0L);
+//                sysUser.setStatus("0");
+//                sysUserService.save(sysUser);
+//            }
+//        }
+        if(sysUser == null){
+            password = passwordEncoder.encode("sda21dsad13214sda22dsa@#$#$%!ds1d1");
+        }else {
+            password = passwordEncoder.encode(sysUser.getPassWord());
+            if (sysUser.getStatus().equals("1") && (System.currentTimeMillis() - sysUser.getLockTime()) < 300000) {
+                password = passwordEncoder.encode("sda21dsad13214sda22dsa@#$#$%!ds1d1");
+            }
+
+            if (sysUser.getStatus().equals("2")) {
+                password = passwordEncoder.encode("sda21dsad13214sda22dsa@#$#$%!ds1d1");
+            }
+        }
+
+
+
+
+        user = new User(username, password, AuthorityUtils.commaSeparatedStringToAuthorityList(username.toUpperCase()));
+        return user;
+    }
+
+}

+ 40 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/SysUser.java

@@ -0,0 +1,40 @@
+package com.jiayue.ipfcst.common.security.user;
+
+import lombok.Data;
+import org.springframework.core.annotation.Order;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+/**
+ * 用户实体
+ *
+ * @author bizy
+ * @version 1.0
+ * @since 2018/10/22 11:29
+ */
+@Data
+@Entity
+public class SysUser implements Serializable {
+    @Id
+    @Order(1)
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    private String userName;
+
+    private String passWord;
+
+    private String name;
+
+    private Integer pwdErrNum;
+
+    private Long lockTime;
+    /**
+     * 状态,0正常、1锁定、2禁用
+     */
+    private String status;
+}

+ 14 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/SysUserRepository.java

@@ -0,0 +1,14 @@
+package com.jiayue.ipfcst.common.security.user;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+ * 用户仓储
+ *
+ * @author bizy
+ * @version 3.0
+ */
+public interface SysUserRepository extends JpaRepository<SysUser, Integer>, JpaSpecificationExecutor<SysUser> {
+    SysUser findByUserName(String username);
+}

+ 51 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/user/SysUserService.java

@@ -0,0 +1,51 @@
+package com.jiayue.ipfcst.common.security.user;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ * 用户服务类
+ *
+ * @author bizy
+ * @version 3.0
+ */
+@Service
+@Slf4j
+public class SysUserService {
+
+    @Autowired
+    SysUserRepository sysUserRepository;
+
+    public SysUser findByUserName(String username) {
+        return sysUserRepository.findByUserName(username);
+    }
+
+    public void save(SysUser user) {
+        sysUserRepository.save(user);
+    }
+
+    public List<SysUser> getAll() {
+        return sysUserRepository.findAll();
+    }
+
+
+    public void delete(String ids) {
+        if (!StringUtils.isEmpty(ids)) {
+            String[] idArray = ids.split(",");
+            if (idArray != null && idArray.length > 0) {
+                for (String id : idArray) {
+                    this.sysUserRepository.deleteById(Integer.valueOf(id));
+                    log.info("删除用户ID为[" + id + "]成功!");
+
+                }
+            } else {
+                this.sysUserRepository.deleteById(Integer.valueOf(ids));
+                log.info("删除用户ID为[" + ids + "]成功!");
+            }
+        }
+    }
+}

+ 135 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/util/JwtTokenUtil.java

@@ -0,0 +1,135 @@
+package com.jiayue.ipfcst.common.security.util;
+
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import lombok.Data;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 生成令牌,验证等等一些操作
+ *
+ */
+@Data
+@Component
+public class JwtTokenUtil {
+
+    private String secret = "syjy";
+
+    // 过期时间 毫秒 20年  徐哥让的
+    private Long expiration = 630720000000L;
+
+    private String Authorization;
+
+    /**
+     * 从数据声明生成令牌
+     *
+     * @param claims 数据声明
+     * @return 令牌
+     */
+    private String generateToken(Map<String, Object> claims) {
+        Date expirationDate = new Date(System.currentTimeMillis() + expiration);
+        return Jwts.builder().setClaims(claims).setExpiration(expirationDate).signWith(SignatureAlgorithm.HS512, secret).compact();
+    }
+
+    /**
+     * 从令牌中获取数据声明
+     *
+     * @param token 令牌
+     * @return 数据声明
+     */
+    private Claims getClaimsFromToken(String token) {
+        Claims claims;
+        try {
+            claims = Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
+        } catch (Exception e) {
+            e.printStackTrace();
+            claims = null;
+        }
+        return claims;
+    }
+
+    /**
+     * 生成令牌
+     *
+     * @param userDetails 用户
+     * @return 令牌
+     */
+    public String generateToken(UserDetails userDetails) {
+        Map<String, Object> claims = new HashMap<String, Object>();
+        claims.put(Claims.SUBJECT, userDetails.getUsername());
+        claims.put(Claims.ISSUED_AT, new Date());
+        return generateToken(claims);
+    }
+
+    /**
+     * 从令牌中获取用户名
+     *
+     * @param token 令牌
+     * @return 用户名
+     */
+    public String getUsernameFromToken(String token) {
+        String username;
+        try {
+            Claims claims = getClaimsFromToken(token);
+            username = claims.getSubject();
+        } catch (Exception e) {
+            username = null;
+        }
+        return username;
+    }
+
+    /**
+     * 判断令牌是否过期
+     *
+     * @param token 令牌
+     * @return 是否过期
+     */
+    public Boolean isTokenExpired(String token) {
+        try {
+            Claims claims = getClaimsFromToken(token);
+            Date expiration = claims.getExpiration();
+            return expiration.before(new Date());
+        } catch (Exception e) {
+            return true;
+        }
+    }
+
+    /**
+     * 刷新令牌
+     *
+     * @param token 原令牌
+     * @return 新令牌
+     */
+    public String refreshToken(String token) {
+        String refreshedToken;
+        try {
+            Claims claims = getClaimsFromToken(token);
+            claims.put(Claims.ISSUED_AT, new Date());
+            refreshedToken = generateToken(claims);
+        } catch (Exception e) {
+            refreshedToken = null;
+        }
+        return refreshedToken;
+    }
+
+    /**
+     * 验证令牌
+     *
+     * @param token       令牌
+     * @param userDetails 用户
+     * @return 是否有效
+     */
+    public Boolean validateToken(String token, UserDetails userDetails) {
+        User user = (User) userDetails;
+        String username = getUsernameFromToken(token);
+        return (username.equals(user.getUsername()) && !isTokenExpired(token));
+    }
+}

+ 27 - 0
ipfcst-common/ipfcst-common-security/src/main/java/com/jiayue/ipfcst/common/security/util/SecurityUtil.java

@@ -0,0 +1,27 @@
+package com.jiayue.ipfcst.common.security.util;
+
+import lombok.experimental.UtilityClass;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+/**
+ * SecurityUtil
+ *
+ * @author L.ym
+ * @version 3.0
+ **/
+@UtilityClass
+public class SecurityUtil {
+    /**
+     * 获取当前登录用户的账号名
+     *
+     * @param
+     * @return java.lang.String
+     * @author L.ym
+     * @date 2020/2/14
+     **/
+    public String getCurrentAccount() {
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+        return String.valueOf(authentication.getPrincipal());
+    }
+}

+ 2 - 0
ipfcst-common/ipfcst-common-security/src/main/resources/META-INF/spring.factories

@@ -0,0 +1,2 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+  com.jiayue.ipfcst.common.security.config.WebSecurityConfig

+ 23 - 0
ipfcst-common/pom.xml

@@ -0,0 +1,23 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.jiayue.focus</groupId>
+        <artifactId>focus</artifactId>
+        <version>3.0</version>
+    </parent>
+
+    <groupId>com.jiayue.focus</groupId>
+    <artifactId>ipfcst-common</artifactId>
+    <packaging>pom</packaging>
+
+    <description>focus 公共聚合模块</description>
+
+    <modules>
+        <module>ipfcst-common-bom</module>
+        <module>ipfcst-common-core</module>
+        <module>ipfcst-common-data</module>
+        <module>ipfcst-common-security</module>
+    </modules>
+</project>

+ 14 - 0
ipfcst-console/.editorconfig

@@ -0,0 +1,14 @@
+# http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false

+ 14 - 0
ipfcst-console/.env.development

@@ -0,0 +1,14 @@
+# just a flag
+ENV = 'development'
+
+# base api
+VUE_APP_BASE_API = '/dev-api'
+
+# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
+# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
+# It only does one thing by converting all import() to require().
+# This configuration can significantly increase the speed of hot updates,
+# when you have a large number of pages.
+# Detail:  https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
+
+VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 6 - 0
ipfcst-console/.env.production

@@ -0,0 +1,6 @@
+# just a flag
+ENV = 'production'
+
+# base api
+VUE_APP_BASE_API = '/'
+

+ 8 - 0
ipfcst-console/.env.staging

@@ -0,0 +1,8 @@
+NODE_ENV = production
+
+# just a flag
+ENV = 'staging'
+
+# base api
+VUE_APP_BASE_API = '/stage-api'
+

+ 4 - 0
ipfcst-console/.eslintignore

@@ -0,0 +1,4 @@
+build/*.js
+src/assets
+public
+dist

+ 198 - 0
ipfcst-console/.eslintrc.js

@@ -0,0 +1,198 @@
+module.exports = {
+  root: true,
+  parserOptions: {
+    parser: 'babel-eslint',
+    sourceType: 'module'
+  },
+  env: {
+    browser: true,
+    node: true,
+    es6: true,
+  },
+  extends: ['plugin:vue/recommended', 'eslint:recommended'],
+
+  // add your custom rules here
+  //it is base on https://github.com/vuejs/eslint-config-vue
+  rules: {
+    "vue/max-attributes-per-line": [2, {
+      "singleline": 10,
+      "multiline": {
+        "max": 1,
+        "allowFirstLine": false
+      }
+    }],
+    "vue/singleline-html-element-content-newline": "off",
+    "vue/multiline-html-element-content-newline":"off",
+    "vue/name-property-casing": ["error", "PascalCase"],
+    "vue/no-v-html": "off",
+    'accessor-pairs': 2,
+    'arrow-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'block-spacing': [2, 'always'],
+    'brace-style': [2, '1tbs', {
+      'allowSingleLine': true
+    }],
+    'camelcase': [0, {
+      'properties': 'always'
+    }],
+    'comma-dangle': [2, 'never'],
+    'comma-spacing': [2, {
+      'before': false,
+      'after': true
+    }],
+    'comma-style': [2, 'last'],
+    'constructor-super': 2,
+    'curly': [2, 'multi-line'],
+    'dot-location': [2, 'property'],
+    'eol-last': 2,
+    'eqeqeq': ["error", "always", {"null": "ignore"}],
+    'generator-star-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'handle-callback-err': [2, '^(err|error)$'],
+    'indent': [2, 2, {
+      'SwitchCase': 1
+    }],
+    'jsx-quotes': [2, 'prefer-single'],
+    'key-spacing': [2, {
+      'beforeColon': false,
+      'afterColon': true
+    }],
+    'keyword-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'new-cap': [2, {
+      'newIsCap': true,
+      'capIsNew': false
+    }],
+    'new-parens': 2,
+    'no-array-constructor': 2,
+    'no-caller': 2,
+    'no-console': 'off',
+    'no-class-assign': 2,
+    'no-cond-assign': 2,
+    'no-const-assign': 2,
+    'no-control-regex': 0,
+    'no-delete-var': 2,
+    'no-dupe-args': 2,
+    'no-dupe-class-members': 2,
+    'no-dupe-keys': 2,
+    'no-duplicate-case': 2,
+    'no-empty-character-class': 2,
+    'no-empty-pattern': 2,
+    'no-eval': 2,
+    'no-ex-assign': 2,
+    'no-extend-native': 2,
+    'no-extra-bind': 2,
+    'no-extra-boolean-cast': 2,
+    'no-extra-parens': [2, 'functions'],
+    'no-fallthrough': 2,
+    'no-floating-decimal': 2,
+    'no-func-assign': 2,
+    'no-implied-eval': 2,
+    'no-inner-declarations': [2, 'functions'],
+    'no-invalid-regexp': 2,
+    'no-irregular-whitespace': 2,
+    'no-iterator': 2,
+    'no-label-var': 2,
+    'no-labels': [2, {
+      'allowLoop': false,
+      'allowSwitch': false
+    }],
+    'no-lone-blocks': 2,
+    'no-mixed-spaces-and-tabs': 2,
+    'no-multi-spaces': 2,
+    'no-multi-str': 2,
+    'no-multiple-empty-lines': [2, {
+      'max': 1
+    }],
+    'no-native-reassign': 2,
+    'no-negated-in-lhs': 2,
+    'no-new-object': 2,
+    'no-new-require': 2,
+    'no-new-symbol': 2,
+    'no-new-wrappers': 2,
+    'no-obj-calls': 2,
+    'no-octal': 2,
+    'no-octal-escape': 2,
+    'no-path-concat': 2,
+    'no-proto': 2,
+    'no-redeclare': 2,
+    'no-regex-spaces': 2,
+    'no-return-assign': [2, 'except-parens'],
+    'no-self-assign': 2,
+    'no-self-compare': 2,
+    'no-sequences': 2,
+    'no-shadow-restricted-names': 2,
+    'no-spaced-func': 2,
+    'no-sparse-arrays': 2,
+    'no-this-before-super': 2,
+    'no-throw-literal': 2,
+    'no-trailing-spaces': 2,
+    'no-undef': 2,
+    'no-undef-init': 2,
+    'no-unexpected-multiline': 2,
+    'no-unmodified-loop-condition': 2,
+    'no-unneeded-ternary': [2, {
+      'defaultAssignment': false
+    }],
+    'no-unreachable': 2,
+    'no-unsafe-finally': 2,
+    'no-unused-vars': [2, {
+      'vars': 'all',
+      'args': 'none'
+    }],
+    'no-useless-call': 2,
+    'no-useless-computed-key': 2,
+    'no-useless-constructor': 2,
+    'no-useless-escape': 0,
+    'no-whitespace-before-property': 2,
+    'no-with': 2,
+    'one-var': [2, {
+      'initialized': 'never'
+    }],
+    'operator-linebreak': [2, 'after', {
+      'overrides': {
+        '?': 'before',
+        ':': 'before'
+      }
+    }],
+    'padded-blocks': [2, 'never'],
+    'quotes': [2, 'single', {
+      'avoidEscape': true,
+      'allowTemplateLiterals': true
+    }],
+    'semi': [2, 'never'],
+    'semi-spacing': [2, {
+      'before': false,
+      'after': true
+    }],
+    'space-before-blocks': [2, 'always'],
+    'space-before-function-paren': [2, 'never'],
+    'space-in-parens': [2, 'never'],
+    'space-infix-ops': 2,
+    'space-unary-ops': [2, {
+      'words': true,
+      'nonwords': false
+    }],
+    'spaced-comment': [2, 'always', {
+      'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
+    }],
+    'template-curly-spacing': [2, 'never'],
+    'use-isnan': 2,
+    'valid-typeof': 2,
+    'wrap-iife': [2, 'any'],
+    'yield-star-spacing': [2, 'both'],
+    'yoda': [2, 'never'],
+    'prefer-const': 2,
+    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
+    'object-curly-spacing': [2, 'always', {
+      objectsInObjects: false
+    }],
+    'array-bracket-spacing': [2, 'never']
+  }
+}

+ 17 - 0
ipfcst-console/.gitignore

@@ -0,0 +1,17 @@
+.DS_Store
+node_modules/
+dist/
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+package-lock.json
+tests/**/coverage/
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+/src/main/resources/static/

+ 5 - 0
ipfcst-console/.travis.yml

@@ -0,0 +1,5 @@
+language: node_js
+node_js: 10
+script: npm run test
+notifications:
+  email: false

+ 21 - 0
ipfcst-console/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017-present PanJiaChen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 98 - 0
ipfcst-console/README-zh.md

@@ -0,0 +1,98 @@
+# vue-admin-template
+
+> 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。
+
+[线上地址](http://panjiachen.github.io/vue-admin-template)
+
+[国内访问](https://panjiachen.gitee.io/vue-admin-template)
+
+目前版本为 `v4.0+` 基于 `vue-cli` 进行构建,若你想使用旧版本,可以切换分支到[tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0),它不依赖 `vue-cli`。
+
+## Extra
+
+如果你想要根据用户角色来动态生成侧边栏和 router,你可以使用该分支[permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control)
+
+## 相关项目
+
+- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
+
+- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
+
+- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template)
+
+- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
+
+写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目:
+
+- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2)
+- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac)
+- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35)
+- [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板,专门针对本项目的文章,算作是一篇文档)](https://juejin.im/post/595b4d776fb9a06bbe7dba56)
+- [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836)
+
+## Build Setup
+
+```bash
+# 克隆项目
+git clone https://github.com/PanJiaChen/vue-admin-template.git
+
+# 进入项目目录
+cd vue-admin-template
+
+# 安装依赖
+npm install
+
+# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
+npm install --registry=https://registry.npm.taobao.org
+
+# 启动服务
+npm run dev
+```
+
+浏览器访问 [http://localhost:9528](http://localhost:9528)
+
+## 发布
+
+```bash
+# 构建测试环境
+npm run build:stage
+
+# 构建生产环境
+npm run build:prod
+```
+
+## 其它
+
+```bash
+# 预览发布环境效果
+npm run preview
+
+# 预览发布环境效果 + 静态资源分析
+npm run preview -- --report
+
+# 代码格式检查
+npm run lint
+
+# 代码格式检查并自动修复
+npm run lint -- --fix
+```
+
+更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/zh/)
+
+## Demo
+
+![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif)
+
+## Browsers support
+
+Modern browsers and Internet Explorer 10+.
+
+| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
+| --------- | --------- | --------- | --------- |
+| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions
+
+## License
+
+[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license.
+
+Copyright (c) 2017-present PanJiaChen

+ 91 - 0
ipfcst-console/README.md

@@ -0,0 +1,91 @@
+# vue-admin-template
+
+English | [简体中文](./README-zh.md)
+
+> A minimal vue admin template with Element UI & axios & iconfont & permission control & lint
+
+**Live demo:** http://panjiachen.github.io/vue-admin-template
+
+
+**The current version is `v4.0+` build on `vue-cli`. If you want to use the old version , you can switch branch to [tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0), it does not rely on `vue-cli`**
+
+## Build Setup
+
+
+```bash
+# clone the project
+git clone https://github.com/PanJiaChen/vue-admin-template.git
+
+# enter the project directory
+cd vue-admin-template
+
+# install dependency
+npm install
+
+# develop
+npm run dev
+```
+
+This will automatically open http://localhost:9528
+
+## Build
+
+```bash
+# build for test environment
+npm run build:stage
+
+# build for production environment
+npm run build:prod
+```
+
+## Advanced
+
+```bash
+# preview the release environment effect
+npm run preview
+
+# preview the release environment effect + static resource analysis
+npm run preview -- --report
+
+# code format check
+npm run lint
+
+# code format check and auto fix
+npm run lint -- --fix
+```
+
+Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information
+
+## Demo
+
+![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif)
+
+## Extra
+
+If you want router permission && generate menu by user roles , you can use this branch [permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control)
+
+For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour))
+
+## Related Project
+
+- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
+
+- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
+
+- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template)
+
+- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
+
+## Browsers support
+
+Modern browsers and Internet Explorer 10+.
+
+| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
+| --------- | --------- | --------- | --------- |
+| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions
+
+## License
+
+[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license.
+
+Copyright (c) 2017-present PanJiaChen

+ 5 - 0
ipfcst-console/babel.config.js

@@ -0,0 +1,5 @@
+module.exports = {
+  presets: [
+    '@vue/app'
+  ]
+}

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů