diff --git a/day06/.idea/.gitignore b/day06/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/day06/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/day06/.idea/compiler.xml b/day06/.idea/compiler.xml new file mode 100644 index 0000000..9245515 --- /dev/null +++ b/day06/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/.idea/day06.iml b/day06/.idea/day06.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/day06/.idea/day06.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/day06/.idea/encodings.xml b/day06/.idea/encodings.xml new file mode 100644 index 0000000..0d8b505 --- /dev/null +++ b/day06/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/day06/.idea/jarRepositories.xml b/day06/.idea/jarRepositories.xml new file mode 100644 index 0000000..e6b00eb --- /dev/null +++ b/day06/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/day06/.idea/misc.xml b/day06/.idea/misc.xml new file mode 100644 index 0000000..0c4aef1 --- /dev/null +++ b/day06/.idea/misc.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/.idea/modules.xml b/day06/.idea/modules.xml new file mode 100644 index 0000000..17a2e94 --- /dev/null +++ b/day06/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/day06/.idea/vcs.xml b/day06/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/day06/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/.gitignore b/day06/jvm-optimize/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/day06/jvm-optimize/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/day06/jvm-optimize/.idea/compiler.xml b/day06/jvm-optimize/.idea/compiler.xml new file mode 100644 index 0000000..d03d254 --- /dev/null +++ b/day06/jvm-optimize/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/dataSources.xml b/day06/jvm-optimize/.idea/dataSources.xml new file mode 100644 index 0000000..d7937fb --- /dev/null +++ b/day06/jvm-optimize/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306/jvm_test + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/easyCodeTableSetting.xml b/day06/jvm-optimize/.idea/easyCodeTableSetting.xml new file mode 100644 index 0000000..1a45fcc --- /dev/null +++ b/day06/jvm-optimize/.idea/easyCodeTableSetting.xml @@ -0,0 +1,43 @@ + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/encodings.xml b/day06/jvm-optimize/.idea/encodings.xml new file mode 100644 index 0000000..63e9001 --- /dev/null +++ b/day06/jvm-optimize/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/inspectionProfiles/Project_Default.xml b/day06/jvm-optimize/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6560a98 --- /dev/null +++ b/day06/jvm-optimize/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/jarRepositories.xml b/day06/jvm-optimize/.idea/jarRepositories.xml new file mode 100644 index 0000000..a9c88c4 --- /dev/null +++ b/day06/jvm-optimize/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_12.xml new file mode 100644 index 0000000..5756609 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_12.xml new file mode 100644 index 0000000..4e4a6dc --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__cn_hutool_hutool_all_5_8_16.xml b/day06/jvm-optimize/.idea/libraries/Maven__cn_hutool_hutool_all_5_8_16.xml new file mode 100644 index 0000000..619eecd --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__cn_hutool_hutool_all_5_8_16.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_3_3_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_3_3_2.xml new file mode 100644 index 0000000..ddfeb75 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_3_3_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_core_3_3_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_core_3_3_2.xml new file mode 100644 index 0000000..1e3ee9a --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_core_3_3_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_support_3_3_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_support_3_3_2.xml new file mode 100644 index 0000000..ebeab54 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_alibaba_easyexcel_support_3_3_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_13_5.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_13_5.xml new file mode 100644 index 0000000..26088bf --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_13_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_13_5.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_13_5.xml new file mode 100644 index 0000000..fe70acf --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_13_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_13_5.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_13_5.xml new file mode 100644 index 0000000..1972d6b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_13_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_13_5.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_13_5.xml new file mode 100644 index 0000000..7d20d35 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_13_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_13_5.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_13_5.xml new file mode 100644 index 0000000..59de5d2 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_13_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_13_5.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_13_5.xml new file mode 100644 index 0000000..b948660 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_13_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_github_ben_manes_caffeine_caffeine_2_9_3.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_github_ben_manes_caffeine_caffeine_2_9_3.xml new file mode 100644 index 0000000..8dac95d --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_github_ben_manes_caffeine_caffeine_2_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_github_virtuald_curvesapi_1_06.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_github_virtuald_curvesapi_1_06.xml new file mode 100644 index 0000000..d156c18 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_github_virtuald_curvesapi_1_06.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_10_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_10_0.xml new file mode 100644 index 0000000..21872ce --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_10_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_19_4.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_19_4.xml new file mode 100644 index 0000000..d08a596 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_19_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_7_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_7_0.xml new file mode 100644 index 0000000..65ee6e6 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_7_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_rabbitmq_amqp_client_5_14_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_rabbitmq_amqp_client_5_14_2.xml new file mode 100644 index 0000000..ca032ad --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_rabbitmq_amqp_client_5_14_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_sun_activation_jakarta_activation_1_2_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_sun_activation_jakarta_activation_1_2_2.xml new file mode 100644 index 0000000..fea99f0 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_sun_activation_jakarta_activation_1_2_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_sun_istack_istack_commons_runtime_3_0_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_sun_istack_istack_commons_runtime_3_0_12.xml new file mode 100644 index 0000000..9f0fc05 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_sun_istack_istack_commons_runtime_3_0_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml new file mode 100644 index 0000000..b8581a6 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_zaxxer_HikariCP_4_0_3.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_zaxxer_HikariCP_4_0_3.xml new file mode 100644 index 0000000..9314c36 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_zaxxer_HikariCP_4_0_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__com_zaxxer_SparseBitSet_1_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__com_zaxxer_SparseBitSet_1_2.xml new file mode 100644 index 0000000..6ce4aae --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__com_zaxxer_SparseBitSet_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__commons_codec_commons_codec_1_15.xml b/day06/jvm-optimize/.idea/libraries/Maven__commons_codec_commons_codec_1_15.xml new file mode 100644 index 0000000..c88c2b7 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__commons_codec_commons_codec_1_15.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__commons_io_commons_io_2_11_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__commons_io_commons_io_2_11_0.xml new file mode 100644 index 0000000..f94fc5a --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__commons_io_commons_io_2_11_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__io_micrometer_micrometer_core_1_9_11.xml b/day06/jvm-optimize/.idea/libraries/Maven__io_micrometer_micrometer_core_1_9_11.xml new file mode 100644 index 0000000..aa825c9 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__io_micrometer_micrometer_core_1_9_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__io_micrometer_micrometer_registry_prometheus_1_9_11.xml b/day06/jvm-optimize/.idea/libraries/Maven__io_micrometer_micrometer_registry_prometheus_1_9_11.xml new file mode 100644 index 0000000..b8bdfcb --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__io_micrometer_micrometer_registry_prometheus_1_9_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_0_15_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_0_15_0.xml new file mode 100644 index 0000000..4091481 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_0_15_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_common_0_15_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_common_0_15_0.xml new file mode 100644 index 0000000..81eb635 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_common_0_15_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_common_0_15_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_common_0_15_0.xml new file mode 100644 index 0000000..f35a43c --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_common_0_15_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_otel_0_15_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_otel_0_15_0.xml new file mode 100644 index 0000000..3118b37 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_otel_0_15_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_otel_agent_0_15_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_otel_agent_0_15_0.xml new file mode 100644 index 0000000..416fd44 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__io_prometheus_simpleclient_tracer_otel_agent_0_15_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__jakarta_activation_jakarta_activation_api_1_2_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__jakarta_activation_jakarta_activation_api_1_2_2.xml new file mode 100644 index 0000000..be90656 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__jakarta_activation_jakarta_activation_api_1_2_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml b/day06/jvm-optimize/.idea/libraries/Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml new file mode 100644 index 0000000..cba9dd2 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_3.xml b/day06/jvm-optimize/.idea/libraries/Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_3.xml new file mode 100644 index 0000000..04213f7 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__javax_cache_cache_api_1_1_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__javax_cache_cache_api_1_1_1.xml new file mode 100644 index 0000000..bb51cd8 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__javax_cache_cache_api_1_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_30.xml b/day06/jvm-optimize/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_30.xml new file mode 100644 index 0000000..d0a05d1 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_30.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_12_23.xml b/day06/jvm-optimize/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_12_23.xml new file mode 100644 index 0000000..80961a6 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_12_23.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_12_23.xml b/day06/jvm-optimize/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_12_23.xml new file mode 100644 index 0000000..5df1219 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_12_23.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__net_minidev_accessors_smart_2_4_11.xml b/day06/jvm-optimize/.idea/libraries/Maven__net_minidev_accessors_smart_2_4_11.xml new file mode 100644 index 0000000..e0b4d98 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__net_minidev_accessors_smart_2_4_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__net_minidev_json_smart_2_4_11.xml b/day06/jvm-optimize/.idea/libraries/Maven__net_minidev_json_smart_2_4_11.xml new file mode 100644 index 0000000..3e094f2 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__net_minidev_json_smart_2_4_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_4.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_4.xml new file mode 100644 index 0000000..5871c95 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_compress_1_19.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_compress_1_19.xml new file mode 100644 index 0000000..7c25fef --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_compress_1_19.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_csv_1_8.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_csv_1_8.xml new file mode 100644 index 0000000..c88f83f --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_csv_1_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_12_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_12_0.xml new file mode 100644 index 0000000..28b8682 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_12_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_math3_3_6_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_math3_3_6_1.xml new file mode 100644 index 0000000..ebfe0a8 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_commons_commons_math3_3_6_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_2.xml new file mode 100644 index 0000000..0a8d4ff --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_17_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_17_2.xml new file mode 100644 index 0000000..a4f1650 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_17_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_4_1_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_4_1_2.xml new file mode 100644 index 0000000..c706d5b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_4_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_ooxml_4_1_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_ooxml_4_1_2.xml new file mode 100644 index 0000000..905ca0c --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_ooxml_4_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_4_1_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_4_1_2.xml new file mode 100644 index 0000000..93d965d --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_4_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_75.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_75.xml new file mode 100644 index 0000000..d845667 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_75.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_75.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_75.xml new file mode 100644 index 0000000..793a442 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_75.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_75.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_75.xml new file mode 100644 index 0000000..b8090b8 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_75.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_3_1_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_3_1_0.xml new file mode 100644 index 0000000..0695d4b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_3_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml new file mode 100644 index 0000000..6ac1c42 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_assertj_assertj_core_3_22_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_assertj_assertj_core_3_22_0.xml new file mode 100644 index 0000000..a084174 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_assertj_assertj_core_3_22_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_checkerframework_checker_qual_3_19_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_checkerframework_checker_qual_3_19_0.xml new file mode 100644 index 0000000..ec11a25 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_checkerframework_checker_qual_3_19_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_ehcache_ehcache_3_10_8.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_ehcache_ehcache_3_10_8.xml new file mode 100644 index 0000000..d004b4f --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_ehcache_ehcache_3_10_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_glassfish_jaxb_jaxb_runtime_2_3_8.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_glassfish_jaxb_jaxb_runtime_2_3_8.xml new file mode 100644 index 0000000..e23be42 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_glassfish_jaxb_jaxb_runtime_2_3_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_glassfish_jaxb_txw2_2_3_8.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_glassfish_jaxb_txw2_2_3_8.xml new file mode 100644 index 0000000..8789537 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_glassfish_jaxb_txw2_2_3_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_hamcrest_hamcrest_2_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_hamcrest_hamcrest_2_2.xml new file mode 100644 index 0000000..6b5496f --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_hamcrest_hamcrest_2_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_hdrhistogram_HdrHistogram_2_1_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_hdrhistogram_HdrHistogram_2_1_12.xml new file mode 100644 index 0000000..6908885 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_hdrhistogram_HdrHistogram_2_1_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_8_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_8_2.xml new file mode 100644 index 0000000..4f367e7 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_2.xml new file mode 100644 index 0000000..8e50783 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_2.xml new file mode 100644 index 0000000..fc8291b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_8_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_8_2.xml new file mode 100644 index 0000000..4b3ffb1 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_2.xml new file mode 100644 index 0000000..181d095 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_2.xml new file mode 100644 index 0000000..5f3aebe --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_latencyutils_LatencyUtils_2_0_3.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_latencyutils_LatencyUtils_2_0_3.xml new file mode 100644 index 0000000..bf68169 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_latencyutils_LatencyUtils_2_0_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_mockito_mockito_core_4_5_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_mockito_mockito_core_4_5_1.xml new file mode 100644 index 0000000..68542c2 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_mockito_mockito_core_4_5_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_mockito_mockito_junit_jupiter_4_5_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_mockito_mockito_junit_jupiter_4_5_1.xml new file mode 100644 index 0000000..42f334f --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_mockito_mockito_junit_jupiter_4_5_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_mybatis_3_5_13.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_mybatis_3_5_13.xml new file mode 100644 index 0000000..120700f --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_mybatis_3_5_13.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_mybatis_spring_2_1_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_mybatis_spring_2_1_1.xml new file mode 100644 index 0000000..519b0a7 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_mybatis_spring_2_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_3_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_3_1.xml new file mode 100644 index 0000000..636121c --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_3_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_3_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_3_1.xml new file mode 100644 index 0000000..fb5645f --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_3_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_objenesis_objenesis_3_2.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_objenesis_objenesis_3_2.xml new file mode 100644 index 0000000..6613def --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_objenesis_objenesis_3_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_openjdk_jol_jol_core_0_9.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_openjdk_jol_jol_core_0_9.xml new file mode 100644 index 0000000..366b137 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_openjdk_jol_jol_core_0_9.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml new file mode 100644 index 0000000..fbc1b16 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_ow2_asm_asm_9_3.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_ow2_asm_asm_9_3.xml new file mode 100644 index 0000000..ce5a26c --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_ow2_asm_asm_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_projectlombok_lombok_1_18_26.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_projectlombok_lombok_1_18_26.xml new file mode 100644 index 0000000..76fa15b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_projectlombok_lombok_1_18_26.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_1.xml new file mode 100644 index 0000000..56582d6 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_36.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_36.xml new file mode 100644 index 0000000..5d5c14b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_36.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_36.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_36.xml new file mode 100644 index 0000000..2d759c1 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_36.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_amqp_spring_amqp_2_4_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_amqp_spring_amqp_2_4_12.xml new file mode 100644 index 0000000..20e751b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_amqp_spring_amqp_2_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_amqp_spring_rabbit_2_4_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_amqp_spring_rabbit_2_4_12.xml new file mode 100644 index 0000000..a4e7151 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_amqp_spring_rabbit_2_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_2_7_12.xml new file mode 100644 index 0000000..5455c99 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_2_7_12.xml new file mode 100644 index 0000000..03979d2 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_autoconfigure_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_autoconfigure_2_7_12.xml new file mode 100644 index 0000000..5a78876 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_autoconfigure_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_7_12.xml new file mode 100644 index 0000000..f6fa6cb --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_7_12.xml new file mode 100644 index 0000000..8eeb289 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_actuator_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_actuator_2_7_12.xml new file mode 100644 index 0000000..075dd3f --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_actuator_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_amqp_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_amqp_2_7_12.xml new file mode 100644 index 0000000..55b237d --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_amqp_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_7_12.xml new file mode 100644 index 0000000..2e4e82b --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_7_12.xml new file mode 100644 index 0000000..1c3c154 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_7_12.xml new file mode 100644 index 0000000..bf4e71a --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_7_12.xml new file mode 100644 index 0000000..c0bab51 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_7_12.xml new file mode 100644 index 0000000..b9e38ad --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_7_12.xml new file mode 100644 index 0000000..6c3b5af --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_7_12.xml new file mode 100644 index 0000000..e2247e0 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_7_12.xml new file mode 100644 index 0000000..af30708 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_7_12.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_7_12.xml new file mode 100644 index 0000000..f7a571c --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_retry_spring_retry_1_3_4.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_retry_spring_retry_1_3_4.xml new file mode 100644 index 0000000..d8f2003 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_retry_spring_retry_1_3_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_aop_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_aop_5_3_27.xml new file mode 100644 index 0000000..b5179f7 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_aop_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_beans_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_beans_5_3_27.xml new file mode 100644 index 0000000..3699ce3 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_beans_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_context_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_context_5_3_27.xml new file mode 100644 index 0000000..e28c5b5 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_context_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_core_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_core_5_3_27.xml new file mode 100644 index 0000000..0cfd4fe --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_core_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_expression_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_expression_5_3_27.xml new file mode 100644 index 0000000..a6dd498 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_expression_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_27.xml new file mode 100644 index 0000000..0dc8d66 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_27.xml new file mode 100644 index 0000000..d8c6d8d --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_messaging_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_messaging_5_3_27.xml new file mode 100644 index 0000000..7bf47b9 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_messaging_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_test_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_test_5_3_27.xml new file mode 100644 index 0000000..f4ff0f9 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_test_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_tx_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_tx_5_3_27.xml new file mode 100644 index 0000000..6944cd0 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_tx_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_web_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_web_5_3_27.xml new file mode 100644 index 0000000..515fe77 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_web_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_webmvc_5_3_27.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_webmvc_5_3_27.xml new file mode 100644 index 0000000..14e9d13 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_springframework_spring_webmvc_5_3_27.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_9_1.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_9_1.xml new file mode 100644 index 0000000..e2f6d14 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_9_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/libraries/Maven__org_yaml_snakeyaml_1_30.xml b/day06/jvm-optimize/.idea/libraries/Maven__org_yaml_snakeyaml_1_30.xml new file mode 100644 index 0000000..7eda891 --- /dev/null +++ b/day06/jvm-optimize/.idea/libraries/Maven__org_yaml_snakeyaml_1_30.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/misc.xml b/day06/jvm-optimize/.idea/misc.xml new file mode 100644 index 0000000..5755a99 --- /dev/null +++ b/day06/jvm-optimize/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/modules.xml b/day06/jvm-optimize/.idea/modules.xml new file mode 100644 index 0000000..84c7602 --- /dev/null +++ b/day06/jvm-optimize/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/runConfigurations.xml b/day06/jvm-optimize/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/day06/jvm-optimize/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/uiDesigner.xml b/day06/jvm-optimize/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/day06/jvm-optimize/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/.idea/workspace_冲突文件_xiadong_20230615174726.xml b/day06/jvm-optimize/.idea/workspace_冲突文件_xiadong_20230615174726.xml new file mode 100644 index 0000000..0e65eb8 --- /dev/null +++ b/day06/jvm-optimize/.idea/workspace_冲突文件_xiadong_20230615174726.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1684890228284 + + + + + + \ No newline at end of file diff --git a/day06/jvm-optimize/pom.xml b/day06/jvm-optimize/pom.xml new file mode 100644 index 0000000..141ed48 --- /dev/null +++ b/day06/jvm-optimize/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.12 + + + com.woniu + jvm-optimize + 0.0.1-SNAPSHOT + jvm-optimize + jvm-optimize + + 8 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.apache.commons + commons-lang3 + 3.12.0 + + + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-logging + + + + + + + + + + + + mysql + mysql-connector-java + 8.0.30 + + + + org.openjdk.jol + jol-core + 0.9 + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.3.1 + + + + org.springframework.data + spring-data-commons + + + + org.apache.poi + poi + 4.1.2 + + + org.apache.poi + poi-ooxml + 4.1.2 + + + + cn.hutool + hutool-all + 5.8.16 + + + + + com.alibaba + easyexcel + 3.3.2 + + + + com.github.ben-manes.caffeine + caffeine + 2.9.3 + + + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + + diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/JvmOptimizeApplication.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/JvmOptimizeApplication.java new file mode 100644 index 0000000..93f5e8d --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/JvmOptimizeApplication.java @@ -0,0 +1,15 @@ +package com.woniu.jvmoptimize; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ConfigurableApplicationContext; + +//-Xmx100m -Xms100m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:/jvm/heapdemo.hprof +@SpringBootApplication +public class JvmOptimizeApplication { + + public static void main(String[] args) { + ConfigurableApplicationContext run = SpringApplication.run(JvmOptimizeApplication.class, args); + } + +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/controller/LeakController.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/controller/LeakController.java new file mode 100644 index 0000000..b9062f8 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/controller/LeakController.java @@ -0,0 +1,43 @@ +package com.woniu.jvmoptimize.controller; + +import com.woniu.jvmoptimize.entity.UserEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/leak") +public class LeakController { + private static Map userCache = new HashMap<>(); + private static List bigheap = new ArrayList<>(); + + /** + * 大量数据 + 处理慢 + */ + @GetMapping("/test") + public void test1() throws InterruptedException { + byte[] bytes = new byte[1024 * 1024 * 100];//100m + Thread.sleep(10 * 1000L); + } + + /** + * 登录接口 传递名字和id,放入hashmap中 + */ + @PostMapping("/login") + public void login(String name,Long id){ + userCache.put(id,new UserEntity(id,name)); + } + + + @GetMapping("/bigheap") + public void bigheap(){ + //3g + for (int i = 0; i < 1024; i++) { + bigheap.add(new byte[1024 * 1024 * 3]); + } + + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/controller/OOMController.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/controller/OOMController.java new file mode 100644 index 0000000..3d0bc24 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/controller/OOMController.java @@ -0,0 +1,37 @@ +package com.woniu.jvmoptimize.controller; + +import com.woniu.jvmoptimize.entity.UserEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.PostConstruct; +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/user") +public class OOMController { + private static Map userCache = new HashMap<>(); + + @PostConstruct + public void init(){ + userCache.put(0L,new UserEntity(0L,"张三")); + } + + //根据id获取用户信息 + @GetMapping("/{id}") + public UserEntity user(@PathVariable("id") Long id){ + return userCache.get(id); + } + + //批量创建缓存 + @GetMapping("/createCache") + public void createCache() + { + for (long i = 0; i < 10000000L; i++) { + userCache.put(i,new UserEntity(i,String.valueOf(i))); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/Student.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/Student.java new file mode 100644 index 0000000..ac74343 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/Student.java @@ -0,0 +1,46 @@ +package com.woniu.jvmoptimize.entity; + +import java.util.Objects; + +public class Student { + private int id; + private String name; + private int classId; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Student student = (Student) o; + return id == student.id; + } + + @Override + public int hashCode() { + return Objects.hash(id); + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/UserEntity.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/UserEntity.java new file mode 100644 index 0000000..ba3559a --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/UserEntity.java @@ -0,0 +1,17 @@ +package com.woniu.jvmoptimize.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +public class UserEntity { + private Long id; + private String name; + //每个对象增加1MB的额外内存,让溢出来的更快一些 + //private byte[] bytes = new byte[1024 * 1024]; + + public UserEntity(Long id, String name) { + this.id = id; + this.name = name; + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo1/Demo1.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo1/Demo1.java new file mode 100644 index 0000000..831e089 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo1/Demo1.java @@ -0,0 +1,52 @@ +package com.woniu.jvmoptimize.leakdemo.demo1; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.sql.*; + +//-Xmx50m -Xms50m +public class Demo1 { + + // JDBC driver name and database URL + static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver"; + static final String DB_URL = "jdbc:mysql:///bank1"; + + // Database credentials + static final String USER = "root"; + static final String PASS = "123456"; + + public static void leak() { + //Connection conn = null; + Statement stmt = null; + try (Connection conn = DriverManager.getConnection(DB_URL, USER, PASS)){ + + // executes a valid query + stmt = conn.createStatement(); + String sql; + sql = "SELECT id, account_name FROM account_info"; + ResultSet rs = stmt.executeQuery(sql); + + //STEP 4: Extract data from result set + while (rs.next()) { + //Retrieve by column name + int id = rs.getInt("id"); + String name = rs.getString("account_name"); + + //Display values + System.out.print("ID: " + id); + System.out.print(", Name: " + name + "\n"); + } + } catch(SQLException sqlEx) { + sqlEx.printStackTrace(); + } + } + + public static void main(String[] args) throws InterruptedException { + while(true){ + leak(); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Demo0.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Demo0.java new file mode 100644 index 0000000..fbe3d9f --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Demo0.java @@ -0,0 +1,12 @@ +package com.woniu.jvmoptimize.leakdemo.demo2; + +public class Demo0 { + public static long count = 0; + public static void main(String[] args) throws InterruptedException { + while (true){ + Student student = new Student(); + student.setId(1); + student.setName("张三"); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Demo2.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Demo2.java new file mode 100644 index 0000000..5f8146e --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Demo2.java @@ -0,0 +1,20 @@ +package com.woniu.jvmoptimize.leakdemo.demo2; + +import java.util.HashMap; +import java.util.Map; + +public class Demo2 { + public static long count = 0; + public static Map map = new HashMap<>(); + public static void main(String[] args) throws InterruptedException { + while (true){ + if(count++ % 100 == 0){ + Thread.sleep(10); + } + Student student = new Student(); + student.setId(1); + student.setName("张三"); + map.put(student,1L); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Student.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Student.java new file mode 100644 index 0000000..e25fdaa --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo2/Student.java @@ -0,0 +1,48 @@ +package com.woniu.jvmoptimize.leakdemo.demo2; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +public class Student { + private String name; + private Integer id; + private byte[] bytes = new byte[1024 * 1024]; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Student student = (Student) o; + + return new EqualsBuilder().append(id, student.id).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(17, 37).append(id).toHashCode(); + } +} + + diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo3/Outer.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo3/Outer.java new file mode 100644 index 0000000..143970b --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo3/Outer.java @@ -0,0 +1,27 @@ +package com.woniu.jvmoptimize.leakdemo.demo3; + +import java.io.IOException; +import java.util.ArrayList; + +public class Outer{ + private byte[] bytes = new byte[1024 * 1024]; //外部类持有数据 + private static String name = "测试"; + static class Inner{ + private String name; + public Inner() { + this.name = Outer.name; + } + } + + public static void main(String[] args) throws IOException, InterruptedException { +// System.in.read(); + int count = 0; + ArrayList inners = new ArrayList<>(); + while (true){ + if(count++ % 100 == 0){ + Thread.sleep(10); + } + inners.add(new Inner()); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo4/Outer.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo4/Outer.java new file mode 100644 index 0000000..5baa5dc --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo4/Outer.java @@ -0,0 +1,26 @@ +package com.woniu.jvmoptimize.leakdemo.demo4; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class Outer { + private byte[] bytes = new byte[1024]; + public static List newList() { + List list = new ArrayList() {{ + add("1"); + add("2"); + }}; + return list; + } + + public static void main(String[] args) throws IOException { + System.in.read(); + int count = 0; + ArrayList objects = new ArrayList<>(); + while (true){ + System.out.println(++count); + objects.add(newList()); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo5/Demo5.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo5/Demo5.java new file mode 100644 index 0000000..62a8c5d --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo5/Demo5.java @@ -0,0 +1,23 @@ +package com.woniu.jvmoptimize.leakdemo.demo5; + +import java.util.concurrent.*; + +public class Demo5 { + public static ThreadLocal threadLocal = new ThreadLocal<>(); + + public static void main(String[] args) throws InterruptedException { + ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Integer.MAX_VALUE, Integer.MAX_VALUE, + 0, TimeUnit.DAYS, new SynchronousQueue<>()); + int count = 0; + while (true) { + System.out.println(++count); + threadPoolExecutor.execute(() -> { + threadLocal.set(new byte[1024 * 1024]); + threadLocal.remove(); + }); + Thread.sleep(10); + } + + + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo5/Demo5_1.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo5/Demo5_1.java new file mode 100644 index 0000000..22f7a08 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo5/Demo5_1.java @@ -0,0 +1,20 @@ +package com.woniu.jvmoptimize.leakdemo.demo5; + +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public class Demo5_1 { + public static ThreadLocal threadLocal = new ThreadLocal<>(); + + public static void main(String[] args) throws InterruptedException { + while (true) { + new Thread(() -> { + threadLocal.set(new byte[1024 * 1024 * 10]); + }).start(); + Thread.sleep(10); + } + + + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo6/Demo6.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo6/Demo6.java new file mode 100644 index 0000000..cba30d5 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo6/Demo6.java @@ -0,0 +1,19 @@ +package com.woniu.jvmoptimize.leakdemo.demo6; + +import org.apache.commons.lang3.RandomStringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class Demo6 { + public static void main(String[] args) { + while (true){ + List list = new ArrayList(); + int i = 0; + while (true) { + //String.valueOf(i++).intern(); //JDK1.6 perm gen 不会溢出 + list.add(String.valueOf(i++).intern()); //溢出 + } + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo7/CaffineDemo.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo7/CaffineDemo.java new file mode 100644 index 0000000..173d35f --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo7/CaffineDemo.java @@ -0,0 +1,19 @@ +package com.woniu.jvmoptimize.leakdemo.demo7; + +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; + +import java.time.Duration; + +public class CaffineDemo { + public static void main(String[] args) throws InterruptedException { + Cache build = Caffeine.newBuilder() + .expireAfterWrite(Duration.ofMillis(100)) + .build(); + int count = 0; + while (true){ + build.put(count++,new byte[1024 * 1024 * 10]); + Thread.sleep(100L); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo7/TestLazy.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo7/TestLazy.java new file mode 100644 index 0000000..05e8649 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/leakdemo/demo7/TestLazy.java @@ -0,0 +1,10 @@ +package com.woniu.jvmoptimize.leakdemo.demo7; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +@Lazy //懒加载 +@Component +public class TestLazy { + private byte[] bytes = new byte[1024 * 1024 * 1024]; +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/HeapDemo.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/HeapDemo.java new file mode 100644 index 0000000..3859b3b --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/HeapDemo.java @@ -0,0 +1,33 @@ +package com.woniu.jvmoptimize.matdemo; + +import java.util.ArrayList; +import java.util.List; + +//-XX:+HeapDumpBeforeFullGC -XX:HeapDumpPath=D:/jvm/dump/mattest.hprof +public class HeapDemo { + public static void main(String[] args) { + TestClass a1 = new TestClass(); + TestClass a2 = new TestClass(); + TestClass a3 = new TestClass(); + String s1 = "itheima1"; + String s2 = "itheima2"; + String s3 = "itheima3"; + + a1.list.add(s1); + + a2.list.add(s1); + a2.list.add(s2); + + a3.list.add(s3); + + //System.out.print(ClassLayout.parseClass(TestClass.class).toPrintable()); + s1 = null; + s2 = null; + s3 = null; + System.gc(); + } +} + +class TestClass { + public List list = new ArrayList<>(10); +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/HeapDemo2.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/HeapDemo2.java new file mode 100644 index 0000000..c36c74f --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/HeapDemo2.java @@ -0,0 +1,35 @@ +package com.woniu.jvmoptimize.matdemo; + +import java.util.ArrayList; +import java.util.List; + +//-XX:+HeapDumpBeforeFullGC -XX:HeapDumpPath=D:/jvm/heapdemo.hprof +public class HeapDemo2 { + public static void main(String[] args) { + TestClass2 a1 = new TestClass2(); + TestClass2 a2 = new TestClass2(); + TestClass2 a3 = new TestClass2(); + + byte[] bytes1 = new byte[1024 * 1024 * 10]; + byte[] bytes2 = new byte[1024 * 1024 * 10]; + byte[] bytes3 = new byte[1024 * 1024 * 10]; + + a1.list.add(bytes1); + + a2.list.add(bytes1); + a2.list.add(bytes2); + + a3.list.add(bytes3); + + //System.out.print(ClassLayout.parseClass(TestClass.class).toPrintable()); + bytes1 = null; + bytes2 = null; + bytes3 = null; + + System.gc(); + } +} + +class TestClass2 { + public List list = new ArrayList(10); +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/StringSize.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/StringSize.java new file mode 100644 index 0000000..c9480fe --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/matdemo/StringSize.java @@ -0,0 +1,10 @@ +package com.woniu.jvmoptimize.matdemo; + +import org.openjdk.jol.info.ClassLayout; + +public class StringSize { + public static void main(String[] args) { + //使用JOL打印String对象 + System.out.print(ClassLayout.parseClass(String.class).toPrintable()); + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/common/UserDataContextHolder.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/common/UserDataContextHolder.java new file mode 100644 index 0000000..1bceebf --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/common/UserDataContextHolder.java @@ -0,0 +1,10 @@ +package com.woniu.jvmoptimize.practice.demo.common; + +public class UserDataContextHolder { + public static ThreadLocal userData = new ThreadLocal<>(); + + public static class UserData{ + byte[] data = new byte[1024 * 1024 * 10]; //模拟保存10m的用户数据 + } +} + diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/AsyncThreadPoolTaskConfig.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/AsyncThreadPoolTaskConfig.java new file mode 100644 index 0000000..f0d27ae --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/AsyncThreadPoolTaskConfig.java @@ -0,0 +1,35 @@ +package com.woniu.jvmoptimize.practice.demo.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.ThreadPoolExecutor; + +@Configuration +@EnableAsync +public class AsyncThreadPoolTaskConfig { + + private static final int corePoolSize = 50; // 核心线程数(默认线程数) + private static final int maxPoolSize = 100; // 最大线程数 + private static final int keepAliveTime = 10; // 允许线程空闲时间(单位:默认为秒) + private static final int queueCapacity = 200; // 缓冲队列数 + private static final String threadNamePrefix = "Async-Task-"; // 线程池名前缀 + + @Bean("asyncTaskExecutor") + public ThreadPoolTaskExecutor getAsyncExecutor(){ + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(corePoolSize); + //executor.setMaxPoolSize(Integer.MAX_VALUE); + executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveTime); + executor.setThreadNamePrefix(threadNamePrefix); + // 线程池对拒绝任务的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); + // 初始化 + executor.initialize(); + return executor; + } +} \ No newline at end of file diff --git a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/LoginConfig.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/LoginConfig.java similarity index 81% rename from 系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/LoginConfig.java rename to day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/LoginConfig.java index faba1ee..cd43fb3 100644 --- a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/LoginConfig.java +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/LoginConfig.java @@ -1,4 +1,4 @@ -package com.woniu.jvmoptimize.config; +package com.woniu.jvmoptimize.practice.demo.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; @@ -11,7 +11,7 @@ public class LoginConfig implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { //注册拦截器 registry.addInterceptor(new UserInterceptor()) - .addPathPatterns("/dealMemory/**"); + .addPathPatterns("/threadlocal/**"); } } \ No newline at end of file diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/ThreadPoolTaskConfig.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/ThreadPoolTaskConfig.java new file mode 100644 index 0000000..9ed3398 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/ThreadPoolTaskConfig.java @@ -0,0 +1,39 @@ +package com.woniu.jvmoptimize.practice.demo.config; + +import com.woniu.jvmoptimize.practice.demo.pojo.ArticleDto; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; + +@Configuration +@EnableAsync +public class ThreadPoolTaskConfig { + + public static final BlockingQueue BUFFER_QUEUE = new LinkedBlockingQueue<>(2000); + private static final int corePoolSize = 50; // 核心线程数(默认线程数) + private static final int maxPoolSize = 100; // 最大线程数 + private static final int keepAliveTime = 10; // 允许线程空闲时间(单位:默认为秒) + private static final int queueCapacity = 200; // 缓冲队列数 + private static final String threadNamePrefix = "Async-Service-"; // 线程池名前缀 + + @Bean("taskExecutor") + public ThreadPoolTaskExecutor getAsyncExecutor(){ + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(corePoolSize); + executor.setMaxPoolSize(Integer.MAX_VALUE); + //executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveTime); + executor.setThreadNamePrefix(threadNamePrefix); + // 线程池对拒绝任务的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); + // 初始化 + executor.initialize(); + return executor; + } +} \ No newline at end of file diff --git a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/UserInterceptor.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/UserInterceptor.java similarity index 74% rename from 系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/UserInterceptor.java rename to day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/UserInterceptor.java index eaafad9..e544907 100644 --- a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/UserInterceptor.java +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/config/UserInterceptor.java @@ -1,6 +1,6 @@ -package com.woniu.jvmoptimize.config; +package com.woniu.jvmoptimize.practice.demo.config; -import com.woniu.jvmoptimize.entity.UserData; +import com.woniu.jvmoptimize.practice.demo.common.UserDataContextHolder; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; @@ -12,21 +12,19 @@ import javax.servlet.http.HttpServletResponse; */ public class UserInterceptor implements HandlerInterceptor { - public static ThreadLocal userData = new ThreadLocal<>(); - @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - userData.set(new UserData()); - return true; + UserDataContextHolder.userData.set(new UserDataContextHolder.UserData()); + return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { -// userData.remove(); + UserDataContextHolder.userData.remove(); } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - userData.remove(); + } } diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/Demo1ArticleController.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/Demo1ArticleController.java new file mode 100644 index 0000000..5d7b808 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/Demo1ArticleController.java @@ -0,0 +1,63 @@ +package com.woniu.jvmoptimize.practice.demo.controller; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woniu.jvmoptimize.practice.demo.pojo.ArticleDto; +import com.woniu.jvmoptimize.practice.demo.service.ArticleService; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * -XX:+HeapDumpOnOutOfMemoryError + */ +@RestController +@RequestMapping("/article") +public class Demo1ArticleController { +// volatile int count = 0; +// @PostConstruct +// public void init(){ +// +// ExecutorService executorService = Executors.newCachedThreadPool(); +// while (true){ +// executorService.submit(new Runnable() { +// @Override +// public void run() { +// System.out.println(++count); +// try { +// Thread.sleep(1000 * 1000); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// } +// }); +// } +// +// } + + @Autowired + private ArticleService articleService; + + @PostMapping("/demo1/{id}") + public void article1(@PathVariable("id") long id, @RequestBody ArticleDto article){ + article.setId(id); + articleService.asyncSaveArticle(article); + } + + @PostMapping("/demo2/{id}") + public void article2(@PathVariable("id") long id, @RequestBody ArticleDto article){ + article.setId(id); + articleService.saveArticle(article); + } + + @Autowired + private RabbitTemplate rabbitTemplate; + @Autowired + private ObjectMapper objectMapper; + + @PostMapping("/demo3/{id}") + public void article3(@PathVariable("id") long id, @RequestBody ArticleDto article) throws JsonProcessingException { + article.setId(id); + rabbitTemplate.convertAndSend("jvm-test",null, objectMapper.writeValueAsString(article)); + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/Demo2ExcelController.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/Demo2ExcelController.java new file mode 100644 index 0000000..7258c07 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/Demo2ExcelController.java @@ -0,0 +1,108 @@ +package com.woniu.jvmoptimize.practice.demo.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.poi.excel.BigExcelWriter; +import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.woniu.jvmoptimize.practice.demo.pojo.DemoData; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.bind.annotation.*; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * -XX:+HeapDumpOnOutOfMemoryError + */ +@RestController +@RequestMapping("/excel") +public class Demo2ExcelController { + + @GetMapping("/export") + public void export(int size, String path) throws IOException { + // 1 、创建工作薄 + Workbook workbook = new XSSFWorkbook(); + // 2、在工作薄中创建sheet + Sheet sheet = workbook.createSheet("测试"); + + for (int i = 0; i < size; i++) { + // 3、在sheet中创建行 + Row row0 = sheet.createRow(i); + // 4、创建单元格并存入数据 + row0.createCell(0).setCellValue(RandomStringUtils.randomAlphabetic(1000)); + } + + + // 将文件输出到指定文件 + FileOutputStream fileOutputStream = null; + try { + fileOutputStream = new FileOutputStream(path + RandomStringUtils.randomAlphabetic(10) + ".xlsx"); + workbook.write(fileOutputStream); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fileOutputStream != null) { + fileOutputStream.close(); + } + if (workbook != null) { + workbook.close(); + } + } + + } + + + //http://www.hutool.cn/docs/#/poi/Excel%E5%A4%A7%E6%95%B0%E6%8D%AE%E7%94%9F%E6%88%90-BigExcelWriter + @GetMapping("/export_hutool") + public void export_hutool(int size, String path) throws IOException { + + + List> rows = new ArrayList<>(); + for (int i = 0; i < size; i++) { + rows.add( CollUtil.newArrayList(RandomStringUtils.randomAlphabetic(1000))); + } + + BigExcelWriter writer= ExcelUtil.getBigWriter(path + RandomStringUtils.randomAlphabetic(10) + ".xlsx"); +// 一次性写出内容,使用默认样式 + writer.write(rows); +// 关闭writer,释放内存 + writer.close(); + + + } + + + //https://easyexcel.opensource.alibaba.com/docs/current/quickstart/write#%E9%87%8D%E5%A4%8D%E5%A4%9A%E6%AC%A1%E5%86%99%E5%85%A5%E5%86%99%E5%88%B0%E5%8D%95%E4%B8%AA%E6%88%96%E8%80%85%E5%A4%9A%E4%B8%AAsheet + @GetMapping("/export_easyexcel") + public void export_easyexcel(int size, String path,int batch) throws IOException { + + // 方法1: 如果写到同一个sheet + String fileName = path + RandomStringUtils.randomAlphabetic(10) + ".xlsx"; + // 这里注意 如果同一个sheet只要创建一次 + WriteSheet writeSheet = EasyExcel.writerSheet("测试").build(); + // 这里 需要指定写用哪个class去写 + try (ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build()) { + // 分100次写入 + for (int i = 0; i < batch; i++) { + // 分页去数据库查询数据 这里可以去数据库查询每一页的数据 + List datas = new ArrayList<>(); + for (int j = 0; j < size / batch; j++) { + DemoData demoData = new DemoData(); + demoData.setString(RandomStringUtils.randomAlphabetic(1000)); + datas.add(demoData); + } + excelWriter.write(datas, writeSheet); + //写入之后datas数据就可以释放了 + } + } + + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoQueryController.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoQueryController.java new file mode 100644 index 0000000..098330d --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoQueryController.java @@ -0,0 +1,82 @@ +package com.woniu.jvmoptimize.practice.demo.controller; + +import com.woniu.jvmoptimize.practice.demo.pojo.TbArticle; +import com.woniu.jvmoptimize.practice.demo.service.TbArticleService; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * -Xmx1g -Xms1g + * -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:/jvm/dump/heapdemo.hprof + */ +@RestController +@RequestMapping("/hugequery") +public class DemoQueryController { + + /** + * 服务对象 + */ + @Resource + private TbArticleService articleService; + + /** + * 分页查询 + * + * @param tbArticle 筛选条件 + * @return 查询结果 + */ + @GetMapping + public ResponseEntity> queryByPage(TbArticle tbArticle, int page,int size) { +// size = Math.min(100,size); + return ResponseEntity.ok(this.articleService.queryByPage(tbArticle, PageRequest.of(page,size))); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseEntity queryById(@PathVariable("id") Long id) { + return ResponseEntity.ok(this.articleService.queryById(id)); + } + + /** + * 新增数据 + * + * @param tbArticle 实体 + * @return 新增结果 + */ + @PostMapping + public ResponseEntity add(TbArticle tbArticle) { + return ResponseEntity.ok(this.articleService.insert(tbArticle)); + } + + /** + * 编辑数据 + * + * @param tbArticle 实体 + * @return 编辑结果 + */ + @PutMapping + public ResponseEntity edit(TbArticle tbArticle) { + return ResponseEntity.ok(this.articleService.update(tbArticle)); + } + + /** + * 删除数据 + * + * @param id 主键 + * @return 删除是否成功 + */ + @DeleteMapping + public ResponseEntity deleteById(Long id) { + return ResponseEntity.ok(this.articleService.deleteById(id)); + } + +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoSqlJointController.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoSqlJointController.java new file mode 100644 index 0000000..a50889d --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoSqlJointController.java @@ -0,0 +1,39 @@ +package com.woniu.jvmoptimize.practice.demo.controller; + +import com.woniu.jvmoptimize.practice.demo.service.TbArticleService; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Random; +import java.util.stream.Collectors; + +/** + * -Xmx1g -Xms1g + * -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:/jvm/dump/heapdemo.hprof + */ +@RestController +@RequestMapping("/sqljoint") +public class DemoSqlJointController { + + /** + * 服务对象 + */ + @Resource + private TbArticleService articleService; + + /** + * 判断批量id存在多少个 + * + */ + @GetMapping + public ResponseEntity countIfAbsent(int size) { + //随机生成批量id + List ids = new Random().ints(0, 1000000). + limit(size).boxed().collect(Collectors.toList()); + + return ResponseEntity.ok(this.articleService.countIfAbsent(ids)); + } + +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoThreadLocal.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoThreadLocal.java new file mode 100644 index 0000000..e7d35e0 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/controller/DemoThreadLocal.java @@ -0,0 +1,26 @@ +package com.woniu.jvmoptimize.practice.demo.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * -Xmx1g -Xms1g + * -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:/jvm/dump/heapdemo.hprof + */ +@RestController +@RequestMapping("/threadlocal") +public class DemoThreadLocal { + + @GetMapping + public ResponseEntity test() { + error(); + return ResponseEntity.ok().build(); + } + + private void error() { + throw new RuntimeException("出错了"); + } + +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/dao/TbArticleDao.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/dao/TbArticleDao.java new file mode 100644 index 0000000..14a1f02 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/dao/TbArticleDao.java @@ -0,0 +1,87 @@ +package com.woniu.jvmoptimize.practice.demo.dao; + +import com.woniu.jvmoptimize.practice.demo.pojo.TbArticle; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * (TbArticle)表数据库访问层 + * + * @author makejava + * @since 2023-10-06 23:55:58 + */ +@Mapper +public interface TbArticleDao { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbArticle queryById(Long id); + + /** + * 查询指定行数据 + * + * @param tbArticle 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAllByLimit(@Param("article") TbArticle tbArticle, @Param("pageable") Pageable pageable); + + /** + * 统计总行数 + * + * @param tbArticle 查询条件 + * @return 总行数 + */ + long count(TbArticle tbArticle); + + /** + * 新增数据 + * + * @param tbArticle 实例对象 + * @return 影响行数 + */ + int insert(TbArticle tbArticle); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbArticle 实例对象 + * @return 影响行数 + */ + int update(TbArticle tbArticle); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Long id); + + Long countIfAbsent(@Param("ids") List ids); +} + diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/ArticleDto.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/ArticleDto.java new file mode 100644 index 0000000..3d1ec27 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/ArticleDto.java @@ -0,0 +1,16 @@ +package com.woniu.jvmoptimize.practice.demo.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class ArticleDto { + private Long id; + /* 标题 + */ + private String title; + /* 内容 + */ + private String content; +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/DemoData.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/DemoData.java new file mode 100644 index 0000000..c915955 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/DemoData.java @@ -0,0 +1,14 @@ +package com.woniu.jvmoptimize.practice.demo.pojo; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Data +public class DemoData { + @ExcelProperty("测试") + private String string; + +} \ No newline at end of file diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/TbArticle.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/TbArticle.java new file mode 100644 index 0000000..7cdb9ce --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/pojo/TbArticle.java @@ -0,0 +1,46 @@ +package com.woniu.jvmoptimize.practice.demo.pojo; + +import java.io.Serializable; + +/** + * (TbArticle)实体类 + * + * @author makejava + * @since 2023-10-06 23:55:59 + */ +public class TbArticle implements Serializable { + private static final long serialVersionUID = -48799947125707294L; + + private Long id; + + private String title; + + private String content; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} + diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/ArticleService.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/ArticleService.java new file mode 100644 index 0000000..e9b2022 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/ArticleService.java @@ -0,0 +1,8 @@ +package com.woniu.jvmoptimize.practice.demo.service; + +import com.woniu.jvmoptimize.practice.demo.pojo.ArticleDto; + +public interface ArticleService { + void saveArticle(ArticleDto article); + void asyncSaveArticle(ArticleDto article); +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/TbArticleService.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/TbArticleService.java new file mode 100644 index 0000000..e76705d --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/TbArticleService.java @@ -0,0 +1,59 @@ +package com.woniu.jvmoptimize.practice.demo.service; + +import com.woniu.jvmoptimize.practice.demo.pojo.TbArticle; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +import java.util.List; + +/** + * (TbArticle)表服务接口 + * + * @author makejava + * @since 2023-10-06 23:55:59 + */ +public interface TbArticleService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbArticle queryById(Long id); + + /** + * 分页查询 + * + * @param tbArticle 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + Page queryByPage(TbArticle tbArticle, PageRequest pageRequest); + + /** + * 新增数据 + * + * @param tbArticle 实例对象 + * @return 实例对象 + */ + TbArticle insert(TbArticle tbArticle); + + /** + * 修改数据 + * + * @param tbArticle 实例对象 + * @return 实例对象 + */ + TbArticle update(TbArticle tbArticle); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Long id); + + Long countIfAbsent(List ids); +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/impl/ArticleServiceImpl.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/impl/ArticleServiceImpl.java new file mode 100644 index 0000000..834eef8 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/impl/ArticleServiceImpl.java @@ -0,0 +1,31 @@ +package com.woniu.jvmoptimize.practice.demo.service.impl; + +import com.woniu.jvmoptimize.practice.demo.pojo.ArticleDto; +import com.woniu.jvmoptimize.practice.demo.service.ArticleService; +import com.woniu.jvmoptimize.practice.demo.utils.AliyunUtil; +import com.woniu.jvmoptimize.practice.demo.config.ThreadPoolTaskConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +@Service +public class ArticleServiceImpl implements ArticleService { + + @Autowired + private AliyunUtil aliyunUtil; + + @Override + public void saveArticle(ArticleDto article) { + ThreadPoolTaskConfig.BUFFER_QUEUE.add(article); + int size = ThreadPoolTaskConfig.BUFFER_QUEUE.size(); + if( size > 0 && size % 10000 == 0){ + System.out.println(size); + } + } + + @Override + @Async("asyncTaskExecutor") + public void asyncSaveArticle(ArticleDto article) { + aliyunUtil.verify(article.getTitle() + "。" + article.getContent()); + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/impl/TbArticleServiceImpl.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/impl/TbArticleServiceImpl.java new file mode 100644 index 0000000..be5eea4 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/service/impl/TbArticleServiceImpl.java @@ -0,0 +1,88 @@ +package com.woniu.jvmoptimize.practice.demo.service.impl; + +import com.woniu.jvmoptimize.practice.demo.dao.TbArticleDao; +import com.woniu.jvmoptimize.practice.demo.pojo.TbArticle; +import com.woniu.jvmoptimize.practice.demo.service.TbArticleService; +import org.springframework.stereotype.Service; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; + +import javax.annotation.Resource; +import java.util.List; + +/** + * (TbArticle)表服务实现类 + * + * @author makejava + * @since 2023-10-06 23:55:59 + */ +@Service("articleService") +public class TbArticleServiceImpl implements TbArticleService { + @Resource + private TbArticleDao articleDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public TbArticle queryById(Long id) { + return this.articleDao.queryById(id); + } + + /** + * 分页查询 + * + * @param tbArticle 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + @Override + public Page queryByPage(TbArticle tbArticle, PageRequest pageRequest) { + //long total = this.articleDao.count(tbArticle); + return new PageImpl<>(this.articleDao.queryAllByLimit(tbArticle, pageRequest), pageRequest, 0); + } + + /** + * 新增数据 + * + * @param tbArticle 实例对象 + * @return 实例对象 + */ + @Override + public TbArticle insert(TbArticle tbArticle) { + this.articleDao.insert(tbArticle); + return tbArticle; + } + + /** + * 修改数据 + * + * @param tbArticle 实例对象 + * @return 实例对象 + */ + @Override + public TbArticle update(TbArticle tbArticle) { + this.articleDao.update(tbArticle); + return this.queryById(tbArticle.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long id) { + return this.articleDao.deleteById(id) > 0; + } + + @Override + public Long countIfAbsent(List ids) { + return articleDao.countIfAbsent(ids); + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/task/ArticleSaveTask.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/task/ArticleSaveTask.java new file mode 100644 index 0000000..de04d35 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/task/ArticleSaveTask.java @@ -0,0 +1,36 @@ +package com.woniu.jvmoptimize.practice.demo.task; + +import com.woniu.jvmoptimize.practice.demo.pojo.ArticleDto; +import com.woniu.jvmoptimize.practice.demo.config.ThreadPoolTaskConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import javax.annotation.PostConstruct; + +//@Component +public class ArticleSaveTask { + @Autowired + @Qualifier("taskExecutor") + private ThreadPoolTaskExecutor threadPoolTaskExecutor; + + @PostConstruct + public void pullArticleTask(){ + for (int i = 0; i < 50; i++) { + threadPoolTaskExecutor.submit((Runnable) () -> { + while (true){ + try { + ArticleDto data = ThreadPoolTaskConfig.BUFFER_QUEUE.take(); + /** + * 获取到队列中的数据之后,调用第三方接口审核数据,但是此时网络出现问题, + * 第三方接口长时间没有响应,此处使用休眠来模式30秒 + */ + Thread.sleep(30 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }); + } + } +} diff --git a/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/utils/AliyunUtil.java b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/utils/AliyunUtil.java new file mode 100644 index 0000000..15346e6 --- /dev/null +++ b/day06/jvm-optimize/src/main/java/com/woniu/jvmoptimize/practice/demo/utils/AliyunUtil.java @@ -0,0 +1,20 @@ +package com.woniu.jvmoptimize.practice.demo.utils; + +import org.springframework.stereotype.Component; + +@Component +public class AliyunUtil { + + //阿里云审核接口调用 + public void verify(String content){ + try { + /** + * 调用第三方接口审核数据,但是此时网络出现问题, + * 第三方接口长时间没有响应,此处使用休眠来模拟30秒 + */ + Thread.sleep(30 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } +} diff --git a/day06/jvm-optimize/src/main/resources/application.yml b/day06/jvm-optimize/src/main/resources/application.yml new file mode 100644 index 0000000..8684361 --- /dev/null +++ b/day06/jvm-optimize/src/main/resources/application.yml @@ -0,0 +1,43 @@ + +#设置应用名 +spring: + application: + name: jvm-service + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/jvm_test?serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8 + username: root + password: 123456 +# url: jdbc:mysql://rm-cn-zpr3eymps0008cso.rwlb.rds.aliyuncs.com:3306/jvm?serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8 +# url: jdbc:mysql://rm-cn-zpr3eymps0008c.rwlb.rds.aliyuncs.com:3306/jvm?serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8 +# username: jvm +# password: itheima123456@ +# rabbitmq: +# host: localhost # rabbitMQ的ip地址 +# port: 5672 # 端口 +# username: guest +# password: guest +# virtual-host: / + +#arthas: +# #tunnel地址,目前是部署在同一台服务器,正式环境需要拆分 +# tunnel-server: ws://localhost:7777/ws +# #tunnel显示的应用名称,直接使用应用名 +# app-name: ${spring.application.name} +# #arthas http访问的端口和远程连接的端口 +# http-port: 8888 +# telnet-port: 9999 + +server: + port: 8881 + tomcat: + threads: + min-spare: 50 + max: 500 + + +mybatis: + mapper-locations: classpath:mapper/*xml + type-aliases-package: com.woniu.jvmoptimize.practice.demo.pojo + + diff --git a/day06/jvm-optimize/src/main/resources/mapper/TbArticleDao.xml b/day06/jvm-optimize/src/main/resources/mapper/TbArticleDao.xml new file mode 100644 index 0000000..fae3677 --- /dev/null +++ b/day06/jvm-optimize/src/main/resources/mapper/TbArticleDao.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + insert into article(title, content) + values (#{title}, #{content}) + + + + insert into article(title, content) + values + + (#{entity.title}, #{entity.content}) + + + + + insert into article(title, content) + values + + (#{entity.title}, #{entity.content}) + + on duplicate key update + title = values(title), + content = values(content) + + + + + update article + + + title = #{title}, + + + content = #{content}, + + + where id = #{id} + + + + + delete + from article + where id = #{id} + + + + diff --git a/day06/jvm-optimize/src/test/java/com/woniu/jvmoptimize/JvmOptimizeApplicationTests.java b/day06/jvm-optimize/src/test/java/com/woniu/jvmoptimize/JvmOptimizeApplicationTests.java new file mode 100644 index 0000000..2250a82 --- /dev/null +++ b/day06/jvm-optimize/src/test/java/com/woniu/jvmoptimize/JvmOptimizeApplicationTests.java @@ -0,0 +1,13 @@ +package com.woniu.jvmoptimize; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class JvmOptimizeApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/day06/jvm-optimize/target/classes/application.yml b/day06/jvm-optimize/target/classes/application.yml new file mode 100644 index 0000000..4cd1901 --- /dev/null +++ b/day06/jvm-optimize/target/classes/application.yml @@ -0,0 +1,60 @@ + +management: + endpoint: + metrics: + enabled: true #支持metrics + prometheus: + enabled: true #支持Prometheus + metrics: + export: + prometheus: + enabled: true + tags: + application: jvm-test #实例名采集 + endpoints: + web: + exposure: + include: '*' #开放所有端口 + +#设置应用名 +spring: + application: + name: jvm-service + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/jvm_test?serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8 + username: root + password: 123456 +# url: jdbc:mysql://rm-cn-zpr3eymps0008cso.rwlb.rds.aliyuncs.com:3306/jvm?serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8 +# url: jdbc:mysql://rm-cn-zpr3eymps0008c.rwlb.rds.aliyuncs.com:3306/jvm?serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8 +# username: jvm +# password: itheima123456@ + rabbitmq: + host: localhost # rabbitMQ的ip地址 + port: 5672 # 端口 + username: guest + password: guest + virtual-host: / + +arthas: + #tunnel地址,目前是部署在同一台服务器,正式环境需要拆分 + tunnel-server: ws://localhost:7777/ws + #tunnel显示的应用名称,直接使用应用名 + app-name: ${spring.application.name} + #arthas http访问的端口和远程连接的端口 + http-port: 8888 + telnet-port: 9999 + +server: + port: 8881 + tomcat: + threads: + min-spare: 50 + max: 500 + + +mybatis: + mapper-locations: classpath:mapper/*xml + type-aliases-package: com.itheima.jvmoptimize.practice.demo.pojo + + diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/JvmOptimizeApplication.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/JvmOptimizeApplication.class new file mode 100644 index 0000000..9ef28b4 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/JvmOptimizeApplication.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/btrace/FileCreator.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/btrace/FileCreator.class new file mode 100644 index 0000000..861b0ee Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/btrace/FileCreator.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/btrace/UserEntityTest.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/btrace/UserEntityTest.class new file mode 100644 index 0000000..b721902 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/btrace/UserEntityTest.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/controller/LeakController.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/controller/LeakController.class new file mode 100644 index 0000000..eeef889 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/controller/LeakController.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/controller/OOMController.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/controller/OOMController.class new file mode 100644 index 0000000..6575a3e Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/controller/OOMController.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/entity/Student.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/entity/Student.class new file mode 100644 index 0000000..dc5719f Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/entity/Student.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/entity/UserEntity.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/entity/UserEntity.class new file mode 100644 index 0000000..d483a44 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/entity/UserEntity.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo1/Demo1.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo1/Demo1.class new file mode 100644 index 0000000..f4535c7 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo1/Demo1.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Demo0.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Demo0.class new file mode 100644 index 0000000..2d7e910 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Demo0.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Demo2.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Demo2.class new file mode 100644 index 0000000..3d68602 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Demo2.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Student.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Student.class new file mode 100644 index 0000000..2172954 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo2/Student.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo3/Outer$Inner.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo3/Outer$Inner.class new file mode 100644 index 0000000..66d2aaa Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo3/Outer$Inner.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo3/Outer.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo3/Outer.class new file mode 100644 index 0000000..82c9fb1 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo3/Outer.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo4/Outer$1.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo4/Outer$1.class new file mode 100644 index 0000000..35be3ea Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo4/Outer$1.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo4/Outer.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo4/Outer.class new file mode 100644 index 0000000..b4e2a84 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo4/Outer.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo5/Demo5.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo5/Demo5.class new file mode 100644 index 0000000..7c0452a Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo5/Demo5.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo5/Demo5_1.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo5/Demo5_1.class new file mode 100644 index 0000000..cdff8df Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo5/Demo5_1.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo6/Demo6.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo6/Demo6.class new file mode 100644 index 0000000..83e4714 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo6/Demo6.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo7/CaffineDemo.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo7/CaffineDemo.class new file mode 100644 index 0000000..65c708f Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo7/CaffineDemo.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo7/TestLazy.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo7/TestLazy.class new file mode 100644 index 0000000..2dc4db2 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/leakdemo/demo7/TestLazy.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/HeapDemo.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/HeapDemo.class new file mode 100644 index 0000000..76d3be8 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/HeapDemo.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/HeapDemo2.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/HeapDemo2.class new file mode 100644 index 0000000..2686ce2 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/HeapDemo2.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/StringSize.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/StringSize.class new file mode 100644 index 0000000..5789933 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/StringSize.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/TestClass.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/TestClass.class new file mode 100644 index 0000000..fe2b9a2 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/TestClass.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/TestClass2.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/TestClass2.class new file mode 100644 index 0000000..4aa858d Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/matdemo/TestClass2.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/common/UserDataContextHolder$UserData.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/common/UserDataContextHolder$UserData.class new file mode 100644 index 0000000..a1ed302 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/common/UserDataContextHolder$UserData.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/common/UserDataContextHolder.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/common/UserDataContextHolder.class new file mode 100644 index 0000000..cf8e90f Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/common/UserDataContextHolder.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/AsyncThreadPoolTaskConfig.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/AsyncThreadPoolTaskConfig.class new file mode 100644 index 0000000..b0bd980 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/AsyncThreadPoolTaskConfig.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/LoginConfig.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/LoginConfig.class new file mode 100644 index 0000000..7cf768c Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/LoginConfig.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/ThreadPoolTaskConfig.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/ThreadPoolTaskConfig.class new file mode 100644 index 0000000..b7a255e Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/ThreadPoolTaskConfig.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/UserInterceptor.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/UserInterceptor.class new file mode 100644 index 0000000..09dd791 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/config/UserInterceptor.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/Demo1ArticleController.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/Demo1ArticleController.class new file mode 100644 index 0000000..a4ba4da Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/Demo1ArticleController.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/Demo2ExcelController.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/Demo2ExcelController.class new file mode 100644 index 0000000..e1e37e0 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/Demo2ExcelController.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoQueryController.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoQueryController.class new file mode 100644 index 0000000..b126235 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoQueryController.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoSqlJointController.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoSqlJointController.class new file mode 100644 index 0000000..7507f9a Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoSqlJointController.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoThreadLocal.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoThreadLocal.class new file mode 100644 index 0000000..6756a84 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/controller/DemoThreadLocal.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/dao/TbArticleDao.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/dao/TbArticleDao.class new file mode 100644 index 0000000..4380d3f Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/dao/TbArticleDao.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/ArticleDto.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/ArticleDto.class new file mode 100644 index 0000000..901157d Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/ArticleDto.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/DemoData.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/DemoData.class new file mode 100644 index 0000000..cac4c62 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/DemoData.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/TbArticle.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/TbArticle.class new file mode 100644 index 0000000..896c048 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/pojo/TbArticle.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/ArticleService.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/ArticleService.class new file mode 100644 index 0000000..2ca1994 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/ArticleService.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/TbArticleService.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/TbArticleService.class new file mode 100644 index 0000000..33b4634 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/TbArticleService.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/impl/ArticleServiceImpl.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/impl/ArticleServiceImpl.class new file mode 100644 index 0000000..91e4de6 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/impl/ArticleServiceImpl.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/impl/TbArticleServiceImpl.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/impl/TbArticleServiceImpl.class new file mode 100644 index 0000000..ecbd099 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/service/impl/TbArticleServiceImpl.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/task/ArticleSaveTask.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/task/ArticleSaveTask.class new file mode 100644 index 0000000..6007543 Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/task/ArticleSaveTask.class differ diff --git a/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/utils/AliyunUtil.class b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/utils/AliyunUtil.class new file mode 100644 index 0000000..833e37b Binary files /dev/null and b/day06/jvm-optimize/target/classes/com/itheima/jvmoptimize/practice/demo/utils/AliyunUtil.class differ diff --git a/day06/jvm-optimize/target/classes/mapper/TbArticleDao.xml b/day06/jvm-optimize/target/classes/mapper/TbArticleDao.xml new file mode 100644 index 0000000..a7440bd --- /dev/null +++ b/day06/jvm-optimize/target/classes/mapper/TbArticleDao.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + insert into article(title, content) + values (#{title}, #{content}) + + + + insert into article(title, content) + values + + (#{entity.title}, #{entity.content}) + + + + + insert into article(title, content) + values + + (#{entity.title}, #{entity.content}) + + on duplicate key update + title = values(title), + content = values(content) + + + + + update article + + + title = #{title}, + + + content = #{content}, + + + where id = #{id} + + + + + delete + from article + where id = #{id} + + + + diff --git a/day06/jvm-optimize/target/jvm-optimize-0.0.1-SNAPSHOT.jar.original b/day06/jvm-optimize/target/jvm-optimize-0.0.1-SNAPSHOT.jar.original new file mode 100644 index 0000000..9f189bf Binary files /dev/null and b/day06/jvm-optimize/target/jvm-optimize-0.0.1-SNAPSHOT.jar.original differ diff --git a/day06/jvm-optimize/target/maven-archiver/pom.properties b/day06/jvm-optimize/target/maven-archiver/pom.properties new file mode 100644 index 0000000..163d279 --- /dev/null +++ b/day06/jvm-optimize/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=jvm-optimize +groupId=com.itheima +version=0.0.1-SNAPSHOT diff --git a/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..cb1ad54 --- /dev/null +++ b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,45 @@ +com\itheima\jvmoptimize\practice\demo\service\ArticleService.class +com\itheima\jvmoptimize\practice\demo\service\impl\ArticleServiceImpl.class +com\itheima\jvmoptimize\practice\demo\config\UserInterceptor.class +com\itheima\jvmoptimize\leakdemo\demo1\Demo1.class +com\itheima\jvmoptimize\JvmOptimizeApplication.class +com\itheima\jvmoptimize\leakdemo\demo7\CaffineDemo.class +com\itheima\jvmoptimize\matdemo\TestClass2.class +com\itheima\jvmoptimize\practice\demo\config\ThreadPoolTaskConfig.class +com\itheima\jvmoptimize\practice\demo\controller\DemoQueryController.class +com\itheima\jvmoptimize\practice\demo\controller\Demo1ArticleController.class +com\itheima\jvmoptimize\practice\demo\controller\Demo2ExcelController.class +com\itheima\jvmoptimize\matdemo\StringSize.class +com\itheima\jvmoptimize\leakdemo\demo4\Outer$1.class +com\itheima\jvmoptimize\practice\demo\pojo\TbArticle.class +com\itheima\jvmoptimize\practice\demo\pojo\DemoData.class +com\itheima\jvmoptimize\practice\demo\config\LoginConfig.class +com\itheima\jvmoptimize\practice\demo\task\ArticleSaveTask.class +com\itheima\jvmoptimize\controller\LeakController.class +com\itheima\jvmoptimize\leakdemo\demo3\Outer$Inner.class +com\itheima\jvmoptimize\leakdemo\demo2\Student.class +com\itheima\jvmoptimize\practice\demo\common\UserDataContextHolder.class +com\itheima\jvmoptimize\btrace\UserEntityTest.class +com\itheima\jvmoptimize\matdemo\TestClass.class +com\itheima\jvmoptimize\entity\Student.class +com\itheima\jvmoptimize\leakdemo\demo7\TestLazy.class +com\itheima\jvmoptimize\practice\demo\controller\DemoSqlJointController.class +com\itheima\jvmoptimize\practice\demo\config\AsyncThreadPoolTaskConfig.class +com\itheima\jvmoptimize\practice\demo\service\impl\TbArticleServiceImpl.class +com\itheima\jvmoptimize\leakdemo\demo3\Outer.class +com\itheima\jvmoptimize\leakdemo\demo4\Outer.class +com\itheima\jvmoptimize\practice\demo\service\TbArticleService.class +com\itheima\jvmoptimize\leakdemo\demo5\Demo5.class +com\itheima\jvmoptimize\leakdemo\demo2\Demo2.class +com\itheima\jvmoptimize\practice\demo\pojo\ArticleDto.class +com\itheima\jvmoptimize\btrace\FileCreator.class +com\itheima\jvmoptimize\matdemo\HeapDemo.class +com\itheima\jvmoptimize\controller\OOMController.class +com\itheima\jvmoptimize\leakdemo\demo5\Demo5_1.class +com\itheima\jvmoptimize\entity\UserEntity.class +com\itheima\jvmoptimize\matdemo\HeapDemo2.class +com\itheima\jvmoptimize\practice\demo\controller\DemoThreadLocal.class +com\itheima\jvmoptimize\leakdemo\demo2\Demo0.class +com\itheima\jvmoptimize\practice\demo\dao\TbArticleDao.class +com\itheima\jvmoptimize\practice\demo\common\UserDataContextHolder$UserData.class +com\itheima\jvmoptimize\leakdemo\demo6\Demo6.class diff --git a/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..f3d7065 --- /dev/null +++ b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,40 @@ +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\service\TbArticleService.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo7\TestLazy.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo2\Student.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo3\Outer.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\task\ArticleSaveTask.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo5\Demo5.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\matdemo\StringSize.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo7\CaffineDemo.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo4\Outer.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo6\Demo6.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\JvmOptimizeApplication.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\controller\Demo2ExcelController.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\config\ThreadPoolTaskConfig.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\controller\DemoQueryController.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\entity\Student.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\matdemo\HeapDemo.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\config\AsyncThreadPoolTaskConfig.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo1\Demo1.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\pojo\ArticleDto.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo2\Demo0.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\config\UserInterceptor.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo5\Demo5_1.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\controller\DemoThreadLocal.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\pojo\DemoData.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\service\impl\TbArticleServiceImpl.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\matdemo\HeapDemo2.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\service\ArticleService.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\btrace\FileCreator.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\btrace\UserEntityTest.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\config\LoginConfig.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\controller\Demo1ArticleController.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\entity\UserEntity.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\pojo\TbArticle.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\dao\TbArticleDao.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\controller\OOMController.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\common\UserDataContextHolder.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\controller\LeakController.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\leakdemo\demo2\Demo2.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\service\impl\ArticleServiceImpl.java +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\main\java\com\itheima\jvmoptimize\practice\demo\controller\DemoSqlJointController.java diff --git a/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000..7c9ee3d --- /dev/null +++ b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +com\itheima\jvmoptimize\JvmOptimizeApplicationTests.class diff --git a/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..fe2530e --- /dev/null +++ b/day06/jvm-optimize/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +D:\教学\同步课程资料\BaiduSyncdisk\实战Java虚拟机\代码\jvm-optimize\src\test\java\com\itheima\jvmoptimize\JvmOptimizeApplicationTests.java diff --git a/day06/jvm-optimize/target/test-classes/com/itheima/jvmoptimize/JvmOptimizeApplicationTests.class b/day06/jvm-optimize/target/test-classes/com/itheima/jvmoptimize/JvmOptimizeApplicationTests.class new file mode 100644 index 0000000..749e3a7 Binary files /dev/null and b/day06/jvm-optimize/target/test-classes/com/itheima/jvmoptimize/JvmOptimizeApplicationTests.class differ diff --git a/day06/测试脚本/内存溢出测试.jmx b/day06/测试脚本/内存溢出测试.jmx new file mode 100644 index 0000000..f733eb1 --- /dev/null +++ b/day06/测试脚本/内存溢出测试.jmx @@ -0,0 +1,148 @@ + + + + + + false + true + false + + + + + + + + continue + + false + -1 + + 30 + 0 + false + + + true + + + + + + + false + ${__Random(1,10000000,)} + = + true + id + + + false + ${__RandomString(10,abcdefghijklmnopqrstuvwxyz,)} + = + true + name + + + + 112.126.28.66 + 8081 + http + + /leak/login + POST + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + 500 + false + + + + + false + false + + + + + + diff --git a/day06/测试脚本/案例-SQL拼接.jmx b/day06/测试脚本/案例-SQL拼接.jmx new file mode 100644 index 0000000..0fc1574 --- /dev/null +++ b/day06/测试脚本/案例-SQL拼接.jmx @@ -0,0 +1,88 @@ + + + + + + false + true + false + + + + + + + + continue + + false + 50 + + 5 + 1 + false + + + true + + + + + + + 112.126.28.66 + 8881 + http + + /sqljoint?size=300 + GET + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + diff --git a/day06/测试脚本/案例-threadlocal内存泄漏.jmx b/day06/测试脚本/案例-threadlocal内存泄漏.jmx new file mode 100644 index 0000000..14ea5a9 --- /dev/null +++ b/day06/测试脚本/案例-threadlocal内存泄漏.jmx @@ -0,0 +1,88 @@ + + + + + + false + true + false + + + + + + + + continue + + false + 1 + + 50 + 0 + false + + + true + + + + + + + localhost + 8881 + http + + /threadlocal + GET + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + diff --git a/day06/测试脚本/案例-导出大文件.jmx b/day06/测试脚本/案例-导出大文件.jmx new file mode 100644 index 0000000..2098173 --- /dev/null +++ b/day06/测试脚本/案例-导出大文件.jmx @@ -0,0 +1,125 @@ + + + + + + false + true + false + + + + + + + + continue + + false + 1 + + 5 + 0 + false + + + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + + localhost + 8881 + http + + /excel/export_hutool?size=100000&path=D:/jvm/data/excel/&batch=100 + GET + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + diff --git a/day06/测试脚本/案例-查询巨大数据量.jmx b/day06/测试脚本/案例-查询巨大数据量.jmx new file mode 100644 index 0000000..9474f01 --- /dev/null +++ b/day06/测试脚本/案例-查询巨大数据量.jmx @@ -0,0 +1,178 @@ + + + + + + false + true + false + + + + + + + + continue + + false + -1 + + 200 + 0 + false + + + true + + + + + + + localhost + 8881 + http + + /hugequery?page=1&size=10 + GET + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + 1000 + false + + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + 500 + false + + + + + false + false + + + + + + diff --git a/day06/测试脚本/案例-生产者消费者问题.jmx b/day06/测试脚本/案例-生产者消费者问题.jmx new file mode 100644 index 0000000..4031f34 --- /dev/null +++ b/day06/测试脚本/案例-生产者消费者问题.jmx @@ -0,0 +1,353 @@ + + + + + + false + true + false + + + + + + + + continue + + false + -1 + + 50 + 1 + false + + + true + + + + true + + + + false + { + "title" : "测试", + "content" :"8月24日,由山西省工业和信息化厅和大同市人民政府共同主办的“晋阳湖·数字经济发展峰会暨第二届云冈数字新基建发展论坛”在山西省大同市顺利召开,各级领导、知名专家学者、行业龙头企业齐聚一堂,共话大同数字经济未来。\",\"云冈数字新基建发展论坛\",\"大同市委副书记、市长张强,工业和信息化部信息技术发展司二级巡视员王少朋,山西省工业和信息化厅副厅长李鑫发表致辞,大同市人民政府副市长孟维君主持开场。传智教育受邀参会,并与大同市数字城市投资建设有限责任公司(简称“数投公司”)签署数字化人才输送协议。\",\"本次论坛以“数智大同、云服天下”为主题,旨在进一步加快“数字大同”建设,夯实数字经济发展基础。\",\"会上,来自全国各地的优秀数字领域专家深入探讨数字新基建发展课题,其中有京东科技、华为、科大讯飞、浪潮等知名科技企业代表进行主题演讲,表示将不断把行业资源和数据创新发展先进经验植入大同,推动产业发展、行业应用的有机结合。\",\"论坛集中签约仪式\",\"近年来,大同市大力发展大数据、云计算等战略性新兴产业,数字经济正成为引领大同高质量发展的新引擎,传智教育顺“数”而为,率先在大同建设了一所具有鲜明数字化特色的大学——大同互联网职业技术学院。\",\"学院紧紧围绕战略新兴产业,重点布局数字经济与“互联网+”方向,致力于培养数字经济时代的高素质技术技能人才,解决因数字化人才供给不足导致传统产业升级困难,产业链竞争力不强的问题,推动职业教育改革发展,助力数字中国建设。\",\"传智教育在大同市就职业教育发展和数字化产业升级方面的深度探索,得到了政府部门的关注和鼓励,为促进大同市数字化人才培养,在本次论坛上,传智教育与大同市数字城市投资建设有限责任公司正式签署合作协议,双方将基于大同互联网职业技术学院人才就业输送、社会人才培训及品牌联动等方面达成合作。\",\"未来,传智教育与数投公司,将展开全方位的深度合作,包括但不限于:基于数投公司汇集的各领域信息系统整合、数字政府、智慧城市等资源,由传智教育承接数投公司方所需的数字化人才培养及培训工作;大同互联网职业技术学院的优秀毕业生将被优先推荐到数投公司生态企业实习或就业等。双方未来将实时互通资源,通过开展多维度的合作联动,提高双方的核心竞争力和社会影响力。\",\"据介绍,大同市数字城市投资建设有限责任公司是大同市政府汇合数智企业,承接全市大数据资源的整合、互联互通、开放共享的建设与服务,负责全市数据资产安全运营工作,培育大同市大数据产业生态体系,引导大同市大数据产业发展。\",\"此次合作的达成,是双方秉承“互利共赢,协同赋能大同市数字产业发展”的一致目标,依托各自在科技领域的育人经验、技术成果及企业人才需求等,促成的企业资源和人才培养对接,是双方在产教融合、校企合作领域的进一步创新探索。" +} + = + + + + localhost + 8881 + http + utf-8 + /article/demo3/1 + POST + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + content-type + application/json + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + 500 + false + + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + 500 + false + + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + 1000 + false + + + + + false + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + diff --git a/day06/测试脚本/聚合报告.jmx b/day06/测试脚本/聚合报告.jmx new file mode 100644 index 0000000..81e5988 --- /dev/null +++ b/day06/测试脚本/聚合报告.jmx @@ -0,0 +1,174 @@ + + + + + + false + true + false + + + + + + + + continue + + false + -1 + + 100 + 0 + false + + + true + + + + + + + localhost + 8881 + http + + /leak/test + GET + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + continue + + false + -1 + + 100 + 0 + false + + + true + + + + + + + false + ${__Random(1,100000,)} + = + true + id + + + false + ${__RandomString(10000,abcdefghijk1mn,)} + = + true + name + + + + localhost + 8881 + http + + /leak/login + POST + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + diff --git a/demo-codes-master/.idea/.gitignore b/demo-codes-master/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/demo-codes-master/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/demo-codes-master/.idea/compiler.xml b/demo-codes-master/.idea/compiler.xml new file mode 100644 index 0000000..55b13d8 --- /dev/null +++ b/demo-codes-master/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo-codes-master/.idea/demo-codes-master.iml b/demo-codes-master/.idea/demo-codes-master.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/demo-codes-master/.idea/demo-codes-master.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/demo-codes-master/.idea/encodings.xml b/demo-codes-master/.idea/encodings.xml new file mode 100644 index 0000000..2255ffe --- /dev/null +++ b/demo-codes-master/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/demo-codes-master/.idea/jarRepositories.xml b/demo-codes-master/.idea/jarRepositories.xml new file mode 100644 index 0000000..e6b00eb --- /dev/null +++ b/demo-codes-master/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/demo-codes-master/.idea/misc.xml b/demo-codes-master/.idea/misc.xml new file mode 100644 index 0000000..6ed2cda --- /dev/null +++ b/demo-codes-master/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/demo-codes-master/.idea/modules.xml b/demo-codes-master/.idea/modules.xml new file mode 100644 index 0000000..fce887e --- /dev/null +++ b/demo-codes-master/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/demo-codes-master/.idea/vcs.xml b/demo-codes-master/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/demo-codes-master/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/.gitignore b/demo-codes-master/demo-codes-master/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/demo-codes-master/demo-codes-master/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/.idea/.gitignore b/demo-codes-master/demo-codes-master/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/demo-codes-master/demo-codes-master/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/demo-codes-master/demo-codes-master/.idea/aws.xml b/demo-codes-master/demo-codes-master/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/demo-codes-master/demo-codes-master/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/.idea/encodings.xml b/demo-codes-master/demo-codes-master/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/demo-codes-master/demo-codes-master/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/.idea/misc.xml b/demo-codes-master/demo-codes-master/.idea/misc.xml new file mode 100644 index 0000000..132404b --- /dev/null +++ b/demo-codes-master/demo-codes-master/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/.idea/uiDesigner.xml b/demo-codes-master/demo-codes-master/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/demo-codes-master/demo-codes-master/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/.idea/vcs.xml b/demo-codes-master/demo-codes-master/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/demo-codes-master/demo-codes-master/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/pom.xml b/demo-codes-master/demo-codes-master/pom.xml new file mode 100644 index 0000000..d4a52b9 --- /dev/null +++ b/demo-codes-master/demo-codes-master/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + org.example + demo-codes + 1.0-SNAPSHOT + jar + + demo-codes + http://maven.apache.org + + + UTF-8 + + + + org.springframework.boot + spring-boot-starter-parent + 2.7.12 + + + + + + + junit + junit + 3.8.1 + test + + + org.projectlombok + lombok + 1.18.6 + + + org.springframework.boot + spring-boot-starter-web + + + com.alibaba + fastjson + 1.2.62 + + + org.springframework.boot + spring-boot-starter-jdbc + + + cn.hutool + hutool-all + 5.7.10 + + + org.redisson + redisson + 3.16.1 + + + + diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/App.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/App.java new file mode 100644 index 0000000..5f21d2e --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/App.java @@ -0,0 +1,13 @@ +package org.example; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/common/util/DateUtil.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/common/util/DateUtil.java new file mode 100644 index 0000000..318b8ea --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/common/util/DateUtil.java @@ -0,0 +1,21 @@ +package org.example.common.util; + +import java.time.LocalDateTime; + +public class DateUtil { + + public static LocalDateTime firstDayOfLastMonth() { + //返回上个月第一天第一毫秒 + return LocalDateTime.now().minusMonths(1) + .withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0); + } + public static int lastDayOfMont(LocalDateTime time) { + return time.withDayOfMonth(time.getMonth().length(time.toLocalDate().isLeapYear())) + .withHour(23).withMinute(59).withSecond(59).withNano(999999999).getDayOfMonth(); + } + + public static int milliSecondBetween(LocalDateTime a, LocalDateTime b) { + return (int) (b.toInstant(java.time.ZoneOffset.of("+8")).toEpochMilli() - a.toInstant(java.time.ZoneOffset.of("+8")).toEpochMilli()); + } + +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/common/BusinessException.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/common/BusinessException.java new file mode 100644 index 0000000..0f1c112 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/common/BusinessException.java @@ -0,0 +1,7 @@ +package org.example.multi_sys_consist.common; + +public class BusinessException extends RuntimeException{ + public BusinessException(String message) { + super(message); + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/constant/TransactionJobType.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/constant/TransactionJobType.java new file mode 100644 index 0000000..97e4657 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/constant/TransactionJobType.java @@ -0,0 +1,25 @@ +package org.example.multi_sys_consist.constant; + +public enum TransactionJobType { + /** + * 更新待办 + */ + UPDATE_TODO, + /** + * 创建财务日志 + */ + CREATE_FINANCE_LOG, + /** + * 类型4 + */ + PUSH_FINANCE_LOG; + + public static TransactionJobType parse(String type) { + for (TransactionJobType transactionJobType : TransactionJobType.values()) { + if (transactionJobType.name().equals(type)) { + return transactionJobType; + } + } + return null; + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/mapper/ApplyMapper.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/mapper/ApplyMapper.java new file mode 100644 index 0000000..c33dc94 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/mapper/ApplyMapper.java @@ -0,0 +1,11 @@ +package org.example.multi_sys_consist.mapper; + +import org.example.multi_sys_consist.pojo.dto.ApplyApproveVo; +import org.example.multi_sys_consist.pojo.entity.ApplyEntity; + +public interface ApplyMapper { + + void saveInfo(ApplyApproveVo vo); + + ApplyEntity selectById(Long id); +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/mapper/TransactionJobMapper.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/mapper/TransactionJobMapper.java new file mode 100644 index 0000000..048f744 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/mapper/TransactionJobMapper.java @@ -0,0 +1,22 @@ +package org.example.multi_sys_consist.mapper; + +import org.example.multi_sys_consist.pojo.entity.TransactionJob; + +import java.util.List; + +public interface TransactionJobMapper { + + void add(TransactionJob job); + + List selectList(int offset, int size); + + /** + * update transaction_job set + * error_message = #{errorMessage}, + * update_time = #{time} + * retry_times = retry_times + 1 where id = #{id} + */ + void updateError(Long id, String errorMessage, Long time); + + void updateSuccess(Long id, long l); +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/CreateFinanceLogExecutor.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/CreateFinanceLogExecutor.java new file mode 100644 index 0000000..09b9cbc --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/CreateFinanceLogExecutor.java @@ -0,0 +1,37 @@ +package org.example.multi_sys_consist.module; + +import com.alibaba.fastjson.JSONObject; +import org.example.multi_sys_consist.constant.TransactionJobType; +import org.example.multi_sys_consist.pojo.entity.FinanceLog; +import org.example.multi_sys_consist.pojo.entity.TransactionJob; +import org.example.multi_sys_consist.service.FinanceLogService; +import org.example.multi_sys_consist.service.TransactionJobService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Component +public class CreateFinanceLogExecutor implements TransactionJobExecutor { + @Autowired + private FinanceLogService financeLogService; + @Autowired + private TransactionJobService transactionJobService; + @Override + @Transactional(rollbackFor = Exception.class) + public void execute(TransactionJob job) { + JSONObject jo = JSONObject.parseObject(job.getData()); + List financeLog = financeLogService.createFinanceLog(jo.getLong("applyId")); + + //留下任务:推送财务日志 + JSONObject data = new JSONObject(); + data.put("applyId", jo.getLong("applyId")); + transactionJobService.create(TransactionJobType.PUSH_FINANCE_LOG, data); + } + + @Override + public TransactionJobType type() { + return TransactionJobType.CREATE_FINANCE_LOG; + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/PushFinanceLogExecutor.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/PushFinanceLogExecutor.java new file mode 100644 index 0000000..9cc12f4 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/PushFinanceLogExecutor.java @@ -0,0 +1,31 @@ +package org.example.multi_sys_consist.module; + +import com.alibaba.fastjson.JSONObject; +import org.example.multi_sys_consist.constant.TransactionJobType; +import org.example.multi_sys_consist.pojo.entity.TransactionJob; +import org.example.multi_sys_consist.remote.FinanceLogSystemService; +import org.example.multi_sys_consist.service.FinanceLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static org.example.multi_sys_consist.constant.TransactionJobType.PUSH_FINANCE_LOG; + +@Component +public class PushFinanceLogExecutor implements TransactionJobExecutor { + + @Autowired + private FinanceLogService financeLogService; + @Autowired + private FinanceLogSystemService financeLogSystemService; + + @Override + public void execute(TransactionJob job) { + JSONObject jo = JSONObject.parseObject(job.getData()); + financeLogSystemService.pushFinanceLog(financeLogService.getByApplyId(jo.getLong("applyId"))); + } + + @Override + public TransactionJobType type() { + return PUSH_FINANCE_LOG; + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/TransactionJobExecutor.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/TransactionJobExecutor.java new file mode 100644 index 0000000..9fe5416 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/TransactionJobExecutor.java @@ -0,0 +1,10 @@ +package org.example.multi_sys_consist.module; + +import org.example.multi_sys_consist.constant.TransactionJobType; +import org.example.multi_sys_consist.pojo.entity.TransactionJob; + +public interface TransactionJobExecutor { + void execute(TransactionJob job); + + TransactionJobType type(); +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/impl/UpdateTodoExecutor.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/impl/UpdateTodoExecutor.java new file mode 100644 index 0000000..d24f6e3 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/module/impl/UpdateTodoExecutor.java @@ -0,0 +1,47 @@ +package org.example.multi_sys_consist.module.impl; + +import com.alibaba.fastjson.JSONObject; +import org.example.multi_sys_consist.constant.TransactionJobType; +import org.example.multi_sys_consist.module.TransactionJobExecutor; +import org.example.multi_sys_consist.pojo.entity.TransactionJob; +import org.example.multi_sys_consist.remote.WorkflowService; +import org.example.multi_sys_consist.service.TodoService; +import org.example.multi_sys_consist.service.TransactionJobService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static org.example.multi_sys_consist.constant.TransactionJobType.UPDATE_TODO; + +@Component +public class UpdateTodoExecutor implements TransactionJobExecutor { + + @Autowired + private TodoService todoService; + @Autowired + private WorkflowService workflowService; + @Autowired + private TransactionJobService transactionJobService; + + @Override + @Transactional(rollbackFor = Exception.class) + public void execute(TransactionJob job) { + JSONObject jo = JSONObject.parseObject(job.getData()); + List todoList = workflowService.getTodoList(jo.getString("workflowId")); + if (todoList != null && todoList.size() > 0) { + todoService.save(jo.getLong("applyId"), todoList); + } else { + //留下生成财务日志的任务 + JSONObject data = new JSONObject(); + data.put("applyId", jo.getLong("applyId")); + transactionJobService.create(TransactionJobType.CREATE_FINANCE_LOG, data); + } + } + + @Override + public TransactionJobType type() { + return UPDATE_TODO; + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/package-info.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/package-info.java new file mode 100644 index 0000000..9282fc4 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/package-info.java @@ -0,0 +1,3 @@ +package org.example.multi_sys_consist; + +//多系统一致性问题 \ No newline at end of file diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/dto/ApplyApproveVo.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/dto/ApplyApproveVo.java new file mode 100644 index 0000000..6948b94 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/dto/ApplyApproveVo.java @@ -0,0 +1,4 @@ +package org.example.multi_sys_consist.pojo.dto; + +public class ApplyApproveVo { +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/dto/TransactionDto.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/dto/TransactionDto.java new file mode 100644 index 0000000..6e97ec1 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/dto/TransactionDto.java @@ -0,0 +1,4 @@ +package org.example.multi_sys_consist.pojo.dto; + +public class TransactionDto { +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/ApplyEntity.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/ApplyEntity.java new file mode 100644 index 0000000..28e5fb4 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/ApplyEntity.java @@ -0,0 +1,9 @@ +package org.example.multi_sys_consist.pojo.entity; + +import lombok.Data; + +@Data +public class ApplyEntity { + private Long id; + private String bpmId; +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/BizEntity.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/BizEntity.java new file mode 100644 index 0000000..9dd7e48 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/BizEntity.java @@ -0,0 +1,11 @@ +package org.example.multi_sys_consist.pojo.entity; + +import lombok.Data; + +/** + * 模拟业务数据 + */ +@Data +public class BizEntity { + private Long id; +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/DemoUser.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/DemoUser.java new file mode 100644 index 0000000..d969c81 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/DemoUser.java @@ -0,0 +1,12 @@ +package org.example.multi_sys_consist.pojo.entity; + +import lombok.Data; + +@Data +public class DemoUser { + + private Long id; + private String account; + private String name; + +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/FinanceLog.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/FinanceLog.java new file mode 100644 index 0000000..1a7a883 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/FinanceLog.java @@ -0,0 +1,12 @@ +package org.example.multi_sys_consist.pojo.entity; + +import lombok.Data; + +@Data +public class FinanceLog { + private Long applyId; + /** + * 1-未推送 2-推送成功 3-推送失败 + */ + private Integer status; +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/TransactionJob.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/TransactionJob.java new file mode 100644 index 0000000..35de500 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/pojo/entity/TransactionJob.java @@ -0,0 +1,29 @@ +package org.example.multi_sys_consist.pojo.entity; + +import lombok.Data; +import org.example.multi_sys_consist.constant.TransactionJobType; + +@Data +public class TransactionJob { + private Long id; + /** + * 任务类型{@link TransactionJobType} + */ + private String type; + /** + * 任务数据 + */ + private String data; + + private String errorMessage; + /** + * 任务上下文 + */ + private String context; + + private Long createTime; + + private Long updateTime; + + private Integer retryTimes; +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/remote/FinanceLogSystemService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/remote/FinanceLogSystemService.java new file mode 100644 index 0000000..004e7c8 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/remote/FinanceLogSystemService.java @@ -0,0 +1,21 @@ +package org.example.multi_sys_consist.remote; + +import org.example.multi_sys_consist.pojo.entity.FinanceLog; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 第三方系统:财务日志系统 + */ +@Service +public class FinanceLogSystemService { + + /** + * 推送财务日志 + * @param logs + */ + public void pushFinanceLog(List logs) { + + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/remote/WorkflowService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/remote/WorkflowService.java new file mode 100644 index 0000000..d562f82 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/remote/WorkflowService.java @@ -0,0 +1,23 @@ +package org.example.multi_sys_consist.remote; + +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 工作流远程服务 + */ +@Service +public class WorkflowService { + + /** + * 审核通过 + */ + public void approve(String id) { + + } + + public List getTodoList(String id) { + return null; + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/ApplyService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/ApplyService.java new file mode 100644 index 0000000..89c5469 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/ApplyService.java @@ -0,0 +1,114 @@ +package org.example.multi_sys_consist.service; + +import org.example.multi_sys_consist.mapper.ApplyMapper; +import org.example.multi_sys_consist.pojo.dto.ApplyApproveVo; +import org.example.multi_sys_consist.pojo.entity.ApplyEntity; +import org.example.multi_sys_consist.pojo.entity.FinanceLog; +import org.example.multi_sys_consist.remote.FinanceLogSystemService; +import org.example.multi_sys_consist.remote.WorkflowService; +import org.example.multi_sys_consist.service.impl.LogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 申请服务 + */ +@Service +public class ApplyService { + + @Autowired + private CurrentService currentService; + @Autowired + private ApplyMapper applyMapper; + @Autowired + private WorkflowService bpmService; + @Autowired + private LogService logService; + @Autowired + private TodoService todoService; + @Autowired + private FinanceLogService financeLogService; + @Autowired + private FinanceLogSystemService financeLogSystemService; + @Autowired + private ApplyService applyService; + + /** + * 审核通过 + * 1. 记录有任务数据和日志 本地 + * 2. 调用工作流服务-通过 远程写 + * 3. 更新待办人 远程读+本地 + * 4. 如果审核完成,还需要创建财务日志 本地 + * 5. 推送财务日志 远程写 + */ + @Transactional(rollbackFor = Exception.class) + public void approve(Long id, ApplyApproveVo vo) { + //---------第一步----------- + //记录业务数据 + applyMapper.saveInfo(vo); + //记录审核通过日志 + logService.addLog(currentService.currentUser().getAccount() + "审核通过了申请单" + id); + //删除本地所有待办人 + todoService.deleteByApplyId(id); + //调用工作流服务 + ApplyEntity applyEntity = applyMapper.selectById(id); + bpmService.approve(applyEntity.getBpmId()); + //---------第二步----------- + //更新待办人 + List todoList = bpmService.getTodoList(applyEntity.getBpmId()); + if (todoList != null && todoList.size() > 0) { + todoService.save(id, todoList); + } else { + //---------第三步----------- + //没有待办人,则说明已经审完了,生成财务日志,并推送财务日志系统 + List financeLog = financeLogService.createFinanceLog(id); + financeLogSystemService.pushFinanceLog(financeLog); + } + } + + public void approve2(Long id, ApplyApproveVo vo) { + applyService.approveBpm(id, vo); + List todoList = applyService.updateTodo(id); + if (todoList.isEmpty()) { + List financeLog = applyService.createFinanceLog(id); + applyService.pushFinanceLog(financeLog); + } + } + + @Transactional(rollbackFor = Exception.class) + public void approveBpm(Long id, ApplyApproveVo vo) { + //记录业务数据 + applyMapper.saveInfo(vo); + //记录审核通过日志 + logService.addLog(currentService.currentUser().getAccount() + "审核通过了申请单" + id); + //删除本地所有待办人 + todoService.deleteByApplyId(id); + //调用工作流服务 + ApplyEntity applyEntity = applyMapper.selectById(id); + bpmService.approve(applyEntity.getBpmId()); + } + + @Transactional(rollbackFor = Exception.class) + public List updateTodo(Long id) { + ApplyEntity applyEntity = applyMapper.selectById(id); + + List todoList = bpmService.getTodoList(applyEntity.getBpmId()); + if (todoList != null && todoList.size() > 0) { + todoService.save(id, todoList); + } + return todoList; + } + + @Transactional(rollbackFor = Exception.class) + public List createFinanceLog(Long id) { + return financeLogService.createFinanceLog(id); + } + + @Transactional(rollbackFor = Exception.class) + public void pushFinanceLog(List financeLog) { + financeLogSystemService.pushFinanceLog(financeLog); + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/ApplyService2.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/ApplyService2.java new file mode 100644 index 0000000..7843143 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/ApplyService2.java @@ -0,0 +1,56 @@ +package org.example.multi_sys_consist.service; + +import com.alibaba.fastjson.JSONObject; +import org.example.multi_sys_consist.constant.TransactionJobType; +import org.example.multi_sys_consist.mapper.ApplyMapper; +import org.example.multi_sys_consist.pojo.dto.ApplyApproveVo; +import org.example.multi_sys_consist.pojo.entity.ApplyEntity; +import org.example.multi_sys_consist.remote.FinanceLogSystemService; +import org.example.multi_sys_consist.remote.WorkflowService; +import org.example.multi_sys_consist.service.impl.LogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * 拆分事务后的优化方案 + */ +@Service +public class ApplyService2 { + + @Autowired + private CurrentService currentService; + @Autowired + private ApplyMapper applyMapper; + @Autowired + private WorkflowService workflowService; + @Autowired + private LogService logService; + @Autowired + private TodoService todoService; + @Autowired + private TransactionJobService transactionJobService; + + @Transactional(rollbackFor = Exception.class) + public void approve(Long id, ApplyApproveVo vo) { + //---------第一步----------- + //记录业务数据 + applyMapper.saveInfo(vo); + //记录审核通过日志 + logService.addLog(currentService.currentUser().getAccount() + "审核通过了申请单" + id); + //调用工作流服务 + ApplyEntity applyEntity = applyMapper.selectById(id); + //删除本地所有待办人 + todoService.deleteByApplyId(id); + + //留下任务:更新待办 + JSONObject data = new JSONObject(); + data.put("workflowId", applyEntity.getBpmId()); + data.put("applyId", id); + transactionJobService.create(TransactionJobType.UPDATE_TODO, data); + + //调用第三方接口:审核通过 + workflowService.approve(applyEntity.getBpmId()); + + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/CurrentService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/CurrentService.java new file mode 100644 index 0000000..2943487 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/CurrentService.java @@ -0,0 +1,17 @@ +package org.example.multi_sys_consist.service; + +import org.example.multi_sys_consist.pojo.entity.DemoUser; + +/** + * 当前用户 + */ +public interface CurrentService { + DemoUser currentUser(); + + void setCurrentUser(DemoUser user); + + void clearAll(); + + long currentTimeMillis(); + +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/FinanceLogService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/FinanceLogService.java new file mode 100644 index 0000000..07edf73 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/FinanceLogService.java @@ -0,0 +1,25 @@ +package org.example.multi_sys_consist.service; + +import org.example.multi_sys_consist.pojo.entity.FinanceLog; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 财务日志服务 + */ +@Service +public class FinanceLogService { + /** + * 创建财务日志 + * @param applyId + * @return + */ + public List createFinanceLog(Long applyId) { + return null; + } + + public List getByApplyId(Long applyId) { + return null; + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/TodoService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/TodoService.java new file mode 100644 index 0000000..1b9e87f --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/TodoService.java @@ -0,0 +1,22 @@ +package org.example.multi_sys_consist.service; + +import java.util.List; + +public class TodoService { + + /** + * 保存待办人 + */ + public void save(Long applyId, List todoList) { + + } + + /** + * 删除待办人 + * + * @param id + */ + public void deleteByApplyId(Long id) { + + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/TransactionJobService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/TransactionJobService.java new file mode 100644 index 0000000..48153da --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/TransactionJobService.java @@ -0,0 +1,15 @@ +package org.example.multi_sys_consist.service; + +import com.alibaba.fastjson.JSONObject; +import org.example.multi_sys_consist.constant.TransactionJobType; +import org.example.multi_sys_consist.pojo.entity.TransactionJob; + +/** + * 大型事务拆分后的小事务 + */ +public interface TransactionJobService { + + TransactionJob create(TransactionJobType type, JSONObject data); + + void findAndExecute(); +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/CurrentServiceImpl.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/CurrentServiceImpl.java new file mode 100644 index 0000000..ec18c97 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/CurrentServiceImpl.java @@ -0,0 +1,39 @@ +package org.example.multi_sys_consist.service.impl; + +import org.example.multi_sys_consist.pojo.entity.DemoUser; +import org.example.multi_sys_consist.service.CurrentService; +import org.springframework.stereotype.Service; + +@Service +public class CurrentServiceImpl implements CurrentService { + + private final ThreadLocal holder = new ThreadLocal<>(); + private final ThreadLocal timeHolder = new ThreadLocal<>(); + + @Override + public DemoUser currentUser() { + DemoUser demoUser = holder.get(); + if (demoUser != null) { + return demoUser; + } + //todo 用项目中的方法去替换 + return new DemoUser(); + } + + @Override + public void setCurrentUser(DemoUser user) { + holder.set(user); + } + + @Override + public void clearAll() { + holder.remove(); + timeHolder.remove(); + } + + @Override + public long currentTimeMillis() { + Long time = timeHolder.get(); + return time != null ? time : System.currentTimeMillis(); + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/LogService.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/LogService.java new file mode 100644 index 0000000..a97944e --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/LogService.java @@ -0,0 +1,19 @@ +package org.example.multi_sys_consist.service.impl; + +import org.example.multi_sys_consist.service.CurrentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 模拟日志服务 + */ +@Service +public class LogService { + + @Autowired + private CurrentService currentService; + + public void addLog(String log) { + System.out.println(currentService.currentUser().getAccount() + "add log: " + log); + } +} diff --git a/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/TransactionJobServiceImpl.java b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/TransactionJobServiceImpl.java new file mode 100644 index 0000000..e267778 --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/main/java/org/example/multi_sys_consist/service/impl/TransactionJobServiceImpl.java @@ -0,0 +1,150 @@ +package org.example.multi_sys_consist.service.impl; + +import cn.hutool.core.exceptions.ExceptionUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.java.Log; +import org.example.multi_sys_consist.common.BusinessException; +import org.example.multi_sys_consist.constant.TransactionJobType; +import org.example.multi_sys_consist.mapper.TransactionJobMapper; +import org.example.multi_sys_consist.module.TransactionJobExecutor; +import org.example.multi_sys_consist.pojo.entity.DemoUser; +import org.example.multi_sys_consist.pojo.entity.TransactionJob; +import org.example.multi_sys_consist.service.CurrentService; +import org.example.multi_sys_consist.service.TransactionJobService; +import org.redisson.api.RedissonClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; +import org.springframework.transaction.support.TransactionSynchronization; +import org.springframework.transaction.support.TransactionSynchronizationAdapter; +import org.springframework.transaction.support.TransactionSynchronizationManager; +import org.springframework.web.bind.annotation.PostMapping; + +import javax.annotation.PostConstruct; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.Lock; + + +@Service +public abstract class TransactionJobServiceImpl implements TransactionJobService { + private final Logger logger = LoggerFactory.getLogger(TransactionJobServiceImpl.class); + @Autowired + private TransactionJobMapper mapper; + @Autowired + private CurrentService currentService; + @Autowired + private RedissonClient redissonClient; + + private final Map executorMap = new HashMap<>(); + private final Map retryInterval = new HashMap<>(); + + { + retryInterval.put(1, 1); + retryInterval.put(2, 2); + retryInterval.put(3, 5); + retryInterval.put(4, 30); + retryInterval.put(5, 60); + retryInterval.put(6, 60 * 12); + retryInterval.put(7, 60 * 24); + retryInterval.put(8, 60 * 24 * 2); + } + + @Autowired + public void initExecutor(List executors) { + executors.forEach(e -> executorMap.put(e.type().name(), e)); + } + + @Override + public TransactionJob create(TransactionJobType type, JSONObject data) { + if (!TransactionSynchronizationManager.isActualTransactionActive()) { + throw new BusinessException("执行此方法时,必须在事务中"); + } + + TransactionJob job = new TransactionJob(); + job.setType(type.name()); + job.setData(data.toJSONString()); + job.setContext(JSON.toJSONString(currentService.currentUser())); + job.setCreateTime(System.currentTimeMillis()); + mapper.add(job); + + TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { + @Override + public void afterCommit() { + doExecute(job); + } + }); + + return job; + } + + /** + * 定时任务:每分钟执行一次 + */ + @Override + @Scheduled(cron = "0 0/1 * * * ?") + public void findAndExecute() { + int offset = 0; + int limit = 100; + while (true) { + List jobs = mapper.selectList(offset, limit); + if (jobs.isEmpty()) { + return; + } + for (TransactionJob job : jobs) { + //判断重试次数,重试时间间隔随着次数的增多而逐渐增大 + Integer re = job.getRetryTimes(); + if (re == 0) { + this.doExecute(job); + } + //超过8次都没有成功,就不再重试了 + if (re > 0 && re < 8) { + Integer interval = retryInterval.get(re); + if (System.currentTimeMillis() - job.getUpdateTime() > interval * 60 * 1000) { + this.doExecute(job); + } + } + } + offset += limit; + } + } + + /** + * 注意:这里一定不能加事务,否则会因为内层事务抛异常导致外层事务被回滚,从而无法记录下报错原因 + */ + private void doExecute(TransactionJob job) { + Lock lock = getLock(job); + if (lock.tryLock()) { + try { + //设置上下文,因为是异步执行的,所以可能需要执行前设置好当时的操作用户 + DemoUser user = JSON.parseObject(job.getContext(), DemoUser.class); + currentService.setCurrentUser(user); + try { + TransactionJobExecutor executor = executorMap.get(job.getType()); + executor.execute(job); + mapper.updateSuccess(job.getId(), System.currentTimeMillis()); + } catch (Exception e) { + logger.error("error execute job:{}", job.getId(), e); + String errorMessage = ExceptionUtil.stacktraceToString(e, 10000); + mapper.updateError(job.getId(), errorMessage, System.currentTimeMillis()); + } finally { + currentService.clearAll(); + } + } finally { + lock.unlock(); + } + } + } + + private Lock getLock(TransactionJob job) { + //使用redisson获取分布式锁 + //todo 按照自己业务的需求,生成唯一的key + String key = ""; + return redissonClient.getLock(key); + } + +} diff --git a/demo-codes-master/demo-codes-master/src/test/java/org/example/AppTest.java b/demo-codes-master/demo-codes-master/src/test/java/org/example/AppTest.java new file mode 100644 index 0000000..d5f435d --- /dev/null +++ b/demo-codes-master/demo-codes-master/src/test/java/org/example/AppTest.java @@ -0,0 +1,38 @@ +package org.example; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/.gitignore b/excel导入校验/mybatis-plus-demo-test-master/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/compiler.xml b/excel导入校验/mybatis-plus-demo-test-master/.idea/compiler.xml new file mode 100644 index 0000000..07e72e7 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/encodings.xml b/excel导入校验/mybatis-plus-demo-test-master/.idea/encodings.xml new file mode 100644 index 0000000..371b015 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/jarRepositories.xml b/excel导入校验/mybatis-plus-demo-test-master/.idea/jarRepositories.xml new file mode 100644 index 0000000..e6b00eb --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/misc.xml b/excel导入校验/mybatis-plus-demo-test-master/.idea/misc.xml new file mode 100644 index 0000000..e67181d --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/modules.xml b/excel导入校验/mybatis-plus-demo-test-master/.idea/modules.xml new file mode 100644 index 0000000..336be1c --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/mybatis-plus-demo-test-master.iml b/excel导入校验/mybatis-plus-demo-test-master/.idea/mybatis-plus-demo-test-master.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/mybatis-plus-demo-test-master.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/.idea/vcs.xml b/excel导入校验/mybatis-plus-demo-test-master/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/LICENSE b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/LICENSE new file mode 100644 index 0000000..8000a6f --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/LICENSE @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random + Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/README.en.md b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/README.en.md new file mode 100644 index 0000000..cd5e036 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/README.en.md @@ -0,0 +1,36 @@ +# mybatis-plus-demo-test + +#### Description +{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/README.md b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/README.md new file mode 100644 index 0000000..2346d7d --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/README.md @@ -0,0 +1,39 @@ +# mybatis-plus-demo-test + +#### 介绍 +{**以下是 Gitee 平台说明,您可以替换此简介** +Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 +无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} + +#### 软件架构 +软件架构说明 + + +#### 安装教程 + +1. xxxx +2. xxxx +3. xxxx + +#### 使用说明 + +1. xxxx +2. xxxx +3. xxxx + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 +4. 新建 Pull Request + + +#### 特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.gitignore b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/MavenWrapperDownloader.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/maven-wrapper.jar b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/maven-wrapper.jar differ diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/maven-wrapper.properties b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..a9f1ef8 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/mvnw b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/mvnw new file mode 100644 index 0000000..a16b543 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/mvnw.cmd b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/mvnw.cmd new file mode 100644 index 0000000..c8d4337 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/pom.xml b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/pom.xml new file mode 100644 index 0000000..f161eb1 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.4.5 + + com.example + demo + 0.0.1-SNAPSHOT + demo + Demo project for Spring Boot + + 1.8 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-test + test + + + com.baomidou + mybatis-plus-boot-starter + 3.5.0 + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + + mysql + mysql-connector-java + runtime + + + + com.alibaba + druid + 1.1.9 + + + + + org.projectlombok + lombok + true + + + + org.apache.commons + commons-lang3 + 3.9 + + + junit + junit + test + + + org.springframework.boot + spring-boot-starter-web + + + + + com.alibaba + easyexcel + 3.0.5 + + + org.springframework.boot + spring-boot-starter-validation + + + com.alibaba + fastjson + 1.2.75 + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/DemoApplication.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/DemoApplication.java new file mode 100644 index 0000000..ec3aa47 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/DemoApplication.java @@ -0,0 +1,15 @@ +package com.example.demo; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@MapperScan("com.example.demo.repository") +public class DemoApplication { + + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } + +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/controller/UserExcelController.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/controller/UserExcelController.java new file mode 100644 index 0000000..be69c76 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/controller/UserExcelController.java @@ -0,0 +1,106 @@ +package com.example.demo.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.example.demo.entity.UserExcel; +import com.example.demo.utils.ValidationUtils; +import com.example.demo.vo.UserExcelVO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.ConstraintViolation; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +/** + * Excel 数据导入,如何更优雅的进行数据校验? + */ +@RestController +@RequestMapping("/user") +@Slf4j +public class UserExcelController { + + @PostMapping("/v1/importExcel") + public UserExcelVO importExcel(@RequestParam("file") MultipartFile file) { + List list = null; + List fail = new ArrayList<>(); + UserExcelVO userExcelVO = new UserExcelVO(); + String mobieReg = "^[1][3,4,5,7,8][0-9]{9}$"; + try { + list = EasyExcel.read(file.getInputStream(), UserExcel.class, new ModelExcelListener()).sheet().doReadSync(); + list.forEach(data -> { + //处理姓名的校验 + if (StringUtils.isEmpty(data.getName()) || data.getName().length() > 4) { + fail.add(data); + return; + } + //处理手机号的校验 + if (StringUtils.isEmpty(data.getMobile()) || !data.getMobile().matches(mobieReg)) { + fail.add(data); + return; + } + //以下根据字段多少可能有n个if + + }); + userExcelVO.setFail(fail); + list.removeAll(fail); + userExcelVO.setSuccess(list); + } catch (IOException e) { + e.printStackTrace(); + } + return userExcelVO; + } + + + @PostMapping("/v2/importExcel") + public UserExcelVO importExcelV2(@RequestParam("file") MultipartFile file) { + List list = null; + List fail = new ArrayList<>(); + UserExcelVO userExcelVO = new UserExcelVO(); + try { + list = EasyExcel.read(file.getInputStream(), UserExcel.class, new ModelExcelListener()).sheet().doReadSync(); + list.forEach(data -> { + Set> violations = ValidationUtils.getValidator().validate(data); + if (violations.size() > 0) { + fail.add(data); + } + }); + userExcelVO.setFail(fail); + list.removeAll(fail); + userExcelVO.setSuccess(list); + } catch (IOException e) { + e.printStackTrace(); + } + return userExcelVO; + } + + + public static class ModelExcelListener extends AnalysisEventListener { + private List datas = new ArrayList<>(); + + /** + * 通过 AnalysisContext 对象还可以获取当前 sheet,当前行等数据 + */ + @Override + public void invoke(UserExcel data, AnalysisContext context) { + //数据存储到list,供批量处理,或后续自己业务逻辑处理。 + log.info("读取到数据{}", data); + datas.add(data); + //根据业务自行处理,可以写入数据库等等 + + + } + + //所有的数据解析完了调用 + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + log.info("所有数据解析完成"); + } + } +} + diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/entity/UserExcel.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/entity/UserExcel.java new file mode 100644 index 0000000..09dea72 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/entity/UserExcel.java @@ -0,0 +1,33 @@ +package com.example.demo.entity; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.io.Serializable; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class UserExcel implements Serializable { + + @NotBlank(message = "用户名不能为空") + @Size(max = 4) + @ExcelProperty(value = "用户名", index = 0) + private String name; + + @ExcelProperty(value = "年龄", index = 1) + private Integer age; + + @Pattern(regexp = "^[1][3,4,5,7,8][0-9]{9}$$", message = "手机号不合法") + @NotBlank(message = "手机号不能为空") + @ExcelProperty(value = "手机号", index = 2) + private String mobile; + + @ExcelProperty(value = "性别", index = 3) + private String sex; +} + diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/utils/ValidationUtils.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/utils/ValidationUtils.java new file mode 100644 index 0000000..89e3979 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/utils/ValidationUtils.java @@ -0,0 +1,18 @@ +package com.example.demo.utils; + +import javax.validation.Validation; +import javax.validation.Validator; +import javax.validation.ValidatorFactory; + +public class ValidationUtils { + + public static Validator getValidator(){ + return validator; + } + + static Validator validator; + static{ + ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory(); + validator=validatorFactory.getValidator(); + } +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/vo/UserExcelVO.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/vo/UserExcelVO.java new file mode 100644 index 0000000..3385efb --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/java/com/example/demo/vo/UserExcelVO.java @@ -0,0 +1,19 @@ +package com.example.demo.vo; + +import com.example.demo.entity.UserExcel; +import lombok.Data; + +import java.util.List; + +@Data +public class UserExcelVO { + /** + * 成功列表 + */ + private List success; + /** + * 失败列表 + */ + private List fail; + +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/application.yml b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/application.yml new file mode 100644 index 0000000..000c014 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/application.yml @@ -0,0 +1,27 @@ +server: + port: 8086 + +spring: + datasource: + username: root + password: root + url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai + driver-class-name: com.mysql.cj.jdbc.Driver + +mybatis-plus: + global-config: + db-config: + logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) + logic-delete-value: 1 # 逻辑已删除值(默认为 1) + logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + mapper-locations: + classpath: mapper/*.xml + type-aliases-package: com.example.demo.entity +#showSql +logging: + level: + com: + example: + mapper : error diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/db/data-h2.sql b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/db/data-h2.sql new file mode 100644 index 0000000..84f802a --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/db/data-h2.sql @@ -0,0 +1,8 @@ +DELETE FROM user; + +INSERT INTO users (id, tenant_id, name) VALUES +(1, 1, 'Jone'),(2, 1, 'Jack'),(3, 1, 'Tom'), +(4, 0, 'Sandy'),(5, 0, 'Billie'); + +INSERT INTO user_addr (id, USER_ID, name) VALUES +(1, 1, 'addr1'),(2,1,'addr2'); \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/db/schema-h2.sql b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/db/schema-h2.sql new file mode 100644 index 0000000..9e29cdd --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/db/schema-h2.sql @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS user; + +CREATE TABLE users +( + id BIGINT(20) NOT NULL COMMENT '主键ID', + tenant_id BIGINT(20) NOT NULL COMMENT '租户ID', + name VARCHAR(30) NULL DEFAULT NULL COMMENT '姓名', + PRIMARY KEY (id) +); + +DROP TABLE IF EXISTS user_addr; + +CREATE TABLE USER_ADDR +( + id BIGINT(20) NOT NULL COMMENT '主键ID', + user_id BIGINT(20) NOT NULL COMMENT 'user.id', + name VARCHAR(30) NULL DEFAULT NULL COMMENT '地址名称', + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/mapper/UserDao.xml b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/mapper/UserDao.xml new file mode 100644 index 0000000..cd36c5d --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/mapper/UserDao.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + id, `name`, age, email, version, create_time, update_time, deleted + + + + delete from user + where id = #{id,jdbcType=BIGINT} + + + insert into user (`name`, age, email, + version, create_time, update_time, + deleted) + values (#{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER}, #{email,jdbcType=VARCHAR}, + #{version,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, + #{deleted,jdbcType=INTEGER}) + + + insert into user + + + `name`, + + + age, + + + email, + + + version, + + + create_time, + + + update_time, + + + deleted, + + + + + #{name,jdbcType=VARCHAR}, + + + #{age,jdbcType=INTEGER}, + + + #{email,jdbcType=VARCHAR}, + + + #{version,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{deleted,jdbcType=INTEGER}, + + + + + update user + + + `name` = #{name,jdbcType=VARCHAR}, + + + age = #{age,jdbcType=INTEGER}, + + + email = #{email,jdbcType=VARCHAR}, + + + version = #{version,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + deleted = #{deleted,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=BIGINT} + + + update user + set `name` = #{name,jdbcType=VARCHAR}, + age = #{age,jdbcType=INTEGER}, + email = #{email,jdbcType=VARCHAR}, + version = #{version,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + deleted = #{deleted,jdbcType=INTEGER} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/mapper/UsersMapper.xml b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/mapper/UsersMapper.xml new file mode 100644 index 0000000..d9c3890 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/main/resources/mapper/UsersMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/ChainTests.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/ChainTests.java new file mode 100644 index 0000000..0579e53 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/ChainTests.java @@ -0,0 +1,27 @@ +package com.example.demo; + +import com.example.demo.chain.ProductService; +import com.example.demo.chain.ProductVO; +import org.springframework.boot.test.context.SpringBootTest; +import org.junit.jupiter.api.Test; +import javax.annotation.Resource; +import java.math.BigDecimal; + +@SpringBootTest +public class ChainTests { + + @Resource + ProductService productService; + + @Test + void contextLoads() { + ProductVO param = ProductVO.builder() + .skuId(11L) + .skuName("测试商品") + .imgPath("http://..") + .price(new BigDecimal(13)) + .stock(-13) + .build(); + productService.createProduct(param); + } +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/DemoApplicationTests.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/DemoApplicationTests.java new file mode 100644 index 0000000..5da1906 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/DemoApplicationTests.java @@ -0,0 +1,84 @@ +package com.example.demo; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.example.demo.repository.UserMapper; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import javax.annotation.Resource; +import java.util.List; + +@SpringBootTest +class DemoApplicationTests { + @Resource + UserMapper userMapper; + + @Test + public void testAdd() { + User user = new User(); + user.setName("OrangeTest17"); + user.setAge(22); + user.setEmail("1525@qq.com"); + int insert = userMapper.insert(user); + System.out.println(insert); + } + + /** + * 乐观锁实现方式: + * 1、取出记录时,获取当前version + * 2、更新时,带上这个version + * 3、执行更新时, set version = newVersion where version = oldVersion + * 4、如果version不对,就更新失败 + */ + //测试乐观锁,看version的值是否加1 + @Test + void testOptimisticLocker(){ + //根据id查询数据 + User user = userMapper.selectById(2); + System.out.println(user.getVersion()); + //进行修改 + user.setAge(21); + userMapper.updateById(user); + } + + //测试乐观锁,模拟失败场景 + @Test + void testOptimisticLockerFail(){ + //线程1 + //根据id查询数据 + User user1 = userMapper.selectById(3); + user1.setAge(20); + + //线程2 + User user2 = userMapper.selectById(3); + user2.setAge(28); + + //模拟另一个线程执行了插队操作 + userMapper.updateById(user2); + userMapper.updateById(user1); + } + + @Test + void testSelect(){ + QueryWrapper queryWrapper = new QueryWrapper(); + List users = userMapper.selectList(queryWrapper); + users.stream().forEach(i ->{ + System.out.println(i.getName()); + }); + } + + @Test + void testSelectPage(){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.like("name","OrangeTest"); + IPage page = new Page<>(1,3); + IPage userPage = userMapper.selectPage(page,queryWrapper); + System.out.println(userPage.getRecords()); + userPage.getRecords().stream().forEach(i ->{ + System.out.println(i.getId()+"\t"+i.getName()); + }); + } + + +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/DynamicTableNameTest.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/DynamicTableNameTest.java new file mode 100644 index 0000000..d3cb632 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/DynamicTableNameTest.java @@ -0,0 +1,27 @@ +package com.example.demo; + +import com.example.demo.config.RequestDataHelper; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import javax.annotation.Resource; + +/** + *

+ * 内置 动态表名 演示 + *

+ * + */ +@SpringBootTest +class DynamicTableNameTest { + @Resource + private NewUserMapper newUserMapper; + + @Test + void test() { + // 自己去观察打印 SQL 目前随机访问 newuser_2021 newuser_2022 表 + for (int i = 0; i < 6; i++) { + NewUser user = newUserMapper.selectById(1); + System.err.println(user.getName()); + } + } +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TenantTest.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TenantTest.java new file mode 100644 index 0000000..4b600cf --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TenantTest.java @@ -0,0 +1,97 @@ +package com.example.demo; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.example.demo.repository.UsersMapper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import javax.annotation.Resource; +import java.util.List; + +/** + * 多租户 Tenant 演示 + */ +@SpringBootTest +public class TenantTest { + @Resource + private UsersMapper mapper; + + @Test + public void testInsert() { + Users user = new Users(); + user.setName("三丰丰"); + Assertions.assertTrue(mapper.insert(user) > 0); + user = mapper.selectById(user.getId()); + Assertions.assertTrue(1 == user.getTenantId()); + } + + + @Test + public void testDelete() { + Assertions.assertTrue(mapper.deleteById(3L) > 0); + } + + + @Test + public void testUpdate() { + Assertions.assertTrue(mapper.updateById(new Users().setId(1L).setName("mp")) > 0); + } + + + /* + * 多个租户共用同一套表通过sql语句级别来隔离不同租户的资源, + * 比如设置一个租户标识字段,每次查询的时候在后面附加一个筛选条件:TenantId=xxx。 + * 这样能低代价、简单地实现多租户服务,但是每次执行sql的时候需要附加字段隔离,否则会出现数据错乱。 + 此隔离过程应该自动标识完成, + * */ + @Test + public void testSelect() { + List userList = mapper.selectList(null); + userList.forEach(u -> Assertions.assertTrue(1 == u.getTenantId())); + } + + /** + * 自定义SQL:默认也会增加多租户条件 + * 参考打印的SQL + */ + @Test + public void manualSqlTenantFilterTest() { + System.out.println(mapper.myCount()); + } + + @Test + public void testTenantFilter(){ + mapper.getAddrAndUser(null).forEach(System.out::println); + mapper.getAddrAndUser("add").forEach(System.out::println); + mapper.getUserAndAddr(null).forEach(System.out::println); + mapper.getUserAndAddr("J").forEach(System.out::println); + } + + //防止全表更新与删除插件 + @Test + public void deleteAll() { + //执行会报错: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Prohibition of full table deletion + int delete = mapper.delete(null); + System.out.println("删除成功"+delete); + + /* 改成根据条件删除,就不会报错*/ + QueryWrapper queryWrapper = new QueryWrapper(); + Users user = new Users(); + user.setName("三丰丰"); + queryWrapper.lambda().eq(Users::getName,"三丰丰"); + mapper.delete(queryWrapper); + int delete2 = mapper.delete(null); + System.out.println("删除成功"+delete2); + + } + + @Test + public void updateAll() { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper().set(Users::getName, "三丰丰"); + mapper.update(null, updateWrapper); + System.out.println("修改成功"); + } + + +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TestCRUD.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TestCRUD.java new file mode 100644 index 0000000..d3dd041 --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TestCRUD.java @@ -0,0 +1,100 @@ +package com.example.demo; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.example.demo.service.impl.UsersServiceImpl; +import org.assertj.core.util.Lists; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** +* 测试 Service CRUD 接口 +*/ +@SpringBootTest +public class TestCRUD { + + @Autowired + private UsersServiceImpl usersService; + + @Test + public void test01() { + // 插入一条记录(选择字段,策略插入) + Users user1 = new Users(); + user1.setId(0L); + user1.setName("Alex"); + user1.setAddrName("shenzhen"); + user1.setTenantId(1L); + usersService.save(user1); + // TableId 注解存在更新记录,否插入一条记录 + //userService.saveOrUpdate(user1); + } + + @Test + public void test02() { + // 根据 ID 删除 + usersService.removeById(0L); + } + + @Test + public void test03() { + IPage page = new Page<>(1,2); + IPage tasks = usersService.page(page); + System.out.println(tasks.getPages()); + System.out.println(tasks.getCurrent()); + System.out.println(tasks.getRecords()); + System.out.println(tasks.getTotal()); + } + + @Test + public void test04() { + System.out.println(usersService.getByName("Jone")); + } + + @Test + public void test05() { + //System.out.println(usersController.getByName("Jone")); + List stringList = Lists.newArrayList(); + for (int i = 0; i < 10; i++) { + stringList.add(String.valueOf(i)); + } + + List longList = stringList.stream().map(Long::valueOf).collect(Collectors.toList()); + System.out.println(longList); + } + + @Test + public void test06() { + Users user1 = new Users(); + user1.setId(0L); + user1.setName("Alex"); + user1.setAddrName("shenzhen"); + user1.setTenantId(1L); + + Users user2 = new Users(); + user2.setId(1L); + user2.setName("Alex2"); + user2.setAddrName("shenzhen2"); + user2.setTenantId(2L); + + List listData = new ArrayList(); + listData.add(user1); + listData.add(user2); + + List list = listData.stream().map(v -> { + User user = new User(); + user.setId(v.getId()); + user.setName(v.getName()); + return user; + }).collect(Collectors.toList()); + + list.forEach(System.out::println); + } + + + +} diff --git a/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TestTreeParser.java b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TestTreeParser.java new file mode 100644 index 0000000..a08cc0e --- /dev/null +++ b/excel导入校验/mybatis-plus-demo-test-master/mybatis-plus-demo-test-master/demo/src/test/java/com/example/demo/TestTreeParser.java @@ -0,0 +1,43 @@ +package com.example.demo; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.ArrayList; +import java.util.List; + +@SpringBootTest +public class TestTreeParser { + + @Test + public void test01() { + List list = new ArrayList<>(); + Menu menu1 = new Menu(); + menu1.setId("1"); + menu1.setParentId("0"); + menu1.setName("菜单1"); + list.add(menu1); + + Menu menu2 = new Menu(); + menu2.setId("2"); + menu2.setParentId("0"); + menu2.setName("菜单2"); + list.add(menu2); + + Menu menu3 = new Menu(); + menu3.setId("3"); + menu3.setParentId("1"); + menu3.setName("菜单11"); + list.add(menu3); + + Menu menu4 = new Menu(); + menu4.setId("4"); + menu4.setParentId("3"); + menu4.setName("菜单111"); + list.add(menu4); + + List menus = TreeParser.getTreeList("0", list); + System.out.println(menus); + + } +} diff --git a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/.idea/uiDesigner.xml b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/DemoConfiguration.java b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/DemoConfiguration.java new file mode 100644 index 0000000..56d6870 --- /dev/null +++ b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/config/DemoConfiguration.java @@ -0,0 +1,14 @@ +package com.woniu.jvmoptimize.config;/** + * @className: Configuration + * @author: Kevin + * @date: 2023/12/9 + **/ +* + * @Author LiuMiss + * @Description //TODO $ + * @Date $ $ + * @Param $ + * @return $ + **/ +public class Configuration { +} diff --git a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/dao/ProductRepository.java b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/dao/ProductRepository.java new file mode 100644 index 0000000..54a88fa --- /dev/null +++ b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/dao/ProductRepository.java @@ -0,0 +1,14 @@ +package com.woniu.jvmoptimize.dao;/** + * @className: ProductRepository + * @author: Kevin + * @date: 2023/12/9 + **/ +* + * @Author LiuMiss + * @Description //TODO $ + * @Date $ $ + * @Param $ + * @return $ + **/ +public class ProductRepository { +} diff --git a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/Product.java b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/Product.java new file mode 100644 index 0000000..98614ca --- /dev/null +++ b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/Product.java @@ -0,0 +1,14 @@ +package com.woniu.jvmoptimize.entity;/** + * @className: Product + * @author: Kevin + * @date: 2023/12/9 + **/ +* + * @Author LiuMiss + * @Description //TODO $ + * @Date $ $ + * @Param $ + * @return $ + **/ +public class Product { +} diff --git a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/UserData.java b/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/UserData.java deleted file mode 100644 index fe31e3f..0000000 --- a/系统不处理业务的时候 也占用大量的内存 该如何排查并解决?/jvm-optimize/src/main/java/com/woniu/jvmoptimize/entity/UserData.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.woniu.jvmoptimize.entity; - -public class UserData { - byte[] data = new byte[1024 * 1024 * 10]; //模拟保存10m的用户数据 -}