From 3a4c6b8ec017218f18b0fb29b1ad817ba23f65d8 Mon Sep 17 00:00:00 2001 From: jiangzeyin Date: Sat, 20 Jan 2018 15:10:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=9A=84pom=20=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ch_qos_logback_logback_classic_1_1_11.xml} | 8 +- ...n__ch_qos_logback_logback_core_1_1_11.xml} | 8 +- ...Maven__cn_jiangzeyin_common_boot_1_1_6.xml | 13 ++ ...Maven__cn_jiangzeyin_simple_util_1_0_4.xml | 13 ++ ...=> Maven__com_alibaba_fastjson_1_2_40.xml} | 8 +- ...ackson_core_jackson_annotations_2_8_8.xml} | 8 +- ...erxml_jackson_core_jackson_core_2_8_8.xml} | 8 +- ...l_jackson_core_jackson_databind_2_8_8.xml} | 8 +- ...tomcat_embed_tomcat_embed_core_8_5_15.xml} | 8 +- ...e_tomcat_embed_tomcat_embed_el_8_5_15.xml} | 8 +- ...t_embed_tomcat_embed_websocket_8_5_15.xml} | 8 +- ...ven__org_aspectj_aspectjweaver_1_8_10.xml} | 8 +- ...rnate_hibernate_validator_5_2_5_Final.xml} | 8 +- ...oss_logging_jboss_logging_3_3_1_Final.xml} | 8 +- ...aven__org_slf4j_jcl_over_slf4j_1_7_25.xml} | 8 +- ... Maven__org_slf4j_jul_to_slf4j_1_7_25.xml} | 8 +- ...en__org_slf4j_log4j_over_slf4j_1_7_25.xml} | 8 +- ... => Maven__org_slf4j_slf4j_api_1_7_25.xml} | 8 +- ...mework_boot_spring_boot_1_4_7_RELEASE.xml} | 8 +- ...ring_boot_autoconfigure_1_4_7_RELEASE.xml} | 8 +- ...oot_spring_boot_starter_1_4_7_RELEASE.xml} | 8 +- ...spring_boot_starter_aop_1_4_7_RELEASE.xml} | 8 +- ...ng_boot_starter_logging_1_4_7_RELEASE.xml} | 8 +- ...ing_boot_starter_tomcat_1_4_7_RELEASE.xml} | 8 +- ...ng_boot_starter_velocity_1_4_2_RELEASE.xml | 13 -- ...ng_boot_starter_velocity_1_4_7_RELEASE.xml | 13 ++ ...spring_boot_starter_web_1_4_7_RELEASE.xml} | 8 +- ...g_boot_starter_websocket_1_4_2_RELEASE.xml | 13 -- ...g_boot_starter_websocket_1_4_7_RELEASE.xml | 13 ++ ...ingframework_spring_aop_4_3_9_RELEASE.xml} | 8 +- ...gframework_spring_beans_4_3_9_RELEASE.xml} | 8 +- ...ramework_spring_context_4_3_9_RELEASE.xml} | 8 +- ..._spring_context_support_4_3_9_RELEASE.xml} | 8 +- ...ngframework_spring_core_4_3_9_RELEASE.xml} | 8 +- ...ework_spring_expression_4_3_9_RELEASE.xml} | 8 +- ...mework_spring_messaging_4_3_9_RELEASE.xml} | 8 +- ...ingframework_spring_web_4_3_9_RELEASE.xml} | 8 +- ...framework_spring_webmvc_4_3_9_RELEASE.xml} | 8 +- ...mework_spring_websocket_4_3_9_RELEASE.xml} | 8 +- boot-line/data/user.json | 2 +- pom.xml | 12 +- .../cn/jiangzeyin/BootOnLineApplication.java | 16 +- .../cn/jiangzeyin/common/BaseApplication.java | 25 --- .../jiangzeyin/common/FileResourceLoader.java | 9 +- .../cn/jiangzeyin/common/JsonMessage.java | 108 --------- .../java/cn/jiangzeyin/common/PageUtil.java | 26 +++ .../common/base/AbstractBaseControl.java | 104 --------- .../common/interceptor/BaseInterceptor.java | 110 --------- .../common/interceptor/GetUserName.java | 8 - .../interceptor/InterceptorControl.java | 105 --------- .../common/interceptor/InterceptorUrl.java | 15 -- .../common/interceptor/LoginInterceptor.java | 27 +-- .../jiangzeyin/common/spring/SpringUtil.java | 127 ----------- .../jiangzeyin/controller/IndexControl.java | 21 +- .../jiangzeyin/controller/LoginControl.java | 15 +- .../controller/manage/FileControl.java | 11 +- .../controller/manage/ManageControl.java | 33 +-- .../cn/jiangzeyin/service/BaseService.java | 24 +- .../jiangzeyin/socket/LogWebSocketHandle.java | 35 ++- .../cn/jiangzeyin/socket/TailLogThread.java | 9 +- .../java/cn/jiangzeyin/system/SystemBean.java | 102 --------- .../cn/jiangzeyin/system/log/SystemLog.java | 210 ------------------ .../cn/jiangzeyin/system/log/aop/WebLog.java | 5 +- .../java/cn/jiangzeyin/util/PackageUtil.java | 166 -------------- src/main/resources/application.properties | 2 +- 65 files changed, 309 insertions(+), 1360 deletions(-) rename .idea/libraries/{Maven__ch_qos_logback_logback_classic_1_1_7.xml => Maven__ch_qos_logback_logback_classic_1_1_11.xml} (57%) rename .idea/libraries/{Maven__ch_qos_logback_logback_core_1_1_7.xml => Maven__ch_qos_logback_logback_core_1_1_11.xml} (59%) create mode 100644 .idea/libraries/Maven__cn_jiangzeyin_common_boot_1_1_6.xml create mode 100644 .idea/libraries/Maven__cn_jiangzeyin_simple_util_1_0_4.xml rename .idea/libraries/{Maven__com_alibaba_fastjson_1_2_29.xml => Maven__com_alibaba_fastjson_1_2_40.xml} (64%) rename .idea/libraries/{Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_4.xml => Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_8.xml} (65%) rename .idea/libraries/{Maven__com_fasterxml_jackson_core_jackson_core_2_8_4.xml => Maven__com_fasterxml_jackson_core_jackson_core_2_8_8.xml} (66%) rename .idea/libraries/{Maven__com_fasterxml_jackson_core_jackson_databind_2_8_4.xml => Maven__com_fasterxml_jackson_core_jackson_databind_2_8_8.xml} (65%) rename .idea/libraries/{Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_6.xml => Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_15.xml} (63%) rename .idea/libraries/{Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_6.xml => Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_15.xml} (64%) rename .idea/libraries/{Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_6.xml => Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_15.xml} (59%) rename .idea/libraries/{Maven__org_aspectj_aspectjweaver_1_8_9.xml => Maven__org_aspectj_aspectjweaver_1_8_10.xml} (60%) rename .idea/libraries/{Maven__org_hibernate_hibernate_validator_5_2_4_Final.xml => Maven__org_hibernate_hibernate_validator_5_2_5_Final.xml} (56%) rename .idea/libraries/{Maven__org_jboss_logging_jboss_logging_3_3_0_Final.xml => Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml} (56%) rename .idea/libraries/{Maven__org_slf4j_jcl_over_slf4j_1_7_21.xml => Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml} (60%) rename .idea/libraries/{Maven__org_slf4j_jul_to_slf4j_1_7_21.xml => Maven__org_slf4j_jul_to_slf4j_1_7_25.xml} (62%) rename .idea/libraries/{Maven__org_slf4j_log4j_over_slf4j_1_7_21.xml => Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml} (58%) rename .idea/libraries/{Maven__org_slf4j_slf4j_api_1_7_21.xml => Maven__org_slf4j_slf4j_api_1_7_25.xml} (64%) rename .idea/libraries/{Maven__org_springframework_boot_spring_boot_1_4_2_RELEASE.xml => Maven__org_springframework_boot_spring_boot_1_4_7_RELEASE.xml} (65%) rename .idea/libraries/{Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_2_RELEASE.xml => Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_7_RELEASE.xml} (53%) rename .idea/libraries/{Maven__org_springframework_boot_spring_boot_starter_1_4_2_RELEASE.xml => Maven__org_springframework_boot_spring_boot_starter_1_4_7_RELEASE.xml} (66%) rename .idea/libraries/{Maven__org_springframework_boot_spring_boot_starter_web_1_4_2_RELEASE.xml => Maven__org_springframework_boot_spring_boot_starter_aop_1_4_7_RELEASE.xml} (54%) rename .idea/libraries/{Maven__org_springframework_boot_spring_boot_starter_logging_1_4_2_RELEASE.xml => Maven__org_springframework_boot_spring_boot_starter_logging_1_4_7_RELEASE.xml} (52%) rename .idea/libraries/{Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_2_RELEASE.xml => Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_7_RELEASE.xml} (53%) delete mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_2_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_7_RELEASE.xml rename .idea/libraries/{Maven__org_springframework_boot_spring_boot_starter_aop_1_4_2_RELEASE.xml => Maven__org_springframework_boot_spring_boot_starter_web_1_4_7_RELEASE.xml} (54%) delete mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_2_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_7_RELEASE.xml rename .idea/libraries/{Maven__org_springframework_spring_aop_4_3_4_RELEASE.xml => Maven__org_springframework_spring_aop_4_3_9_RELEASE.xml} (56%) rename .idea/libraries/{Maven__org_springframework_spring_beans_4_3_4_RELEASE.xml => Maven__org_springframework_spring_beans_4_3_9_RELEASE.xml} (56%) rename .idea/libraries/{Maven__org_springframework_spring_context_4_3_4_RELEASE.xml => Maven__org_springframework_spring_context_4_3_9_RELEASE.xml} (57%) rename .idea/libraries/{Maven__org_springframework_spring_context_support_4_3_4_RELEASE.xml => Maven__org_springframework_spring_context_support_4_3_9_RELEASE.xml} (67%) rename .idea/libraries/{Maven__org_springframework_spring_core_4_3_4_RELEASE.xml => Maven__org_springframework_spring_core_4_3_9_RELEASE.xml} (56%) rename .idea/libraries/{Maven__org_springframework_spring_expression_4_3_4_RELEASE.xml => Maven__org_springframework_spring_expression_4_3_9_RELEASE.xml} (66%) rename .idea/libraries/{Maven__org_springframework_spring_messaging_4_3_4_RELEASE.xml => Maven__org_springframework_spring_messaging_4_3_9_RELEASE.xml} (66%) rename .idea/libraries/{Maven__org_springframework_spring_web_4_3_4_RELEASE.xml => Maven__org_springframework_spring_web_4_3_9_RELEASE.xml} (56%) rename .idea/libraries/{Maven__org_springframework_spring_webmvc_4_3_4_RELEASE.xml => Maven__org_springframework_spring_webmvc_4_3_9_RELEASE.xml} (56%) rename .idea/libraries/{Maven__org_springframework_spring_websocket_4_3_4_RELEASE.xml => Maven__org_springframework_spring_websocket_4_3_9_RELEASE.xml} (66%) delete mode 100644 src/main/java/cn/jiangzeyin/common/BaseApplication.java delete mode 100644 src/main/java/cn/jiangzeyin/common/JsonMessage.java create mode 100644 src/main/java/cn/jiangzeyin/common/PageUtil.java delete mode 100644 src/main/java/cn/jiangzeyin/common/base/AbstractBaseControl.java delete mode 100644 src/main/java/cn/jiangzeyin/common/interceptor/BaseInterceptor.java delete mode 100644 src/main/java/cn/jiangzeyin/common/interceptor/GetUserName.java delete mode 100644 src/main/java/cn/jiangzeyin/common/interceptor/InterceptorControl.java delete mode 100644 src/main/java/cn/jiangzeyin/common/interceptor/InterceptorUrl.java delete mode 100644 src/main/java/cn/jiangzeyin/common/spring/SpringUtil.java delete mode 100644 src/main/java/cn/jiangzeyin/system/SystemBean.java delete mode 100644 src/main/java/cn/jiangzeyin/system/log/SystemLog.java delete mode 100644 src/main/java/cn/jiangzeyin/util/PackageUtil.java diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_7.xml b/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml similarity index 57% rename from .idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_7.xml rename to .idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml index cdd79598e..c6ea67e83 100644 --- a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_7.xml +++ b/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_7.xml b/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml similarity index 59% rename from .idea/libraries/Maven__ch_qos_logback_logback_core_1_1_7.xml rename to .idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml index 6c2a7607f..f538e36ce 100644 --- a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_7.xml +++ b/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__cn_jiangzeyin_common_boot_1_1_6.xml b/.idea/libraries/Maven__cn_jiangzeyin_common_boot_1_1_6.xml new file mode 100644 index 000000000..bf983e7e9 --- /dev/null +++ b/.idea/libraries/Maven__cn_jiangzeyin_common_boot_1_1_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__cn_jiangzeyin_simple_util_1_0_4.xml b/.idea/libraries/Maven__cn_jiangzeyin_simple_util_1_0_4.xml new file mode 100644 index 000000000..0748f497f --- /dev/null +++ b/.idea/libraries/Maven__cn_jiangzeyin_simple_util_1_0_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_alibaba_fastjson_1_2_29.xml b/.idea/libraries/Maven__com_alibaba_fastjson_1_2_40.xml similarity index 64% rename from .idea/libraries/Maven__com_alibaba_fastjson_1_2_29.xml rename to .idea/libraries/Maven__com_alibaba_fastjson_1_2_40.xml index 338ddd27e..1c96ec05d 100644 --- a/.idea/libraries/Maven__com_alibaba_fastjson_1_2_29.xml +++ b/.idea/libraries/Maven__com_alibaba_fastjson_1_2_40.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_4.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_8.xml similarity index 65% rename from .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_4.xml rename to .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_8.xml index fab9f73e4..cd79bdce2 100644 --- a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_4.xml +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_8.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_4.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_8.xml similarity index 66% rename from .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_4.xml rename to .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_8.xml index 37fcf4ebd..dc8e04dc9 100644 --- a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_4.xml +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_8.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_4.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_8.xml similarity index 65% rename from .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_4.xml rename to .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_8.xml index 568335609..247589ed5 100644 --- a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_4.xml +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_8.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_6.xml b/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_15.xml similarity index 63% rename from .idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_6.xml rename to .idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_15.xml index 79b2a1fda..54252771f 100644 --- a/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_6.xml +++ b/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_15.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_6.xml b/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_15.xml similarity index 64% rename from .idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_6.xml rename to .idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_15.xml index 935699ff4..246c07a91 100644 --- a/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_6.xml +++ b/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_15.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_6.xml b/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_15.xml similarity index 59% rename from .idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_6.xml rename to .idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_15.xml index 759baaf94..41aa369d8 100644 --- a/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_6.xml +++ b/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_15.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_9.xml b/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_10.xml similarity index 60% rename from .idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_9.xml rename to .idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_10.xml index 687b798ec..36093ff4a 100644 --- a/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_9.xml +++ b/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_10.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hibernate_hibernate_validator_5_2_4_Final.xml b/.idea/libraries/Maven__org_hibernate_hibernate_validator_5_2_5_Final.xml similarity index 56% rename from .idea/libraries/Maven__org_hibernate_hibernate_validator_5_2_4_Final.xml rename to .idea/libraries/Maven__org_hibernate_hibernate_validator_5_2_5_Final.xml index 6c5e17f5f..8d71bef78 100644 --- a/.idea/libraries/Maven__org_hibernate_hibernate_validator_5_2_4_Final.xml +++ b/.idea/libraries/Maven__org_hibernate_hibernate_validator_5_2_5_Final.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_0_Final.xml b/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml similarity index 56% rename from .idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_0_Final.xml rename to .idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml index 186d87fd0..6dc7a37ee 100644 --- a/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_0_Final.xml +++ b/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_21.xml b/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml similarity index 60% rename from .idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_21.xml rename to .idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml index 2f93a6301..bae9949f1 100644 --- a/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_21.xml +++ b/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_21.xml b/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml similarity index 62% rename from .idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_21.xml rename to .idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml index dd05efc35..6073e5338 100644 --- a/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_21.xml +++ b/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_21.xml b/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml similarity index 58% rename from .idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_21.xml rename to .idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml index 0f9744ace..a14ac63f3 100644 --- a/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_21.xml +++ b/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_21.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml similarity index 64% rename from .idea/libraries/Maven__org_slf4j_slf4j_api_1_7_21.xml rename to .idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml index 1b644dd84..20e816363 100644 --- a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_21.xml +++ b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_4_7_RELEASE.xml similarity index 65% rename from .idea/libraries/Maven__org_springframework_boot_spring_boot_1_4_2_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_boot_spring_boot_1_4_7_RELEASE.xml index f07ee1173..a716466bb 100644 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_4_2_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_4_7_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_7_RELEASE.xml similarity index 53% rename from .idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_2_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_7_RELEASE.xml index 1a8d2a229..a023258c2 100644 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_2_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_4_7_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_4_7_RELEASE.xml similarity index 66% rename from .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_4_2_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_4_7_RELEASE.xml index 7adb33631..2e633b8af 100644 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_4_2_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_4_7_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_4_7_RELEASE.xml similarity index 54% rename from .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_4_2_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_4_7_RELEASE.xml index 8debb6e46..db171550e 100644 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_4_2_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_4_7_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_4_7_RELEASE.xml similarity index 52% rename from .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_4_2_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_4_7_RELEASE.xml index 92d0599a5..7bdc086bc 100644 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_4_2_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_4_7_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_7_RELEASE.xml similarity index 53% rename from .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_2_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_7_RELEASE.xml index 06f45877d..719d09ba1 100644 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_2_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_4_7_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_2_RELEASE.xml deleted file mode 100644 index 347724541..000000000 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_2_RELEASE.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_7_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_7_RELEASE.xml new file mode 100644 index 000000000..aee27a472 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_velocity_1_4_7_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_4_7_RELEASE.xml similarity index 54% rename from .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_4_2_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_4_7_RELEASE.xml index d84ffcd5d..e52c60978 100644 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_4_2_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_4_7_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_2_RELEASE.xml deleted file mode 100644 index 2bb1d2742..000000000 --- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_2_RELEASE.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_7_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_7_RELEASE.xml new file mode 100644 index 000000000..ca6983269 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_1_4_7_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_aop_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_aop_4_3_9_RELEASE.xml similarity index 56% rename from .idea/libraries/Maven__org_springframework_spring_aop_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_aop_4_3_9_RELEASE.xml index 298a82cee..613ae4020 100644 --- a/.idea/libraries/Maven__org_springframework_spring_aop_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_aop_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_beans_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_beans_4_3_9_RELEASE.xml similarity index 56% rename from .idea/libraries/Maven__org_springframework_spring_beans_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_beans_4_3_9_RELEASE.xml index 92af26916..c79c942d5 100644 --- a/.idea/libraries/Maven__org_springframework_spring_beans_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_beans_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_context_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_context_4_3_9_RELEASE.xml similarity index 57% rename from .idea/libraries/Maven__org_springframework_spring_context_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_context_4_3_9_RELEASE.xml index e151b4d20..68f6cf374 100644 --- a/.idea/libraries/Maven__org_springframework_spring_context_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_context_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_context_support_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_context_support_4_3_9_RELEASE.xml similarity index 67% rename from .idea/libraries/Maven__org_springframework_spring_context_support_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_context_support_4_3_9_RELEASE.xml index aec756c1b..14ed1cfe4 100644 --- a/.idea/libraries/Maven__org_springframework_spring_context_support_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_context_support_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_core_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_core_4_3_9_RELEASE.xml similarity index 56% rename from .idea/libraries/Maven__org_springframework_spring_core_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_core_4_3_9_RELEASE.xml index 519ca31ed..50151bd2a 100644 --- a/.idea/libraries/Maven__org_springframework_spring_core_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_core_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_expression_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_expression_4_3_9_RELEASE.xml similarity index 66% rename from .idea/libraries/Maven__org_springframework_spring_expression_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_expression_4_3_9_RELEASE.xml index ffd9732f6..fa046e9ae 100644 --- a/.idea/libraries/Maven__org_springframework_spring_expression_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_expression_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_messaging_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_messaging_4_3_9_RELEASE.xml similarity index 66% rename from .idea/libraries/Maven__org_springframework_spring_messaging_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_messaging_4_3_9_RELEASE.xml index d0ec7b49d..0ef8e0631 100644 --- a/.idea/libraries/Maven__org_springframework_spring_messaging_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_messaging_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_web_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_web_4_3_9_RELEASE.xml similarity index 56% rename from .idea/libraries/Maven__org_springframework_spring_web_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_web_4_3_9_RELEASE.xml index 2a3e87e48..6b1ce20d3 100644 --- a/.idea/libraries/Maven__org_springframework_spring_web_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_web_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_webmvc_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_webmvc_4_3_9_RELEASE.xml similarity index 56% rename from .idea/libraries/Maven__org_springframework_spring_webmvc_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_webmvc_4_3_9_RELEASE.xml index e0e1e66f9..fa6a68b3d 100644 --- a/.idea/libraries/Maven__org_springframework_spring_webmvc_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_webmvc_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_websocket_4_3_4_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_websocket_4_3_9_RELEASE.xml similarity index 66% rename from .idea/libraries/Maven__org_springframework_spring_websocket_4_3_4_RELEASE.xml rename to .idea/libraries/Maven__org_springframework_spring_websocket_4_3_9_RELEASE.xml index 1d6ff9dd7..f3eb35ce0 100644 --- a/.idea/libraries/Maven__org_springframework_spring_websocket_4_3_4_RELEASE.xml +++ b/.idea/libraries/Maven__org_springframework_spring_websocket_4_3_9_RELEASE.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/boot-line/data/user.json b/boot-line/data/user.json index 14df76f51..24594715e 100644 --- a/boot-line/data/user.json +++ b/boot-line/data/user.json @@ -1,4 +1,4 @@ -{ + { "test":{ "password":"testtest", "role":"tester", diff --git a/pom.xml b/pom.xml index d486a6cbd..6f18bd7c7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,11 +4,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 1.4.2.RELEASE + cn.jiangzeyin + common-parent + 1.1.6 - cn.jiangzeyin boot-online 1.0 @@ -16,6 +15,10 @@ 1.8 + + cn.jiangzeyin + common-boot + org.springframework.boot spring-boot-starter-websocket @@ -31,7 +34,6 @@ com.alibaba fastjson - 1.2.29 diff --git a/src/main/java/cn/jiangzeyin/BootOnLineApplication.java b/src/main/java/cn/jiangzeyin/BootOnLineApplication.java index 123a23485..26fab5d3a 100644 --- a/src/main/java/cn/jiangzeyin/BootOnLineApplication.java +++ b/src/main/java/cn/jiangzeyin/BootOnLineApplication.java @@ -1,6 +1,6 @@ package cn.jiangzeyin; -import org.springframework.boot.SpringApplication; +import cn.jiangzeyin.common.BaseApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.context.annotation.ComponentScan; @@ -11,17 +11,7 @@ import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @ServletComponentScan @ComponentScan({"cn.jiangzeyin"}) -public class BootOnLineApplication extends SpringApplication { - - /** - * @param sources sources - */ - public BootOnLineApplication(Object... sources) { - super(sources); - setBanner((environment, sourceClass, out) -> { - out.println("yokead Spring Boot online manager starting"); - }); - } +public class BootOnLineApplication extends BaseApplication { /** * 启动执行 @@ -29,7 +19,7 @@ public class BootOnLineApplication extends SpringApplication { * @param args 参数 */ public static void main(String[] args) { - BootOnLineApplication application = new BootOnLineApplication(BootOnLineApplication.class); + BaseApplication application = new BaseApplication(BootOnLineApplication.class); application.run(args); } } diff --git a/src/main/java/cn/jiangzeyin/common/BaseApplication.java b/src/main/java/cn/jiangzeyin/common/BaseApplication.java deleted file mode 100644 index 76dfb3c99..000000000 --- a/src/main/java/cn/jiangzeyin/common/BaseApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.jiangzeyin.common; -/** - * Created by jiangzeyin on 2017/1/10. - */ - -import org.springframework.boot.SpringApplication; - -/** - * @author jiangzeyin - * @create 2017 01 10 16:22 - */ -public class BaseApplication extends SpringApplication { - - /** - * @param sources - */ - public BaseApplication(Object... sources) { - super(sources); - setBanner((environment, sourceClass, out) -> { - String describe = environment.getProperty("describe"); - - out.println("优客创想 " + describe + " 系统启动中"); - }); - } -} diff --git a/src/main/java/cn/jiangzeyin/common/FileResourceLoader.java b/src/main/java/cn/jiangzeyin/common/FileResourceLoader.java index 3e17309c1..efea1609c 100644 --- a/src/main/java/cn/jiangzeyin/common/FileResourceLoader.java +++ b/src/main/java/cn/jiangzeyin/common/FileResourceLoader.java @@ -1,7 +1,6 @@ package cn.jiangzeyin.common; -import cn.jiangzeyin.system.SystemBean; -import cn.jiangzeyin.system.log.SystemLog; +import cn.jiangzeyin.common.spring.SpringUtil; import org.apache.commons.collections.ExtendedProperties; import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.runtime.resource.Resource; @@ -19,7 +18,7 @@ import java.util.Map; * Created by jiangzeyin on 2017/1/5. */ public class FileResourceLoader extends ResourceLoader { - Map fileLastModified = new HashMap<>(); + private Map fileLastModified = new HashMap<>(); @Override public void init(ExtendedProperties configuration) { @@ -33,7 +32,7 @@ public class FileResourceLoader extends ResourceLoader { file = getResourceFile(source); return new FileInputStream(file); } catch (FileNotFoundException e) { - SystemLog.LOG().info("FileNotFoundException:" + source + " " + file.getPath()); + DefaultSystemLog.LOG().info("FileNotFoundException:" + source + " " + file.getPath()); return this.getClass().getResourceAsStream(source); } finally { if (file != null) @@ -56,6 +55,6 @@ public class FileResourceLoader extends ResourceLoader { private File getResourceFile(String name) { // SystemBean.getInstance().VelocityPath - return new File(String.format("%s/%s", SystemBean.getInstance().VelocityPath, name)); + return new File(String.format("%s/%s", SpringUtil.getEnvironment().getProperty("spring.velocity.resource-loader-path"), name)); } } diff --git a/src/main/java/cn/jiangzeyin/common/JsonMessage.java b/src/main/java/cn/jiangzeyin/common/JsonMessage.java deleted file mode 100644 index eb283256c..000000000 --- a/src/main/java/cn/jiangzeyin/common/JsonMessage.java +++ /dev/null @@ -1,108 +0,0 @@ -package cn.jiangzeyin.common; -/** - * Created by jiangzeyin on 2017/2/6. - */ - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - -import java.io.Serializable; - -/** - * @author jiangzeyin - * @create 2017 02 06 18:42 - */ -public class JsonMessage implements Serializable { - public static final String CODE = "code"; - public static final String MSG = "msg"; - public static final String DATA = "data"; - - private int code; - private String msg; - private Object data; - - public JsonMessage(int code, String msg, Object data) { - this.code = code; - this.msg = msg; - this.data = data; - } - - public JsonMessage(int code, String msg) { - this(code, msg, null); - } - - public Object getData() { - return data; - } - - public void setData(Object data) { - this.data = data; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - /** - * @return - * @author jiangzeyin - * @date 2016-8-8 - */ - @Override - public String toString() { - // TODO Auto-generated method stub - return JSONObject.toJSONString(this);// new JSONObject(this).toString(); - } - - - /** - * @param code - * @param msg - * @return - * @author jiangzeyin - * @date 2016-9-6 - */ - public static String getString(int code, String msg) { - return new JsonMessage(code, msg).toString(); - } - - /** - * @param code - * @param msg - * @param data - * @return - * @author jiangzeyin - * @date 2016-9-6 - */ - public static String getString(int code, String msg, Object data) { - return new JsonMessage(code, msg, data).toString(); - } - - /** - * 分页json格式 - * @param code - * @param msg - * @param data - * @return - */ - public static String getPaginate(int code, String msg, JSONArray data) { - JSONObject json = new JSONObject(); - json.put("code", code); - json.put("msg", 0 < data.size() ? msg : "没有查询到数据!"); - json.put("count", data.size()); - json.put("data", data); - return JSONObject.toJSONString(json); - } -} diff --git a/src/main/java/cn/jiangzeyin/common/PageUtil.java b/src/main/java/cn/jiangzeyin/common/PageUtil.java new file mode 100644 index 000000000..e19d25548 --- /dev/null +++ b/src/main/java/cn/jiangzeyin/common/PageUtil.java @@ -0,0 +1,26 @@ +package cn.jiangzeyin.common; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +/** + * Created by jiangzeyin on 2018/1/20. + */ +public class PageUtil { + /** + * 分页json格式 + * + * @param code + * @param msg + * @param data + * @return + */ + public static String getPaginate(int code, String msg, JSONArray data) { + JSONObject json = new JSONObject(); + json.put("code", code); + json.put("msg", 0 < data.size() ? msg : "没有查询到数据!"); + json.put("count", data.size()); + json.put("data", data); + return JSONObject.toJSONString(json); + } +} diff --git a/src/main/java/cn/jiangzeyin/common/base/AbstractBaseControl.java b/src/main/java/cn/jiangzeyin/common/base/AbstractBaseControl.java deleted file mode 100644 index eca9c31d8..000000000 --- a/src/main/java/cn/jiangzeyin/common/base/AbstractBaseControl.java +++ /dev/null @@ -1,104 +0,0 @@ -package cn.jiangzeyin.common.base; - -import cn.jiangzeyin.util.FileUtil; -import cn.jiangzeyin.util.RequestUtil; -import cn.jiangzeyin.util.StringUtil; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * @author jiangzeyin - * Created by jiangzeyin on 2017/1/12. - */ -public abstract class AbstractBaseControl { - protected HttpServletRequest request; - protected HttpSession session; - protected HttpServletResponse response; - - protected String referer; - protected String ip; - protected String reqUrl; - - - /** - * 拦截器注入 - * - * @param request - * @param session - * @param response - */ - public void setReqAndRes(HttpServletRequest request, HttpSession session, HttpServletResponse response) { - this.request = request; - this.session = session; - this.response = response; - - this.referer = StringUtil.convertNULL(this.request.getHeader("Referer")); - this.ip = RequestUtil.getIpAddress(this.request); - this.reqUrl = request.getRequestURI(); - this.response.setCharacterEncoding("UTF-8"); - - } - - public void reLoad() { - - } - - protected String getUserAgent() { - return request.getHeader("user-agent"); - } - - - protected String convertFilePath(String path) { - return FileUtil.ClearPath(StringUtil.convertNULL(path).replace("..", "")); - } - - /** - * 获取一次性session 字符串 - * - * @param name - * @return - * @author jiangzeyin - * @date 2016-10-17 - */ - public String getSessionAttributeAfterRemove(String name) { - Object obj = session.getAttribute(name); - session.removeAttribute(name); - if (obj == null) - return ""; - return obj.toString(); - } - - - public String getCookieValue(String name) { - Cookie cookie = RequestUtil.getCookieByName(request, name); - if (cookie == null) - return ""; - return cookie.getValue(); - - } - - protected String getParameter(String name) { - return getParameter(name, null); - } - - protected String[] getParameters(String name) { - return request.getParameterValues(name); - } - - - protected String getParameter(String name, String def) { - String value = request.getParameter(name); - return value == null ? def : value; - } - - protected int getParameterInt(String name, int def) { - return StringUtil.parseInt(request.getParameter(name), def); - } - - protected int getParameterInt(String name) { - return getParameterInt(name, 0); - } -} diff --git a/src/main/java/cn/jiangzeyin/common/interceptor/BaseInterceptor.java b/src/main/java/cn/jiangzeyin/common/interceptor/BaseInterceptor.java deleted file mode 100644 index 745bcec6e..000000000 --- a/src/main/java/cn/jiangzeyin/common/interceptor/BaseInterceptor.java +++ /dev/null @@ -1,110 +0,0 @@ -package cn.jiangzeyin.common.interceptor; - -import cn.jiangzeyin.common.base.AbstractBaseControl; -import cn.jiangzeyin.system.log.LogType; -import cn.jiangzeyin.system.log.SystemLog; -import cn.jiangzeyin.util.RequestUtil; -import org.springframework.http.HttpStatus; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import java.util.Map; -import java.util.Set; - -/** - * @author jiangzeyin - * Created by jiangzeyin on 2017/2/17. - */ -public abstract class BaseInterceptor extends HandlerInterceptorAdapter { - - protected HttpServletRequest request; - protected HttpServletResponse response; - protected HttpSession session; - protected ServletContext application; - protected String url; - private AbstractBaseControl abstractBaseControl; - private volatile static GetUserName getUserName; - - protected static void put(GetUserName getUserName) { - BaseInterceptor.getUserName = getUserName; - } - - public static String getNowUserName() { - if (getUserName == null) - return null; - return getUserName.getUserName(); - } - - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - this.session = request.getSession(); - this.application = session.getServletContext(); - this.request = request; - this.response = response; - this.url = request.getRequestURI(); - if (handler instanceof HandlerMethod) { - HandlerMethod handlerMethod = (HandlerMethod) handler; - Class controlClass = ((HandlerMethod) handler).getBean().getClass(); - Object object = handlerMethod.getBean(); - // - if (AbstractBaseControl.class.isAssignableFrom(controlClass)) { - abstractBaseControl = (AbstractBaseControl) object; - abstractBaseControl.setReqAndRes(this.request, this.session, this.response); - } - } - Map header = RequestUtil.getHeaderMapValues(request); - Map parameters = request.getParameterMap(); - StringBuilder stringBuffer = new StringBuilder(); - stringBuffer.append(request.getRequestURI()); - //.append(",ip:").append(RequestUtil.getIpAddress(request)) - stringBuffer.append(" parameters:"); - if (parameters != null) { - Set> entries = parameters.entrySet(); - stringBuffer.append("{"); - for (Map.Entry entry : entries) { - String key = entry.getKey(); - stringBuffer.append(key).append(":"); - String[] value = entry.getValue(); - if (value != null) { - for (int i = 0; i < value.length; i++) { - if (i != 0) - stringBuffer.append(","); - stringBuffer.append(value[i]); - } - } - stringBuffer.append(";"); - } - stringBuffer.append("}"); - } else { - stringBuffer.append("null"); - } - stringBuffer.append(",header:").append(header); - SystemLog.LOG(LogType.REQUEST).info(stringBuffer.toString()); - return true; - } - - protected void reload() { - if (abstractBaseControl != null) - abstractBaseControl.reLoad(); - } - - @Override - public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { - if (response.getStatus() != HttpStatus.OK.value()) { - SystemLog.LOG(LogType.CONTROL_ERROR).info("请求错误:" + request.getRequestURI() + " " + response.getStatus()); - } - } - - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - if (ex != null) - SystemLog.LOG(LogType.CONTROL_ERROR).error("controller 异常", ex); - } -} diff --git a/src/main/java/cn/jiangzeyin/common/interceptor/GetUserName.java b/src/main/java/cn/jiangzeyin/common/interceptor/GetUserName.java deleted file mode 100644 index b13b508f5..000000000 --- a/src/main/java/cn/jiangzeyin/common/interceptor/GetUserName.java +++ /dev/null @@ -1,8 +0,0 @@ -package cn.jiangzeyin.common.interceptor; - -/** - * Created by jiangzeyin on 2017/5/16. - */ -public interface GetUserName { - String getUserName(); -} diff --git a/src/main/java/cn/jiangzeyin/common/interceptor/InterceptorControl.java b/src/main/java/cn/jiangzeyin/common/interceptor/InterceptorControl.java deleted file mode 100644 index 185fb7b20..000000000 --- a/src/main/java/cn/jiangzeyin/common/interceptor/InterceptorControl.java +++ /dev/null @@ -1,105 +0,0 @@ -package cn.jiangzeyin.common.interceptor; - -import cn.jiangzeyin.system.SystemBean; -import cn.jiangzeyin.system.log.SystemLog; -import cn.jiangzeyin.util.PackageUtil; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.StringHttpMessageConverter; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.config.annotation.*; - -import java.io.IOException; -import java.lang.reflect.Modifier; -import java.nio.charset.Charset; -import java.util.List; - -/** - * 拦截器控制器 - * - * @author jiangzeyin - * Created by jiangzeyin on 2017/2/4. - */ -@Configuration -@EnableWebMvc -public class InterceptorControl extends WebMvcConfigurerAdapter { - - - // 解决返回中文乱码 - @Bean - public HttpMessageConverter responseBodyConverter() { - StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8")); - return converter; - } - - @Override - public void configureMessageConverters( - List> converters) { - super.configureMessageConverters(converters); - converters.add(responseBodyConverter()); - } - - @Override - public void configureContentNegotiation( - ContentNegotiationConfigurer configurer) { - configurer.favorPathExtension(false); - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - //registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**"); - init(registry); - } - - // 配置静态资源的目录 - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/static/**"). - addResourceLocations(SystemBean.getInstance().getEnvironment().getProperty("static.conf")); - } - - /** - * @param registry - */ - private void init(InterceptorRegistry registry) { - List list = null; - try { - list = PackageUtil.getClassName("cn.jiangzeyin.common.interceptor"); - } catch (IOException e) { - } - if (list == null) - return; - for (String item : list) { - Class classItem = null; - try { - classItem = Class.forName(item); - } catch (ClassNotFoundException e) { - SystemLog.ERROR().error("加载拦截器错误", e); - } - if (classItem == null) - continue; - boolean isAbstract = Modifier.isAbstract(classItem.getModifiers()); - if (isAbstract) - continue; - InterceptorUrl interceptorUrl = (InterceptorUrl) classItem.getAnnotation(InterceptorUrl.class); - if (interceptorUrl == null) - continue; - HandlerInterceptor handlerInterceptor = null; - try { - handlerInterceptor = (HandlerInterceptor) classItem.newInstance(); - } catch (InstantiationException e) { - SystemLog.ERROR().error("加载拦截器错误", e); - } catch (IllegalAccessException e) { - SystemLog.ERROR().error("加载拦截器错误", e); - } - if (handlerInterceptor == null) - continue; - String[] patterns = interceptorUrl.value(); - if (patterns == null) - continue; - registry.addInterceptor(handlerInterceptor).addPathPatterns(patterns); - SystemLog.LOG().info("加载拦截器:" + classItem + " " + patterns[0]); - } - } -} diff --git a/src/main/java/cn/jiangzeyin/common/interceptor/InterceptorUrl.java b/src/main/java/cn/jiangzeyin/common/interceptor/InterceptorUrl.java deleted file mode 100644 index 7284785ec..000000000 --- a/src/main/java/cn/jiangzeyin/common/interceptor/InterceptorUrl.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.jiangzeyin.common.interceptor; - -import java.lang.annotation.*; - -/** - * Created by jiangzeyin on 2017/5/9. - */ -@Documented -@Target(ElementType.TYPE) -@Inherited -@Retention(RetentionPolicy.RUNTIME) -public @interface InterceptorUrl { - - String[] value(); -} diff --git a/src/main/java/cn/jiangzeyin/common/interceptor/LoginInterceptor.java b/src/main/java/cn/jiangzeyin/common/interceptor/LoginInterceptor.java index 876c42778..2488c2022 100644 --- a/src/main/java/cn/jiangzeyin/common/interceptor/LoginInterceptor.java +++ b/src/main/java/cn/jiangzeyin/common/interceptor/LoginInterceptor.java @@ -1,7 +1,5 @@ package cn.jiangzeyin.common.interceptor; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.method.HandlerMethod; import javax.servlet.http.HttpServletRequest; @@ -13,15 +11,12 @@ import javax.servlet.http.HttpServletResponse; * @author jiangzeyin * Created by jiangzeyin on 2017/2/4. */ -@InterceptorUrl({"/**"}) -public class LoginInterceptor extends BaseInterceptor implements GetUserName { +@InterceptorPattens() +public class LoginInterceptor extends BaseInterceptor { public static final String SESSION_NAME = "user"; public static final String SESSION_PWD = "pwd"; - public LoginInterceptor() { - put(this); - } @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { @@ -38,24 +33,6 @@ public class LoginInterceptor extends BaseInterceptor implements GetUserName { } } } - // 系统管理限制 - if (url.startsWith("/sysadmin")) { - if (!"admin".equals(user)) { - response.sendRedirect(request.getContextPath() + "/login.html"); - return false; - } - } return true; } - - @Override - public String getUserName() { - ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); - HttpServletRequest request = attributes.getRequest(); - return (String) request.getSession().getAttribute(LoginInterceptor.SESSION_NAME); - } - - public String getAllUserName() { - return getUserName(); - } } diff --git a/src/main/java/cn/jiangzeyin/common/spring/SpringUtil.java b/src/main/java/cn/jiangzeyin/common/spring/SpringUtil.java deleted file mode 100644 index 55a6c263e..000000000 --- a/src/main/java/cn/jiangzeyin/common/spring/SpringUtil.java +++ /dev/null @@ -1,127 +0,0 @@ -package cn.jiangzeyin.common.spring; - -import cn.jiangzeyin.system.log.LogType; -import cn.jiangzeyin.system.log.SystemLog; -import org.springframework.beans.BeansException; -import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent; -import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; -import org.springframework.boot.context.event.ApplicationPreparedEvent; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.ContextClosedEvent; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.event.ContextStartedEvent; -import org.springframework.context.event.ContextStoppedEvent; -import org.springframework.util.Assert; -import org.springframework.web.context.support.ServletRequestHandledEvent; - -/** - * @author jiangzeyin - * Created by jiangzeyin on 2017/1/5. - */ -@Configuration -public class SpringUtil implements ApplicationListener, ApplicationContextAware { - - private static ApplicationContext applicationContext; - - /** - * 容器加载完成 - * - * @param applicationContext - * @throws BeansException - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - SpringUtil.applicationContext = applicationContext; - //SystemLog.init(); - } - - /** - * 启动完成 - * - * @param event - */ - @Override - public void onApplicationEvent(ApplicationEvent event) { - // 初始化页面模板 - if (event instanceof ApplicationEnvironmentPreparedEvent) { // 初始化环境变量 - //System.out.println("0"); - } else if (event instanceof ApplicationPreparedEvent) { // 初始化完成 - //System.out.println("1"); - } else if (event instanceof ContextRefreshedEvent) { // 应用刷新 - } else if (event instanceof ApplicationReadyEvent) {// 应用已启动完成 - SystemLog.LOG().info(" 启动完成"); - } else if (event instanceof ContextStartedEvent) { // 应用启动,需要在代码动态添加监听器才可捕获 - System.out.println("3"); - } else if (event instanceof ContextStoppedEvent) { // 应用停止 - System.out.println("stop"); - } else if (event instanceof ContextClosedEvent) { // 应用关闭 - SystemLog.LOG().info("关闭程序"); - } else if (event instanceof ServletRequestHandledEvent) { - ServletRequestHandledEvent servletRequestHandledEvent = (ServletRequestHandledEvent) event; - if ("/favicon.ico".equals(servletRequestHandledEvent.getRequestUrl())) - return; - int code = servletRequestHandledEvent.getStatusCode(); - if (servletRequestHandledEvent.wasFailure()) { - SystemLog.LOG(LogType.REQUEST).info("code:" + code + " error:" + servletRequestHandledEvent.toString()); - } else if (code != 200) { - SystemLog.LOG(LogType.REQUEST).info("code:" + code + " " + servletRequestHandledEvent.toString()); - } - } else if (event instanceof EmbeddedServletContainerInitializedEvent) { - - } else { - System.out.println("else"); - System.out.println(event); - } - } - - /** - * 获取applicationContext - * - * @return - */ - public static ApplicationContext getApplicationContext() { - Assert.notNull(applicationContext, "application is null"); - return applicationContext; - } - - /** - * 通过name获取 Bean. - * - * @param name - * @return - */ - public static Object getBean(String name) { - return getApplicationContext().getBean(name); - - } - - /** - * 通过class获取Bean. - * - * @param clazz - * @param - * @return - */ - public static T getBean(Class clazz) { - return getApplicationContext().getBean(clazz); - } - - /** - * 通过name,以及Clazz返回指定的Bean - * - * @param name - * @param clazz - * @param - * @return - */ - public static T getBean(String name, Class clazz) { - return getApplicationContext().getBean(name, clazz); - } - - -} diff --git a/src/main/java/cn/jiangzeyin/controller/IndexControl.java b/src/main/java/cn/jiangzeyin/controller/IndexControl.java index 4598a0202..36ca84bc9 100644 --- a/src/main/java/cn/jiangzeyin/controller/IndexControl.java +++ b/src/main/java/cn/jiangzeyin/controller/IndexControl.java @@ -1,11 +1,11 @@ package cn.jiangzeyin.controller; +import cn.jiangzeyin.common.DefaultSystemLog; import cn.jiangzeyin.common.JsonMessage; -import cn.jiangzeyin.common.base.AbstractBaseControl; import cn.jiangzeyin.common.interceptor.LoginInterceptor; +import cn.jiangzeyin.controller.base.AbstractBaseControl; import cn.jiangzeyin.service.IndexService; import cn.jiangzeyin.service.UserService; -import cn.jiangzeyin.system.log.SystemLog; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -19,10 +19,11 @@ public class IndexControl extends AbstractBaseControl { @Resource IndexService indexService; @Resource - UserService userService; + private UserService userService; /** * 加载首页 + * * @return */ @RequestMapping(value = "index") @@ -39,16 +40,18 @@ public class IndexControl extends AbstractBaseControl { /** * 退出登录 + * * @return */ @RequestMapping(value = "logout") public String logout() { - session.invalidate(); + getSession().invalidate(); return "login"; } /** * 修改密码 + * * @param oldPwd 旧密码 * @param newPwd 新密码 * @return @@ -58,23 +61,23 @@ public class IndexControl extends AbstractBaseControl { public String updatePwd(String oldPwd, String newPwd) { try { - String result = userService.updatePwd(session.getAttribute(LoginInterceptor.SESSION_NAME).toString(), oldPwd, newPwd); + String result = userService.updatePwd(getSession().getAttribute(LoginInterceptor.SESSION_NAME).toString(), oldPwd, newPwd); // 用户不存在 if ("notexist".equals(result)) { - return JsonMessage.getString(500, "用户不存在!"); + return JsonMessage.getString(500, "用户不存在!"); } // 旧密码不正确 if ("olderror".equals(result)) { - return JsonMessage.getString(500, "旧密码不正确!"); + return JsonMessage.getString(500, "旧密码不正确!"); } // 如果修改成功,则销毁会话 - session.invalidate(); + getSession().invalidate(); return JsonMessage.getString(200, "修改密码成功!"); } catch (Exception e) { - SystemLog.ERROR().info(e.getMessage()); + DefaultSystemLog.ERROR().error(e.getMessage(), e); return JsonMessage.getString(500, e.getMessage()); } } diff --git a/src/main/java/cn/jiangzeyin/controller/LoginControl.java b/src/main/java/cn/jiangzeyin/controller/LoginControl.java index 1fd8192cf..e4eae7c58 100644 --- a/src/main/java/cn/jiangzeyin/controller/LoginControl.java +++ b/src/main/java/cn/jiangzeyin/controller/LoginControl.java @@ -1,11 +1,12 @@ package cn.jiangzeyin.controller; +import cn.jiangzeyin.common.DefaultSystemLog; import cn.jiangzeyin.common.JsonMessage; -import cn.jiangzeyin.common.base.AbstractBaseControl; import cn.jiangzeyin.common.interceptor.LoginInterceptor; import cn.jiangzeyin.common.interceptor.NotLogin; +import cn.jiangzeyin.controller.base.AbstractBaseControl; import cn.jiangzeyin.service.UserService; -import cn.jiangzeyin.system.log.SystemLog; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -17,7 +18,7 @@ import javax.annotation.Resource; public class LoginControl extends AbstractBaseControl { @Resource - UserService userService; + private UserService userService; @RequestMapping(value = {"login.html", "", "/"}) @NotLogin @@ -31,13 +32,13 @@ public class LoginControl extends AbstractBaseControl { public String userLogin(String userName, String userPwd) { StringBuilder stringBuffer = new StringBuilder(); stringBuffer.append("用户登录:").append(userName).append(",IP:").append(ip); - stringBuffer.append(",浏览器:").append(getUserAgent()); + stringBuffer.append(",浏览器:").append(getHeader(HttpHeaders.USER_AGENT)); try { boolean flag = userService.login(userName, userPwd); if (flag) { stringBuffer.append(",结果:").append("OK"); - session.setAttribute(LoginInterceptor.SESSION_NAME, userName); - session.setAttribute(LoginInterceptor.SESSION_PWD, userPwd); + getSession().setAttribute(LoginInterceptor.SESSION_NAME, userName); + getSession().setAttribute(LoginInterceptor.SESSION_PWD, userPwd); return JsonMessage.getString(200, "登录成功"); } else { stringBuffer.append(",结果:").append("faild"); @@ -47,7 +48,7 @@ public class LoginControl extends AbstractBaseControl { stringBuffer.append(",结果:").append("error"); return JsonMessage.getString(500, e.getLocalizedMessage()); } finally { - SystemLog.LOG().info(stringBuffer.toString()); + DefaultSystemLog.LOG().info(stringBuffer.toString()); } } } diff --git a/src/main/java/cn/jiangzeyin/controller/manage/FileControl.java b/src/main/java/cn/jiangzeyin/controller/manage/FileControl.java index 007a26c8c..3f3194630 100644 --- a/src/main/java/cn/jiangzeyin/controller/manage/FileControl.java +++ b/src/main/java/cn/jiangzeyin/controller/manage/FileControl.java @@ -2,13 +2,11 @@ package cn.jiangzeyin.controller.manage; import cn.jiangzeyin.common.JsonMessage; -import cn.jiangzeyin.service.manage.ManageService; -import cn.jiangzeyin.system.SystemBean; +import cn.jiangzeyin.common.spring.SpringUtil; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; import java.io.*; import java.util.HashMap; import java.util.Map; @@ -19,6 +17,7 @@ public class FileControl { /** * 文件管理页面 + * * @param id * @return */ @@ -33,13 +32,14 @@ public class FileControl { /** * 读取启动文件 + * * @return */ @RequestMapping(value = "getRunBoot") @ResponseBody public String getRunBoot() { - File file = new File(SystemBean.getInstance().getEnvironment().getProperty("command.conf")); + File file = new File(SpringUtil.getEnvironment().getProperty("command.conf")); if (!file.exists()) { return JsonMessage.getString(500, "启动文件不存在"); @@ -69,13 +69,14 @@ public class FileControl { /** * 修改启动文件 + * * @param content * @return */ @RequestMapping(value = "saveRunBoot") @ResponseBody public String saveRunBoot(String content) { - File file = new File(SystemBean.getInstance().getEnvironment().getProperty("command.conf")); + File file = new File(SpringUtil.getEnvironment().getProperty("command.conf")); if (!file.exists()) { return JsonMessage.getString(500, "启动文件不存在"); diff --git a/src/main/java/cn/jiangzeyin/controller/manage/ManageControl.java b/src/main/java/cn/jiangzeyin/controller/manage/ManageControl.java index 086d8cddc..4f77f2402 100644 --- a/src/main/java/cn/jiangzeyin/controller/manage/ManageControl.java +++ b/src/main/java/cn/jiangzeyin/controller/manage/ManageControl.java @@ -1,11 +1,12 @@ package cn.jiangzeyin.controller.manage; +import cn.jiangzeyin.common.DefaultSystemLog; import cn.jiangzeyin.common.JsonMessage; -import cn.jiangzeyin.common.base.AbstractBaseControl; +import cn.jiangzeyin.common.PageUtil; import cn.jiangzeyin.common.interceptor.LoginInterceptor; +import cn.jiangzeyin.controller.base.AbstractBaseControl; import cn.jiangzeyin.model.ProjectInfoModel; import cn.jiangzeyin.service.manage.ManageService; -import cn.jiangzeyin.system.log.SystemLog; import cn.jiangzeyin.util.StringUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -15,11 +16,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; -import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import java.util.Set; @Controller @@ -27,11 +25,12 @@ import java.util.Set; public class ManageControl extends AbstractBaseControl { @Resource - ManageService manageService; + private ManageService manageService; /** * 展示项目页面 + * * @return */ @RequestMapping(value = "projectInfo") @@ -42,6 +41,7 @@ public class ManageControl extends AbstractBaseControl { /** * 管理项目 + * * @return */ @RequestMapping(value = "console") @@ -51,17 +51,17 @@ public class ManageControl extends AbstractBaseControl { pim = manageService.getProjectInfo(id); } catch (IOException e) { e.printStackTrace(); - SystemLog.LOG().error(e.getMessage(), e); + DefaultSystemLog.LOG().error(e.getMessage(), e); } - request.setAttribute("projectInfo", JSONObject.toJSONString(pim)); - request.setAttribute("userInfo", StringUtil.getMd5(String.format("%s:%s", session.getAttribute(LoginInterceptor.SESSION_NAME), session.getAttribute(LoginInterceptor.SESSION_PWD)))); + setAttribute("projectInfo", JSONObject.toJSONString(pim)); + setAttribute("userInfo", StringUtil.getMd5(String.format("%s:%s", getSession().getAttribute(LoginInterceptor.SESSION_NAME), getSession().getAttribute(LoginInterceptor.SESSION_PWD)))); return "manage/console"; } - /** * 查询所有项目 + * * @return */ @RequestMapping(value = "getProjectInfo") @@ -81,10 +81,10 @@ public class ManageControl extends AbstractBaseControl { array.add(json.get(iterator.next())); } - return JsonMessage.getPaginate(200, "查询成功!", array); + return PageUtil.getPaginate(200, "查询成功!", array); } catch (IOException e) { e.printStackTrace(); - SystemLog.LOG().error(e.getMessage(), e); + DefaultSystemLog.LOG().error(e.getMessage(), e); return JsonMessage.getString(500, e.getMessage()); } } @@ -92,6 +92,7 @@ public class ManageControl extends AbstractBaseControl { /** * 添加项目 + * * @return */ @RequestMapping(value = "addProject", method = RequestMethod.POST) @@ -106,13 +107,14 @@ public class ManageControl extends AbstractBaseControl { return JsonMessage.getString(200, "新增成功!"); } catch (Exception e) { e.printStackTrace(); - SystemLog.LOG().error(e.getMessage(), e); + DefaultSystemLog.LOG().error(e.getMessage(), e); return JsonMessage.getString(500, e.getMessage()); } } /** * 删除项目 + * * @param id * @return */ @@ -126,7 +128,7 @@ public class ManageControl extends AbstractBaseControl { return JsonMessage.getString(200, "删除成功!"); } catch (Exception e) { e.printStackTrace(); - SystemLog.LOG().error(e.getMessage(), e); + DefaultSystemLog.LOG().error(e.getMessage(), e); return JsonMessage.getString(500, e.getMessage()); } } @@ -134,6 +136,7 @@ public class ManageControl extends AbstractBaseControl { /** * 配置项目信息 + * * @param projectInfo * @return */ @@ -149,7 +152,7 @@ public class ManageControl extends AbstractBaseControl { return JsonMessage.getString(200, "配置成功!"); } catch (Exception e) { e.printStackTrace(); - SystemLog.LOG().error(e.getMessage(), e); + DefaultSystemLog.LOG().error(e.getMessage(), e); return JsonMessage.getString(500, e.getMessage()); } } diff --git a/src/main/java/cn/jiangzeyin/service/BaseService.java b/src/main/java/cn/jiangzeyin/service/BaseService.java index df4f9210a..e73b49791 100644 --- a/src/main/java/cn/jiangzeyin/service/BaseService.java +++ b/src/main/java/cn/jiangzeyin/service/BaseService.java @@ -1,13 +1,10 @@ package cn.jiangzeyin.service; -import cn.jiangzeyin.system.SystemBean; +import cn.jiangzeyin.common.spring.SpringUtil; import cn.jiangzeyin.util.JsonUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; @@ -15,10 +12,11 @@ public class BaseService { /** * 获取数据的路径,如果没有这个路径,则创建一个 + * * @return */ public File getDataPath() { - String path = SystemBean.getInstance().getEnvironment().getProperty("data.conf"); + String path = SpringUtil.getEnvironment().getProperty("data.conf"); File file = new File(path); if (!file.exists()) { file.mkdirs(); @@ -28,6 +26,7 @@ public class BaseService { /** * 获取数据文件的路径,如果文件不存在,则创建一个 + * * @param filename 文件名 * @return * @throws IOException @@ -35,7 +34,7 @@ public class BaseService { public String getDataFilePath(String filename) throws IOException { File file = new File(getDataPath(), filename); - if(!file.exists()) { + if (!file.exists()) { throw new FileNotFoundException(file.getPath() + " 文件不存在!"); } @@ -44,8 +43,9 @@ public class BaseService { /** * 保存json对象 + * * @param filename 文件名 - * @param json json数据 + * @param json json数据 * @throws IOException */ public void saveJson(String filename, JSONObject json) throws Exception { @@ -65,10 +65,11 @@ public class BaseService { /** * 修改json对象 + * * @param filename 文件名 - * @param json json数据 + * @param json json数据 */ - public void updateJson(String filename, JSONObject json) throws Exception{ + public void updateJson(String filename, JSONObject json) throws Exception { String key = json.getString("id"); // 读取文件,如果不存在记录,则抛出异常 JSONObject allData = getJsonObject(filename); @@ -85,6 +86,7 @@ public class BaseService { /** * 删除json对象 + * * @param filename * @param key * @throws Exception @@ -105,8 +107,9 @@ public class BaseService { /** * 根据主键读取json对象 + * * @param filename 文件名 - * @param key 主键 + * @param key 主键 * @return * @throws IOException */ @@ -118,6 +121,7 @@ public class BaseService { /** * 读取整个json文件 + * * @param filename 文件名 * @return * @throws IOException diff --git a/src/main/java/cn/jiangzeyin/socket/LogWebSocketHandle.java b/src/main/java/cn/jiangzeyin/socket/LogWebSocketHandle.java index 7148d629b..092b4bb59 100644 --- a/src/main/java/cn/jiangzeyin/socket/LogWebSocketHandle.java +++ b/src/main/java/cn/jiangzeyin/socket/LogWebSocketHandle.java @@ -1,16 +1,13 @@ package cn.jiangzeyin.socket; +import cn.jiangzeyin.common.DefaultSystemLog; import cn.jiangzeyin.common.JsonMessage; +import cn.jiangzeyin.common.spring.SpringUtil; import cn.jiangzeyin.service.BaseService; -import cn.jiangzeyin.service.UserService; -import cn.jiangzeyin.system.SystemBean; -import cn.jiangzeyin.system.log.SystemLog; -import cn.jiangzeyin.util.JsonUtil; import cn.jiangzeyin.util.StringUtil; import com.alibaba.fastjson.JSONObject; import org.springframework.stereotype.Component; -import javax.annotation.Resource; import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; @@ -64,14 +61,14 @@ public class LogWebSocketHandle implements TailLogThread.Evn { session.close(); } } catch (Exception e) { - SystemLog.LOG().error(e.getMessage()); + DefaultSystemLog.ERROR().error(e.getMessage()); try { if (null != session) { sendMsg(session, JsonMessage.getString(500, "系统错误!")); session.close(); } } catch (IOException e1) { - SystemLog.LOG().error(e1.getMessage()); + DefaultSystemLog.ERROR().error(e1.getMessage()); } } } @@ -79,7 +76,7 @@ public class LogWebSocketHandle implements TailLogThread.Evn { @OnMessage public void onMessage(String message, Session session) { - SystemLog.LOG().info("客户端消息:" + message); + DefaultSystemLog.LOG().info("客户端消息:" + message); JSONObject json = JSONObject.parseObject(message); JSONObject projectInfo = json.getJSONObject("projectInfo"); @@ -152,7 +149,7 @@ public class LogWebSocketHandle implements TailLogThread.Evn { } } catch (IOException e) { - SystemLog.ERROR().error("打开日志异常", e); + DefaultSystemLog.ERROR().error("打开日志异常", e); } break; default: @@ -162,8 +159,9 @@ public class LogWebSocketHandle implements TailLogThread.Evn { /** * 执行shell命令 - * @param session 用于输出的websocket会话 - * @param op 执行的操作 + * + * @param session 用于输出的websocket会话 + * @param op 执行的操作 * @param tag * @param mainClass * @param lib @@ -176,7 +174,7 @@ public class LogWebSocketHandle implements TailLogThread.Evn { StringBuffer sb_temp = new StringBuffer(); try { // 执行命令 - String command = String.format("%s %s %s %s %s %s %s %s", SystemBean.getInstance().getEnvironment().getProperty("command.conf"), op, tag, mainClass, lib, log, port, token); + String command = String.format("%s %s %s %s %s %s %s %s", SpringUtil.getEnvironment().getProperty("command.conf"), op, tag, mainClass, lib, log, port, token); System.out.println(command); Process process = Runtime.getRuntime().exec(command); is = process.getInputStream(); @@ -189,8 +187,8 @@ public class LogWebSocketHandle implements TailLogThread.Evn { } is.close(); } catch (IOException e) { - SystemLog.ERROR().error("执行命令异常", e); - sendMsg(session,"执行命令异常"); + DefaultSystemLog.ERROR().error("执行命令异常", e); + sendMsg(session, "执行命令异常"); } catch (InterruptedException e) { e.printStackTrace(); } @@ -207,17 +205,18 @@ public class LogWebSocketHandle implements TailLogThread.Evn { if (inputStream != null) inputStream.close(); } catch (Exception e) { - SystemLog.ERROR().error("关闭异常", e); + DefaultSystemLog.ERROR().error("关闭异常", e); } if (process != null) process.destroy(); if (thread != null) thread.stop(); - SystemLog.LOG().info(" socket 关闭"); + DefaultSystemLog.LOG().info(" socket 关闭"); } /** * 发送消息 + * * @param session * @param msg */ @@ -226,14 +225,14 @@ public class LogWebSocketHandle implements TailLogThread.Evn { try { session.getBasicRemote().sendText(msg); } catch (IOException e) { - SystemLog.ERROR().error("websocket发送信息异常", e); + DefaultSystemLog.ERROR().error("websocket发送信息异常", e); } } @OnError public void onError(Session session, Throwable thr) { - SystemLog.ERROR().error("socket 异常", thr); + DefaultSystemLog.ERROR().error("socket 异常", thr); } @Override diff --git a/src/main/java/cn/jiangzeyin/socket/TailLogThread.java b/src/main/java/cn/jiangzeyin/socket/TailLogThread.java index 2778f9110..c7cc210d8 100644 --- a/src/main/java/cn/jiangzeyin/socket/TailLogThread.java +++ b/src/main/java/cn/jiangzeyin/socket/TailLogThread.java @@ -1,10 +1,9 @@ package cn.jiangzeyin.socket; -import cn.jiangzeyin.system.log.SystemLog; +import cn.jiangzeyin.common.DefaultSystemLog; import javax.websocket.Session; import java.io.BufferedReader; -import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -45,10 +44,10 @@ public class TailLogThread implements Runnable { session.getAsyncRemote().sendText(line); } } catch (Exception e) { - SystemLog.ERROR().error("发送消息失败", e); + DefaultSystemLog.ERROR().error("发送消息失败", e); errorCount++; if (errorCount == 10) { - SystemLog.LOG().info("失败次数超过10次,结束本次事件"); + DefaultSystemLog.LOG().info("失败次数超过10次,结束本次事件"); stop(); if (evn != null) evn.onError(); @@ -56,7 +55,7 @@ public class TailLogThread implements Runnable { } } } - SystemLog.LOG().info("结束本次读取地址事件"); + DefaultSystemLog.LOG().info("结束本次读取地址事件"); } public interface Evn { diff --git a/src/main/java/cn/jiangzeyin/system/SystemBean.java b/src/main/java/cn/jiangzeyin/system/SystemBean.java deleted file mode 100644 index fedadb763..000000000 --- a/src/main/java/cn/jiangzeyin/system/SystemBean.java +++ /dev/null @@ -1,102 +0,0 @@ -package cn.jiangzeyin.system; -/** - * Created by jiangzeyin on 2017/1/5. - */ - -import cn.jiangzeyin.common.spring.SpringUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.EnvironmentAware; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; - -/** - * @author jiangzeyin - * @create 2017 01 05 21:10 - */ -@Configuration -public class SystemBean implements EnvironmentAware { - private volatile static SystemBean systemBean; - /** - * 系统标示 - */ - public static String SYSTEM_TAG = ""; - private Environment environment; - - @Override - public void setEnvironment(Environment environment) { - this.environment = environment; - } - - /** - * 模板文件存放路径 - */ - @Value("${spring.velocity.resource-loader-path:}") - public String VelocityPath; - /** - * 模板文件后缀 - */ - @Value("${spring.velocity.suffix:}") - public String velocitySuffix; -// /** -// * 系统标示 -// */ -// @Value("${server.tag}") -// public String systemTag; - - /** - * 检测请求超时记录时间 - */ - @Value("${request_timeout_log:3000}") - public Long request_timeout_log; - /** - * 系统预加载包名 - */ - @Value("${server.initPackageName:cn.jiangzeyin.system.init}") - public String initPackageName; - /** - * tomcat 路径 - */ - @Value("${server.tomcat.basedir:}") - private String tomcatBaseDir; - /** - * 程序绑定域名 - */ - @Value("${server.domain:}") - public String domain; - /** - * 程序运行模式 - */ - @Value("${spring.profiles.active:dev}") - private String profiles_active; - /** - * - */ - @Value("${server.api.token:}") - public String systemApiToken; - - - /** - * 系统配置对象 - * - * @return - */ - public static SystemBean getInstance() { - if (systemBean == null) { - synchronized (SystemBean.class) { - if (systemBean == null) { - systemBean = SpringUtil.getBean(SystemBean.class); - } - } - } - return systemBean; - } - - public Environment getEnvironment() { - return environment; - } - - - public String getTomcatBaseDir() { - return tomcatBaseDir; - } -} diff --git a/src/main/java/cn/jiangzeyin/system/log/SystemLog.java b/src/main/java/cn/jiangzeyin/system/log/SystemLog.java deleted file mode 100644 index 06154e82f..000000000 --- a/src/main/java/cn/jiangzeyin/system/log/SystemLog.java +++ /dev/null @@ -1,210 +0,0 @@ -package cn.jiangzeyin.system.log; - -import ch.qos.logback.classic.*; -import ch.qos.logback.classic.encoder.PatternLayoutEncoder; -import ch.qos.logback.classic.spi.ILoggingEvent; -import ch.qos.logback.core.ConsoleAppender; -import ch.qos.logback.core.rolling.RollingFileAppender; -import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy; -import ch.qos.logback.core.util.FileSize; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Configuration; -import org.springframework.util.Assert; - -import javax.annotation.PostConstruct; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @author jiangzeyin - * Created by jiangzeyin on 2017/2/3. - */ -@Configuration -public class SystemLog { - private static final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); - private static final Map LOG_TYPE_LOGGER_MAP = new ConcurrentHashMap<>(); - private static final Map LOGGER_MAP = new ConcurrentHashMap<>(); - private static final String TYPE_ERROR_TAG = "ERROR"; - private static ConsoleAppender consoleAppender; - private static String LogPath = "/ztoutiao/log/"; - - @PostConstruct - public void test() { - //System.out.println("执行加载方法"); - init(); - } - - private static void init() { - System.out.println("调用方法"); - //SystemLog.LogPath = logPath; - consoleAppender = initConsole(); - //initLogBackXml(); - initSystemLog(); - } - - /** - * 加载系统日志文件对象 - */ - private static void initSystemLog() { - for (LogType type : LogType.values()) { - String tag = type.toString(); - Level level = Level.INFO; - if (tag.endsWith(TYPE_ERROR_TAG)) { - level = Level.ERROR; - } - Logger logger = initLogger(tag, tag, level); - LOG_TYPE_LOGGER_MAP.put(type, logger); - //logger.info("init ok!"); - //logger.error("init error"); - } - } - -// /** -// * 加载自定义日志文件对象 -// */ -// private static void initLogBackXml() { -// // 加载自定义日志类型 -// InputStream inputStream = SystemLog.class.getResourceAsStream("/logback-spring.xml"); -// try { -// Document document = XmlUtil.load(inputStream); -// Element rootElement = document.getRootElement(); -// List property_s = rootElement.elements("property"); -// for (Element property : property_s) { -// Attribute name = property.attribute("name"); -// String name_value = name.getValue(); -// // 自定义日志类型 -// if (MY_LOG_TYPENAME.equalsIgnoreCase(name_value)) { -// String value = property.attribute("value").getValue(); -// String[] values = StringUtil.StringToArray(value); -// if (values != null) -// for (String item : values) { -// Level level = Level.INFO; -// if (item.endsWith(TYPE_ERROR_TAG)) { -// level = Level.ERROR; -// } -// Logger logger = initLogger(item, item, level); -// LOGGER_MAP.put(item, logger); -// //logger.info("init ok!"); -// } -// } else if (LOG_PATH_NAME.equalsIgnoreCase(name_value)) { -// // 日志保存跟路径 -// LogPath = property.attribute("value").getValue(); -// } -// } -// } catch (DocumentException e) { -// SystemLog.ERROR().error("加载日志文件xml", e); -// } -// } - - /** - * 加载控制显示 - * - * @return - */ - private static ConsoleAppender initConsole() { - ConsoleAppender appender = new ConsoleAppender<>(); - appender.setContext(loggerContext); - PatternLayout patternLayout = new PatternLayout(); - patternLayout.setContext(loggerContext); - patternLayout.setPattern("%date %level [%thread] %logger{10} [%file:%line]- x:\\(%X\\) %msg%n"); - patternLayout.start(); - appender.setLayout(patternLayout); - - appender.start(); - return appender; - } - - /** - * 创建日志对象 - * - * @param tag - * @param path - * @param level - * @return - */ - private static Logger initLogger(String tag, String path, Level level) { - Logger logger = (Logger) LoggerFactory.getLogger(tag); - logger.detachAndStopAllAppenders(); - logger.setLevel(level); - AsyncAppender asyncAppender = new AsyncAppender(); - asyncAppender.setContext(loggerContext); - asyncAppender.setDiscardingThreshold(0); - asyncAppender.setQueueSize(512); - //define appender - RollingFileAppender appender = new RollingFileAppender<>(); - //policy - SizeAndTimeBasedRollingPolicy policy = new SizeAndTimeBasedRollingPolicy<>(); - policy.setContext(loggerContext); - //"/ztoutiao/logsss/" + EntitySystemBean.getInstance().systemTag + "/" + path + "/" + tag + "-%d{yyyy-MM-dd}.%i.logsss" - policy.setFileNamePattern(String.format("%s/%s/%s-%%d{yyyy-MM-dd}.%%i.log", LogPath, path, tag)); - policy.setMaxFileSize("100MB"); - policy.setMaxHistory(30); - policy.setTotalSizeCap(FileSize.valueOf("10GB")); - policy.setParent(appender); - policy.start(); - //encoder - PatternLayoutEncoder encoder = new PatternLayoutEncoder(); - encoder.setContext(loggerContext); - encoder.setPattern("%d{HH:mm:ss.SSS} %-5level [%thread %file:%line] %logger - %msg%n"); - encoder.start(); - //start appender // "/ztoutiao/logsss/" + EntitySystemBean.getInstance().systemTag + "/" + path + "/" + tag + ".logsss" - appender.setFile(String.format("%s/%s/%s.log", LogPath, path, tag)); - appender.setName("appender" + tag); - appender.setRollingPolicy(policy); - appender.setContext(loggerContext); - appender.setEncoder(encoder); - //appender.setPrudent(true); //support that multiple JVMs can safely write to the same file. - appender.start(); - asyncAppender.addAppender(appender); - - asyncAppender.start(); - logger.addAppender(asyncAppender); - if (level == Level.ERROR) { - logger.addAppender(consoleAppender); - } - //setup level - // newLogger.setLevel(Level.ERROR); - //remove the appenders that inherited 'ROOT'. - logger.setAdditive(true); - return logger; - } - - /** - * 获取系统日志 - * - * @param type - * @return - */ - public static Logger LOG(LogType type) { - Logger logger = LOG_TYPE_LOGGER_MAP.get(type); - if (logger == null) - return LOG(LogType.DEFAULT); - return logger; - } - - public static Logger LOG() { - return LOG(LogType.DEFAULT); - } - - public static Logger ERROR() { - return LOG(LogType.ERROR); - } - - /** - * 获取自定义日志 - * - * @param type - * @return - */ - public static Logger LOG(String type) { - Logger logger = LOGGER_MAP.get(type); - if (logger == null) { - Assert.notNull(type); - if (type.endsWith(TYPE_ERROR_TAG)) - return ERROR(); - else - return LOG(); - } - return logger; - } -} diff --git a/src/main/java/cn/jiangzeyin/system/log/aop/WebLog.java b/src/main/java/cn/jiangzeyin/system/log/aop/WebLog.java index e9f512252..ae360d45d 100644 --- a/src/main/java/cn/jiangzeyin/system/log/aop/WebLog.java +++ b/src/main/java/cn/jiangzeyin/system/log/aop/WebLog.java @@ -1,8 +1,7 @@ package cn.jiangzeyin.system.log.aop; -import cn.jiangzeyin.system.log.LogType; -import cn.jiangzeyin.system.log.SystemLog; +import cn.jiangzeyin.common.DefaultSystemLog; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.Signature; import org.aspectj.lang.annotation.AfterReturning; @@ -51,6 +50,6 @@ public class WebLog { if (ret == null) return; //BaseInterceptor.getNowUserName() + - SystemLog.LOG(LogType.REQUEST).info(" :" + ret.toString()); + DefaultSystemLog.LOG().info(" :" + ret.toString()); } } diff --git a/src/main/java/cn/jiangzeyin/util/PackageUtil.java b/src/main/java/cn/jiangzeyin/util/PackageUtil.java deleted file mode 100644 index 0b7902b67..000000000 --- a/src/main/java/cn/jiangzeyin/util/PackageUtil.java +++ /dev/null @@ -1,166 +0,0 @@ -package cn.jiangzeyin.util; - - -import java.io.File; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -/** - * @author jiangzeyin - * @date 2016-9-9 - */ -public class PackageUtil { - - /** - * 获取某包下(包括该包的所有子包)所有类 - * - * @param packageName 包名 - * @return 类的完整名称 - * @throws UnsupportedEncodingException - */ - public static List getClassName(String packageName) throws IOException { - return getClassName(packageName, true); - } - - /** - * 获取某包下所有类 - * - * @param packageName 包名 - * @param childPackage 是否遍历子包 - * @return 类的完整名称 - * @throws UnsupportedEncodingException - */ - public static List getClassName(String packageName, boolean childPackage) throws IOException { - List fileNames = new ArrayList<>(); - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - String packagePath = packageName.replace(".", "/"); - Enumeration urls = loader.getResources(packagePath); - while (urls.hasMoreElements()) { - URL url = urls.nextElement(); - if (url == null) - continue; - String type = url.getProtocol(); - if (type.equals("file")) { - fileNames.addAll(getClassNameByFile(url.getPath(), childPackage)); - } else if (type.equals("jar")) { - fileNames.addAll(getClassNameByJar(url.getPath(), childPackage)); - } - } - fileNames.addAll(getClassNameByJars(((URLClassLoader) loader).getURLs(), packagePath, childPackage)); - return fileNames; - } - - /** - * 从项目文件获取某包下所有类 - * - * @param filePath 文件路径 - * 类名集合 - * @param childPackage 是否遍历子包 - * @return 类的完整名称 - * @throws UnsupportedEncodingException - */ - private static List getClassNameByFile(String filePath, boolean childPackage) throws UnsupportedEncodingException { - List myClassName = new ArrayList<>(); - filePath = UrlDecode.getURLDecode(filePath); - File file = new File(filePath); - File[] childFiles = file.listFiles(); - if (childFiles == null) - return myClassName; - for (File childFile : childFiles) { - if (childFile.isDirectory()) { - if (childPackage) { - myClassName.addAll(getClassNameByFile(childFile.getPath(), childPackage)); - } - } else { - String childFilePath = childFile.getPath(); - childFilePath = FileUtil.ClearPath(childFilePath); - if (childFilePath.endsWith(".class")) { - childFilePath = childFilePath.substring(childFilePath.indexOf("/classes/") + 9, childFilePath.lastIndexOf(".")); - childFilePath = childFilePath.replace("/", "."); - myClassName.add(childFilePath); - } - } - } - return myClassName; - } - - /** - * 从jar获取某包下所有类 - * - * @param jarPath jar文件路径 - * @param childPackage 是否遍历子包 - * @return 类的完整名称 - * @throws UnsupportedEncodingException - */ - private static List getClassNameByJar(String jarPath, boolean childPackage) throws UnsupportedEncodingException { - List myClassName = new ArrayList<>(); - String[] jarInfo = jarPath.split("!"); - String jarFilePath = jarInfo[0].substring(jarInfo[0].indexOf("/")); - jarFilePath = UrlDecode.getURLDecode(jarFilePath); - String packagePath = jarInfo[1].substring(1); - try { - JarFile jarFile = new JarFile(jarFilePath); - Enumeration entrys = jarFile.entries(); - while (entrys.hasMoreElements()) { - JarEntry jarEntry = entrys.nextElement(); - String entryName = jarEntry.getName(); - if (entryName.endsWith(".class")) { - if (childPackage) { - if (entryName.startsWith(packagePath)) { - entryName = entryName.replace("/", ".").substring(0, entryName.lastIndexOf(".")); - myClassName.add(entryName); - } - } else { - int index = entryName.lastIndexOf("/"); - String myPackagePath; - if (index != -1) { - myPackagePath = entryName.substring(0, index); - } else { - myPackagePath = entryName; - } - if (myPackagePath.equals(packagePath)) { - entryName = entryName.replace("/", ".").substring(0, entryName.lastIndexOf(".")); - myClassName.add(entryName); - } - } - } - } - } catch (Exception e) { - //SystemLog.Log(LogType.systemInfo, e.getMessage(), e); - } - return myClassName; - } - - /** - * 从所有jar中搜索该包,并获取该包下所有类 - * - * @param urls URL集合 - * @param packagePath 包路径 - * @param childPackage 是否遍历子包 - * @return 类的完整名称 - * @throws UnsupportedEncodingException - */ - private static List getClassNameByJars(URL[] urls, String packagePath, boolean childPackage) throws UnsupportedEncodingException { - List myClassName = new ArrayList(); - if (urls != null) { - for (int i = 0; i < urls.length; i++) { - URL url = urls[i]; - String urlPath = url.getPath(); - // 不必搜索classes文件夹 - if (urlPath.endsWith("classes/")) { - continue; - } - String jarPath = urlPath + "!/" + packagePath; - myClassName.addAll(getClassNameByJar(jarPath, childPackage)); - } - } - return myClassName; - } -} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 108eb34c7..9294a1212 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -6,7 +6,7 @@ boot.conf=/boot-line/ #order.conf=/yokead_boot/order/ #shield.conf=${order.conf}shield server.session-timeout=1800 -describe=nginx tools +banner.msg=boot-line server.tomcat.basedir=/ztoutiao_boot_tomcat spring.profiles.active=dev #velocity \u6A21\u677F\u6587\u4EF6\u914D\u7F6E