style: 优化全局代码格式

This commit is contained in:
2024-01-10 21:24:02 +08:00
parent ab19c05f00
commit 57c21a9109
51 changed files with 627 additions and 186 deletions

380
.style/p3c-codestyle.xml Normal file
View File

@@ -0,0 +1,380 @@
<?xml version="1.0" encoding="utf-8"?>
<profiles version="21">
<profile kind="CodeFormatterProfile" name="P3C-CodeStyle" version="21">
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="18"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="48"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
</profile>
</profiles>

View File

@@ -44,7 +44,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* API 文档自动配置
*
@@ -63,8 +62,9 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/");
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/")
.setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/")
.setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
}
/**
@@ -73,20 +73,16 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
@Bean
@ConditionalOnMissingBean
public OpenAPI openApi(ProjectProperties projectProperties, SpringDocExtensionProperties properties) {
Info info = new Info()
.title(String.format("%s %s", projectProperties.getName(), "API 文档"))
.version(projectProperties.getVersion())
.description(projectProperties.getDescription());
Info info = new Info().title(String.format("%s %s", projectProperties.getName(), "API 文档"))
.version(projectProperties.getVersion())
.description(projectProperties.getDescription());
ProjectProperties.Contact contact = projectProperties.getContact();
if (null != contact) {
info.contact(new Contact().name(contact.getName())
.email(contact.getEmail())
.url(contact.getUrl()));
info.contact(new Contact().name(contact.getName()).email(contact.getEmail()).url(contact.getUrl()));
}
ProjectProperties.License license = projectProperties.getLicense();
if (null != license) {
info.license(new License().name(license.getName())
.url(license.getUrl()));
info.license(new License().name(license.getName()).url(license.getUrl()));
}
OpenAPI openAPI = new OpenAPI();
openAPI.info(info);
@@ -120,7 +116,10 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
Map<String, SecurityScheme> securitySchemeMap = components.getSecuritySchemes();
pathItem.readOperations().forEach(operation -> {
SecurityRequirement securityRequirement = new SecurityRequirement();
List<String> list = securitySchemeMap.values().stream().map(SecurityScheme::getName).toList();
List<String> list = securitySchemeMap.values()
.stream()
.map(SecurityScheme::getName)
.toList();
list.forEach(securityRequirement::addList);
operation.addSecurityItem(securityRequirement);
});

View File

@@ -21,7 +21,6 @@ import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
/**
* API 文档扩展配置属性
*

View File

@@ -40,8 +40,7 @@ public class JustAuthStateCacheRedisImpl implements AuthStateCache {
@Override
public void cache(String key, String value) {
// 参考:在 JustAuth 中,内置了一个基于 map 的 state 缓存器,默认缓存有效期为 3 分钟
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value,
Duration.ofMinutes(3));
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value, Duration.ofMinutes(3));
}
/**
@@ -53,8 +52,7 @@ public class JustAuthStateCacheRedisImpl implements AuthStateCache {
*/
@Override
public void cache(String key, String value, long timeout) {
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value,
Duration.ofMillis(timeout));
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value, Duration.ofMillis(timeout));
}
/**

View File

@@ -57,8 +57,9 @@ public class SaTokenAutoConfiguration implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())).addPathPatterns(StringConstants.PATH_PATTERN)
.excludePathPatterns(properties.getSecurity().getExcludes());
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
.addPathPatterns(StringConstants.PATH_PATTERN)
.excludePathPatterns(properties.getSecurity().getExcludes());
}
/**

View File

@@ -23,7 +23,6 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty;
import top.charles7c.continew.starter.auth.satoken.properties.SaTokenDaoProperties;
import top.charles7c.continew.starter.auth.satoken.properties.SaTokenSecurityProperties;
/**
* SaToken 扩展配置属性
*

View File

@@ -86,7 +86,9 @@ public class RedissonAutoConfiguration {
// 下方配置如果为空,则使用 Redis 的配置
if (CollUtil.isEmpty(sentinelServersConfig.getSentinelAddresses())) {
List<String> nodeList = redisProperties.getSentinel().getNodes();
nodeList.stream().map(node -> protocol + node).forEach(sentinelServersConfig::addSentinelAddress);
nodeList.stream()
.map(node -> protocol + node)
.forEach(sentinelServersConfig::addSentinelAddress);
}
if (StrUtil.isBlank(sentinelServersConfig.getPassword())) {
sentinelServersConfig.setPassword(redisProperties.getPassword());
@@ -107,7 +109,8 @@ public class RedissonAutoConfiguration {
singleServerConfig.setPassword(redisProperties.getPassword());
}
if (StrUtil.isBlank(singleServerConfig.getAddress())) {
singleServerConfig.setAddress(protocol + redisProperties.getHost() + StringConstants.COLON + redisProperties.getPort());
singleServerConfig.setAddress(protocol + redisProperties
.getHost() + StringConstants.COLON + redisProperties.getPort());
}
}
}

View File

@@ -22,7 +22,6 @@ import org.redisson.config.SentinelServersConfig;
import org.redisson.config.SingleServerConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Redisson 配置属性
*

View File

@@ -62,8 +62,7 @@ public class BehaviorCaptchaAutoConfiguration {
*/
@Configuration
@Import({BehaviorCaptchaCacheConfiguration.Redis.class, BehaviorCaptchaCacheConfiguration.Custom.class})
protected static class BehaviorCaptchaCacheAutoConfiguration {
}
protected static class BehaviorCaptchaCacheAutoConfiguration {}
/**
* 行为验证码服务接口
@@ -94,8 +93,8 @@ public class BehaviorCaptchaAutoConfiguration {
config.put(Const.CAPTCHA_FONT_SIZE, properties.getFontSize());
config.put(Const.CAPTCHA_FONT_STYLE, properties.getFontStyle());
config.put(Const.CAPTCHA_WORD_COUNT, 4);
if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:")
|| StrUtil.startWith(properties.getPicClickBaseMapPath(), "classpath:")) {
if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:") || StrUtil.startWith(properties
.getPicClickBaseMapPath(), "classpath:")) {
// 自定义 resources 目录下初始化底图
config.put(Const.CAPTCHA_INIT_ORIGINAL, true);
initializeBaseMap(properties.getJigsawBaseMapPath(), properties.getPicClickBaseMapPath());
@@ -110,9 +109,8 @@ public class BehaviorCaptchaAutoConfiguration {
* @param picClick 点选验证码底图路径
*/
private static void initializeBaseMap(String jigsaw, String picClick) {
ImageUtils.cacheBootImage(getResourcesImagesFile(jigsaw + "/original/*.png"),
getResourcesImagesFile(jigsaw + "/slidingBlock/*.png"),
getResourcesImagesFile(picClick + "/*.png"));
ImageUtils
.cacheBootImage(getResourcesImagesFile(jigsaw + "/original/*.png"), getResourcesImagesFile(jigsaw + "/slidingBlock/*.png"), getResourcesImagesFile(picClick + "/*.png"));
}
/**

View File

@@ -53,7 +53,8 @@ abstract class BehaviorCaptchaCacheConfiguration {
@ConditionalOnProperty(name = PropertiesConstants.CAPTCHA_BEHAVIOR + ".cache-type", havingValue = "redis")
static class Redis {
static {
CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name().toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name()
.toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Redis' completed initialization.");
}
}
@@ -72,7 +73,8 @@ abstract class BehaviorCaptchaCacheConfiguration {
@PostConstruct
public void postConstruct() {
CaptchaServiceFactory.cacheService.put(StorageType.CUSTOM.name().toLowerCase(), SpringUtil.getBean(CaptchaCacheService.class));
CaptchaServiceFactory.cacheService.put(StorageType.CUSTOM.name().toLowerCase(), SpringUtil
.getBean(CaptchaCacheService.class));
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Custom' completed initialization.");
}
}

View File

@@ -54,8 +54,7 @@ public enum GraphicCaptchaType {
/**
* 特殊类型
*/
SPEC(SpecCaptcha.class),
;
SPEC(SpecCaptcha.class),;
/**
* 验证码实现

View File

@@ -81,8 +81,9 @@ public class ProjectProperties {
public static final boolean IP_ADDR_LOCAL_PARSE_ENABLED;
static {
IP_ADDR_LOCAL_PARSE_ENABLED = SpringUtil.getProperty("project.ip-addr-local-parse-enabled", boolean.class, false)
|| SpringUtil.getProperty("project.ipAddrLocalParseEnabled", boolean.class, false);
IP_ADDR_LOCAL_PARSE_ENABLED = SpringUtil
.getProperty("project.ip-addr-local-parse-enabled", boolean.class, false) || SpringUtil
.getProperty("project.ipAddrLocalParseEnabled", boolean.class, false);
}
/**

View File

@@ -66,8 +66,10 @@ public class AsyncAutoConfiguration implements AsyncConfigurer {
return (throwable, method, objects) -> {
throwable.printStackTrace();
StringBuilder sb = new StringBuilder();
sb.append("Exception message: ").append(throwable.getMessage()).append(", Method name: ")
.append(method.getName());
sb.append("Exception message: ")
.append(throwable.getMessage())
.append(", Method name: ")
.append(method.getName());
if (ArrayUtil.isNotEmpty(objects)) {
sb.append(", Parameter value: ").append(Arrays.toString(objects));
}

View File

@@ -78,9 +78,9 @@ public class ThreadPoolAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ScheduledExecutorService scheduledExecutorService(ThreadPoolProperties properties) {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ObjectUtil.defaultIfNull(properties.getCorePoolSize(), corePoolSize),
ThreadUtil.newNamedThreadFactory("schedule-pool-%d", true),
new ThreadPoolExecutor.CallerRunsPolicy()) {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ObjectUtil.defaultIfNull(properties
.getCorePoolSize(), corePoolSize), ThreadUtil
.newNamedThreadFactory("schedule-pool-%d", true), new ThreadPoolExecutor.CallerRunsPolicy()) {
@Override
protected void afterExecute(Runnable runnable, Throwable throwable) {
super.afterExecute(runnable, throwable);

View File

@@ -27,7 +27,11 @@ import org.springframework.lang.Nullable;
import java.io.IOException;
/**
* 通用配置文件读取工厂DefaultPropertySourceFactory 仅支持 properties 配置文件读取,详见:<a href="https://docs.spring.io/spring-boot/docs/2.0.6.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-yaml-shortcomings">YAML Shortcomings</a>
* 通用配置文件读取工厂
* <p>
* DefaultPropertySourceFactory 仅支持 properties
* 配置文件读取,详见:<ahref="https://docs.spring.io/spring-boot/docs/2.0.6.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-yaml-shortcomings">YAMLShortcomings</a>
* </p>
*
* @author Charles7c
* @since 1.0.0
@@ -35,7 +39,8 @@ import java.io.IOException;
public class GeneralPropertySourceFactory extends DefaultPropertySourceFactory {
@Override
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource encodedResource) throws IOException {
public PropertySource<?> createPropertySource(@Nullable String name,
EncodedResource encodedResource) throws IOException {
Resource resource = encodedResource.getResource();
String resourceName = resource.getFilename();
if (StrUtil.isNotBlank(resourceName) && StrUtil.endWithAny(resourceName, ".yml", ".yaml")) {

View File

@@ -53,8 +53,8 @@ public class FileUploadUtils {
String fileName;
if (isKeepOriginalFilename) {
fileName = String.format("%s-%s.%s", FileNameUtil.getPrefix(originalFilename),
DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_MS_PATTERN), extensionName);
fileName = String.format("%s-%s.%s", FileNameUtil.getPrefix(originalFilename), DateUtil.format(LocalDateTime
.now(), DatePattern.PURE_DATETIME_MS_PATTERN), extensionName);
} else {
fileName = String.format("%s.%s", IdUtil.fastSimpleUUID(), extensionName);
}

View File

@@ -120,6 +120,6 @@ public class ServletUtils {
}
private static ServletRequestAttributes getServletRequestAttributes() {
return (ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes());
return (ServletRequestAttributes)Objects.requireNonNull(RequestContextHolder.getRequestAttributes());
}
}

View File

@@ -49,8 +49,10 @@ public class SpringUtils {
public static void deRegisterResourceHandler(Map<String, String> handlerMap) {
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
// 获取已经注册的映射
final HandlerMapping resourceHandlerMapping = applicationContext.getBean("resourceHandlerMapping", HandlerMapping.class);
final Map<String, Object> oldHandlerMap = (Map<String, Object>) ReflectUtil.getFieldValue(resourceHandlerMapping, "handlerMap");
final HandlerMapping resourceHandlerMapping = applicationContext
.getBean("resourceHandlerMapping", HandlerMapping.class);
final Map<String, Object> oldHandlerMap = (Map<String, Object>)ReflectUtil
.getFieldValue(resourceHandlerMapping, "handlerMap");
// 移除之前注册的映射
for (Map.Entry<String, String> entry : handlerMap.entrySet()) {
String pathPattern = StrUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN);
@@ -66,11 +68,14 @@ public class SpringUtils {
public static void registerResourceHandler(Map<String, String> handlerMap) {
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
// 获取已经注册的映射
final HandlerMapping resourceHandlerMapping = applicationContext.getBean("resourceHandlerMapping", HandlerMapping.class);
final Map<String, Object> oldHandlerMap = (Map<String, Object>) ReflectUtil.getFieldValue(resourceHandlerMapping, "handlerMap");
final HandlerMapping resourceHandlerMapping = applicationContext
.getBean("resourceHandlerMapping", HandlerMapping.class);
final Map<String, Object> oldHandlerMap = (Map<String, Object>)ReflectUtil
.getFieldValue(resourceHandlerMapping, "handlerMap");
// 重新注册映射
final ServletContext servletContext = applicationContext.getBean(ServletContext.class);
final ContentNegotiationManager contentNegotiationManager = applicationContext.getBean("mvcContentNegotiationManager", ContentNegotiationManager.class);
final ContentNegotiationManager contentNegotiationManager = applicationContext
.getBean("mvcContentNegotiationManager", ContentNegotiationManager.class);
final UrlPathHelper urlPathHelper = applicationContext.getBean("mvcUrlPathHelper", UrlPathHelper.class);
final ResourceHandlerRegistry resourceHandlerRegistry = new ResourceHandlerRegistry(applicationContext, servletContext, contentNegotiationManager, urlPathHelper);
for (Map.Entry<String, String> entry : handlerMap.entrySet()) {
@@ -81,7 +86,9 @@ public class SpringUtils {
String resourceLocations = StrUtil.appendIfMissing(entry.getValue(), StringConstants.SLASH);
resourceHandlerRegistry.addResourceHandler(pathPattern).addResourceLocations("file:" + resourceLocations);
}
final Map<String, ?> additionalUrlMap = ReflectUtil.<SimpleUrlHandlerMapping>invoke(resourceHandlerRegistry, "getHandlerMapping").getUrlMap();
final Map<String, ?> additionalUrlMap = ReflectUtil
.<SimpleUrlHandlerMapping>invoke(resourceHandlerRegistry, "getHandlerMapping")
.getUrlMap();
ReflectUtil.<Void>invoke(resourceHandlerMapping, "registerHandlers", additionalUrlMap);
}
}

View File

@@ -56,8 +56,8 @@ public class TemplateUtils {
* @return 渲染后的内容
*/
public static String render(String parentPath, String templatePath, Map<?, ?> bindingMap) {
TemplateEngine engine =
TemplateUtil.createEngine(new TemplateConfig(parentPath, TemplateConfig.ResourceMode.CLASSPATH));
TemplateEngine engine = TemplateUtil
.createEngine(new TemplateConfig(parentPath, TemplateConfig.ResourceMode.CLASSPATH));
Template template = engine.getTemplate(templatePath);
return template.render(bindingMap);
}

View File

@@ -47,8 +47,8 @@ public class CheckUtils extends Validator {
* @param fieldValue 字段值
*/
public static void throwIfNotExists(Object obj, String entityName, String fieldName, Object fieldValue) {
String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue,
StrUtil.replace(entityName, "DO", StringConstants.EMPTY));
String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue, StrUtil
.replace(entityName, "DO", StringConstants.EMPTY));
throwIfNull(obj, message, EXCEPTION_TYPE);
}
@@ -175,7 +175,9 @@ public class CheckUtils extends Validator {
* @param template 异常信息模板,被替换的部分用 {} 表示,如果模板为 null返回 "null"
* @param params 参数值
*/
public static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String template,
public static void throwIfNotEqualIgnoreCase(CharSequence str1,
CharSequence str2,
String template,
Object... params) {
throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE);
}

View File

@@ -147,7 +147,9 @@ public class ValidationUtils extends Validator {
* @param template 异常信息模板,被替换的部分用 {} 表示,如果模板为 null返回 "null"
* @param params 参数值
*/
public static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String template,
public static void throwIfNotEqualIgnoreCase(CharSequence str1,
CharSequence str2,
String template,
Object... params) {
throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE);
}

View File

@@ -86,7 +86,8 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
protected static void throwIfBlank(CharSequence str, String message,
protected static void throwIfBlank(CharSequence str,
String message,
Class<? extends RuntimeException> exceptionType) {
throwIf(StrUtil.isBlank(str), message, exceptionType);
}
@@ -98,7 +99,8 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
protected static void throwIfNotBlank(CharSequence str, String message,
protected static void throwIfNotBlank(CharSequence str,
String message,
Class<? extends RuntimeException> exceptionType) {
throwIf(StrUtil.isNotBlank(str), message, exceptionType);
}
@@ -111,7 +113,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
protected static void throwIfEqual(Object obj1, Object obj2, String message,
protected static void throwIfEqual(Object obj1,
Object obj2,
String message,
Class<? extends RuntimeException> exceptionType) {
throwIf(ObjectUtil.equal(obj1, obj2), message, exceptionType);
}
@@ -124,7 +128,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
protected static void throwIfNotEqual(Object obj1, Object obj2, String message,
protected static void throwIfNotEqual(Object obj1,
Object obj2,
String message,
Class<? extends RuntimeException> exceptionType) {
throwIf(ObjectUtil.notEqual(obj1, obj2), message, exceptionType);
}
@@ -137,7 +143,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
protected static void throwIfEqualIgnoreCase(CharSequence str1, CharSequence str2, String message,
protected static void throwIfEqualIgnoreCase(CharSequence str1,
CharSequence str2,
String message,
Class<? extends RuntimeException> exceptionType) {
throwIf(StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType);
}
@@ -150,7 +158,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
protected static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String message,
protected static void throwIfNotEqualIgnoreCase(CharSequence str1,
CharSequence str2,
String message,
Class<? extends RuntimeException> exceptionType) {
throwIf(!StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType);
}
@@ -176,7 +186,8 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
protected static void throwIf(BooleanSupplier conditionSupplier, String message,
protected static void throwIf(BooleanSupplier conditionSupplier,
String message,
Class<? extends RuntimeException> exceptionType) {
if (null != conditionSupplier && conditionSupplier.getAsBoolean()) {
log.error(message);

View File

@@ -27,7 +27,8 @@ import java.lang.annotation.*;
* @since 1.1.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
@ConditionalOnProperty(prefix = "mybatis-plus.extension.data-permission", name = "enabled", havingValue = "true")
public @interface ConditionalOnEnabledDataPermission {}
public @interface ConditionalOnEnabledDataPermission {
}

View File

@@ -20,7 +20,6 @@ import com.baomidou.mybatisplus.annotation.DbType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* MyBatis Plus 扩展配置属性
*

View File

@@ -39,7 +39,6 @@ import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory;
import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter;
import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionHandlerImpl;
/**
* MyBatis Plus 自动配置
*
@@ -63,9 +62,11 @@ public class MybatisPlusAutoConfiguration {
public MybatisPlusInterceptor mybatisPlusInterceptor(MyBatisPlusExtensionProperties properties) {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 数据权限插件
MyBatisPlusExtensionProperties.DataPermissionProperties dataPermissionProperties = properties.getDataPermission();
MyBatisPlusExtensionProperties.DataPermissionProperties dataPermissionProperties = properties
.getDataPermission();
if (null != dataPermissionProperties && dataPermissionProperties.isEnabled()) {
interceptor.addInnerInterceptor(new DataPermissionInterceptor(SpringUtil.getBean(DataPermissionHandler.class)));
interceptor.addInnerInterceptor(new DataPermissionInterceptor(SpringUtil
.getBean(DataPermissionHandler.class)));
}
// 分页插件
MyBatisPlusExtensionProperties.PaginationProperties paginationProperties = properties.getPagination();
@@ -105,8 +106,8 @@ public class MybatisPlusAutoConfiguration {
private PaginationInnerInterceptor paginationInnerInterceptor(MyBatisPlusExtensionProperties.PaginationProperties paginationProperties) {
// 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
PaginationInnerInterceptor paginationInnerInterceptor = null != paginationProperties.getDbType()
? new PaginationInnerInterceptor(paginationProperties.getDbType())
: new PaginationInnerInterceptor();
? new PaginationInnerInterceptor(paginationProperties.getDbType())
: new PaginationInnerInterceptor();
paginationInnerInterceptor.setOverflow(paginationProperties.isOverflow());
paginationInnerInterceptor.setMaxLimit(paginationProperties.getMaxLimit());
return paginationInnerInterceptor;

View File

@@ -107,6 +107,6 @@ public interface BaseMapper<T> extends com.baomidou.mybatisplus.core.mapper.Base
* @return 实体类 Class 对象
*/
default Class<T> currentEntityClass() {
return (Class<T>) ClassUtil.getTypeArgument(this.getClass(), 0);
return (Class<T>)ClassUtil.getTypeArgument(this.getClass(), 0);
}
}

View File

@@ -59,14 +59,14 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
@Override
public Expression getSqlSegment(Expression where, String mappedStatementId) {
try {
Class<?> clazz =
Class.forName(mappedStatementId.substring(0, mappedStatementId.lastIndexOf(StringConstants.DOT)));
Class<?> clazz = Class.forName(mappedStatementId.substring(0, mappedStatementId
.lastIndexOf(StringConstants.DOT)));
String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringConstants.DOT) + 1);
Method[] methodArr = clazz.getMethods();
for (Method method : methodArr) {
DataPermission dataPermission = method.getAnnotation(DataPermission.class);
if (null != dataPermission
&& (method.getName().equals(methodName) || (method.getName() + "_COUNT").equals(methodName))) {
if (null != dataPermission && (method.getName().equals(methodName) || (method.getName() + "_COUNT")
.equals(methodName))) {
if (dataPermissionFilter.isFilter()) {
return buildDataScopeFilter(dataPermission, where);
}
@@ -81,10 +81,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
/**
* 构建数据范围过滤条件
*
* @param dataPermission
* 数据权限
* @param where
* 当前查询条件
* @param dataPermission 数据权限
* @param where 当前查询条件
* @return 构建后查询条件
*/
private Expression buildDataScopeFilter(DataPermission dataPermission, Expression where) {
@@ -112,7 +110,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
equalsTo.setRightExpression(new LongValue(currentUser.getDeptId()));
Function function = new Function();
function.setName("find_in_set");
function.setParameters(new ExpressionList(new LongValue(currentUser.getDeptId()), new Column("ancestors")));
function.setParameters(new ExpressionList(new LongValue(currentUser
.getDeptId()), new Column("ancestors")));
select.setWhere(new OrExpression(equalsTo, function));
subSelect.setSelectBody(select);
// 构建父查询
@@ -158,10 +157,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
/**
* 构建 Column
*
* @param tableAlias
* 表别名
* @param columnName
* 字段名称
* @param tableAlias 表别名
* @param columnName 字段名称
* @return 带表别名字段
*/
private Column buildColumn(String tableAlias, String columnName) {

View File

@@ -90,8 +90,8 @@ public class QueryHelper {
// 解析查询条件
parse(queryAnnotation, field.getName(), fieldValue, queryWrapper);
} catch (BadRequestException e) {
log.error("Build query occurred an validation error: {}. Query: {}, Field: {}.", e.getMessage(), query,
field, e);
log.error("Build query occurred an validation error: {}. Query: {}, Field: {}.", e
.getMessage(), query, field, e);
throw e;
} catch (Exception e) {
log.error("Build query occurred an error: {}. Query: {}, Field: {}.", e.getMessage(), query, field, e);
@@ -109,7 +109,9 @@ public class QueryHelper {
* @param queryWrapper MyBatis Plus 查询条件封装对象
* @param <R> 查询数据类型
*/
private static <R> void parse(Query queryAnnotation, String fieldName, Object fieldValue,
private static <R> void parse(Query queryAnnotation,
String fieldName,
Object fieldValue,
QueryWrapper<R> queryWrapper) {
// 解析多属性模糊查询
// 如果设置了多属性模糊查询,分割属性进行条件拼接
@@ -137,7 +139,7 @@ public class QueryHelper {
case GREATER_THAN_OR_EQUAL -> queryWrapper.ge(columnName, fieldValue);
case LESS_THAN_OR_EQUAL -> queryWrapper.le(columnName, fieldValue);
case BETWEEN -> {
List<Object> between = new ArrayList<>((List<Object>) fieldValue);
List<Object> between = new ArrayList<>((List<Object>)fieldValue);
ValidationUtils.throwIf(between.size() != 2, "[{}] 必须是一个范围", fieldName);
queryWrapper.between(columnName, between.get(0), between.get(1));
}
@@ -146,11 +148,11 @@ public class QueryHelper {
case RIGHT_LIKE -> queryWrapper.likeRight(columnName, fieldValue);
case IN -> {
ValidationUtils.throwIfEmpty(fieldValue, "[{}] 不能为空", fieldName);
queryWrapper.in(columnName, (List<Object>) fieldValue);
queryWrapper.in(columnName, (List<Object>)fieldValue);
}
case NOT_IN -> {
ValidationUtils.throwIfEmpty(fieldValue, "[{}] 不能为空", fieldName);
queryWrapper.notIn(columnName, (List<Object>) fieldValue);
queryWrapper.notIn(columnName, (List<Object>)fieldValue);
}
case IS_NULL -> queryWrapper.isNull(columnName);
case IS_NOT_NULL -> queryWrapper.isNotNull(columnName);

View File

@@ -84,8 +84,7 @@ public enum QueryType {
/**
* 非空查询例如WHERE `email` IS NOT NULL
*/
IS_NOT_NULL(14, "IS NOT NULL"),
;
IS_NOT_NULL(14, "IS NOT NULL"),;
private final Integer value;
private final String description;

View File

@@ -50,10 +50,9 @@ public class CrudAutoConfiguration extends DelegatingWebMvcConfiguration {
@Bean
@Primary
@Override
public RequestMappingHandlerMapping requestMappingHandlerMapping(
@Qualifier("mvcContentNegotiationManager") ContentNegotiationManager contentNegotiationManager,
@Qualifier("mvcConversionService") FormattingConversionService conversionService,
@Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider) {
public RequestMappingHandlerMapping requestMappingHandlerMapping(@Qualifier("mvcContentNegotiationManager") ContentNegotiationManager contentNegotiationManager,
@Qualifier("mvcConversionService") FormattingConversionService conversionService,
@Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider) {
return super.requestMappingHandlerMapping(contentNegotiationManager, conversionService, resourceUrlProvider);
}

View File

@@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.time.LocalDateTime;
/**
@@ -34,7 +35,7 @@ import java.time.LocalDateTime;
@EqualsAndHashCode(callSuper = true)
public class BaseDetailResp extends BaseResp {
@Serial
private static final long serialVersionUID = 1L;
/**

View File

@@ -62,8 +62,7 @@ import java.util.List;
* @author Charles7c
* @since 1.0.0
*/
public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO, L, D, Q, C extends BaseReq>
implements BaseService<L, D, Q, C> {
public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO, L, D, Q, C extends BaseReq> implements BaseService<L, D, Q, C> {
@Autowired
protected M baseMapper;
@@ -104,10 +103,10 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
tree.setWeight(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.weightKey())));
if (!isSimple) {
List<Field> fieldList = ReflectUtils.getNonStaticFields(listClass);
fieldList.removeIf(f -> StrUtil.containsAnyIgnoreCase(f.getName(), treeField.value(),
treeField.parentIdKey(), treeField.nameKey(), treeField.weightKey(), treeField.childrenKey()));
fieldList
.forEach(f -> tree.putExtra(f.getName(), ReflectUtil.invoke(node, StrUtil.genGetter(f.getName()))));
fieldList.removeIf(f -> StrUtil.containsAnyIgnoreCase(f.getName(), treeField.value(), treeField
.parentIdKey(), treeField.nameKey(), treeField.weightKey(), treeField.childrenKey()));
fieldList.forEach(f -> tree.putExtra(f.getName(), ReflectUtil.invoke(node, StrUtil.genGetter(f
.getName()))));
}
});
}
@@ -133,7 +132,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
this.sort(queryWrapper, sortQuery);
List<T> entityList = baseMapper.selectList(queryWrapper);
if (entityClass == targetClass) {
return (List<E>) entityList;
return (List<E>)entityList;
}
return BeanUtil.copyToList(entityList, targetClass);
}
@@ -242,7 +241,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
* @return 当前实体类型
*/
protected Class<T> currentEntityClass() {
return (Class<T>) this.typeArguments[1];
return (Class<T>)this.typeArguments[1];
}
/**
@@ -251,7 +250,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
* @return 当前列表信息类型
*/
protected Class<L> currentListClass() {
return (Class<L>) this.typeArguments[2];
return (Class<L>)this.typeArguments[2];
}
/**
@@ -260,6 +259,6 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
* @return 当前详情信息类型
*/
protected Class<D> currentDetailClass() {
return (Class<D>) this.typeArguments[3];
return (Class<D>)this.typeArguments[3];
}
}

View File

@@ -60,7 +60,9 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
return this.getMappingForMethodWrapper(method, handlerType, crudRequestMapping);
}
private RequestMappingInfo getMappingForMethodWrapper(@NonNull Method method, @NonNull Class<?> handlerType, CrudRequestMapping crudRequestMapping) {
private RequestMappingInfo getMappingForMethodWrapper(@NonNull Method method,
@NonNull Class<?> handlerType,
CrudRequestMapping crudRequestMapping) {
RequestMappingInfo info = this.createRequestMappingInfo(method);
if (null != info) {
RequestMappingInfo typeInfo = this.createRequestMappingInfo(handlerType);
@@ -79,8 +81,9 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
private RequestMappingInfo createRequestMappingInfo(AnnotatedElement element) {
RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(element, RequestMapping.class);
RequestCondition<?> condition = (element instanceof Class<?> clazz ?
getCustomTypeCondition(clazz) : getCustomMethodCondition((Method) element));
RequestCondition<?> condition = (element instanceof Class<?> clazz
? getCustomTypeCondition(clazz)
: getCustomMethodCondition((Method)element));
return (requestMapping != null ? createRequestMappingInfo(requestMapping, condition) : null);
}
}

View File

@@ -51,18 +51,18 @@ public class GlobalErrorHandler extends BasicErrorController {
@Resource
private ObjectMapper objectMapper;
public GlobalErrorHandler(ErrorAttributes errorAttributes, ServerProperties serverProperties,
public GlobalErrorHandler(ErrorAttributes errorAttributes,
ServerProperties serverProperties,
List<ErrorViewResolver> errorViewResolvers) {
super(errorAttributes, serverProperties.getError(), errorViewResolvers);
}
@Override
public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> errorAttributeMap =
super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.TEXT_HTML));
String path = (String) errorAttributeMap.get("path");
Map<String, Object> errorAttributeMap = super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.TEXT_HTML));
String path = (String)errorAttributeMap.get("path");
HttpStatus status = super.getStatus(request);
R<Object> result = R.fail(status.value(), (String) errorAttributeMap.get("error"));
R<Object> result = R.fail(status.value(), (String)errorAttributeMap.get("error"));
result.setData(path);
try {
response.setStatus(HttpStatus.OK.value());
@@ -77,11 +77,10 @@ public class GlobalErrorHandler extends BasicErrorController {
@Override
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
Map<String, Object> errorAttributeMap =
super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.ALL));
String path = (String) errorAttributeMap.get("path");
Map<String, Object> errorAttributeMap = super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.ALL));
String path = (String)errorAttributeMap.get("path");
HttpStatus status = super.getStatus(request);
R<Object> result = R.fail(status.value(), (String) errorAttributeMap.get("error"));
R<Object> result = R.fail(status.value(), (String)errorAttributeMap.get("error"));
result.setData(path);
log.error("请求地址 [{}],发生错误,错误信息:{}。", path, JSONUtil.toJsonStr(errorAttributeMap));
return new ResponseEntity<>(BeanUtil.beanToMap(result), HttpStatus.OK);

View File

@@ -68,8 +68,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(ConstraintViolationException.class)
public R constraintViolationException(ConstraintViolationException e, HttpServletRequest request) {
log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e);
String errorMsg =
CollUtil.join(e.getConstraintViolations(), StringConstants.CHINESE_COMMA, ConstraintViolation::getMessage);
String errorMsg = CollUtil.join(e
.getConstraintViolations(), StringConstants.CHINESE_COMMA, ConstraintViolation::getMessage);
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);
}
@@ -79,8 +79,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(BindException.class)
public R handleBindException(BindException e, HttpServletRequest request) {
log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e);
String errorMsg = CollUtil.join(e.getAllErrors(), StringConstants.CHINESE_COMMA,
DefaultMessageSourceResolvable::getDefaultMessage);
String errorMsg = CollUtil.join(e
.getAllErrors(), StringConstants.CHINESE_COMMA, DefaultMessageSourceResolvable::getDefaultMessage);
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);
}
@@ -90,8 +90,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(MethodArgumentNotValidException.class)
public R handleMethodArgumentNotValidException(MethodArgumentNotValidException e, HttpServletRequest request) {
log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e);
String errorMsg = ExceptionUtils
.exToNull(() -> Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage());
String errorMsg = ExceptionUtils.exToNull(() -> Objects.requireNonNull(e.getBindingResult().getFieldError())
.getDefaultMessage());
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);
}
@@ -100,7 +100,7 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
public R handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e,
HttpServletRequest request) {
HttpServletRequest request) {
String errorMsg = StrUtil.format("参数名:[{}],期望参数类型:[{}]", e.getName(), e.getParameter().getParameterType());
log.warn("请求地址 [{}],参数转换失败,{}。", request.getRequestURI(), errorMsg, e);
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);

View File

@@ -62,8 +62,8 @@ public class SortQuery implements Serializable {
// e.g "sort=createTime,desc&sort=name,asc"
for (String s : sort) {
List<String> sortList = StrUtil.splitTrim(s, StringConstants.COMMA);
Sort.Order order =
new Sort.Order(Sort.Direction.valueOf(sortList.get(1).toUpperCase()), sortList.get(0));
Sort.Order order = new Sort.Order(Sort.Direction.valueOf(sortList.get(1).toUpperCase()), sortList
.get(0));
orders.add(order);
}
} else {

View File

@@ -42,8 +42,9 @@ public class TreeUtils {
/**
* 默认字段配置对象(根据前端树结构灵活调整名称)
*/
public static final TreeNodeConfig DEFAULT_CONFIG =
TreeNodeConfig.DEFAULT_CONFIG.setNameKey("title").setIdKey("key").setWeightKey("sort");
public static final TreeNodeConfig DEFAULT_CONFIG = TreeNodeConfig.DEFAULT_CONFIG.setNameKey("title")
.setIdKey("key")
.setWeightKey("sort");
/**
* 树构建
@@ -72,7 +73,7 @@ public class TreeUtils {
if (CollUtil.isEmpty(list)) {
return new ArrayList<>(0);
}
E parentId = (E) ReflectUtil.getFieldValue(list.get(0), treeNodeConfig.getParentIdKey());
E parentId = (E)ReflectUtil.getFieldValue(list.get(0), treeNodeConfig.getParentIdKey());
return TreeUtil.build(list, parentId, treeNodeConfig, nodeParser);
}
@@ -84,8 +85,11 @@ public class TreeUtils {
*/
public static TreeNodeConfig genTreeNodeConfig(TreeField treeField) {
CheckUtils.throwIfNull(treeField, "请添加并配置 @TreeField 树结构信息");
return new TreeNodeConfig().setIdKey(treeField.value()).setParentIdKey(treeField.parentIdKey())
.setNameKey(treeField.nameKey()).setWeightKey(treeField.weightKey()).setChildrenKey(treeField.childrenKey())
.setDeep(treeField.deep() < 0 ? null : treeField.deep());
return new TreeNodeConfig().setIdKey(treeField.value())
.setParentIdKey(treeField.parentIdKey())
.setNameKey(treeField.nameKey())
.setWeightKey(treeField.weightKey())
.setChildrenKey(treeField.childrenKey())
.setDeep(treeField.deep() < 0 ? null : treeField.deep());
}
}

View File

@@ -55,7 +55,8 @@ public class ExcelBigNumberConverter implements Converter<Long> {
* 转换为 Java 数据(读取 Excel
*/
@Override
public Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
public Long convertToJavaData(ReadCellData<?> cellData,
ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return Convert.toLong(cellData.getData());
}
@@ -64,7 +65,8 @@ public class ExcelBigNumberConverter implements Converter<Long> {
* 转换为 Excel 数据(写入 Excel
*/
@Override
public WriteCellData<Object> convertToExcelData(Long value, ExcelContentProperty contentProperty,
public WriteCellData<Object> convertToExcelData(Long value,
ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (null != value) {
String str = Long.toString(value);

View File

@@ -62,19 +62,25 @@ public class ExcelUtils {
* @param clazz 导出数据类型
* @param response 响应对象
*/
public static <T> void export(List<T> list, String fileName, String sheetName, Class<T> clazz,
public static <T> void export(List<T> list,
String fileName,
String sheetName,
Class<T> clazz,
HttpServletResponse response) {
try {
fileName =
String.format("%s_%s.xlsx", fileName, DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN));
fileName = String.format("%s_%s.xlsx", fileName, DateUtil
.format(new Date(), DatePattern.PURE_DATETIME_PATTERN));
fileName = URLUtil.encode(fileName);
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
EasyExcel.write(response.getOutputStream(), clazz).autoCloseStream(false)
// 自动适配宽度
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
// 自动转换大数值
.registerConverter(new ExcelBigNumberConverter()).sheet(sheetName).doWrite(list);
EasyExcel.write(response.getOutputStream(), clazz)
.autoCloseStream(false)
// 自动适配宽度
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
// 自动转换大数值
.registerConverter(new ExcelBigNumberConverter())
.sheet(sheetName)
.doWrite(list);
} catch (Exception e) {
log.error("Export excel occurred an error: {}. fileName: {}.", e.getMessage(), fileName, e);
throw new BaseException("导出 Excel 出现错误");

View File

@@ -84,8 +84,7 @@ public enum Include {
/**
* 响应参数(默认)
*/
RESPONSE_PARAM,
;
RESPONSE_PARAM,;
private static final Set<Include> DEFAULT_INCLUDES;

View File

@@ -16,7 +16,6 @@
package top.charles7c.continew.starter.log.common.model;
import lombok.Data;
import top.charles7c.continew.starter.log.common.enums.Include;

View File

@@ -28,7 +28,8 @@ import java.lang.annotation.*;
* @since 1.1.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
@ConditionalOnProperty(prefix = PropertiesConstants.LOG, name = PropertiesConstants.ENABLED, havingValue = "true")
public @interface ConditionalOnEnabledLog {}
public @interface ConditionalOnEnabledLog {
}

View File

@@ -58,7 +58,8 @@ public class LogFilter extends OncePerRequestFilter implements Ordered {
}
@Override
protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response,
protected void doFilterInternal(@NonNull HttpServletRequest request,
@NonNull HttpServletResponse response,
@NonNull FilterChain filterChain) throws ServletException, IOException {
if (!isRequestValid(request)) {
filterChain.doFilter(request, response);
@@ -103,8 +104,8 @@ public class LogFilter extends OncePerRequestFilter implements Ordered {
*/
private boolean isRequestWrapper(HttpServletRequest request) {
Set<Include> includeSet = logProperties.getInclude();
return !(request instanceof ContentCachingRequestWrapper)
&& (includeSet.contains(Include.REQUEST_BODY) || includeSet.contains(Include.REQUEST_PARAM));
return !(request instanceof ContentCachingRequestWrapper) && (includeSet
.contains(Include.REQUEST_BODY) || includeSet.contains(Include.REQUEST_PARAM));
}
/**
@@ -115,8 +116,8 @@ public class LogFilter extends OncePerRequestFilter implements Ordered {
*/
private boolean isResponseWrapper(HttpServletResponse response) {
Set<Include> includeSet = logProperties.getInclude();
return !(response instanceof ContentCachingResponseWrapper)
&& (includeSet.contains(Include.RESPONSE_BODY) || includeSet.contains(Include.RESPONSE_PARAM));
return !(response instanceof ContentCachingResponseWrapper) && (includeSet
.contains(Include.RESPONSE_BODY) || includeSet.contains(Include.RESPONSE_PARAM));
}
/**
@@ -126,8 +127,8 @@ public class LogFilter extends OncePerRequestFilter implements Ordered {
* @throws IOException /
*/
private void updateResponse(HttpServletResponse response) throws IOException {
ContentCachingResponseWrapper responseWrapper =
WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class);
ContentCachingResponseWrapper responseWrapper = WebUtils
.getNativeResponse(response, ContentCachingResponseWrapper.class);
Objects.requireNonNull(responseWrapper).copyBodyToResponse();
}
}

View File

@@ -54,7 +54,8 @@ public class LogInterceptor implements HandlerInterceptor {
private final TransmittableThreadLocal<LogRecord.Started> timestampTtl = new TransmittableThreadLocal<>();
@Override
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response,
public boolean preHandle(@NonNull HttpServletRequest request,
@NonNull HttpServletResponse response,
@NonNull Object handler) {
Clock timestamp = Clock.systemUTC();
if (this.isRequestRecord(handler, request)) {
@@ -68,8 +69,10 @@ public class LogInterceptor implements HandlerInterceptor {
}
@Override
public void afterCompletion(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response,
@NonNull Object handler, Exception e) {
public void afterCompletion(@NonNull HttpServletRequest request,
@NonNull HttpServletResponse response,
@NonNull Object handler,
Exception e) {
LogRecord.Started startedLogRecord = timestampTtl.get();
if (null == startedLogRecord) {
return;
@@ -77,8 +80,9 @@ public class LogInterceptor implements HandlerInterceptor {
timestampTtl.remove();
Set<Include> includeSet = logProperties.getInclude();
try {
LogRecord finishedLogRecord = startedLogRecord.finish(new RecordableServletHttpResponse(response, response.getStatus()), includeSet);
HandlerMethod handlerMethod = (HandlerMethod) handler;
LogRecord finishedLogRecord = startedLogRecord.finish(new RecordableServletHttpResponse(response, response
.getStatus()), includeSet);
HandlerMethod handlerMethod = (HandlerMethod)handler;
// 记录日志描述
if (includeSet.contains(Include.DESCRIPTION)) {
this.logDescription(finishedLogRecord, handlerMethod);
@@ -89,7 +93,8 @@ public class LogInterceptor implements HandlerInterceptor {
}
if (Boolean.TRUE.equals(logProperties.getIsPrint())) {
LogResponse logResponse = finishedLogRecord.getResponse();
log.info("[{}] {} {} {}ms", request.getMethod(), request.getRequestURI(), logResponse.getStatus(), finishedLogRecord.getTimeTaken().toMillis());
log.info("[{}] {} {} {}ms", request.getMethod(), request.getRequestURI(), logResponse
.getStatus(), finishedLogRecord.getTimeTaken().toMillis());
}
logDao.add(finishedLogRecord);
} catch (Exception ex) {
@@ -131,7 +136,7 @@ public class LogInterceptor implements HandlerInterceptor {
return;
}
Log classLog = handlerMethod.getBeanType().getDeclaredAnnotation(Log.class);
if(null != classLog && StrUtil.isNotBlank(classLog.module())) {
if (null != classLog && StrUtil.isNotBlank(classLog.module())) {
logRecord.setModule(classLog.module());
return;
}

View File

@@ -90,8 +90,8 @@ public final class RecordableServletHttpRequest implements RecordableHttpRequest
public Map<String, Object> getParam() {
String body = this.getBody();
return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body)
? JSONUtil.toBean(body, Map.class)
: Collections.unmodifiableMap(request.getParameterMap());
? JSONUtil.toBean(body, Map.class)
: Collections.unmodifiableMap(request.getParameterMap());
}
private StringBuffer appendQueryString(String queryString) {

View File

@@ -56,7 +56,8 @@ public final class RecordableServletHttpResponse implements RecordableHttpRespon
@Override
public String getBody() {
ContentCachingResponseWrapper wrapper = WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class);
ContentCachingResponseWrapper wrapper = WebUtils
.getNativeResponse(response, ContentCachingResponseWrapper.class);
if (null != wrapper) {
return StrUtil.utf8Str(wrapper.getContentAsByteArray());
}
@@ -66,8 +67,6 @@ public final class RecordableServletHttpResponse implements RecordableHttpRespon
@Override
public Map<String, Object> getParam() {
String body = this.getBody();
return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body)
? JSONUtil.toBean(body, Map.class)
: null;
return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body) ? JSONUtil.toBean(body, Map.class) : null;
}
}

View File

@@ -94,8 +94,10 @@ public class MailUtils {
* @param files 附件列表
* @throws MessagingException /
*/
public static void sendHtml(Collection<String> tos, String subject, String content, File... files)
throws MessagingException {
public static void sendHtml(Collection<String> tos,
String subject,
String content,
File... files) throws MessagingException {
send(tos, null, null, subject, content, true, files);
}
@@ -109,7 +111,10 @@ public class MailUtils {
* @param files 附件列表
* @throws MessagingException /
*/
public static void sendHtml(Collection<String> tos, Collection<String> ccs, String subject, String content,
public static void sendHtml(Collection<String> tos,
Collection<String> ccs,
String subject,
String content,
File... files) throws MessagingException {
send(tos, ccs, null, subject, content, true, files);
}
@@ -125,8 +130,12 @@ public class MailUtils {
* @param files 附件列表
* @throws MessagingException /
*/
public static void sendHtml(Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject,
String content, File... files) throws MessagingException {
public static void sendHtml(Collection<String> tos,
Collection<String> ccs,
Collection<String> bccs,
String subject,
String content,
File... files) throws MessagingException {
send(tos, ccs, bccs, subject, content, true, files);
}
@@ -142,12 +151,17 @@ public class MailUtils {
* @param files 附件列表
* @throws MessagingException /
*/
public static void send(Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject,
String content, boolean isHtml, File... files) throws MessagingException {
public static void send(Collection<String> tos,
Collection<String> ccs,
Collection<String> bccs,
String subject,
String content,
boolean isHtml,
File... files) throws MessagingException {
Assert.isTrue(CollUtil.isEmpty(tos), "请至少指定一名收件人");
MimeMessage mimeMessage = MAIL_SENDER.createMimeMessage();
MimeMessageHelper messageHelper =
new MimeMessageHelper(mimeMessage, true, StandardCharsets.UTF_8.displayName());
MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, true, StandardCharsets.UTF_8
.displayName());
// 设置基本信息
messageHelper.setFrom(SpringUtil.getProperty("spring.mail.username"));

View File

@@ -31,7 +31,6 @@ import top.charles7c.continew.starter.core.constant.StringConstants;
import java.util.Map;
/**
* 本地文件自动配置
*
@@ -59,8 +58,10 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
throw new IllegalArgumentException(String.format("Path pattern [%s] location is null.", pathPattern));
}
registry.addResourceHandler(StrUtil.appendIfMissing(pathPattern, StringConstants.PATH_PATTERN))
.addResourceLocations(!location.startsWith("file:") ? String.format("file:%s", this.format(location)) : this.format(location))
.setCachePeriod(0);
.addResourceLocations(!location.startsWith("file:")
? String.format("file:%s", this.format(location))
: this.format(location))
.setCachePeriod(0);
}
}

View File

@@ -110,8 +110,11 @@
<configuration>
<java>
<removeUnusedImports/>
<eclipse>
<file>.style/p3c-codestyle.xml</file>
</eclipse>
<licenseHeader>
<file>code-style/license-header</file>
<file>.style/license-header</file>
</licenseHeader>
</java>
</configuration>