最新公众号管理平台后端
This commit is contained in:
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/../../../../../:\Research\96.boot\jojuboot\.idea/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
7
.idea/ApifoxUploaderProjectSetting.xml
generated
Normal file
7
.idea/ApifoxUploaderProjectSetting.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ApifoxUploaderProjectSetting">
|
||||||
|
<option name="apifoxAccessToken" value="APS-K6HwysEYZa5MbMv92lHB0YmYGcoTiYie" />
|
||||||
|
<option name="yapiTokens" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/CoolRequestSetting.xml
generated
Normal file
6
.idea/CoolRequestSetting.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CoolRequestSetting">
|
||||||
|
<option name="projectCachePath" value="project-2decf95c-9bb2-4227-a8e7-82b29cadc8a3" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
7
.idea/MarsCodeWorkspaceAppSettings.xml
generated
Normal file
7
.idea/MarsCodeWorkspaceAppSettings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
|
||||||
|
<option name="ckgOperationStatus" value="SUCCESS" />
|
||||||
|
<option name="progress" value="0.9995477" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
52
.idea/compiler.xml
generated
Normal file
52
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<option name="BUILD_PROCESS_HEAP_SIZE" value="2048" />
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
</profile>
|
||||||
|
<profile name="Annotation profile for a-jojuboot" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<processorPath useClasspath="false">
|
||||||
|
<entry name="$PROJECT_DIR$/../../../../JavaUtils/Respositories/org/projectlombok/lombok/1.18.20/lombok-1.18.20.jar" />
|
||||||
|
<entry name="$PROJECT_DIR$/../../../../JavaUtils/Respositories/org/mapstruct/mapstruct-processor/1.4.1.Final/mapstruct-processor-1.4.1.Final.jar" />
|
||||||
|
<entry name="$PROJECT_DIR$/../../../../JavaUtils/Respositories/org/mapstruct/mapstruct/1.4.1.Final/mapstruct-1.4.1.Final.jar" />
|
||||||
|
</processorPath>
|
||||||
|
<module name="joju-spring-boot-starter-biz-pay" />
|
||||||
|
<module name="joju-spring-boot-starter-biz-dict" />
|
||||||
|
<module name="joju-spring-boot-starter-biz-tenant" />
|
||||||
|
<module name="joju-spring-boot-starter-biz-data-permission" />
|
||||||
|
<module name="joju-common" />
|
||||||
|
<module name="joju-spring-boot-starter-protection" />
|
||||||
|
<module name="joju-spring-boot-starter-security" />
|
||||||
|
<module name="joju-spring-boot-starter-biz-sms" />
|
||||||
|
<module name="joju-spring-boot-starter-biz-operatelog" />
|
||||||
|
<module name="joju-spring-boot-starter-file" />
|
||||||
|
<module name="joju-module-system-biz" />
|
||||||
|
<module name="joju-spring-boot-starter-banner" />
|
||||||
|
<module name="joju-module-infra-biz" />
|
||||||
|
<module name="joju-spring-boot-starter-biz-error-code" />
|
||||||
|
<module name="joju-server" />
|
||||||
|
<module name="joju-module-pay-api" />
|
||||||
|
<module name="joju-spring-boot-starter-monitor" />
|
||||||
|
<module name="joju-spring-boot-starter-mq" />
|
||||||
|
<module name="joju-module-infra-api" />
|
||||||
|
<module name="joju-spring-boot-starter-redis" />
|
||||||
|
<module name="joju-spring-boot-starter-web" />
|
||||||
|
<module name="joju-spring-boot-starter-biz-social" />
|
||||||
|
<module name="joju-spring-boot-starter-mybatis" />
|
||||||
|
<module name="joju-module-system-api" />
|
||||||
|
<module name="joju-spring-boot-starter-test" />
|
||||||
|
<module name="joju-spring-boot-starter-job" />
|
||||||
|
<module name="joju-spring-boot-starter-excel" />
|
||||||
|
<module name="joju-module-pay-biz" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
71
.idea/encodings.xml
generated
Normal file
71
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-common/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-common/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-banner/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-banner/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-data-permission/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-data-permission/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-dict/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-dict/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-error-code/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-error-code/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-operatelog/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-operatelog/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-pay/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-pay/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-sms/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-sms/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-social/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-social/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-tenant/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-tenant/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-excel/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-excel/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-file/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-file/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-job/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-job/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-monitor/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-monitor/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-mq/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-mq/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-mybatis/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-mybatis/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-protection/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-protection/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-redis/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-redis/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-security/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-security/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-test/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-test/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-web/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-web/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-framework/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-infra/joju-module-infra-api/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-infra/joju-module-infra-api/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-infra/joju-module-infra-biz/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-infra/joju-module-infra-biz/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-infra/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-infra/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-pay/joju-module-pay-api/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-pay/joju-module-pay-api/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-pay/joju-module-pay-biz/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-pay/joju-module-pay-biz/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-pay/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-pay/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-system/joju-module-system-api/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-system/joju-module-system-api/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-system/joju-module-system-biz/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-system/joju-module-system-biz/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-system/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-module-system/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-server/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/joju-server/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
73
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
73
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="date" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ADDITIONAL_TAGS" value="date" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="MissingJavadoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="PACKAGE_SETTINGS">
|
||||||
|
<Options>
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
</Options>
|
||||||
|
</option>
|
||||||
|
<option name="MODULE_SETTINGS">
|
||||||
|
<Options>
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
</Options>
|
||||||
|
</option>
|
||||||
|
<option name="TOP_LEVEL_CLASS_SETTINGS">
|
||||||
|
<Options>
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
</Options>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_SETTINGS">
|
||||||
|
<Options>
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
</Options>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_SETTINGS">
|
||||||
|
<Options>
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
</Options>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_SETTINGS">
|
||||||
|
<Options>
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
</Options>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
204
.idea/intellij-javadocs-4.0.1.xml
generated
Normal file
204
.idea/intellij-javadocs-4.0.1.xml
generated
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaDocConfiguration">
|
||||||
|
<GENERAL>
|
||||||
|
<MODE>UPDATE</MODE>
|
||||||
|
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
||||||
|
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
||||||
|
<LEVELS>
|
||||||
|
<LEVEL>FIELD</LEVEL>
|
||||||
|
<LEVEL>TYPE</LEVEL>
|
||||||
|
<LEVEL>METHOD</LEVEL>
|
||||||
|
</LEVELS>
|
||||||
|
<VISIBILITIES>
|
||||||
|
<VISIBILITY>PUBLIC</VISIBILITY>
|
||||||
|
<VISIBILITY>PROTECTED</VISIBILITY>
|
||||||
|
<VISIBILITY>DEFAULT</VISIBILITY>
|
||||||
|
</VISIBILITIES>
|
||||||
|
</GENERAL>
|
||||||
|
<TEMPLATES>
|
||||||
|
<CLASSES>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The interface ${name}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if>
|
||||||
|
<#list element.typeParameters as typeParameter>
|
||||||
|
* @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list>
|
||||||
|
*/</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The enum ${name}.\n
|
||||||
|
*/</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The type ${name}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if>
|
||||||
|
<#list element.typeParameters as typeParameter>
|
||||||
|
* @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list>
|
||||||
|
*/</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The type ${name}.\n
|
||||||
|
*/</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
</CLASSES>
|
||||||
|
<CONSTRUCTORS>
|
||||||
|
<CONSTRUCTOR>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* Instantiates a new ${name}.\n
|
||||||
|
<#if element.parameterList.parameters?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.parameterList.parameters as parameter>
|
||||||
|
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list>
|
||||||
|
<#if element.throwsList.referenceElements?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.throwsList.referenceElements as exception>
|
||||||
|
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list>
|
||||||
|
*/</VALUE>
|
||||||
|
</CONSTRUCTOR>
|
||||||
|
</CONSTRUCTORS>
|
||||||
|
<METHODS>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* Gets ${partName}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if>
|
||||||
|
<#list element.typeParameters as typeParameter>
|
||||||
|
* @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list>
|
||||||
|
<#if element.parameterList.parameters?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.parameterList.parameters as parameter>
|
||||||
|
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list>
|
||||||
|
<#if isNotVoid>
|
||||||
|
*\n
|
||||||
|
* @return the ${partName}\n
|
||||||
|
</#if>
|
||||||
|
<#if element.throwsList.referenceElements?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.throwsList.referenceElements as exception>
|
||||||
|
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list>
|
||||||
|
*/</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* Sets ${partName}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if>
|
||||||
|
<#list element.typeParameters as typeParameter>
|
||||||
|
* @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list>
|
||||||
|
<#if element.parameterList.parameters?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.parameterList.parameters as parameter>
|
||||||
|
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list>
|
||||||
|
<#if isNotVoid>
|
||||||
|
*\n
|
||||||
|
* @return the ${partName}\n
|
||||||
|
</#if>
|
||||||
|
<#if element.throwsList.referenceElements?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.throwsList.referenceElements as exception>
|
||||||
|
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list>
|
||||||
|
*/</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The entry point of application.\n
|
||||||
|
|
||||||
|
<#if element.parameterList.parameters?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
* @param ${element.parameterList.parameters[0].name} the input arguments\n
|
||||||
|
<#if element.throwsList.referenceElements?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.throwsList.referenceElements as exception>
|
||||||
|
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list>
|
||||||
|
*/</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if>
|
||||||
|
<#list element.typeParameters as typeParameter>
|
||||||
|
* @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list>
|
||||||
|
<#if element.parameterList.parameters?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.parameterList.parameters as parameter>
|
||||||
|
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list>
|
||||||
|
<#if isNotVoid>
|
||||||
|
*\n
|
||||||
|
* @return the ${return}\n
|
||||||
|
</#if>
|
||||||
|
<#if element.throwsList.referenceElements?has_content>
|
||||||
|
*\n
|
||||||
|
</#if>
|
||||||
|
<#list element.throwsList.referenceElements as exception>
|
||||||
|
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list>
|
||||||
|
*/</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
</METHODS>
|
||||||
|
<FIELDS>
|
||||||
|
<FIELD>
|
||||||
|
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The constant ${element.getName()}.\n
|
||||||
|
*/</VALUE>
|
||||||
|
</FIELD>
|
||||||
|
<FIELD>
|
||||||
|
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
<#if element.parent.isInterface()>
|
||||||
|
* The constant ${element.getName()}.\n
|
||||||
|
<#else>
|
||||||
|
* The ${name}.\n
|
||||||
|
</#if> */</VALUE>
|
||||||
|
</FIELD>
|
||||||
|
<FIELD>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
<#if element.parent.isEnum()>
|
||||||
|
*${name} ${typeName}.\n
|
||||||
|
<#else>
|
||||||
|
* The ${name}.\n
|
||||||
|
</#if>*/</VALUE>
|
||||||
|
</FIELD>
|
||||||
|
</FIELDS>
|
||||||
|
</TEMPLATES>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
30
.idea/jarRepositories.xml
generated
Normal file
30
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://maven.aliyun.com/repository/central" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
43
.idea/misc.xml
generated
Normal file
43
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
|
<file type="web" url="file://$PROJECT_DIR$/joju-server" />
|
||||||
|
</component>
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-module-system/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-banner/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-module-infra/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-web/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-operatelog/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-dict/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-error-code/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-redis/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-mybatis/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-test/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-mq/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-excel/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-file/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-job/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-security/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-protection/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-data-permission/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-pay/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-social/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-tenant/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-biz-sms/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-module-system/joju-module-system-biz/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-module-infra/joju-module-infra-biz/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-server/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-framework/joju-spring-boot-starter-monitor/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/joju-module-pay/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
2
joju-dependencies/joju-dependencies.iml
Normal file
2
joju-dependencies/joju-dependencies.iml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4" />
|
||||||
524
joju-dependencies/pom.xml
Normal file
524
joju-dependencies/pom.xml
Normal file
@@ -0,0 +1,524 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-dependencies</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>基础 bom 文件,管理整个项目的依赖版本</description>
|
||||||
|
<url>https://www.jojubanking.com</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<revision>2.0.0-beta</revision>
|
||||||
|
<!-- 统一依赖管理 -->
|
||||||
|
<spring.boot.version>2.6.10</spring.boot.version>
|
||||||
|
<!-- Web 相关 -->
|
||||||
|
<knife4j.version>3.0.3</knife4j.version>
|
||||||
|
<swagger-annotations.version>1.6.6</swagger-annotations.version>
|
||||||
|
<servlet.versoin>2.5</servlet.versoin>
|
||||||
|
<!-- DB 相关 -->
|
||||||
|
<druid.version>1.2.14</druid.version>
|
||||||
|
<mybatis-plus.version>3.5.2</mybatis-plus.version>
|
||||||
|
<mybatis-plus-generator.version>3.5.2</mybatis-plus-generator.version>
|
||||||
|
<dynamic-datasource.version>3.5.0</dynamic-datasource.version>
|
||||||
|
<redisson.version>3.17.4</redisson.version>
|
||||||
|
<!-- Config 配置中心相关 -->
|
||||||
|
<apollo.version>1.9.2</apollo.version>
|
||||||
|
<!-- 服务保障相关 -->
|
||||||
|
<lock4j.version>2.2.0</lock4j.version>
|
||||||
|
<resilience4j.version>1.7.1</resilience4j.version>
|
||||||
|
<!-- 监控相关 -->
|
||||||
|
<skywalking.version>8.7.0</skywalking.version>
|
||||||
|
<spring-boot-admin.version>2.6.7</spring-boot-admin.version>
|
||||||
|
<opentracing.version>0.31.0</opentracing.version>
|
||||||
|
<!-- Test 测试相关 -->
|
||||||
|
<podam.version>7.2.6.RELEASE</podam.version>
|
||||||
|
<jedis-mock.version>0.1.16</jedis-mock.version>
|
||||||
|
<mockito-inline.version>4.0.0</mockito-inline.version>
|
||||||
|
<!-- Bpm 工作流相关 -->
|
||||||
|
<flowable.version>6.7.0</flowable.version>
|
||||||
|
<!-- 工具类相关 -->
|
||||||
|
<jasypt-spring-boot-starter.version>3.0.4</jasypt-spring-boot-starter.version>
|
||||||
|
<lombok.version>1.18.20</lombok.version>
|
||||||
|
<mapstruct.version>1.4.1.Final</mapstruct.version>
|
||||||
|
<hutool.version>5.7.22</hutool.version>
|
||||||
|
<easyexcel.verion>3.1.1</easyexcel.verion>
|
||||||
|
<velocity.version>2.2</velocity.version>
|
||||||
|
<screw.version>1.0.5</screw.version>
|
||||||
|
<fastjson.version>1.2.83</fastjson.version>
|
||||||
|
<guava.version>30.1.1-jre</guava.version>
|
||||||
|
<guice.version>5.1.0</guice.version>
|
||||||
|
<transmittable-thread-local.version>2.12.2</transmittable-thread-local.version>
|
||||||
|
<commons-net.version>3.8.0</commons-net.version>
|
||||||
|
<jsch.version>0.1.55</jsch.version>
|
||||||
|
<tika-core.version>2.4.1</tika-core.version>
|
||||||
|
<!-- 三方云服务相关 -->
|
||||||
|
<minio.version>8.2.2</minio.version>
|
||||||
|
<aliyun-java-sdk-core.version>4.5.25</aliyun-java-sdk-core.version>
|
||||||
|
<aliyun-java-sdk-dysmsapi.version>2.1.0</aliyun-java-sdk-dysmsapi.version>
|
||||||
|
<tencentcloud-sdk-java.version>3.1.471</tencentcloud-sdk-java.version>
|
||||||
|
<yunpian-java-sdk.version>1.2.7</yunpian-java-sdk.version>
|
||||||
|
<justauth.version>1.4.0</justauth.version>
|
||||||
|
<jimureport.version>1.5.2</jimureport.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 统一依赖管理 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-banner</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-operatelog</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-dict</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-sms</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-pay</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.jojubanking.boot</groupId>-->
|
||||||
|
<!-- <artifactId>joju-spring-boot-starter-biz-weixin</artifactId>-->
|
||||||
|
<!-- <version>${revision}</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-tenant</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-data-permission</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-social</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-biz-error-code</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring 核心 -->
|
||||||
|
<dependency>
|
||||||
|
<!-- 用于生成自定义的 Spring @ConfigurationProperties 配置类的说明文件 -->
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Web 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-web</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-security</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>mapstruct</artifactId>
|
||||||
|
<groupId>org.mapstruct</groupId> <!-- 避免冲突 -->
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-annotations.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- DB 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-mybatis</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>${druid.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>${mybatis-plus.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-generator</artifactId> <!-- 代码生成器,使用它解析表结构 -->
|
||||||
|
<version>${mybatis-plus-generator.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 -->
|
||||||
|
<version>${dynamic-datasource.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-redis</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
<version>${redisson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Config 配置中心相关 -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.jojubanking.boot</groupId>-->
|
||||||
|
<!-- <artifactId>joju-spring-boot-starter-config</artifactId>-->
|
||||||
|
<!-- <version>${revision}</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ctrip.framework.apollo</groupId>
|
||||||
|
<artifactId>apollo-client</artifactId> <!-- 引入 Apollo Client 库,实现内嵌的配置中心 -->
|
||||||
|
<version>${apollo.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Job 定时任务相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-job</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 消息队列相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-mq</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
||||||
|
<version>${lock4j.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.resilience4j</groupId>
|
||||||
|
<artifactId>resilience4j-ratelimiter</artifactId>
|
||||||
|
<version>${resilience4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.resilience4j</groupId>
|
||||||
|
<artifactId>resilience4j-spring-boot2</artifactId>
|
||||||
|
<version>${resilience4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentracing</groupId>
|
||||||
|
<artifactId>opentracing-api</artifactId>
|
||||||
|
<version>${opentracing.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentracing</groupId>
|
||||||
|
<artifactId>opentracing-util</artifactId>
|
||||||
|
<version>${opentracing.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentracing</groupId>
|
||||||
|
<artifactId>opentracing-noop</artifactId>
|
||||||
|
<version>${opentracing.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Test 测试相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-test</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-inline</artifactId>
|
||||||
|
<version>${mockito-inline.version}</version> <!-- 支持 Mockito 的 final 类与 static 方法的 mock -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>asm</artifactId>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.fppt</groupId> <!-- 单元测试,我们采用内嵌的 Redis 数据库 -->
|
||||||
|
<artifactId>jedis-mock</artifactId>
|
||||||
|
<version>${jedis-mock.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>uk.co.jemos.podam</groupId> <!-- 单元测试,随机生成 POJO 类 -->
|
||||||
|
<artifactId>podam</artifactId>
|
||||||
|
<version>${podam.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 工具类相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-common</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.ulisesbocchio</groupId>
|
||||||
|
<artifactId>jasypt-spring-boot-starter</artifactId> <!-- 加解密 -->
|
||||||
|
<version>${jasypt-spring-boot-starter.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-excel</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||||
|
<version>${mapstruct.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-jdk8</artifactId>
|
||||||
|
<version>${mapstruct.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>${mapstruct.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
<version>${easyexcel.verion}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tika</groupId>
|
||||||
|
<artifactId>tika-core</artifactId> <!-- 文件类型的识别 -->
|
||||||
|
<version>${tika-core.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
|
<version>${velocity.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.smallbun.screw</groupId>
|
||||||
|
<artifactId>screw-core</artifactId> <!-- 实现数据库文档 -->
|
||||||
|
<version>${screw.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.freemarker</groupId>
|
||||||
|
<artifactId>freemarker</artifactId> <!-- 移除 Freemarker 依赖,采用 Velocity 作为模板引擎 -->
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId> <!-- 最新版screw-core1.0.5依赖fastjson1.2.73存在漏洞,移除。 -->
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>${guava.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.inject</groupId>
|
||||||
|
<artifactId>guice</artifactId>
|
||||||
|
<version>${guice.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>transmittable-thread-local</artifactId> <!-- 解决 ThreadLocal 父子线程的传值问题 -->
|
||||||
|
<version>${transmittable-thread-local.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-net</groupId>
|
||||||
|
<artifactId>commons-net</artifactId> <!-- 解决 ftp 连接 -->
|
||||||
|
<version>${commons-net.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jcraft</groupId>
|
||||||
|
<artifactId>jsch</artifactId> <!-- 解决 sftp 连接 -->
|
||||||
|
<version>${jsch.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 三方云服务相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-spring-boot-starter-file</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.minio</groupId>
|
||||||
|
<artifactId>minio</artifactId>
|
||||||
|
<version>${minio.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SMS SDK begin -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yunpian.sdk</groupId>
|
||||||
|
<artifactId>yunpian-java-sdk</artifactId>
|
||||||
|
<version>${yunpian-java-sdk.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||||
|
<version>${aliyun-java-sdk-core.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>opentracing-api</artifactId>
|
||||||
|
<groupId>io.opentracing</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>opentracing-util</artifactId>
|
||||||
|
<groupId>io.opentracing</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||||
|
<version>${aliyun-java-sdk-dysmsapi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
|
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||||
|
<version>${tencentcloud-sdk-java.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- SMS SDK end -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xkcoding.justauth</groupId>
|
||||||
|
<artifactId>justauth-spring-boot-starter</artifactId> <!-- 社交登陆(例如说,个人微信、企业微信等等) -->
|
||||||
|
<version>${justauth.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 监控相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.skywalking</groupId>
|
||||||
|
<artifactId>apm-toolkit-trace</artifactId>
|
||||||
|
<version>${skywalking.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.skywalking</groupId>
|
||||||
|
<artifactId>apm-toolkit-logback-1.x</artifactId>
|
||||||
|
<version>${skywalking.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.skywalking</groupId>
|
||||||
|
<artifactId>apm-toolkit-opentracing</artifactId>
|
||||||
|
<version>${skywalking.version}</version>
|
||||||
|
<!-- <exclusions>-->
|
||||||
|
<!-- <exclusion>-->
|
||||||
|
<!-- <artifactId>opentracing-api</artifactId>-->
|
||||||
|
<!-- <groupId>io.opentracing</groupId>-->
|
||||||
|
<!-- </exclusion>-->
|
||||||
|
<!-- <exclusion>-->
|
||||||
|
<!-- <artifactId>opentracing-util</artifactId>-->
|
||||||
|
<!-- <groupId>io.opentracing</groupId>-->
|
||||||
|
<!-- </exclusion>-->
|
||||||
|
<!-- </exclusions>-->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
</project>
|
||||||
2
joju-framework/joju-common/joju-common.iml
Normal file
2
joju-framework/joju-common/joju-common.iml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4" />
|
||||||
154
joju-framework/joju-common/pom.xml
Normal file
154
joju-framework/joju-common/pom.xml
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.jojubanking.boot</groupId>
|
||||||
|
<artifactId>joju-framework</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>joju-common</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>定义基础 pojo 类、枚举、工具类等等</description>
|
||||||
|
<url>https://www.jojubanking.com</url>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring 核心 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-expression</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aop</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.aspectj</groupId>
|
||||||
|
<artifactId>aspectjweaver</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<!-- 用于生成自定义的 Spring @ConfigurationProperties 配置类的说明文件 -->
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Web 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.servlet</groupId>
|
||||||
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,主要是 PageParam 使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 监控相关-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.skywalking</groupId>
|
||||||
|
<artifactId>apm-toolkit-trace</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 工具类相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-httpclient</groupId>
|
||||||
|
<artifactId>commons-httpclient</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-jdk8</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.validation</groupId>
|
||||||
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,主要是 PageParam 使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>transmittable-thread-local</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>dom4j</artifactId>
|
||||||
|
<version>1.7-20060614</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可生成 Int 数组的接口
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public interface IntArrayValuable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int 数组
|
||||||
|
*/
|
||||||
|
int[] array();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.core;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key Value 的键值对
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class KeyValue<K, V> {
|
||||||
|
|
||||||
|
private K key;
|
||||||
|
private V value;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.enums;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.core.IntArrayValuable;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用状态枚举
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum CommonStatusEnum implements IntArrayValuable {
|
||||||
|
|
||||||
|
ENABLE(0, "开启"),
|
||||||
|
DISABLE(1, "关闭");
|
||||||
|
|
||||||
|
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CommonStatusEnum::getStatus).toArray();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态值
|
||||||
|
*/
|
||||||
|
private final Integer status;
|
||||||
|
/**
|
||||||
|
* 状态名
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] array() {
|
||||||
|
return ARRAYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档地址
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DocumentEnum {
|
||||||
|
|
||||||
|
REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档");
|
||||||
|
|
||||||
|
private final String url;
|
||||||
|
private final String memo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.enums;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import com.jojubanking.boot.framework.common.core.IntArrayValuable;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局用户类型枚举
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum UserTypeEnum implements IntArrayValuable {
|
||||||
|
|
||||||
|
MEMBER(1, "会员"), // 面向 c 端,普通用户
|
||||||
|
ADMIN(2, "管理员"); // 面向 b 端,管理后台
|
||||||
|
|
||||||
|
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(UserTypeEnum::getValue).toArray();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final Integer value;
|
||||||
|
/**
|
||||||
|
* 类型名
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static UserTypeEnum valueOf(Integer value) {
|
||||||
|
return ArrayUtil.firstMatch(userType -> userType.getValue().equals(value), UserTypeEnum.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] array() {
|
||||||
|
return ARRAYS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Web 过滤器顺序的枚举类,保证过滤器按照符合我们的预期
|
||||||
|
*
|
||||||
|
* 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 enums 包下
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public interface WebFilterOrderEnum {
|
||||||
|
|
||||||
|
int CORS_FILTER = Integer.MIN_VALUE;
|
||||||
|
|
||||||
|
int TRACE_FILTER = CORS_FILTER + 1;
|
||||||
|
|
||||||
|
int REQUEST_BODY_CACHE_FILTER = Integer.MIN_VALUE + 500;
|
||||||
|
|
||||||
|
// OrderedRequestContextFilter 默认为 -105,用于国际化上下文等等
|
||||||
|
|
||||||
|
int TENANT_CONTEXT_FILTER = - 104; // 需要保证在 ApiAccessLogFilter 前面
|
||||||
|
|
||||||
|
int API_ACCESS_LOG_FILTER = -103; // 需要保证在 RequestBodyCacheFilter 后面
|
||||||
|
|
||||||
|
int XSS_FILTER = -102; // 需要保证在 RequestBodyCacheFilter 后面
|
||||||
|
|
||||||
|
// Spring Security Filter 默认为 -100,可见 org.springframework.boot.autoconfigure.security.SecurityProperties 配置属性类
|
||||||
|
|
||||||
|
int TENANT_SECURITY_FILTER = -99; // 需要保证在 Spring Security 过滤器后面
|
||||||
|
|
||||||
|
int ACTIVITI_FILTER = -98; // 需要保证在 Spring Security 过滤后面
|
||||||
|
|
||||||
|
int FLOWABLE_FILTER = -98; // 需要保证在 Spring Security 过滤后面
|
||||||
|
|
||||||
|
int DEMO_FILTER = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.exception;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
|
import com.jojubanking.boot.framework.common.exception.enums.ServiceErrorCodeRange;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码对象
|
||||||
|
*
|
||||||
|
* 全局错误码,占用 [0, 999], 参见 {@link GlobalErrorCodeConstants}
|
||||||
|
* 业务异常错误码,占用 [1 000 000 000, +∞),参见 {@link ServiceErrorCodeRange}
|
||||||
|
*
|
||||||
|
* TODO 错误码设计成对象的原因,为未来的 i18 国际化做准备
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ErrorCode {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*/
|
||||||
|
private final Integer code;
|
||||||
|
/**
|
||||||
|
* 错误提示
|
||||||
|
*/
|
||||||
|
private final String msg;
|
||||||
|
|
||||||
|
public ErrorCode(Integer code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.exception;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器异常 Exception
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public final class ServerException extends RuntimeException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局错误码
|
||||||
|
*
|
||||||
|
* @see GlobalErrorCodeConstants
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
/**
|
||||||
|
* 错误提示
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空构造方法,避免反序列化问题
|
||||||
|
*/
|
||||||
|
public ServerException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerException(ErrorCode errorCode) {
|
||||||
|
this.code = errorCode.getCode();
|
||||||
|
this.message = errorCode.getMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerException(Integer code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerException setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerException setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.exception;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.exception.enums.ServiceErrorCodeRange;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务逻辑异常 Exception
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public final class ServiceException extends RuntimeException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务错误码
|
||||||
|
*
|
||||||
|
* @see ServiceErrorCodeRange
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
/**
|
||||||
|
* 错误提示
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空构造方法,避免反序列化问题
|
||||||
|
*/
|
||||||
|
public ServiceException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException(ErrorCode errorCode) {
|
||||||
|
this.code = errorCode.getCode();
|
||||||
|
this.message = errorCode.getMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException(Integer code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.exception.enums;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.exception.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局错误码枚举
|
||||||
|
* 0-999 系统异常编码保留
|
||||||
|
*
|
||||||
|
* 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status
|
||||||
|
* 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的
|
||||||
|
* 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public interface GlobalErrorCodeConstants {
|
||||||
|
|
||||||
|
ErrorCode SUCCESS = new ErrorCode(0, "成功");
|
||||||
|
|
||||||
|
// ========== 客户端错误段 ==========
|
||||||
|
|
||||||
|
ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确");
|
||||||
|
ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录");
|
||||||
|
ErrorCode FORBIDDEN = new ErrorCode(403, "没有该操作权限");
|
||||||
|
ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到");
|
||||||
|
ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "请求方法不正确");
|
||||||
|
ErrorCode LOCKED = new ErrorCode(423, "请求失败,请稍后重试"); // 并发请求,不允许
|
||||||
|
ErrorCode TOO_MANY_REQUESTS = new ErrorCode(429, "请求过于频繁,请稍后重试");
|
||||||
|
|
||||||
|
// ========== 服务端错误段 ==========
|
||||||
|
|
||||||
|
ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常");
|
||||||
|
|
||||||
|
// ========== 自定义错误段 ==========
|
||||||
|
ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求,请稍后重试"); // 重复请求
|
||||||
|
ErrorCode DEMO_DENY = new ErrorCode(901, "演示模式,禁止写操作");
|
||||||
|
|
||||||
|
ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为服务端错误,参考 HTTP 5XX 错误码段
|
||||||
|
*
|
||||||
|
* @param code 错误码
|
||||||
|
* @return 是否
|
||||||
|
*/
|
||||||
|
static boolean isServerErrorCode(Integer code) {
|
||||||
|
return code != null
|
||||||
|
&& code >= INTERNAL_SERVER_ERROR.getCode() && code <= INTERNAL_SERVER_ERROR.getCode() + 99;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.exception.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务异常的错误码区间,解决:解决各模块错误码定义,避免重复,在此只声明不做实际使用
|
||||||
|
*
|
||||||
|
* 一共 10 位,分成四段
|
||||||
|
*
|
||||||
|
* 第一段,1 位,类型
|
||||||
|
* 1 - 业务级别异常
|
||||||
|
* x - 预留
|
||||||
|
* 第二段,3 位,系统类型
|
||||||
|
* 001 - 用户系统
|
||||||
|
* 002 - 商品系统
|
||||||
|
* 003 - 订单系统
|
||||||
|
* 004 - 支付系统
|
||||||
|
* 005 - 优惠劵系统
|
||||||
|
* ... - ...
|
||||||
|
* 第三段,3 位,模块
|
||||||
|
* 不限制规则。
|
||||||
|
* 一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子:
|
||||||
|
* 001 - OAuth2 模块
|
||||||
|
* 002 - User 模块
|
||||||
|
* 003 - MobileCode 模块
|
||||||
|
* 第四段,3 位,错误码
|
||||||
|
* 不限制规则。
|
||||||
|
* 一般建议,每个模块自增。
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class ServiceErrorCodeRange {
|
||||||
|
|
||||||
|
// 模块 infra 错误码区间 [1-001-000-000 ~ 1-002-000-000)
|
||||||
|
// 模块 system 错误码区间 [1-002-000-000 ~ 1-003-000-000)
|
||||||
|
// 模块 member 错误码区间 [1-004-000-000 ~ 1-005-000-000)
|
||||||
|
// 模块 pay 错误码区间 [1-007-000-000 ~ 1-008-000-000)
|
||||||
|
// 模块 bpm 错误码区间 [1-009-000-000 ~ 1-010-000-000)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.exception.util;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.exception.ErrorCode;
|
||||||
|
import com.jojubanking.boot.framework.common.exception.ServiceException;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link ServiceException} 工具类
|
||||||
|
*
|
||||||
|
* 目的在于,格式化异常信息提示。
|
||||||
|
* 考虑到 String.format 在参数不正确时会报错,因此使用 {} 作为占位符,并使用 {@link #doFormat(int, String, Object...)} 方法来格式化
|
||||||
|
*
|
||||||
|
* 因为 {@link #MESSAGES} 里面默认是没有异常信息提示的模板的,所以需要使用方自己初始化进去。目前想到的有几种方式:
|
||||||
|
*
|
||||||
|
* 1. 异常提示信息,写在枚举类中,例如说,cn.iocoder.oceans.user.api.constants.ErrorCodeEnum 类 + ServiceExceptionConfiguration
|
||||||
|
* 2. 异常提示信息,写在 .properties 等等配置文件
|
||||||
|
* 3. 异常提示信息,写在 Apollo 等等配置中心中,从而实现可动态刷新
|
||||||
|
* 4. 异常提示信息,存储在 db 等等数据库中,从而实现可动态刷新
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class ServiceExceptionUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码提示模板
|
||||||
|
*/
|
||||||
|
private static final ConcurrentMap<Integer, String> MESSAGES = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public static void putAll(Map<Integer, String> messages) {
|
||||||
|
ServiceExceptionUtil.MESSAGES.putAll(messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void put(Integer code, String message) {
|
||||||
|
ServiceExceptionUtil.MESSAGES.put(code, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void delete(Integer code, String message) {
|
||||||
|
ServiceExceptionUtil.MESSAGES.remove(code, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 和 ServiceException 的集成 ==========
|
||||||
|
|
||||||
|
public static ServiceException exception(ErrorCode errorCode) {
|
||||||
|
String messagePattern = MESSAGES.getOrDefault(errorCode.getCode(), errorCode.getMsg());
|
||||||
|
return exception0(errorCode.getCode(), messagePattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ServiceException exception(ErrorCode errorCode, Object... params) {
|
||||||
|
String messagePattern = MESSAGES.getOrDefault(errorCode.getCode(), errorCode.getMsg());
|
||||||
|
return exception0(errorCode.getCode(), messagePattern, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建指定编号的 ServiceException 的异常
|
||||||
|
*
|
||||||
|
* @param code 编号
|
||||||
|
* @return 异常
|
||||||
|
*/
|
||||||
|
public static ServiceException exception(Integer code) {
|
||||||
|
return exception0(code, MESSAGES.get(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建指定编号的 ServiceException 的异常
|
||||||
|
*
|
||||||
|
* @param code 编号
|
||||||
|
* @param params 消息提示的占位符对应的参数
|
||||||
|
* @return 异常
|
||||||
|
*/
|
||||||
|
public static ServiceException exception(Integer code, Object... params) {
|
||||||
|
return exception0(code, MESSAGES.get(code), params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ServiceException exception0(Integer code, String messagePattern, Object... params) {
|
||||||
|
String message = doFormat(code, messagePattern, params);
|
||||||
|
return new ServiceException(code, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 格式化方法 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将错误编号对应的消息使用 params 进行格式化。
|
||||||
|
*
|
||||||
|
* @param code 错误编号
|
||||||
|
* @param messagePattern 消息模版
|
||||||
|
* @param params 参数
|
||||||
|
* @return 格式化后的提示
|
||||||
|
*/
|
||||||
|
@VisibleForTesting
|
||||||
|
public static String doFormat(int code, String messagePattern, Object... params) {
|
||||||
|
StringBuilder sbuf = new StringBuilder(messagePattern.length() + 50);
|
||||||
|
int i = 0;
|
||||||
|
int j;
|
||||||
|
int l;
|
||||||
|
for (l = 0; l < params.length; l++) {
|
||||||
|
j = messagePattern.indexOf("{}", i);
|
||||||
|
if (j == -1) {
|
||||||
|
log.error("[doFormat][参数过多:错误码({})|错误内容({})|参数({})", code, messagePattern, params);
|
||||||
|
if (i == 0) {
|
||||||
|
return messagePattern;
|
||||||
|
} else {
|
||||||
|
sbuf.append(messagePattern.substring(i));
|
||||||
|
return sbuf.toString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sbuf.append(messagePattern, i, j);
|
||||||
|
sbuf.append(params[l]);
|
||||||
|
i = j + 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (messagePattern.indexOf("{}", i) != -1) {
|
||||||
|
log.error("[doFormat][参数过少:错误码({})|错误内容({})|参数({})", code, messagePattern, params);
|
||||||
|
}
|
||||||
|
sbuf.append(messagePattern.substring(i));
|
||||||
|
return sbuf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* 基础的通用类,和框架无关
|
||||||
|
*
|
||||||
|
* 例如说,CommonResult 为通用返回
|
||||||
|
*/
|
||||||
|
package com.jojubanking.boot.framework.common;
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.pojo;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.exception.ErrorCode;
|
||||||
|
import com.jojubanking.boot.framework.common.exception.ServerException;
|
||||||
|
import com.jojubanking.boot.framework.common.exception.ServiceException;
|
||||||
|
import com.jojubanking.boot.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用返回
|
||||||
|
*
|
||||||
|
* @param <T> 数据泛型
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class CommonResult<T> implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*
|
||||||
|
* @see ErrorCode#getCode()
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
/**
|
||||||
|
* 返回数据
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
/**
|
||||||
|
* 错误提示,用户可阅读
|
||||||
|
*
|
||||||
|
* @see ErrorCode#getMsg() ()
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将传入的 result 对象,转换成另外一个泛型结果的对象
|
||||||
|
*
|
||||||
|
* 因为 A 方法返回的 CommonResult 对象,不满足调用其的 B 方法的返回,所以需要进行转换。
|
||||||
|
*
|
||||||
|
* @param result 传入的 result 对象
|
||||||
|
* @param <T> 返回的泛型
|
||||||
|
* @return 新的 CommonResult 对象
|
||||||
|
*/
|
||||||
|
public static <T> CommonResult<T> error(CommonResult<?> result) {
|
||||||
|
return error(result.getCode(), result.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> CommonResult<T> error(Integer code, String message) {
|
||||||
|
Assert.isTrue(!GlobalErrorCodeConstants.SUCCESS.getCode().equals(code), "code 必须是错误的!");
|
||||||
|
CommonResult<T> result = new CommonResult<>();
|
||||||
|
result.code = code;
|
||||||
|
result.msg = message;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> CommonResult<T> error(ErrorCode errorCode) {
|
||||||
|
return error(errorCode.getCode(), errorCode.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> CommonResult<T> success(T data) {
|
||||||
|
CommonResult<T> result = new CommonResult<>();
|
||||||
|
result.code = GlobalErrorCodeConstants.SUCCESS.getCode();
|
||||||
|
result.data = data;
|
||||||
|
result.msg = "";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSuccess(Integer code) {
|
||||||
|
return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore // 避免 jackson 序列化
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return isSuccess(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore // 避免 jackson 序列化
|
||||||
|
public boolean isError() {
|
||||||
|
return !isSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========= 和 Exception 异常体系集成 =========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常
|
||||||
|
*/
|
||||||
|
public void checkError() throws ServiceException {
|
||||||
|
if (isSuccess()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 服务端异常
|
||||||
|
if (GlobalErrorCodeConstants.isServerErrorCode(code)) {
|
||||||
|
throw new ServerException(code, msg);
|
||||||
|
}
|
||||||
|
// 业务异常
|
||||||
|
throw new ServiceException(code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常
|
||||||
|
* 如果没有,则返回 {@link #data} 数据
|
||||||
|
*/
|
||||||
|
@JsonIgnore // 避免 jackson 序列化
|
||||||
|
public T getCheckedData() {
|
||||||
|
checkError();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> CommonResult<T> error(ServiceException serviceException) {
|
||||||
|
return error(serviceException.getCode(), serviceException.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.pojo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.Max;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ApiModel("分页参数")
|
||||||
|
@Data
|
||||||
|
public class PageParam implements Serializable {
|
||||||
|
|
||||||
|
private static final Integer PAGE_NO = 1;
|
||||||
|
private static final Integer PAGE_SIZE = 10;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "页码,从 1 开始", required = true,example = "1")
|
||||||
|
@NotNull(message = "页码不能为空")
|
||||||
|
@Min(value = 1, message = "页码最小值为 1")
|
||||||
|
private Integer pageNo = PAGE_NO;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "每页条数,最大值为 100", required = true, example = "10")
|
||||||
|
@NotNull(message = "每页条数不能为空")
|
||||||
|
@Min(value = 1, message = "每页条数最小值为 1")
|
||||||
|
@Max(value = 100, message = "每页条数最大值为 100")
|
||||||
|
private Integer pageSize = PAGE_SIZE;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.pojo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("分页结果")
|
||||||
|
@Data
|
||||||
|
public final class PageResult<T> implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据", required = true)
|
||||||
|
private List<T> list;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总量", required = true)
|
||||||
|
private Long total;
|
||||||
|
|
||||||
|
public PageResult() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public PageResult(List<T> list, Long total) {
|
||||||
|
this.list = list;
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PageResult(Long total) {
|
||||||
|
this.list = new ArrayList<>();
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> PageResult<T> empty() {
|
||||||
|
return new PageResult<>(0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> PageResult<T> empty(Long total) {
|
||||||
|
return new PageResult<>(total);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.pojo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序字段 DTO
|
||||||
|
*
|
||||||
|
* 类名加了 ing 的原因是,避免和 ES SortField 重名。
|
||||||
|
*/
|
||||||
|
public class SortingField implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顺序 - 升序
|
||||||
|
*/
|
||||||
|
public static final String ORDER_ASC = "asc";
|
||||||
|
/**
|
||||||
|
* 顺序 - 降序
|
||||||
|
*/
|
||||||
|
public static final String ORDER_DESC = "desc";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段
|
||||||
|
*/
|
||||||
|
private String field;
|
||||||
|
/**
|
||||||
|
* 顺序
|
||||||
|
*/
|
||||||
|
private String order;
|
||||||
|
|
||||||
|
// 空构造方法,解决反序列化
|
||||||
|
public SortingField() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortingField(String field, String order) {
|
||||||
|
this.field = field;
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField() {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortingField setField(String field) {
|
||||||
|
this.field = field;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortingField setOrder(String order) {
|
||||||
|
this.order = order;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.cache;
|
||||||
|
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.cache.CacheLoader;
|
||||||
|
import com.google.common.cache.LoadingCache;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class CacheUtils {
|
||||||
|
|
||||||
|
public static <K, V> LoadingCache<K, V> buildAsyncReloadingCache(Duration duration, CacheLoader<K, V> loader) {
|
||||||
|
return CacheBuilder.newBuilder()
|
||||||
|
// 只阻塞当前数据加载线程,其他线程返回旧值
|
||||||
|
.refreshAfterWrite(duration)
|
||||||
|
// 通过 asyncReloading 实现全异步加载,包括 refreshAfterWrite 被阻塞的加载线程
|
||||||
|
.build(CacheLoader.asyncReloading(loader, Executors.newCachedThreadPool())); // TODO TW:可能要思考下,未来要不要做成可配置
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.collection;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static com.jojubanking.boot.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class ArrayUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 object 和 newElements 合并成一个数组
|
||||||
|
*
|
||||||
|
* @param object 对象
|
||||||
|
* @param newElements 数组
|
||||||
|
* @param <T> 泛型
|
||||||
|
* @return 结果数组
|
||||||
|
*/
|
||||||
|
@SafeVarargs
|
||||||
|
public static <T> Consumer<T>[] append(Consumer<T> object, Consumer<T>... newElements) {
|
||||||
|
if (object == null) {
|
||||||
|
return newElements;
|
||||||
|
}
|
||||||
|
Consumer<T>[] result = ArrayUtil.newArray(Consumer.class, 1 + newElements.length);
|
||||||
|
result[0] = object;
|
||||||
|
System.arraycopy(newElements, 0, result, 1, newElements.length);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, V> V[] toArray(Collection<T> from, Function<T, V> mapper) {
|
||||||
|
return toArray(CollectionUtils.convertList(from, mapper));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T> T[] toArray(Collection<T> from) {
|
||||||
|
if (CollectionUtil.isEmpty(from)) {
|
||||||
|
return (T[]) (new Object[0]);
|
||||||
|
}
|
||||||
|
return ArrayUtil.toArray(from, (Class<T>) CollectionUtil.getElementType(from.iterator()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T get(T[] array, int index) {
|
||||||
|
if (null == array || index >= array.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return array[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.collection;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.BinaryOperator;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class CollectionUtils {
|
||||||
|
|
||||||
|
public static boolean containsAny(Object source, Object... targets) {
|
||||||
|
return Arrays.asList(targets).contains(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAnyEmpty(Collection<?>... collections) {
|
||||||
|
return Arrays.stream(collections).anyMatch(CollectionUtil::isEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> filterList(Collection<T> from, Predicate<T> predicate) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return from.stream().filter(predicate).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, R> List<T> distinct(Collection<T> from, Function<T, R> keyMapper) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return distinct(from, keyMapper, (t1, t2) -> t1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, R> List<T> distinct(Collection<T> from, Function<T, R> keyMapper, BinaryOperator<T> cover) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return new ArrayList<>(convertMap(from, keyMapper, Function.identity(), cover).values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, U> List<U> convertList(Collection<T> from, Function<T, U> func) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, U> List<U> convertList(Collection<T> from, Function<T, U> func, Predicate<T> filter) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return from.stream().filter(filter).map(func).filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, U> Set<U> convertSet(Collection<T> from, Function<T, U> func) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, U> Set<U> convertSet(Collection<T> from, Function<T, U> func, Predicate<T> filter) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
return from.stream().filter(filter).map(func).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K> Map<K, T> convertMap(Collection<T> from, Function<T, K> keyFunc) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return convertMap(from, keyFunc, Function.identity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K> Map<K, T> convertMap(Collection<T> from, Function<T, K> keyFunc, Supplier<? extends Map<K, T>> supplier) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return supplier.get();
|
||||||
|
}
|
||||||
|
return convertMap(from, keyFunc, Function.identity(), supplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return convertMap(from, keyFunc, valueFunc, (v1, v2) -> v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc, BinaryOperator<V> mergeFunction) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return convertMap(from, keyFunc, valueFunc, mergeFunction, HashMap::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc, Supplier<? extends Map<K, V>> supplier) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return supplier.get();
|
||||||
|
}
|
||||||
|
return convertMap(from, keyFunc, valueFunc, (v1, v2) -> v1, supplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K, V> Map<K, V> convertMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K, V>> supplier) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return from.stream().collect(Collectors.toMap(keyFunc, valueFunc, mergeFunction, supplier));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K> Map<K, List<T>> convertMultiMap(Collection<T> from, Function<T, K> keyFunc) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return from.stream().collect(Collectors.groupingBy(keyFunc, Collectors.mapping(t -> t, Collectors.toList())));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K, V> Map<K, List<V>> convertMultiMap(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return from.stream()
|
||||||
|
.collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toList())));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暂时没想好名字,先以 2 结尾噶
|
||||||
|
public static <T, K, V> Map<K, Set<V>> convertMultiMap2(Collection<T> from, Function<T, K> keyFunc, Function<T, V> valueFunc) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return from.stream().collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toSet())));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, K> Map<K, T> convertImmutableMap(Collection<T> from, Function<T, K> keyFunc) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
ImmutableMap.Builder<K, T> builder = ImmutableMap.builder();
|
||||||
|
from.forEach(item -> builder.put(keyFunc.apply(item), item));
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean containsAny(Collection<?> source, Collection<?> candidates) {
|
||||||
|
return org.springframework.util.CollectionUtils.containsAny(source, candidates);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T getFirst(List<T> from) {
|
||||||
|
return !CollectionUtil.isEmpty(from) ? from.get(0) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T findFirst(List<T> from, Predicate<T> predicate) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return from.stream().filter(predicate).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T, V extends Comparable<? super V>> V getMaxValue(List<T> from, Function<T, V> valueFunc) {
|
||||||
|
if (CollUtil.isEmpty(from)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
assert from.size() > 0; // 断言,避免告警
|
||||||
|
T t = from.stream().max(Comparator.comparing(valueFunc)).get();
|
||||||
|
return valueFunc.apply(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> void addIfNotNull(Collection<T> coll, T item) {
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
coll.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Collection<T> singleton(T deptId) {
|
||||||
|
return deptId == null ? Collections.emptyList() : Collections.singleton(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.collection;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.jojubanking.boot.framework.common.core.KeyValue;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class MapUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从哈希表表中,获得 keys 对应的所有 value 数组
|
||||||
|
*
|
||||||
|
* @param multimap 哈希表
|
||||||
|
* @param keys keys
|
||||||
|
* @return value 数组
|
||||||
|
*/
|
||||||
|
public static <K, V> List<V> getList(Multimap<K, V> multimap, Collection<K> keys) {
|
||||||
|
List<V> result = new ArrayList<>();
|
||||||
|
keys.forEach(k -> {
|
||||||
|
Collection<V> values = multimap.get(k);
|
||||||
|
if (CollectionUtil.isEmpty(values)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
result.addAll(values);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从哈希表查找到 key 对应的 value,然后进一步处理
|
||||||
|
* 注意,如果查找到的 value 为 null 时,不进行处理
|
||||||
|
*
|
||||||
|
* @param map 哈希表
|
||||||
|
* @param key key
|
||||||
|
* @param consumer 进一步处理的逻辑
|
||||||
|
*/
|
||||||
|
public static <K, V> void findAndThen(Map<K, V> map, K key, Consumer<V> consumer) {
|
||||||
|
if (CollUtil.isEmpty(map)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
V value = map.get(key);
|
||||||
|
if (value == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
consumer.accept(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <K, V> Map<K, V> convertMap(List<KeyValue<K, V>> keyValues) {
|
||||||
|
Map<K, V> map = Maps.newLinkedHashMapWithExpectedSize(keyValues.size());
|
||||||
|
keyValues.forEach(keyValue -> map.put(keyValue.getKey(), keyValue.getValue()));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.collection;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class SetUtils {
|
||||||
|
|
||||||
|
public static <T> Set<T> asSet(T... objs) {
|
||||||
|
return new HashSet<>(Arrays.asList(objs));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.date;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class DateUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时区 - 默认
|
||||||
|
*/
|
||||||
|
public static final String TIME_ZONE_DEFAULT = "GMT+8";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秒转换成毫秒
|
||||||
|
*/
|
||||||
|
public static final long SECOND_MILLIS = 1000;
|
||||||
|
|
||||||
|
public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
public static Date addTime(Duration duration) {
|
||||||
|
return new Date(System.currentTimeMillis() + duration.toMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isExpired(Date time) {
|
||||||
|
return System.currentTimeMillis() > time.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long diff(Date endTime, Date startTime) {
|
||||||
|
return endTime.getTime() - startTime.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建指定时间
|
||||||
|
*
|
||||||
|
* @param year 年
|
||||||
|
* @param mouth 月
|
||||||
|
* @param day 日
|
||||||
|
* @return 指定时间
|
||||||
|
*/
|
||||||
|
public static Date buildTime(int year, int mouth, int day) {
|
||||||
|
return buildTime(year, mouth, day, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建指定时间
|
||||||
|
*
|
||||||
|
* @param year 年
|
||||||
|
* @param mouth 月
|
||||||
|
* @param day 日
|
||||||
|
* @param hour 小时
|
||||||
|
* @param minute 分钟
|
||||||
|
* @param second 秒
|
||||||
|
* @return 指定时间
|
||||||
|
*/
|
||||||
|
public static Date buildTime(int year, int mouth, int day,
|
||||||
|
int hour, int minute, int second) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.set(Calendar.YEAR, year);
|
||||||
|
calendar.set(Calendar.MONTH, mouth - 1);
|
||||||
|
calendar.set(Calendar.DAY_OF_MONTH, day);
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, hour);
|
||||||
|
calendar.set(Calendar.MINUTE, minute);
|
||||||
|
calendar.set(Calendar.SECOND, second);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 0); // 一般情况下,都是 0 毫秒
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date max(Date a, Date b) {
|
||||||
|
if (a == null) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
if (b == null) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return a.compareTo(b) > 0 ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean beforeNow(Date date) {
|
||||||
|
return date.getTime() < System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean afterNow(Date date) {
|
||||||
|
return date.getTime() >= System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算当期时间相差的日期
|
||||||
|
*
|
||||||
|
* @param field 日历字段.<br/>eg:Calendar.MONTH,Calendar.DAY_OF_MONTH,<br/>Calendar.HOUR_OF_DAY等.
|
||||||
|
* @param amount 相差的数值
|
||||||
|
* @return 计算后的日志
|
||||||
|
*/
|
||||||
|
public static Date addDate(int field, int amount) {
|
||||||
|
return addDate(null, field, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算当期时间相差的日期
|
||||||
|
*
|
||||||
|
* @param date 设置时间
|
||||||
|
* @param field 日历字段 例如说,{@link Calendar#DAY_OF_MONTH} 等
|
||||||
|
* @param amount 相差的数值
|
||||||
|
* @return 计算后的日志
|
||||||
|
*/
|
||||||
|
public static Date addDate(Date date, int field, int amount) {
|
||||||
|
if (amount == 0) {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
if (date != null) {
|
||||||
|
c.setTime(date);
|
||||||
|
}
|
||||||
|
c.add(field, amount);
|
||||||
|
return c.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否今天
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @return 是否
|
||||||
|
*/
|
||||||
|
public static boolean isToday(Date date) {
|
||||||
|
if (date == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return DateUtil.isSameDay(date, new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.http;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import cn.hutool.core.map.TableMap;
|
||||||
|
import cn.hutool.core.net.url.UrlBuilder;
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.util.UriComponents;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class HttpUtils {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static String replaceUrlQuery(String url, String key, String value) {
|
||||||
|
UrlBuilder builder = UrlBuilder.of(url, Charset.defaultCharset());
|
||||||
|
// 先移除
|
||||||
|
TableMap<CharSequence, CharSequence> query = (TableMap<CharSequence, CharSequence>)
|
||||||
|
ReflectUtil.getFieldValue(builder.getQuery(), "query");
|
||||||
|
query.remove(key);
|
||||||
|
// 后添加
|
||||||
|
builder.addQuery(key, value);
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String append(String base, Map<String, ?> query, boolean fragment) {
|
||||||
|
return append(base, query, null, fragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接 URL
|
||||||
|
*
|
||||||
|
* copy from Spring Security OAuth2 的 AuthorizationEndpoint 类的 append 方法
|
||||||
|
*
|
||||||
|
* @param base 基础 URL
|
||||||
|
* @param query 查询参数
|
||||||
|
* @param keys query 的 key,对应的原本的 key 的映射。例如说 query 里有个 key 是 xx,实际它的 key 是 extra_xx,则通过 keys 里添加这个映射
|
||||||
|
* @param fragment URL 的 fragment,即拼接到 # 中
|
||||||
|
* @return 拼接后的 URL
|
||||||
|
*/
|
||||||
|
public static String append(String base, Map<String, ?> query, Map<String, String> keys, boolean fragment) {
|
||||||
|
UriComponentsBuilder template = UriComponentsBuilder.newInstance();
|
||||||
|
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(base);
|
||||||
|
URI redirectUri;
|
||||||
|
try {
|
||||||
|
// assume it's encoded to start with (if it came in over the wire)
|
||||||
|
redirectUri = builder.build(true).toUri();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ... but allow client registrations to contain hard-coded non-encoded values
|
||||||
|
redirectUri = builder.build().toUri();
|
||||||
|
builder = UriComponentsBuilder.fromUri(redirectUri);
|
||||||
|
}
|
||||||
|
template.scheme(redirectUri.getScheme()).port(redirectUri.getPort()).host(redirectUri.getHost())
|
||||||
|
.userInfo(redirectUri.getUserInfo()).path(redirectUri.getPath());
|
||||||
|
|
||||||
|
if (fragment) {
|
||||||
|
StringBuilder values = new StringBuilder();
|
||||||
|
if (redirectUri.getFragment() != null) {
|
||||||
|
String append = redirectUri.getFragment();
|
||||||
|
values.append(append);
|
||||||
|
}
|
||||||
|
for (String key : query.keySet()) {
|
||||||
|
if (values.length() > 0) {
|
||||||
|
values.append("&");
|
||||||
|
}
|
||||||
|
String name = key;
|
||||||
|
if (keys != null && keys.containsKey(key)) {
|
||||||
|
name = keys.get(key);
|
||||||
|
}
|
||||||
|
values.append(name).append("={").append(key).append("}");
|
||||||
|
}
|
||||||
|
if (values.length() > 0) {
|
||||||
|
template.fragment(values.toString());
|
||||||
|
}
|
||||||
|
UriComponents encoded = template.build().expand(query).encode();
|
||||||
|
builder.fragment(encoded.getFragment());
|
||||||
|
} else {
|
||||||
|
for (String key : query.keySet()) {
|
||||||
|
String name = key;
|
||||||
|
if (keys != null && keys.containsKey(key)) {
|
||||||
|
name = keys.get(key);
|
||||||
|
}
|
||||||
|
template.queryParam(name, "{" + key + "}");
|
||||||
|
}
|
||||||
|
template.fragment(redirectUri.getFragment());
|
||||||
|
UriComponents encoded = template.build().expand(query).encode();
|
||||||
|
builder.query(encoded.getQuery());
|
||||||
|
}
|
||||||
|
return builder.build().toUriString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] obtainBasicAuthorization(HttpServletRequest request) {
|
||||||
|
String clientId;
|
||||||
|
String clientSecret;
|
||||||
|
// 先从 Header 中获取
|
||||||
|
String authorization = request.getHeader("Authorization");
|
||||||
|
authorization = StrUtil.subAfter(authorization, "Basic ", true);
|
||||||
|
if (StringUtils.hasText(authorization)) {
|
||||||
|
authorization = Base64.decodeStr(authorization);
|
||||||
|
clientId = StrUtil.subBefore(authorization, ":", false);
|
||||||
|
clientSecret = StrUtil.subAfter(authorization, ":", false);
|
||||||
|
// 再从 Param 中获取
|
||||||
|
} else {
|
||||||
|
clientId = request.getParameter("client_id");
|
||||||
|
clientSecret = request.getParameter("client_secret");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果两者非空,则返回
|
||||||
|
if (StrUtil.isNotEmpty(clientId) && StrUtil.isNotEmpty(clientSecret)) {
|
||||||
|
return new String[]{clientId, clientSecret};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.http;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
|
import com.jojubanking.boot.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
|
import org.apache.commons.httpclient.HttpClient;
|
||||||
|
import org.apache.commons.httpclient.methods.PostMethod;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问远程SOAP Web Service 协议接口
|
||||||
|
*/
|
||||||
|
public class SoapUtil {
|
||||||
|
//外网测试地址
|
||||||
|
// private static String url = "http://222.128.90.115:8010/BtGhYytWebService.asmx";
|
||||||
|
//测试库地址
|
||||||
|
// private static String url = "http://192.168.150.17:8002/BtGhYytWebService.asmx";
|
||||||
|
|
||||||
|
//生成库地址
|
||||||
|
// private static String url = "http://192.168.150.15:8001/BtGhYytWebService.asmx";
|
||||||
|
private static String url = "http://101.132.179.117/webservice/WebService.asmx";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param xml
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String soapMethod(String xml) throws Exception {
|
||||||
|
HttpClient client = new HttpClient();
|
||||||
|
PostMethod method = new PostMethod(url);
|
||||||
|
// 设置请求头头
|
||||||
|
method.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
||||||
|
// 设置请求体
|
||||||
|
method.setRequestBody(xml);
|
||||||
|
// 获取响应状态码
|
||||||
|
int code = client.executeMethod(method);
|
||||||
|
if (code == 200) {
|
||||||
|
return method.getResponseBodyAsString();
|
||||||
|
} else {
|
||||||
|
throw ServiceExceptionUtil.exception(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR);
|
||||||
|
// throw new LogicException("异常,请联系管理员。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务发送请求
|
||||||
|
*
|
||||||
|
* @param xml
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String taskSoapMethod(String xml) throws Exception {
|
||||||
|
HttpClient client = new HttpClient();
|
||||||
|
PostMethod method = new PostMethod(url);
|
||||||
|
// 设置请求头头
|
||||||
|
method.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
||||||
|
// 设置请求体
|
||||||
|
method.setRequestBody(xml);
|
||||||
|
// 获取响应状态码
|
||||||
|
int code = client.executeMethod(method);
|
||||||
|
if (code == 200) {
|
||||||
|
return method.getResponseBodyAsString();
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.io;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileTypeUtil;
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.io.file.FileNameUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class FileUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建临时文件
|
||||||
|
* 该文件会在 JVM 退出时,进行删除
|
||||||
|
*
|
||||||
|
* @param data 文件内容
|
||||||
|
* @return 文件
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public static File createTempFile(String data) {
|
||||||
|
File file = createTempFile();
|
||||||
|
// 写入内容
|
||||||
|
FileUtil.writeUtf8String(data, file);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建临时文件
|
||||||
|
* 该文件会在 JVM 退出时,进行删除
|
||||||
|
*
|
||||||
|
* @param data 文件内容
|
||||||
|
* @return 文件
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public static File createTempFile(byte[] data) {
|
||||||
|
File file = createTempFile();
|
||||||
|
// 写入内容
|
||||||
|
FileUtil.writeBytes(data, file);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建临时文件,无内容
|
||||||
|
* 该文件会在 JVM 退出时,进行删除
|
||||||
|
*
|
||||||
|
* @return 文件
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public static File createTempFile() {
|
||||||
|
// 创建文件,通过 UUID 保证唯一
|
||||||
|
File file = File.createTempFile(IdUtil.simpleUUID(), null);
|
||||||
|
// 标记 JVM 退出时,自动删除
|
||||||
|
file.deleteOnExit();
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成文件路径
|
||||||
|
*
|
||||||
|
* @param content 文件内容
|
||||||
|
* @param originalName 原始文件名
|
||||||
|
* @return path,唯一不可重复
|
||||||
|
*/
|
||||||
|
public static String generatePath(byte[] content, String originalName) {
|
||||||
|
String sha256Hex = DigestUtil.sha256Hex(content);
|
||||||
|
// 情况一:如果存在 name,则优先使用 name 的后缀
|
||||||
|
if (StrUtil.isNotBlank(originalName)) {
|
||||||
|
String extName = FileNameUtil.extName(originalName);
|
||||||
|
return StrUtil.isBlank(extName) ? sha256Hex : sha256Hex + "." + extName;
|
||||||
|
}
|
||||||
|
// 情况二:基于 content 计算
|
||||||
|
return sha256Hex + '.' + FileTypeUtil.getType(new ByteArrayInputStream(content));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.io;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IORuntimeException;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IO 工具类,用于 {@link cn.hutool.core.io.IoUtil} 缺失的方法
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class IoUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从流中读取 UTF8 编码的内容
|
||||||
|
*
|
||||||
|
* @param in 输入流
|
||||||
|
* @param isClose 是否关闭
|
||||||
|
* @return 内容
|
||||||
|
* @throws IORuntimeException IO 异常
|
||||||
|
*/
|
||||||
|
public static String readUtf8(InputStream in, boolean isClose) throws IORuntimeException {
|
||||||
|
return StrUtil.utf8Str(IoUtil.read(in, isClose));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.json;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
@UtilityClass
|
||||||
|
@Slf4j
|
||||||
|
public class JsonUtils {
|
||||||
|
|
||||||
|
private static ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
static {
|
||||||
|
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化 objectMapper 属性
|
||||||
|
* <p>
|
||||||
|
* 通过这样的方式,使用 Spring 创建的 ObjectMapper Bean
|
||||||
|
*
|
||||||
|
* @param objectMapper ObjectMapper 对象
|
||||||
|
*/
|
||||||
|
public static void init(ObjectMapper objectMapper) {
|
||||||
|
JsonUtils.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static String toJsonString(Object object) {
|
||||||
|
return objectMapper.writeValueAsString(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static byte[] toJsonByte(Object object) {
|
||||||
|
return objectMapper.writeValueAsBytes(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static String toJsonPrettyString(Object object) {
|
||||||
|
return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T parseObject(String text, Class<T> clazz) {
|
||||||
|
if (StrUtil.isEmpty(text)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return objectMapper.readValue(text, clazz);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("json parse err,json:{}", text, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串解析成指定类型的对象
|
||||||
|
* 使用 {@link #parseObject(String, Class)} 时,在@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) 的场景下,
|
||||||
|
* 如果 text 没有 class 属性,则会报错。此时,使用这个方法,可以解决。
|
||||||
|
*
|
||||||
|
* @param text 字符串
|
||||||
|
* @param clazz 类型
|
||||||
|
* @return 对象
|
||||||
|
*/
|
||||||
|
public static <T> T parseObject2(String text, Class<T> clazz) {
|
||||||
|
if (StrUtil.isEmpty(text)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSONUtil.toBean(text, clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
|
||||||
|
if (ArrayUtil.isEmpty(bytes)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return objectMapper.readValue(bytes, clazz);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("json parse err,json:{}", bytes, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T parseObject(String text, TypeReference<T> typeReference) {
|
||||||
|
try {
|
||||||
|
return objectMapper.readValue(text, typeReference);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("json parse err,json:{}", text, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> parseArray(String text, Class<T> clazz) {
|
||||||
|
if (StrUtil.isEmpty(text)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return objectMapper.readValue(text, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("json parse err,json:{}", text, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonNode parseTree(String text) {
|
||||||
|
try {
|
||||||
|
return objectMapper.readTree(text);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("json parse err,json:{}", text, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonNode parseTree(byte[] text) {
|
||||||
|
try {
|
||||||
|
return objectMapper.readTree(text);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("json parse err,json:{}", text, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isJson(String text) {
|
||||||
|
return JSONUtil.isTypeJSON(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.monitor;
|
||||||
|
|
||||||
|
import org.apache.skywalking.apm.toolkit.trace.TraceContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链路追踪工具类
|
||||||
|
*
|
||||||
|
* 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 util 包下
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class TracerUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私有化构造方法
|
||||||
|
*/
|
||||||
|
private TracerUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得链路追踪编号,直接返回 SkyWalking 的 TraceId。
|
||||||
|
* 如果不存在的话为空字符串!!!
|
||||||
|
*
|
||||||
|
* @return 链路追踪编号
|
||||||
|
*/
|
||||||
|
public static String getTraceId() {
|
||||||
|
return TraceContext.traceId();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.number;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class NumberUtils {
|
||||||
|
|
||||||
|
public static Long parseLong(String str) {
|
||||||
|
return StrUtil.isNotEmpty(str) ? Long.valueOf(str) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.object;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class ObjectUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制对象,并忽略 Id 编号
|
||||||
|
*
|
||||||
|
* @param object 被复制对象
|
||||||
|
* @param consumer 消费者,可以二次编辑被复制对象
|
||||||
|
* @return 复制后的对象
|
||||||
|
*/
|
||||||
|
public static <T> T cloneIgnoreId(T object, Consumer<T> consumer) {
|
||||||
|
T result = ObjectUtil.clone(object);
|
||||||
|
// 忽略 id 编号
|
||||||
|
Field field = ReflectUtil.getField(object.getClass(), "id");
|
||||||
|
if (field != null) {
|
||||||
|
ReflectUtil.setFieldValue(result, field, null);
|
||||||
|
}
|
||||||
|
// 二次编辑
|
||||||
|
if (result != null) {
|
||||||
|
consumer.accept(result);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends Comparable<T>> T max(T obj1, T obj2) {
|
||||||
|
if (obj1 == null) {
|
||||||
|
return obj2;
|
||||||
|
}
|
||||||
|
if (obj2 == null) {
|
||||||
|
return obj1;
|
||||||
|
}
|
||||||
|
return obj1.compareTo(obj2) > 0 ? obj1 : obj2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T defaultIfNull(T... array) {
|
||||||
|
for (T item : array) {
|
||||||
|
if (item != null) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> boolean equalsAny(T obj, T... array) {
|
||||||
|
return Arrays.asList(array).contains(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.object;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link PageParam} 工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class PageUtils {
|
||||||
|
|
||||||
|
public static int getStart(PageParam pageParam) {
|
||||||
|
return (pageParam.getPageNo() - 1) * pageParam.getPageSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* 对于工具类的选择,优先查找 Hutool 中有没对应的方法
|
||||||
|
* 如果没有,则自己封装对应的工具类,以 Utils 结尾,用于区分
|
||||||
|
*
|
||||||
|
* ps:如果担心 Hutool 存在坑的问题,可以阅读 Hutool 的实现源码,以确保可靠性。并且,可以补充相关的单元测试。
|
||||||
|
*/
|
||||||
|
package com.jojubanking.boot.framework.common.util;
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.servlet;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
|
import com.jojubanking.boot.framework.common.util.json.JsonUtils;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.context.request.RequestAttributes;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class ServletUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回 JSON 字符串
|
||||||
|
*
|
||||||
|
* @param response 响应
|
||||||
|
* @param object 对象,会序列化成 JSON 字符串
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码
|
||||||
|
public static void writeJSON(HttpServletResponse response, Object object) {
|
||||||
|
String content = JsonUtils.toJsonString(object);
|
||||||
|
ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回附件
|
||||||
|
*
|
||||||
|
* @param response 响应
|
||||||
|
* @param filename 文件名
|
||||||
|
* @param content 附件内容
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {
|
||||||
|
// 设置 header 和 contentType
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
// 输出附件
|
||||||
|
IoUtil.write(response.getOutputStream(), false, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param request 请求
|
||||||
|
* @return ua
|
||||||
|
*/
|
||||||
|
public static String getUserAgent(HttpServletRequest request) {
|
||||||
|
String ua = request.getHeader("User-Agent");
|
||||||
|
return ua != null ? ua : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得请求
|
||||||
|
*
|
||||||
|
* @return HttpServletRequest
|
||||||
|
*/
|
||||||
|
public static HttpServletRequest getRequest() {
|
||||||
|
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||||
|
if (!(requestAttributes instanceof ServletRequestAttributes)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ((ServletRequestAttributes) requestAttributes).getRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUserAgent() {
|
||||||
|
HttpServletRequest request = getRequest();
|
||||||
|
if (request == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return getUserAgent(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getClientIP() {
|
||||||
|
HttpServletRequest request = getRequest();
|
||||||
|
if (request == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ServletUtil.getClientIP(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isJsonRequest(ServletRequest request) {
|
||||||
|
return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.spring;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import org.springframework.aop.framework.AdvisedSupport;
|
||||||
|
import org.springframework.aop.framework.AopProxy;
|
||||||
|
import org.springframework.aop.support.AopUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spring AOP 工具类
|
||||||
|
*
|
||||||
|
* 参考波克尔 http://www.bubuko.com/infodetail-3471885.html 实现
|
||||||
|
*/
|
||||||
|
public class SpringAopUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取代理的目标对象
|
||||||
|
*
|
||||||
|
* @param proxy 代理对象
|
||||||
|
* @return 目标对象
|
||||||
|
*/
|
||||||
|
public static Object getTarget(Object proxy) throws Exception {
|
||||||
|
// 不是代理对象
|
||||||
|
if (!AopUtils.isAopProxy(proxy)) {
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
// Jdk 代理
|
||||||
|
if (AopUtils.isJdkDynamicProxy(proxy)) {
|
||||||
|
return getJdkDynamicProxyTargetObject(proxy);
|
||||||
|
}
|
||||||
|
// Cglib 代理
|
||||||
|
return getCglibProxyTargetObject(proxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
|
||||||
|
Object dynamicAdvisedInterceptor = BeanUtil.getFieldValue(proxy, "CGLIB$CALLBACK_0");
|
||||||
|
AdvisedSupport advisedSupport = (AdvisedSupport) BeanUtil.getFieldValue(dynamicAdvisedInterceptor, "advised");
|
||||||
|
return advisedSupport.getTargetSource().getTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
|
||||||
|
AopProxy aopProxy = (AopProxy) BeanUtil.getFieldValue(proxy, "h");
|
||||||
|
AdvisedSupport advisedSupport = (AdvisedSupport) BeanUtil.getFieldValue(aopProxy, "advised");
|
||||||
|
return advisedSupport.getTargetSource().getTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.spring;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||||
|
import org.springframework.core.ParameterNameDiscoverer;
|
||||||
|
import org.springframework.expression.EvaluationContext;
|
||||||
|
import org.springframework.expression.ExpressionParser;
|
||||||
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spring EL 表达式的工具类
|
||||||
|
*
|
||||||
|
* @author mashu
|
||||||
|
*/
|
||||||
|
public class SpringExpressionUtils {
|
||||||
|
|
||||||
|
private static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser();
|
||||||
|
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
|
||||||
|
|
||||||
|
private SpringExpressionUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从切面中,单个解析 EL 表达式的结果
|
||||||
|
*
|
||||||
|
* @param joinPoint 切面点
|
||||||
|
* @param expressionString EL 表达式数组
|
||||||
|
* @return 执行界面
|
||||||
|
*/
|
||||||
|
public static Object parseExpression(ProceedingJoinPoint joinPoint, String expressionString) {
|
||||||
|
Map<String, Object> result = parseExpressions(joinPoint, Collections.singletonList(expressionString));
|
||||||
|
return result.get(expressionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从切面中,批量解析 EL 表达式的结果
|
||||||
|
*
|
||||||
|
* @param joinPoint 切面点
|
||||||
|
* @param expressionStrings EL 表达式数组
|
||||||
|
* @return 结果,key 为表达式,value 为对应值
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> parseExpressions(ProceedingJoinPoint joinPoint, List<String> expressionStrings) {
|
||||||
|
// 如果为空,则不进行解析
|
||||||
|
if (CollUtil.isEmpty(expressionStrings)) {
|
||||||
|
return MapUtil.newHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 第一步,构建解析的上下文 EvaluationContext
|
||||||
|
// 通过 joinPoint 获取被注解方法
|
||||||
|
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
|
||||||
|
Method method = methodSignature.getMethod();
|
||||||
|
// 使用 spring 的 ParameterNameDiscoverer 获取方法形参名数组
|
||||||
|
String[] paramNames = PARAMETER_NAME_DISCOVERER.getParameterNames(method);
|
||||||
|
// Spring 的表达式上下文对象
|
||||||
|
EvaluationContext context = new StandardEvaluationContext();
|
||||||
|
// 给上下文赋值
|
||||||
|
if (ArrayUtil.isNotEmpty(paramNames)) {
|
||||||
|
Object[] args = joinPoint.getArgs();
|
||||||
|
for (int i = 0; i < paramNames.length; i++) {
|
||||||
|
context.setVariable(paramNames[i], args[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 第二步,逐个参数解析
|
||||||
|
Map<String, Object> result = MapUtil.newHashMap(expressionStrings.size(), true);
|
||||||
|
expressionStrings.forEach(key -> {
|
||||||
|
Object value = EXPRESSION_PARSER.parseExpression(key).getValue(context);
|
||||||
|
result.put(key, value);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.string;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class StrUtils {
|
||||||
|
|
||||||
|
public static String maxLength(CharSequence str, int maxLength) {
|
||||||
|
return StrUtil.maxLength(str, maxLength - 3); // -3 的原因,是该方法会补充 ... 恰好
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给定字符串是否以任何一个字符串开始
|
||||||
|
* 给定字符串和数组为空都返回 false
|
||||||
|
*
|
||||||
|
* @param str 给定字符串
|
||||||
|
* @param prefixes 需要检测的开始字符串
|
||||||
|
* @since 3.0.6
|
||||||
|
*/
|
||||||
|
public static boolean startWithAny(String str, Collection<String> prefixes) {
|
||||||
|
if (StrUtil.isEmpty(str) || ArrayUtil.isEmpty(prefixes)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CharSequence suffix : prefixes) {
|
||||||
|
if (StrUtil.startWith(str, suffix, false)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.validation;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintViolation;
|
||||||
|
import javax.validation.ConstraintViolationException;
|
||||||
|
import javax.validation.Validator;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验工具类
|
||||||
|
*
|
||||||
|
* @author TW
|
||||||
|
*/
|
||||||
|
public class ValidationUtils {
|
||||||
|
|
||||||
|
private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
|
||||||
|
|
||||||
|
private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*");
|
||||||
|
|
||||||
|
public static boolean isMobile(String mobile) {
|
||||||
|
if (StrUtil.length(mobile) != 11) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// TODO TW,后面完善手机校验
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isURL(String url) {
|
||||||
|
return StringUtils.hasText(url)
|
||||||
|
&& PATTERN_URL.matcher(url).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isXmlNCName(String str) {
|
||||||
|
return StringUtils.hasText(str)
|
||||||
|
&& PATTERN_XML_NCNAME.matcher(str).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void validate(Validator validator, Object object, Class<?>... groups) {
|
||||||
|
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
|
||||||
|
if (CollUtil.isNotEmpty(constraintViolations)) {
|
||||||
|
throw new ConstraintViolationException(constraintViolations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,283 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.util.xml;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentException;
|
||||||
|
import org.dom4j.DocumentHelper;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class XmlUtil {
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// Reserve8Vo vo = new Reserve8Vo();
|
||||||
|
// System.out.println(getOpAppAppoint(vo));
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省份证的正则表达式^(\d{15}|\d{17}[\dx])$
|
||||||
|
*
|
||||||
|
* @param id 省份证号
|
||||||
|
* @return 生日(yyyy-MM-dd)
|
||||||
|
*/
|
||||||
|
public static String extractYearMonthDayOfIdCard(String id) {
|
||||||
|
String year = null;
|
||||||
|
String month = null;
|
||||||
|
String day = null;
|
||||||
|
//正则匹配身份证号是否是正确的,15位或者17位数字+数字/x/X
|
||||||
|
if (id.matches("^\\d{15}|\\d{17}[\\dxX]$")) {
|
||||||
|
year = id.substring(6, 10);
|
||||||
|
month = id.substring(10, 12);
|
||||||
|
day = id.substring(12, 14);
|
||||||
|
} else {
|
||||||
|
System.out.println("身份证号码不匹配!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return year + "-" + month + "-" + day;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取返回的报文统一处理
|
||||||
|
// public static Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
public static Map<String, Object> parse(String soap) throws DocumentException {
|
||||||
|
//map.clear();
|
||||||
|
String soapWeb = StringEscapeUtils.unescapeXml(soap);
|
||||||
|
soapWeb = soapWeb.replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "");
|
||||||
|
Document doc = DocumentHelper.parseText(soapWeb);// 报文 转成 xml
|
||||||
|
Element root = doc.getRootElement();//获取根元素,准备递归解析这个XML树
|
||||||
|
|
||||||
|
Map<String, Object> map = getCodeNC(root);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 非递归遍历所有的 节点 和 数据
|
||||||
|
public static Map<String, Object> getCodeNC(Element root) {
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
Stack a = null;
|
||||||
|
a = new Stack<>();
|
||||||
|
a.push(root);
|
||||||
|
|
||||||
|
if (root.elements().size() == 0 || root.elements() == null) {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
//top 是栈顶元素
|
||||||
|
Element top = null;
|
||||||
|
while (!a.empty()) {
|
||||||
|
top = (Element) a.peek();
|
||||||
|
a.pop();
|
||||||
|
|
||||||
|
//如果当前跟节点有子节点,找到子节点
|
||||||
|
List<Element> list = top.elements();
|
||||||
|
int size = top.elements().size();
|
||||||
|
|
||||||
|
for (Element e : list) {
|
||||||
|
//遍历每个节点
|
||||||
|
if (e.elements().size() > 0) {
|
||||||
|
//对栈顶元素进行反向遍历,入栈
|
||||||
|
a.push((Element) e);
|
||||||
|
}
|
||||||
|
if (e.elements().size() == 0) {
|
||||||
|
map.put(e.getName(), e.getTextTrim());
|
||||||
|
}//如果为叶子节点,那么直接把名称和值放入map
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // 递归遍历所有的 节点 和 数据
|
||||||
|
// public static Map<String, Object> getCode(Element root) {
|
||||||
|
// // Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
//
|
||||||
|
// if (root.elements() != null) {
|
||||||
|
// List<Element> list = root.elements();//如果当前跟节点有子节点,找到子节点
|
||||||
|
// for (Element e : list) {//遍历每个节点
|
||||||
|
// if (e.elements().size() > 0) {
|
||||||
|
// getCode(e);//当前节点不为空的话,递归遍历子节点;
|
||||||
|
// }
|
||||||
|
// if (e.elements().size() == 0) {
|
||||||
|
// map.put(e.getName(), e.getTextTrim());
|
||||||
|
// }//如果为叶子节点,那么直接把名称和值放入map
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
public static List<Map<String, Object>> getPacsRes(String soap, String name) throws DocumentException {
|
||||||
|
String res1 = name + "Response";
|
||||||
|
String res2 = name + "Result";
|
||||||
|
String soapWeb = org.apache.commons.lang.StringEscapeUtils.unescapeXml(soap);
|
||||||
|
soapWeb = soapWeb.replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "");
|
||||||
|
// 字符串转xml
|
||||||
|
Document doc = DocumentHelper.parseText(soapWeb);
|
||||||
|
|
||||||
|
//获取根节点
|
||||||
|
Element root = doc.getRootElement();
|
||||||
|
Element body = root.element("Body").element(res1).element(res2).element("response");
|
||||||
|
|
||||||
|
Element elresult = body.element("returnresult");
|
||||||
|
Element eldata = body.element("data");
|
||||||
|
|
||||||
|
System.out.println("根节点 为 : " + elresult.element("returncode").getText());
|
||||||
|
|
||||||
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
||||||
|
//判断返回值
|
||||||
|
String soapcode = elresult.element("returncode").getText();
|
||||||
|
if (soapcode.equals("1")) {
|
||||||
|
// 获取Body下的所有子节点
|
||||||
|
|
||||||
|
List<?> bodyChild = eldata.elements();
|
||||||
|
for (Iterator<?> it = bodyChild.iterator(); it.hasNext(); ) {
|
||||||
|
Map<String, Object> soapMap = new HashMap<String, Object>();
|
||||||
|
soapMap.put("returncode", soapcode);
|
||||||
|
|
||||||
|
Element elm1 = (Element) it.next();
|
||||||
|
List<?> responseChild = elm1.elements();
|
||||||
|
for (Iterator<?> it1 = responseChild.iterator(); it1.hasNext(); ) {
|
||||||
|
Element elm2 = (Element) it1.next();
|
||||||
|
soapMap.put(elm2.getName(), elm2.getTextTrim());
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Map<String, Object> soapMap = new HashMap<String, Object>();
|
||||||
|
soapMap.put("returncode", soapcode);
|
||||||
|
soapMap.put("errormsg", elresult.element("errormsg").getText());
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务解析 xml
|
||||||
|
*/
|
||||||
|
public static List<Map<String, String>> getTasks(String soap) throws DocumentException {
|
||||||
|
String soapWeb = StringEscapeUtils.unescapeXml(soap);
|
||||||
|
soapWeb = soapWeb.replace("<?xml version=\"1.0\"?>", "");
|
||||||
|
Document doc = DocumentHelper.parseText(soapWeb); // 字符串转xml
|
||||||
|
Element root = doc.getRootElement();//获取根节点
|
||||||
|
Element body = root.element("Body"); // 获取所需节点
|
||||||
|
Element response = body.element("queryAppRegistRecordsNewResponse");
|
||||||
|
Element result = response.element("queryAppRegistRecordsNewResult");
|
||||||
|
Element Response = result.element("Response");
|
||||||
|
|
||||||
|
String Result_Code = Response.elementTextTrim("Result_Code");
|
||||||
|
|
||||||
|
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||||
|
if (Result_Code.equals("0000")) {
|
||||||
|
Element resultData = Response.element("Result_Data");
|
||||||
|
Element recordList = resultData.element("Record_List");
|
||||||
|
List<Element> elements = recordList.elements();
|
||||||
|
Iterator<Element> iterator = elements.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Element element = iterator.next();
|
||||||
|
Map<String, String> soapMap = new HashMap<String, String>();
|
||||||
|
soapMap.put("Result_Code", "0000");
|
||||||
|
soapMap.put("HIS_ORDER_NO", element.elementTextTrim("HIS_ORDER_NO")); // 交易流水号
|
||||||
|
soapMap.put("REGIST_TYPE", element.elementTextTrim("REGIST_TYPE")); // 预约单状态 1 已退费 0 正常
|
||||||
|
soapMap.put("ALLOWREFUNDFLAG", element.elementTextTrim("ALLOWREFUNDFLAG")); // 允许退号标志 N 不允许 Y 允许
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Map<String, String> soapMap = new HashMap<String, String>();
|
||||||
|
soapMap.put("Result_Code", Result_Code);
|
||||||
|
soapMap.put("Error_Msg", Response.elementTextTrim("Error_Msg"));
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询解析xml
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static List<Map<String, Object>> getDeptQueryXml(String resp1, String resp2, String soap) throws DocumentException {
|
||||||
|
String soapWeb = StringEscapeUtils.unescapeXml(soap);
|
||||||
|
soapWeb = soapWeb.replace("<?xml version=\"1.0\"?>", "");
|
||||||
|
Document doc = DocumentHelper.parseText(soapWeb); // 字符串转xml
|
||||||
|
Element root = doc.getRootElement();//获取根节点
|
||||||
|
Element body = root.element("Body"); // 获取所需节点
|
||||||
|
Element response = body.element(resp1);
|
||||||
|
Element result = response.element(resp2);
|
||||||
|
Element Response = result.element("Response");
|
||||||
|
|
||||||
|
String Result_Code = Response.elementTextTrim("Result_Code");
|
||||||
|
|
||||||
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
||||||
|
if (Result_Code.equals("0000")) {
|
||||||
|
Element resultData = Response.element("Result_Data");
|
||||||
|
Element recordList = resultData.element("Record_List");
|
||||||
|
List<Element> elements = recordList.elements();
|
||||||
|
Iterator<Element> iterator = elements.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Element element = iterator.next();
|
||||||
|
Map<String, Object> soapMap = new HashMap<String, Object>();
|
||||||
|
soapMap.put("Result_Code", "0000");
|
||||||
|
soapMap.put("DEPT_CODE", element.elementTextTrim("DEPT_CODE"));
|
||||||
|
soapMap.put("DEPT_NAME", element.elementTextTrim("DEPT_NAME"));
|
||||||
|
soapMap.put("IS_ONLINE", element.elementTextTrim("IS_ONLINE"));
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Map<String, Object> soapMap = new HashMap<String, Object>();
|
||||||
|
soapMap.put("Result_Code", Result_Code);
|
||||||
|
soapMap.put("Error_Msg", Response.elementTextTrim("Error_Msg"));
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Map<String, Object>> getHidsQueryXml(String resp1, String resp2, String soap) throws DocumentException {
|
||||||
|
String soapWeb = StringEscapeUtils.unescapeXml(soap);
|
||||||
|
soapWeb = soapWeb.replace("<?xml version=\"1.0\"?>", "");
|
||||||
|
Document doc = DocumentHelper.parseText(soapWeb); // 字符串转xml
|
||||||
|
Element root = doc.getRootElement();//获取根节点
|
||||||
|
Element body = root.element("Body"); // 获取所需节点
|
||||||
|
Element response = body.element(resp1);
|
||||||
|
Element result = response.element(resp2);
|
||||||
|
Element Response = result.element("Response");
|
||||||
|
|
||||||
|
String Result_Code = Response.elementTextTrim("Result_Code");
|
||||||
|
|
||||||
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
||||||
|
if (Result_Code.equals("0000")) {
|
||||||
|
Element resultData = Response.element("Result_Data");
|
||||||
|
Element recordList = resultData.element("Record_List");
|
||||||
|
List<Element> elements = recordList.elements();
|
||||||
|
Iterator<Element> iterator = elements.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Element element = iterator.next();
|
||||||
|
Map<String, Object> soapMap = new HashMap<String, Object>();
|
||||||
|
soapMap.put("Result_Code", "0000");
|
||||||
|
soapMap.put("HID", element.elementTextTrim("HID"));
|
||||||
|
soapMap.put("DEPT_CODE", element.elementTextTrim("DEPT_CODE"));
|
||||||
|
soapMap.put("DOCTOR_CODE", element.elementTextTrim("DOCTOR_CODE"));
|
||||||
|
soapMap.put("DOCTOR_NAME", element.elementTextTrim("DOCTOR_NAME"));
|
||||||
|
soapMap.put("CLINIC_DATE", element.elementTextTrim("CLINIC_DATE"));
|
||||||
|
soapMap.put("HB_TIME", element.elementTextTrim("HB_TIME"));
|
||||||
|
soapMap.put("CLINIC_DURATION", element.elementTextTrim("CLINIC_DURATION"));
|
||||||
|
soapMap.put("REGISTERED_FEE", element.elementTextTrim("REGISTERED_FEE"));
|
||||||
|
soapMap.put("PHARMACY_FEE", element.elementTextTrim("PHARMACY_FEE"));
|
||||||
|
soapMap.put("DIAG_FEE", element.elementTextTrim("DIAG_FEE"));
|
||||||
|
soapMap.put("IS_ONLINE", element.elementTextTrim("IS_ONLINE"));
|
||||||
|
soapMap.put("HB_TYPE", element.elementTextTrim("HB_TYPE"));
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Map<String, Object> soapMap = new HashMap<String, Object>();
|
||||||
|
soapMap.put("Result_Code", Result_Code);
|
||||||
|
soapMap.put("Error_Msg", Response.elementTextTrim("Error_Msg"));
|
||||||
|
list.add(soapMap);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.validation;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.core.IntArrayValuable;
|
||||||
|
|
||||||
|
import javax.validation.Constraint;
|
||||||
|
import javax.validation.Payload;
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@Target({
|
||||||
|
ElementType.METHOD,
|
||||||
|
ElementType.FIELD,
|
||||||
|
ElementType.ANNOTATION_TYPE,
|
||||||
|
ElementType.CONSTRUCTOR,
|
||||||
|
ElementType.PARAMETER,
|
||||||
|
ElementType.TYPE_USE
|
||||||
|
})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Constraint(
|
||||||
|
validatedBy = InEnumValidator.class
|
||||||
|
)
|
||||||
|
public @interface InEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 实现 EnumValuable 接口的
|
||||||
|
*/
|
||||||
|
Class<? extends IntArrayValuable> value();
|
||||||
|
|
||||||
|
String message() default "必须在指定范围 {value}";
|
||||||
|
|
||||||
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.validation;
|
||||||
|
|
||||||
|
import com.jojubanking.boot.framework.common.core.IntArrayValuable;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintValidator;
|
||||||
|
import javax.validation.ConstraintValidatorContext;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class InEnumValidator implements ConstraintValidator<InEnum, Integer> {
|
||||||
|
|
||||||
|
private List<Integer> values;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(InEnum annotation) {
|
||||||
|
IntArrayValuable[] values = annotation.value().getEnumConstants();
|
||||||
|
if (values.length == 0) {
|
||||||
|
this.values = Collections.emptyList();
|
||||||
|
} else {
|
||||||
|
this.values = Arrays.stream(values[0].array()).boxed().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||||
|
// 为空时,默认不校验,即认为通过
|
||||||
|
if (value == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 校验通过
|
||||||
|
if (values.contains(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
||||||
|
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||||
|
context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate()
|
||||||
|
.replaceAll("\\{value}", values.toString())).addConstraintViolation(); // 重新添加错误提示语句
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.validation;
|
||||||
|
|
||||||
|
import javax.validation.Constraint;
|
||||||
|
import javax.validation.Payload;
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@Target({
|
||||||
|
ElementType.METHOD,
|
||||||
|
ElementType.FIELD,
|
||||||
|
ElementType.ANNOTATION_TYPE,
|
||||||
|
ElementType.CONSTRUCTOR,
|
||||||
|
ElementType.PARAMETER,
|
||||||
|
ElementType.TYPE_USE
|
||||||
|
})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Constraint(
|
||||||
|
validatedBy = MobileValidator.class
|
||||||
|
)
|
||||||
|
public @interface Mobile {
|
||||||
|
|
||||||
|
String message() default "手机号格式不正确";
|
||||||
|
|
||||||
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.jojubanking.boot.framework.common.validation;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.jojubanking.boot.framework.common.util.validation.ValidationUtils;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintValidator;
|
||||||
|
import javax.validation.ConstraintValidatorContext;
|
||||||
|
|
||||||
|
public class MobileValidator implements ConstraintValidator<Mobile, String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(Mobile annotation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||||
|
// 如果手机号为空,默认不校验,即校验通过
|
||||||
|
if (StrUtil.isEmpty(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 校验手机
|
||||||
|
return ValidationUtils.isMobile(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 使用 Hibernate Validator 实现参数校验
|
||||||
|
*/
|
||||||
|
package com.jojubanking.boot.framework.common.validation;
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user