From a160d838f9c0a79dfc2f18e7cd46bdd4faa59c6d Mon Sep 17 00:00:00 2001
From: yj <2077506045@qq.com>
Date: 星期四, 05 十二月 2024 11:21:50 +0800
Subject: [PATCH] add
---
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Range.java | 27 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/model/GatewayResponse.java | 19
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/GeneratorUtil.java | 45 ++
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/EmptyEnums.java | 22 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/SuperDTO.java | 19
dobbinfw-core/.gitignore | 28 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/BaseEnums.java | 76 +++
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceException.java | 47 ++
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/IdentityOwner.java | 14
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AppServiceException.java | 15
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ThirdPartServiceException.java | 17
dobbinfw-core/pom.xml | 86 ++++
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiEntity.java | 21 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParamType.java | 20
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpMethod.java | 34 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ISessionUtil.java | 28 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParam.java | 35 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/TextFormat.java | 41 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/CustomCheck.java | 27 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/build/AnnotationProcessor.java | 26 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/BizServiceException.java | 15
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/PermissionOwner.java | 16
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AdminServiceException.java | 20
dobbinfw-core/README.md | 40 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/ResultType.java | 13
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Validator.java | 16
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/Const.java | 49 ++
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/RateLimitType.java | 17
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiField.java | 26 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/CoreExceptionDefinition.java | 25 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ReflectUtil.java | 223 ++++++++++
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/NotNull.java | 23 +
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpOpenApi.java | 20
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceExceptionDefinition.java | 13
dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/SessionUtil.java | 83 +++
35 files changed, 1,246 insertions(+), 0 deletions(-)
diff --git a/dobbinfw-core/.gitignore b/dobbinfw-core/.gitignore
new file mode 100644
index 0000000..9f55144
--- /dev/null
+++ b/dobbinfw-core/.gitignore
@@ -0,0 +1,28 @@
+# Compiled class file
+*.class
+
+/target
+
+/.idea
+*.iml
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
diff --git a/dobbinfw-core/README.md b/dobbinfw-core/README.md
new file mode 100644
index 0000000..b59457e
--- /dev/null
+++ b/dobbinfw-core/README.md
@@ -0,0 +1,40 @@
+## Dobbin Framework Logo
+
+#### 涓�銆侀」鐩儗鏅�
+
+> 涓轰簡蹇�熻惤鍦伴」鐩�佸揩閫熸惌寤鸿剼鎵嬫灦锛宒obbinsoft寮�鍙戜竴濂楀熀浜嶴pringBoot MyBatis鐨勬鏋讹紝骞舵墜鎼撲簡濡傚弬鏁版牎楠屻�佹枃妗g敓鎴愩�侀檺娴併�侀壌鏉冪瓑绛夊父鐢ㄥ姛鑳姐�俢ore鍖呬腑鍖呮嫭宸ュ叿绫汇�佹敞瑙c�佹ā鍨嬬瓑銆�
+
+#### 浜屻�佸揩閫熷紑濮�
+
+##### 2.1. 涓嬭浇浠g爜
+
+鎮ㄥ彲浠ュ湪鍥藉唴寮�婧愮ぞ鍖篏itee涓嬭浇锛堟帹鑽愶級锛歨ttps://gitee.com/iotechn/dobbinfw-core
+
+鎮ㄥ彲浠ュ湪鍥介檯寮�婧愮ぞ鍖篏ithub涓嬭浇锛歨ttps://github.com/iotechn/dobbinfw-core
+
+##### 2.2. maven寮曞叆
+
+璇风‘瀹氭偍宸茬粡灏� JAVA_HOME 閰嶇疆锛屽苟灏唌vn鍛戒护閰嶇疆鍒癙ATH涓紝鑻ュ嚭鐜版壘涓嶅埌鍛戒护锛屾垨鎵句笉鍒癑AVA_HOME锛孾璇峰弬鑰冩鏂囨。](https://blog.csdn.net/weixin_44548718/article/details/108635409)
+
+鍦ㄩ」鐩牴鐩綍锛屾墦寮�鍛戒护琛屻�傚苟鎵ц 锛�
+
+```shell
+mvn install -Dmaven.test.skip=true
+```
+
+寮曞叆maven鍧愭爣鍒板伐绋媝om.xml鏂囦欢涓��
+
+```xml
+<groupId>com.dobbinsoft</groupId>
+<artifactId>fw-core</artifactId>
+<version>1.0-SNAPSHOT</version>
+```
+
+#### 涓夈�佸父瑙侀棶棰�
+
+##### 3.1. 涓轰綍鍒嗙core鍖咃紵
+
+閮ㄥ垎椤圭洰锛岄渶瑕佹媶鍒嗗井鏈嶅姟锛岃繖绫婚」鐩渶瑕佸皢鎺ュ彛鏆撮湶缁欏叾浠栧井鏈嶅姟绯荤粺锛岄�氬父鎻愪緵涓�涓猘pi鍖咃紝api鍖呬笉闇�瑕佸紩鍏ヨ繃閲嶄緷璧栵紝浣跨敤姝ゆ鏋跺垯鍙渶瑕佸紩鍏ore鍖呭嵆鍙��
+
+#### 鍥涖�佽础鐚� & 绀惧尯
+鎮ㄥ彲浠ョ洿鎺ュ湪浠撳簱涓彂甯働ull Request銆傛湰椤圭洰娆㈣繋鎵�鏈夊紑鍙戣�呬竴璧风淮鎶わ紝骞舵案涔呭紑婧愩��
\ No newline at end of file
diff --git a/dobbinfw-core/pom.xml b/dobbinfw-core/pom.xml
new file mode 100644
index 0000000..c825fe9
--- /dev/null
+++ b/dobbinfw-core/pom.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.dobbinsoft</groupId>
+ <artifactId>fw-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>8</source>
+ <target>8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <!-- 閰嶇疆缂栬瘧鏃朵繚鐣欏弬鏁板悕 -->
+ <configuration>
+ <debuglevel>lines,vars,source</debuglevel>
+ <compilerArgs>
+ <arg>-parameters</arg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <properties>
+ <java.version>1.8</java.version>
+ </properties>
+
+ <dependencies>
+
+ <!-- HuTool 宸ュ叿鍖� -->
+ <dependency>
+ <groupId>cn.hutool</groupId>
+ <artifactId>hutool-all</artifactId>
+ <version>5.6.0</version>
+ </dependency>
+
+ <!-- 闃块噷宸村反 json 瑙f瀽 -->
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ <version>1.2.76</version>
+ </dependency>
+
+ <!-- 鑵捐浜戠煭淇� -->
+ <dependency>
+ <groupId>com.github.qcloudsms</groupId>
+ <artifactId>qcloudsms</artifactId>
+ <version>1.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.aliyun</groupId>
+ <artifactId>aliyun-java-sdk-core</artifactId>
+ <version>4.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.4</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+ <distributionManagement>
+ <repository>
+ <id>rdc-snapshot</id>
+ <name>Aliyun Xiao</name>
+ <url>https://packages.aliyun.com/maven/repository/2084582-snapshot-Vrq4iK/</url>
+ </repository>
+ </distributionManagement>
+
+
+</project>
\ No newline at end of file
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/Const.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/Const.java
new file mode 100644
index 0000000..0974965
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/Const.java
@@ -0,0 +1,49 @@
+package com.dobbinsoft.fw.core;
+
+import java.util.*;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-08-11
+ * Time: 涓嬪崍11:43
+ */
+public class Const {
+
+ public static final Set<Class> IGNORE_PARAM_LIST = new HashSet<Class>();
+
+ static {
+ IGNORE_PARAM_LIST.add(boolean.class);
+ IGNORE_PARAM_LIST.add(byte.class);
+ IGNORE_PARAM_LIST.add(char.class);
+ IGNORE_PARAM_LIST.add(short.class);
+ IGNORE_PARAM_LIST.add(int.class);
+ IGNORE_PARAM_LIST.add(long.class);
+ IGNORE_PARAM_LIST.add(float.class);
+ IGNORE_PARAM_LIST.add(double.class);
+ IGNORE_PARAM_LIST.add(Byte.class);
+ IGNORE_PARAM_LIST.add(Character.class);
+ IGNORE_PARAM_LIST.add(Short.class);
+ IGNORE_PARAM_LIST.add(Integer.class);
+ IGNORE_PARAM_LIST.add(Long.class);
+ IGNORE_PARAM_LIST.add(String.class);
+ IGNORE_PARAM_LIST.add(Float.class);
+ IGNORE_PARAM_LIST.add(Double.class);
+ IGNORE_PARAM_LIST.add(Boolean.class);
+ }
+
+ public static final int CACHE_ONE_DAY = 60 * 60 * 24;
+
+ public static final int CACHE_ONE_YEAR = 60 * 60 * 24 * 365;
+
+
+ public static final String USER_ACCESS_TOKEN = "ACCESSTOKEN";
+
+ public static final String USER_REDIS_PREFIX = "USER_SESSION_";
+
+ public static final String ADMIN_ACCESS_TOKEN = "ADMINTOKEN";
+
+ public static final String ADMIN_REDIS_PREFIX = "ADMIN_SESSION_";
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpMethod.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpMethod.java
new file mode 100644
index 0000000..a8b9466
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpMethod.java
@@ -0,0 +1,34 @@
+package com.dobbinsoft.fw.core.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-03-25
+ * Time: 涓嬪崍1:12
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HttpMethod {
+ String description();
+ ResultType type() default ResultType.COMMONS;
+ RateLimitType rateLimit() default RateLimitType.NONE;
+ int rateWindow() default 60;
+ int rate() default 1;
+ String retName() default "";
+ int maxAge() default -1;
+ String permission() default "";
+ String permissionParentName() default "";
+ String permissionName() default "";
+ boolean openPlatform() default false;
+ /**
+ * 浠庣綉鍏充笂鏋勫缓涓�涓疄渚�
+ * @return
+ */
+ Class loadBean() default void.class;
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpOpenApi.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpOpenApi.java
new file mode 100644
index 0000000..047f9be
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpOpenApi.java
@@ -0,0 +1,20 @@
+package com.dobbinsoft.fw.core.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-03-25
+ * Time: 涓嬪崍1:12
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HttpOpenApi {
+ String group();
+ String description();
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParam.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParam.java
new file mode 100644
index 0000000..8501260
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParam.java
@@ -0,0 +1,35 @@
+package com.dobbinsoft.fw.core.annotation;
+
+import com.dobbinsoft.fw.core.enums.BaseEnums;
+import com.dobbinsoft.fw.core.enums.EmptyEnums;
+
+import java.lang.annotation.*;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-03-25
+ * Time: 涓嬪崍1:12
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HttpParam {
+
+ String name();
+
+ HttpParamType type() default HttpParamType.COMMON;
+
+ String description() default "";
+
+ String valueDef() default "";
+
+ Class arrayClass() default Object.class;
+
+ /**
+ * 缁戝畾鏋氫妇
+ * @return
+ */
+ Class<? extends BaseEnums> enums() default EmptyEnums.class;
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParamType.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParamType.java
new file mode 100644
index 0000000..4f9dc08
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/HttpParamType.java
@@ -0,0 +1,20 @@
+package com.dobbinsoft.fw.core.annotation;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-03-25
+ * Time: 涓嬪崍1:12
+ */
+
+public enum HttpParamType {
+ HEADER,
+ COMMON,
+ USER_ID,
+ ADMIN_ID,
+ IP,
+ FILE
+ ;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/RateLimitType.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/RateLimitType.java
new file mode 100644
index 0000000..f19370f
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/RateLimitType.java
@@ -0,0 +1,17 @@
+package com.dobbinsoft.fw.core.annotation;
+
+/**
+ * ClassName: RateLimitType
+ * Description: TODO
+ *
+ * @author: e-weichaozheng
+ * @date: 2021-04-12
+ */
+public enum RateLimitType {
+
+ USER_ID,
+ IP,
+ ALL,
+ NONE
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/ResultType.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/ResultType.java
new file mode 100644
index 0000000..5abb9af
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/ResultType.java
@@ -0,0 +1,13 @@
+package com.dobbinsoft.fw.core.annotation;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-08-24
+ * Time: 涓嬪崍5:03
+ */
+public enum ResultType {
+ COMMONS,
+ COOKIE;
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiEntity.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiEntity.java
new file mode 100644
index 0000000..a312f46
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiEntity.java
@@ -0,0 +1,21 @@
+package com.dobbinsoft.fw.core.annotation.doc;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description: 鎻忚堪瀹炰綋
+ * User: rize
+ * Date: 2021-03-17
+ * Time: 涓婂崍9:15
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ApiEntity {
+
+ String description();
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiField.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiField.java
new file mode 100644
index 0000000..248f080
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/doc/ApiField.java
@@ -0,0 +1,26 @@
+package com.dobbinsoft.fw.core.annotation.doc;
+
+import com.dobbinsoft.fw.core.enums.BaseEnums;
+import com.dobbinsoft.fw.core.enums.EmptyEnums;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description: 鎻忚堪瀹炰綋灞炴��
+ * User: rize
+ * Date: 2021-03-17
+ * Time: 涓婂崍9:15
+ */
+@Target({ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ApiField {
+
+ String description();
+
+ Class<? extends BaseEnums> enums() default EmptyEnums.class;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/CustomCheck.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/CustomCheck.java
new file mode 100644
index 0000000..42a6808
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/CustomCheck.java
@@ -0,0 +1,27 @@
+package com.dobbinsoft.fw.core.annotation.param;
+
+import java.lang.annotation.*;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description: 鑷畾涔夊弬鏁版牎楠�
+ * User: rize
+ * Date: 2021-03-17
+ * Time: 涓婂崍9:15
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.PARAMETER, ElementType.FIELD})
+@Documented
+public @interface CustomCheck {
+
+ /**
+ * 鏍¢獙鍣–lass瀵硅薄锛屼細浠嶪oC涓嬁鍙�
+ * @return
+ */
+ Class beanClass();
+
+ boolean reqScope() default true;
+
+ boolean respScope() default false;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/NotNull.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/NotNull.java
new file mode 100644
index 0000000..acc0ad0
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/NotNull.java
@@ -0,0 +1,23 @@
+package com.dobbinsoft.fw.core.annotation.param;
+
+import java.lang.annotation.*;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-08-20
+ * Time: 涓婂崍10:51
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.PARAMETER, ElementType.FIELD})
+@Documented
+public @interface NotNull {
+
+ String message() default "";
+
+ boolean reqScope() default true;
+
+ boolean respScope() default false;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Range.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Range.java
new file mode 100644
index 0000000..f17b6ac
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Range.java
@@ -0,0 +1,27 @@
+package com.dobbinsoft.fw.core.annotation.param;
+
+import java.lang.annotation.*;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-08-20
+ * Time: 涓婂崍11:11
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.PARAMETER, ElementType.FIELD})
+@Documented
+public @interface Range {
+
+ long min() default Long.MIN_VALUE;
+
+ long max() default Long.MAX_VALUE;
+
+ String message() default "";
+
+ boolean reqScope() default true;
+
+ boolean respScope() default false;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/TextFormat.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/TextFormat.java
new file mode 100644
index 0000000..566b412
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/TextFormat.java
@@ -0,0 +1,41 @@
+package com.dobbinsoft.fw.core.annotation.param;
+
+import java.lang.annotation.*;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-08-20
+ * Time: 涓婂崍10:51
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.PARAMETER, ElementType.FIELD})
+@Documented
+public @interface TextFormat {
+
+ String regex() default "";
+
+ String[] contains() default {};
+
+ String[] notContains() default {};
+
+ String startWith() default "";
+
+ String endsWith() default "";
+
+ int lengthMax() default Integer.MAX_VALUE;
+
+ int lengthMin() default 0;
+
+ int length() default -1;
+
+ boolean notChinese() default false;
+
+ String message() default "";
+
+ boolean reqScope() default true;
+
+ boolean respScope() default false;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Validator.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Validator.java
new file mode 100644
index 0000000..8b8d01b
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/annotation/param/Validator.java
@@ -0,0 +1,16 @@
+package com.dobbinsoft.fw.core.annotation.param;
+
+import com.dobbinsoft.fw.core.exception.ServiceException;
+
+/**
+ * ClassName: Validator
+ * Description: 鏍¢獙鍣�
+ *
+ * @author: e-weichaozheng
+ * @date: 2021-03-17
+ */
+public interface Validator<T> {
+
+ public boolean check(T param) throws ServiceException;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/build/AnnotationProcessor.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/build/AnnotationProcessor.java
new file mode 100644
index 0000000..e2dca38
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/build/AnnotationProcessor.java
@@ -0,0 +1,26 @@
+package com.dobbinsoft.fw.core.build;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+import java.util.Set;
+
+/**
+ * Description:
+ * User: rize
+ * Date: 2021/4/4
+ * Time: 13:57
+ */
+@SupportedAnnotationTypes(value = {"com.dobbinsoft.fw.support.annotation.Table"})
+@SupportedSourceVersion(value = SourceVersion.RELEASE_8)
+public class AnnotationProcessor extends AbstractProcessor {
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+
+ return true;
+ }
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/SuperDTO.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/SuperDTO.java
new file mode 100644
index 0000000..f7930a7
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/SuperDTO.java
@@ -0,0 +1,19 @@
+package com.dobbinsoft.fw.core.entiy;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Created by rize on 2019/7/1.
+ */
+@Data
+public class SuperDTO {
+
+ private Long id;
+
+ private Date gmtUpdate;
+
+ private Date gmtCreate;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/IdentityOwner.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/IdentityOwner.java
new file mode 100644
index 0000000..c363492
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/IdentityOwner.java
@@ -0,0 +1,14 @@
+package com.dobbinsoft.fw.core.entiy.inter;
+
+/**
+ * ClassName: IdentityOwner
+ * Description: 鏈夎韩浠界殑
+ *
+ * @author: e-weichaozheng
+ * @date: 2021-03-17
+ */
+public interface IdentityOwner {
+
+ public Long getId();
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/PermissionOwner.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/PermissionOwner.java
new file mode 100644
index 0000000..816f7dd
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/entiy/inter/PermissionOwner.java
@@ -0,0 +1,16 @@
+package com.dobbinsoft.fw.core.entiy.inter;
+
+import java.util.List;
+
+/**
+ * ClassName: PermissionOwner
+ * Description: 琛ㄧず涓�涓湁鏉冮檺鐨勮韩浠�
+ *
+ * @author: e-weichaozheng
+ * @date: 2021-03-16
+ */
+public interface PermissionOwner extends IdentityOwner {
+
+ public List<String> getPerms();
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/BaseEnums.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/BaseEnums.java
new file mode 100644
index 0000000..36a3193
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/BaseEnums.java
@@ -0,0 +1,76 @@
+package com.dobbinsoft.fw.core.enums;
+
+import cn.hutool.core.util.StrUtil;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: BaseEnums
+ * Description: TODO
+ *
+ * @author: e-weichaozheng
+ * @date: 2021-03-19
+ */
+public interface BaseEnums<T extends Serializable> {
+
+ public Serializable getCode();
+
+ public String getMsg();
+
+ public static <T extends Serializable> BaseEnums getByCode(T t, Class<? extends BaseEnums<T>> clazz) {
+ BaseEnums<T>[] enumConstants = clazz.getEnumConstants();
+ for (BaseEnums baseEnums : enumConstants) {
+ if (baseEnums.getCode().equals(t)) {
+ return baseEnums;
+ }
+ }
+ return null;
+ }
+
+ public static <T extends Serializable> String getMsgByCode(T t, Class<? extends BaseEnums<T>> clazz) {
+ BaseEnums baseEnums = getByCode(t, clazz);
+ if (baseEnums == null) {
+ return null;
+ }
+ return baseEnums.getMsg();
+ }
+
+ /**
+ * 鑾峰彇鍓嶇鏍煎紡鍖栭渶瑕佺殑MAP
+ * @return
+ */
+ public default String getMap() {
+ Class<? extends BaseEnums> clazz = this.getClass();
+ BaseEnums[] enumConstants = clazz.getEnumConstants();
+ StringBuilder sb = new StringBuilder();
+ sb.append("const ");
+ sb.append(StrUtil.lowerFirst(clazz.getSimpleName()));
+ sb.append("Map = {\n");
+
+ for (int i = 0; i < enumConstants.length; i++) {
+ sb.append(" ");
+ sb.append(enumConstants[i].getCode());
+ sb.append(": '");
+ sb.append(enumConstants[i].getMsg());
+ if (i == enumConstants.length -1) {
+ sb.append("'\n}");
+ } else {
+ sb.append("',\n");
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 鑾峰彇鍓嶇鏍煎紡鍖栭渶瑕佺殑杩囨护鍣�
+ * @return
+ */
+ public default String getFilter() {
+ Class<? extends BaseEnums> clazz = this.getClass();
+ return
+ " " + StrUtil.lowerFirst(clazz.getSimpleName()) + "Filter(status) {\n" +
+ " return " + StrUtil.lowerFirst(clazz.getSimpleName()) + "Map[status]\n" +
+ " }";
+ }
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/EmptyEnums.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/EmptyEnums.java
new file mode 100644
index 0000000..ca52b58
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/enums/EmptyEnums.java
@@ -0,0 +1,22 @@
+package com.dobbinsoft.fw.core.enums;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: EmptyEnums
+ * Description: TODO
+ *
+ * @author: e-weichaozheng
+ * @date: 2021-03-19
+ */
+public enum EmptyEnums implements BaseEnums<Integer> {
+ ;
+
+ public Integer getCode() {
+ return 0;
+ }
+
+ public String getMsg() {
+ return null;
+ }
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AdminServiceException.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AdminServiceException.java
new file mode 100644
index 0000000..be10bdf
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AdminServiceException.java
@@ -0,0 +1,20 @@
+package com.dobbinsoft.fw.core.exception;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: kbq
+ * Date: 2019-07-07
+ * Time: 涓嬪崍4:21
+ */
+public class AdminServiceException extends ServiceException {
+
+ public AdminServiceException(ServiceExceptionDefinition definition) {
+ super(definition);
+ }
+
+ public AdminServiceException(String message, int code) {
+ super(message,code);
+ }
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AppServiceException.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AppServiceException.java
new file mode 100644
index 0000000..cd870b1
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/AppServiceException.java
@@ -0,0 +1,15 @@
+package com.dobbinsoft.fw.core.exception;
+
+/**
+ * Created by rize on 2019/7/1.
+ */
+public class AppServiceException extends ServiceException {
+
+ public AppServiceException(ServiceExceptionDefinition definition) {
+ super(definition);
+ }
+
+ public AppServiceException(String message, int code) {
+ super(message,code);
+ }
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/BizServiceException.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/BizServiceException.java
new file mode 100644
index 0000000..5315077
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/BizServiceException.java
@@ -0,0 +1,15 @@
+package com.dobbinsoft.fw.core.exception;
+
+/**
+ * Created by rize on 2019/7/1.
+ */
+public class BizServiceException extends ServiceException {
+
+ public BizServiceException(ServiceExceptionDefinition definition) {
+ super(definition);
+ }
+
+ public BizServiceException(String message, int code) {
+ super(message,code);
+ }
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/CoreExceptionDefinition.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/CoreExceptionDefinition.java
new file mode 100644
index 0000000..e0ccd23
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/CoreExceptionDefinition.java
@@ -0,0 +1,25 @@
+package com.dobbinsoft.fw.core.exception;
+
+/**
+ * Created by rize on 2019/7/1.
+ */
+public class CoreExceptionDefinition {
+
+ public static final ServiceExceptionDefinition THIRD_PART_SERVICE_EXCEPTION =
+ new ServiceExceptionDefinition(0, "绗笁鏂规湇鍔″紓甯�");
+
+ public static final ServiceExceptionDefinition THIRD_PART_IO_EXCEPTION =
+ new ServiceExceptionDefinition(0, "绗笁鏂规湇鍔$綉缁滃紓甯�");
+
+ public static ServiceExceptionDefinition buildVariableException(ServiceExceptionDefinition definition, String ...args) {
+ String msg = definition.getMsg();
+ for (int i = 0; i < args.length; i++) {
+ msg = msg.replace("${" + i + "}", args[i]);
+ }
+ return new ServiceExceptionDefinition(definition.getCode(), msg);
+ }
+
+
+
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceException.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceException.java
new file mode 100644
index 0000000..d4fc41d
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceException.java
@@ -0,0 +1,47 @@
+package com.dobbinsoft.fw.core.exception;
+
+import java.io.Serializable;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2019-01-31
+ * Time: 涓嬪崍8:07
+ */
+public abstract class ServiceException extends Exception implements Serializable {
+
+ private int code;
+
+ private Object attach;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public Object getAttach() {
+ return attach;
+ }
+
+ public ServiceException() {
+ }
+
+ public ServiceException(String message, int code) {
+ super(message);
+ this.code = code;
+ }
+
+ public ServiceException(ServiceExceptionDefinition definition) {
+ super(definition.getMsg());
+ this.code = definition.getCode();
+ }
+
+ public ServiceException attach(Object attach) {
+ this.attach = attach;
+ return this;
+ }
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceExceptionDefinition.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceExceptionDefinition.java
new file mode 100644
index 0000000..a1e9bb3
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ServiceExceptionDefinition.java
@@ -0,0 +1,13 @@
+package com.dobbinsoft.fw.core.exception;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ServiceExceptionDefinition {
+ private int code;
+ private String msg;
+}
\ No newline at end of file
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ThirdPartServiceException.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ThirdPartServiceException.java
new file mode 100644
index 0000000..cc4a6d2
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/exception/ThirdPartServiceException.java
@@ -0,0 +1,17 @@
+package com.dobbinsoft.fw.core.exception;
+
+/**
+ * 绗笁鏂规帴鍙f湇鍔″紓甯�
+ * Created by rize on 2019/7/3.
+ */
+public class ThirdPartServiceException extends ServiceException {
+
+ public ThirdPartServiceException(ServiceExceptionDefinition definition) {
+ super(definition);
+ }
+
+ public ThirdPartServiceException(String message, int code) {
+ super(message, code);
+ }
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/model/GatewayResponse.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/model/GatewayResponse.java
new file mode 100644
index 0000000..b1c12a5
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/model/GatewayResponse.java
@@ -0,0 +1,19 @@
+package com.dobbinsoft.fw.core.model;
+
+import lombok.Data;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Description:
+ * User: rize
+ * Date: 2018-08-12
+ * Time: 涓婂崍10:35
+ */
+@Data
+public class GatewayResponse<T> {
+ private int errno;
+ private String errmsg;
+ private T data;
+ private long timestamp;
+}
+
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/GeneratorUtil.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/GeneratorUtil.java
new file mode 100644
index 0000000..84d0e89
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/GeneratorUtil.java
@@ -0,0 +1,45 @@
+package com.dobbinsoft.fw.core.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Created by rize on 2019/7/1.
+ */
+public class GeneratorUtil {
+
+ private static AtomicInteger orderIdCount = new AtomicInteger();
+
+ private static final SimpleDateFormat ORDER_ID_FORMAT = new SimpleDateFormat("yyyyMMHHmmss");
+
+ public static final String genSalt() {
+ return genUUId().substring(0, 7);
+ }
+
+ public static String genSixVerifyCode() {
+ String time = System.nanoTime() + "";
+ return time.substring(time.length() - 6);
+ }
+
+ public static String genSessionId() {
+ return UUID.randomUUID().toString().replace("-","").toUpperCase();
+ }
+
+
+ public static String genOrderId(String machineNo, String env) {
+ int i = orderIdCount.incrementAndGet() % 1000;
+ if (i < 1000)
+ i += 1000;
+ return env + machineNo + ORDER_ID_FORMAT.format(new Date()) + i;
+ }
+
+ public static String genFileName(){
+ return UUID.randomUUID().toString().replaceAll("-", "");
+ }
+
+ public static String genUUId() {
+ return UUID.randomUUID().toString().replace("-", "");
+ }
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ISessionUtil.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ISessionUtil.java
new file mode 100644
index 0000000..5aa94e3
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ISessionUtil.java
@@ -0,0 +1,28 @@
+package com.dobbinsoft.fw.core.util;
+
+import com.dobbinsoft.fw.core.entiy.inter.IdentityOwner;
+import com.dobbinsoft.fw.core.entiy.inter.PermissionOwner;
+import com.dobbinsoft.fw.core.exception.ServiceException;
+
+import java.util.List;
+
+/**
+ * Session 鐩稿叧鎶藉彇鎺ュ彛
+ */
+public interface ISessionUtil<U extends IdentityOwner, A extends PermissionOwner> {
+
+ public void setUser(U userDTO);
+
+ public U getUser();
+
+ public void setAdmin(A adminDTO);
+
+ public A getAdmin();
+
+ public Class<U> getUserClass();
+
+ public Class<A> getAdminClass();
+
+ public boolean hasPerm(String permission) throws ServiceException;
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ReflectUtil.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ReflectUtil.java
new file mode 100644
index 0000000..dca4a05
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/ReflectUtil.java
@@ -0,0 +1,223 @@
+package com.dobbinsoft.fw.core.util;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * Description:
+ * User: rize
+ * Date: 2020/8/15
+ * Time: 11:01
+ */
+public class ReflectUtil {
+
+ /**
+ * 閫氳繃Getter鏂规硶鍚嶇О鑾峰彇灞炴��
+ * @param getterName
+ * @return
+ */
+ public static String getField(String getterName) {
+ char[] dst = new char[getterName.length() - 3];
+ getterName.getChars(3, getterName.length(), dst, 0);
+ if ('A' <= dst[0] && 'Z' >= dst[0]) {
+ dst[0] = (char) (dst[0] + 32);
+ }
+ return new String(dst);
+ }
+
+ /**
+ * 閫氳繃灞炴�у悕鑾峰彇 Getter 鎴� Setter
+ * @param fieldName
+ * @param prefix "get" | "set"
+ * @return
+ */
+ public static String getMethodName(String fieldName, String prefix) {
+ char[] dst = new char[fieldName.length() + 3];
+ // 1. 灏唒refix鎼炶繘鍘�
+ prefix.getChars(0, 3, dst, 0);
+ // 2. 璺熼殢鑰冭繘鍘�
+ fieldName.getChars(0, fieldName.length(), dst, 3);
+ if ('a' <= dst[3] && 'z' >= dst[3]) {
+ dst[3] = (char) (dst[3] - 32);
+ }
+ return new String(dst);
+ }
+
+ /**
+ * 鍔犺浇鍖呭瓧鑺傜爜
+ * @return
+ */
+ public static Map<String, byte[]> loadPackageBytes(String basePackage, boolean subPackage, boolean isInterface) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ String fsBasePackage = basePackage.replace(".","/");
+ Map<String, byte[]> map = new HashMap<>();
+ try {
+ Enumeration<URL> resources = classLoader.getResources(fsBasePackage);
+ while(resources.hasMoreElements()) {
+ //鍏堣幏寰楁湰绫荤殑鎵�鍦ㄤ綅缃�
+ URL url = resources.nextElement();
+ //url.getProtocol()鏄幏鍙朥RL鐨凥TTP鍗忚銆�
+ if(url.getProtocol().equals("jar")) {
+ //鍒ゆ柇鏄笉鏄痡ar鍖�
+ JarURLConnection urlConnection = (JarURLConnection) url.openConnection();
+ JarFile jarfile = urlConnection.getJarFile();
+ Enumeration<JarEntry> jarEntries = jarfile.entries();
+ while(jarEntries.hasMoreElements()) {
+ JarEntry jarEntry = jarEntries.nextElement();
+ String jarName = jarEntry.getName();
+ if(!jarName.endsWith(".class")) {
+ continue;
+ }
+ String className = jarName.replace(".class", "").replaceAll("/", ".");
+ if (!className.startsWith(basePackage)) {
+ continue;
+ }
+ if (!subPackage) {
+ if (!className.substring(0, className.lastIndexOf(".")).equals(basePackage)) {
+ continue;
+ }
+ }
+ if (checkClassType(isInterface, className)) {
+ continue;
+ }
+ InputStream inputStream = null;
+ try {
+ String newUrl = url.toString().substring(0, url.toString().lastIndexOf("!") + 2) + jarName;
+ URL classUrl = new URL(newUrl);
+ URLConnection classUrlConnection = classUrl.openConnection();
+ inputStream = classUrlConnection.getInputStream();
+ byte[] bytes = IoUtil.readBytes(inputStream);
+ map.put(className, bytes);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ }
+ }
+ } else if (url.getProtocol().equals("file")) {
+ // 鏂囦欢绯荤粺锛岃繖鏄湪寮�鍙戠殑鏃跺�欎細鐢ㄥ埌
+ // file:/D:/develop/workspace/ideawork/unierp/unierp-data/target/classes/com/dobbinsoft/unierp/data/dto
+ Map<String, File> classNameFileMap = getClassNameFileMap(new HashMap<>(), new File(url.getFile()), basePackage, subPackage);
+ for (String className : classNameFileMap.keySet()) {
+ if (checkClassType(isInterface, className)) {
+ continue;
+ }
+ InputStream inputStream = null;
+ try {
+ File file = classNameFileMap.get(className);
+ inputStream = new FileInputStream(file);
+ byte[] bytes = IoUtil.readBytes(inputStream);
+ map.put(className, bytes);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ }
+ }
+ } else {
+ throw new RuntimeException("涓嶆敮鎸佹湰鍖呭璞★紝璇蜂笉瑕佸皢鎺ュ彛鍜屽疄浣撴斁鍏ュ惎鍔ㄥ櫒涓�");
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return map;
+ }
+
+ private static boolean checkClassType(boolean isInterface, String className) {
+ try {
+ Class<?> klass = Class.forName(className);
+ if (klass.isAnnotation()
+ || klass.isEnum()
+ || klass.isPrimitive()) {
+ return true;
+ }
+ if (isInterface && !klass.isInterface()) {
+ return true;
+ } else if (!isInterface && klass.isInterface()) {
+ return true;
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ throw new RuntimeException("鏈壘鍒扮被锛�" + className);
+ }
+ return false;
+ }
+
+ /**
+ * 閫掑綊鑾峰彇baseDir涓嬬殑绫讳笌鏂囦欢鏄犲皠
+ * @param map
+ * @param baseDir
+ * @return
+ */
+ private static Map<String, File> getClassNameFileMap(Map<String, File> map, File baseDir, String basePackage, boolean subPackage) {
+ if (baseDir == null || !baseDir.isDirectory()) {
+ return map;
+ }
+ File[] files = baseDir.listFiles();
+ for (File file : files) {
+ if (file.isDirectory() && subPackage) {
+ // 涓嶈繖涔堝啓 true idea 鎶ラ粍锛岀湅鐫�鑳�鐪肩潧
+ getClassNameFileMap(map, file, basePackage, true);
+ } else if (file.getName().endsWith("class")) {
+ // 鍏煎 Windows
+ String rawPackage = baseDir.toString().replace("\\", ".").replace("/", ".");
+ String className = rawPackage.substring(rawPackage.indexOf(basePackage)) + "." + file.getName().replace(".class", "");
+ map.put(className, file);
+ }
+ }
+ return map;
+ }
+
+
+ /**
+ * 娓呯悊鎺夊璞$殑绌轰覆灞炴��
+ * @param object
+ */
+ public static void clearEmptyString(Object object) {
+ try {
+ Class<?> clazz = object.getClass();
+ Field[] fields = clazz.getFields();
+ for (Field field : fields) {
+ String getter = getMethodName(field.getName(), "get");
+ Method getterMethod = clazz.getMethod(getter);
+ if (getterMethod != null) {
+ Object res = getterMethod.invoke(object);
+ if (res != null && res instanceof String) {
+ // 鑻ユ槸杩斿洖String
+ if (!"".equals(res)) {
+ //璁剧疆涓虹┖
+ String setter = getMethodName(field.getName(), "set");
+ Method setterMethod = clazz.getMethod(setter);
+ if (setterMethod != null) {
+ setterMethod.invoke(object, null);
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/SessionUtil.java b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/SessionUtil.java
new file mode 100644
index 0000000..fec8a06
--- /dev/null
+++ b/dobbinfw-core/src/main/java/com/dobbinsoft/fw/core/util/SessionUtil.java
@@ -0,0 +1,83 @@
+package com.dobbinsoft.fw.core.util;
+
+
+
+import com.dobbinsoft.fw.core.entiy.inter.IdentityOwner;
+import com.dobbinsoft.fw.core.entiy.inter.PermissionOwner;
+import com.dobbinsoft.fw.core.exception.ServiceException;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.List;
+
+/**
+ * Created by rize on 2019/2/27.
+ * Edit by rize on 2021/3/16.
+ */
+public class SessionUtil<U extends IdentityOwner, A extends PermissionOwner> implements ISessionUtil<U, A> {
+
+ private ThreadLocal<U> userLocal = new ThreadLocal<U>();
+
+ private ThreadLocal<A> adminLocal = new ThreadLocal<A>();
+
+ private Class<U> userClass;
+
+ private Class<A> adminClass;
+
+ public SessionUtil(Class<U> userClass, Class<A> adminClass) {
+ this.userClass = userClass;
+ this.adminClass = adminClass;
+ }
+
+ public void setUser(U userDTO) {
+ userLocal.set(userDTO);
+ }
+
+ public U getUser() {
+ return userLocal.get();
+ }
+
+ public void setAdmin(A adminDTO) {
+ adminLocal.set(adminDTO);
+ }
+
+ public A getAdmin() {
+ return adminLocal.get();
+ }
+
+ public Class<U> getUserClass() {
+ return this.userClass;
+ }
+
+ public Class<A> getAdminClass() {
+ return this.adminClass;
+ }
+
+ public boolean hasPerm(String permission) throws ServiceException {
+ //鎷ユ湁鐨勬潈闄�
+ List<String> perms = getAdmin().getPerms();
+ boolean hasPerm = false;
+ //鐩爣鍖归厤鏉冮檺
+ String[] permissions = permission.split(":");
+ outer : for(String item : perms) {
+ //鎷ユ湁鐨勬潈闄愮偣
+ String[] hasPer = item.split(":");
+ inner : for (int i = 0; i < permissions.length; i++) {
+ if ("*".equals(hasPer[i])) {
+ hasPerm = true;
+ break outer;
+ } else if (hasPer[i].equals(permissions[i])){
+ //姝ゅ眰鍚堟牸
+ if (i == permissions.length - 1) {
+ //鑻ユ槸鐩爣灞傜殑鏈�鍚庝竴灞傘�傚垯琛ㄧず鎵�鏈夊眰鏍¢獙閫氳繃
+ hasPerm = true;
+ }
+ } else {
+ break inner;
+ }
+ }
+ }
+ return hasPerm;
+ }
+
+}
--
Gitblit v1.9.1