first commit
This commit is contained in:
commit
492d3de52e
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<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" />
|
||||
<module name="real-name-lineProtector" />
|
||||
<module name="common-security" />
|
||||
<module name="real-name-mw" />
|
||||
<module name="real-name-bmw" />
|
||||
<module name="real-name-oiPlan" />
|
||||
<module name="common-datascope" />
|
||||
<module name="common-log" />
|
||||
<module name="common-redis" />
|
||||
<module name="real-name-auth" />
|
||||
<module name="real-name-wechat" />
|
||||
<module name="common-datasource" />
|
||||
<module name="real-name-app" />
|
||||
<module name="real-name-system" />
|
||||
<module name="api-system" />
|
||||
<module name="common-swagger" />
|
||||
<module name="modules-file" />
|
||||
<module name="gateway" />
|
||||
<module name="common-core" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/api/api-system/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/api/api-system/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/api/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/api/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/auth/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/auth/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-core/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-core/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-datascope/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-datascope/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-datasource/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-datasource/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-log/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-log/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-redis/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-redis/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-security/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-security/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-swagger/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/common-swagger/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/gateway/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/gateway/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/app/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/app/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/bmw/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/bmw/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/file/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/file/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/lineProtector/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/lineProtector/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/mw/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/mw/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/oiPlan/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/oiPlan/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/system/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/system/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/wechat/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/wechat/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>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
</profile>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="public" />
|
||||
<option name="name" value="aliyun nexus" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</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>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="ms-21" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="svn" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"last_opened_file_path": "F:/workspace/idea",
|
||||
"settings.editor.selected.configurable": "com.poratu.idea.plugins.tomcat.setting.TomcatServersConfigurable"
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager" selected="Spring Boot.AuthApplication">
|
||||
<configuration name="AppApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="real-name-app" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.app.AppApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="AuthApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="real-name-auth" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.auth.AuthApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BmwApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||
<module name="real-name-bmw" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.bmw.BmwApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="FileApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="modules-file" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.file.FileApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="GatewayApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="gateway" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.gateway.GatewayApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="LineProtectorApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="real-name-lineProtector" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.lineProtector.LineProtectorApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="MwApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="real-name-mw" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.mw.MwApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="OiPlanApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||
<module name="real-name-oiPlan" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.oiplan.OiPlanApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="SystemApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="real-name-system" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.system.SystemApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="WeChatApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="real-name-wechat" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.wechat.WeChatApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration>C:\Users\86157\AppData\Roaming\Subversion</configuration>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.68" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.68" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="common-core" />
|
||||
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: aspose:aspose-words:15.8.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../common/common-core/lib/aspose-words-15.8.0-jdk16.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: aspose:aspose-slide:19.6">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../common/common-core/lib/aspose-slides-19.6.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: aspose:aspose-cells:8.5.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../common/common-core/lib/aspose-cells-8.5.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:11.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:11.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-loadbalancer:3.1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-loadbalancer:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.19" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.projectreactor.addons:reactor-extra:3.4.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.stoyanr:evictor:1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:transmittable-thread-local:2.13.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.64" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.3.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.3.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:4.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi:4.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:4.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.06" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.6.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-android" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.checkerframework:checker-compat-qual:2.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.8.27" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.itextpdf:itextpdf:5.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.itextpdf:itext-asian:5.2.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.68" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.68" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>api-system</artifactId>
|
||||
|
||||
<description>
|
||||
api-system系统接口模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Common Core-->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.system.api;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import com.bonus.common.core.constant.ServiceNameConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import com.bonus.system.api.factory.RemoteFileFallbackFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 文件服务
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
||||
public interface RemoteFileService
|
||||
{
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<SysFile> upload(HttpServletRequest request);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.bonus.system.api;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.ServiceNameConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.domain.SysLogininfor;
|
||||
import com.bonus.system.api.domain.SysOperLog;
|
||||
import com.bonus.system.api.factory.RemoteLogFallbackFactory;
|
||||
|
||||
/**
|
||||
* 日志服务
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
|
||||
public interface RemoteLogService
|
||||
{
|
||||
/**
|
||||
* 保存系统日志
|
||||
*
|
||||
* @param sysOperLog 日志实体
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/operlog")
|
||||
public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 保存访问记录
|
||||
*
|
||||
* @param sysLogininfor 访问实体
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/logininfor")
|
||||
public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.system.api;
|
||||
|
||||
import com.bonus.system.api.model.Dict;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.ServiceNameConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.factory.RemoteUserFallbackFactory;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||
public interface RemoteUserService
|
||||
{
|
||||
/**
|
||||
* 通过用户名查询用户信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/user/info/{username}")
|
||||
public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/user/register")
|
||||
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* Dict信息
|
||||
*
|
||||
* @param type 类型
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/dicts/getType/{type}")
|
||||
public List<Dict> getDictByType(@PathVariable("type") String type, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
/**
|
||||
* 下拉框专用
|
||||
*/
|
||||
public class SelectBean {
|
||||
/**
|
||||
* 返回值
|
||||
*/
|
||||
private String id;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 传参(自己加)
|
||||
*/
|
||||
private String orgId;
|
||||
private String companyId;
|
||||
private String proId;
|
||||
private String subId;
|
||||
private String roleId;
|
||||
private String proNum;
|
||||
private String proName;
|
||||
private String subContractId;
|
||||
private String subContractName;
|
||||
private String orgName;
|
||||
private String type;
|
||||
private String roleLevel;
|
||||
private String _id;
|
||||
private String parentId;
|
||||
private String level;
|
||||
private String teamId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 部门表 sys_dept
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SysDept extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
/** 父部门ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 部门名称 */
|
||||
private String deptName;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
/** 负责人 */
|
||||
private String leader;
|
||||
|
||||
/** 联系电话 */
|
||||
private String phone;
|
||||
|
||||
/** 邮箱 */
|
||||
private String email;
|
||||
|
||||
/** 部门状态:0正常,1停用 */
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 父部门名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 子部门 */
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getAncestors()
|
||||
{
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
public void setAncestors(String ancestors)
|
||||
{
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
|
||||
@NotBlank(message = "部门名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
||||
public String getDeptName()
|
||||
{
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName)
|
||||
{
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public String getLeader()
|
||||
{
|
||||
return leader;
|
||||
}
|
||||
|
||||
public void setLeader(String leader)
|
||||
{
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
||||
public String getPhone()
|
||||
{
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone)
|
||||
{
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email)
|
||||
{
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public List<SysDept> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysDept> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("deptId", getDeptId())
|
||||
.append("parentId", getParentId())
|
||||
.append("ancestors", getAncestors())
|
||||
.append("deptName", getDeptName())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("leader", getLeader())
|
||||
.append("phone", getPhone())
|
||||
.append("email", getEmail())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.constant.UserConstants;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典数据表 sys_dict_data
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SysDictData extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典编码 */
|
||||
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典排序 */
|
||||
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
|
||||
private Long dictSort;
|
||||
|
||||
/** 字典标签 */
|
||||
@Excel(name = "字典标签")
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
@Excel(name = "字典键值")
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 样式属性(其他样式扩展) */
|
||||
private String cssClass;
|
||||
|
||||
/** 表格字典样式 */
|
||||
private String listClass;
|
||||
|
||||
/** 是否默认(Y是 N否) */
|
||||
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
|
||||
private String isDefault;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
public Long getDictCode()
|
||||
{
|
||||
return dictCode;
|
||||
}
|
||||
|
||||
public void setDictCode(Long dictCode)
|
||||
{
|
||||
this.dictCode = dictCode;
|
||||
}
|
||||
|
||||
public Long getDictSort()
|
||||
{
|
||||
return dictSort;
|
||||
}
|
||||
|
||||
public void setDictSort(Long dictSort)
|
||||
{
|
||||
this.dictSort = dictSort;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
|
||||
public String getDictLabel()
|
||||
{
|
||||
return dictLabel;
|
||||
}
|
||||
|
||||
public void setDictLabel(String dictLabel)
|
||||
{
|
||||
this.dictLabel = dictLabel;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典键值不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
|
||||
public String getDictValue()
|
||||
{
|
||||
return dictValue;
|
||||
}
|
||||
|
||||
public void setDictValue(String dictValue)
|
||||
{
|
||||
this.dictValue = dictValue;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
|
||||
public String getDictType()
|
||||
{
|
||||
return dictType;
|
||||
}
|
||||
|
||||
public void setDictType(String dictType)
|
||||
{
|
||||
this.dictType = dictType;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
|
||||
public String getCssClass()
|
||||
{
|
||||
return cssClass;
|
||||
}
|
||||
|
||||
public void setCssClass(String cssClass)
|
||||
{
|
||||
this.cssClass = cssClass;
|
||||
}
|
||||
|
||||
public String getListClass()
|
||||
{
|
||||
return listClass;
|
||||
}
|
||||
|
||||
public void setListClass(String listClass)
|
||||
{
|
||||
this.listClass = listClass;
|
||||
}
|
||||
|
||||
public boolean getDefault()
|
||||
{
|
||||
return UserConstants.YES.equals(this.isDefault) ? true : false;
|
||||
}
|
||||
|
||||
public String getIsDefault()
|
||||
{
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public void setIsDefault(String isDefault)
|
||||
{
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("dictCode", getDictCode())
|
||||
.append("dictSort", getDictSort())
|
||||
.append("dictLabel", getDictLabel())
|
||||
.append("dictValue", getDictValue())
|
||||
.append("dictType", getDictType())
|
||||
.append("cssClass", getCssClass())
|
||||
.append("listClass", getListClass())
|
||||
.append("isDefault", getIsDefault())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典类型表 sys_dict_type
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SysDictType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典主键 */
|
||||
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
|
||||
private Long dictId;
|
||||
|
||||
/** 字典名称 */
|
||||
@Excel(name = "字典名称")
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
public Long getDictId()
|
||||
{
|
||||
return dictId;
|
||||
}
|
||||
|
||||
public void setDictId(Long dictId)
|
||||
{
|
||||
this.dictId = dictId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典名称不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
|
||||
public String getDictName()
|
||||
{
|
||||
return dictName;
|
||||
}
|
||||
|
||||
public void setDictName(String dictName)
|
||||
{
|
||||
this.dictName = dictName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
|
||||
public String getDictType()
|
||||
{
|
||||
return dictType;
|
||||
}
|
||||
|
||||
public void setDictType(String dictType)
|
||||
{
|
||||
this.dictType = dictType;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("dictId", getDictId())
|
||||
.append("dictName", getDictName())
|
||||
.append("dictType", getDictType())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 文件信息
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SysFile
|
||||
{
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 文件大小KB
|
||||
*/
|
||||
private Integer fileSize = 0;
|
||||
|
||||
/**
|
||||
* 是否上传成功 1:成功 0:失败
|
||||
*/
|
||||
private Integer isSuccess;
|
||||
/**
|
||||
* 压缩文件名称
|
||||
*/
|
||||
private String ysName;
|
||||
|
||||
/**
|
||||
* 压缩文件地址
|
||||
*/
|
||||
private String ysUrl;
|
||||
|
||||
/**
|
||||
* 压缩文件大小KB
|
||||
*/
|
||||
private Integer ysFileSize = 0;
|
||||
private String gtId;
|
||||
private String gtName;
|
||||
|
||||
private String personData;
|
||||
|
||||
private boolean isFace;
|
||||
|
||||
public boolean isFace() {
|
||||
return isFace;
|
||||
}
|
||||
|
||||
public void setFace(boolean face) {
|
||||
isFace = face;
|
||||
}
|
||||
|
||||
public String getPersonData() {
|
||||
return personData;
|
||||
}
|
||||
|
||||
public void setPersonData(String personData) {
|
||||
this.personData = personData;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public Integer getFileSize()
|
||||
{
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Integer fileSize)
|
||||
{
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
public Integer getIsSuccess() {
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
public void setIsSuccess(Integer isSuccess) {
|
||||
this.isSuccess = isSuccess;
|
||||
}
|
||||
|
||||
public String getYsName() {
|
||||
return ysName;
|
||||
}
|
||||
|
||||
public void setYsName(String ysName) {
|
||||
this.ysName = ysName;
|
||||
}
|
||||
|
||||
public String getYsUrl() {
|
||||
return ysUrl;
|
||||
}
|
||||
|
||||
public void setYsUrl(String ysUrl) {
|
||||
this.ysUrl = ysUrl;
|
||||
}
|
||||
|
||||
public Integer getYsFileSize() {
|
||||
return ysFileSize;
|
||||
}
|
||||
|
||||
public void setYsFileSize(Integer ysFileSize) {
|
||||
this.ysFileSize = ysFileSize;
|
||||
}
|
||||
|
||||
public String getGtId() {
|
||||
return gtId;
|
||||
}
|
||||
|
||||
public void setGtId(String gtId) {
|
||||
this.gtId = gtId;
|
||||
}
|
||||
|
||||
public String getGtName() {
|
||||
return gtName;
|
||||
}
|
||||
|
||||
public void setGtName(String gtName) {
|
||||
this.gtName = gtName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("name", getName())
|
||||
.append("url", getUrl())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 系统访问记录表 sys_logininfor
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SysLogininfor extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
@Excel(name = "序号", cellType = ColumnType.NUMERIC)
|
||||
private Long infoId;
|
||||
|
||||
/** 用户账号 */
|
||||
@Excel(name = "用户账号")
|
||||
private String userName;
|
||||
|
||||
/** 状态 0成功 1失败 */
|
||||
@Excel(name = "状态", readConverterExp = "0=成功,1=失败")
|
||||
private String status;
|
||||
|
||||
/** 地址 */
|
||||
@Excel(name = "地址")
|
||||
private String ipaddr;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String msg;
|
||||
|
||||
/** 访问时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date accessTime;
|
||||
|
||||
public Long getInfoId()
|
||||
{
|
||||
return infoId;
|
||||
}
|
||||
|
||||
public void setInfoId(Long infoId)
|
||||
{
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getIpaddr()
|
||||
{
|
||||
return ipaddr;
|
||||
}
|
||||
|
||||
public void setIpaddr(String ipaddr)
|
||||
{
|
||||
this.ipaddr = ipaddr;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Date getAccessTime()
|
||||
{
|
||||
return accessTime;
|
||||
}
|
||||
|
||||
public void setAccessTime(Date accessTime)
|
||||
{
|
||||
this.accessTime = accessTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 操作日志记录表 oper_log
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Data
|
||||
public class SysOperLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 日志主键 */
|
||||
@Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
|
||||
private Long operId;
|
||||
|
||||
/** 用户编号 */
|
||||
private String userId;
|
||||
|
||||
/** 操作模块 */
|
||||
@Excel(name = "操作模块")
|
||||
private String title;
|
||||
|
||||
/** 业务类型(0其它 1新增 2修改 3删除) */
|
||||
@Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
|
||||
private Integer businessType;
|
||||
|
||||
/** 业务类型数组 */
|
||||
private Integer[] businessTypes;
|
||||
|
||||
/** 请求方法 */
|
||||
@Excel(name = "请求方法")
|
||||
private String method;
|
||||
|
||||
/** 请求方式 */
|
||||
@Excel(name = "请求方式")
|
||||
private String requestMethod;
|
||||
|
||||
/** 操作类别(0其它 1后台用户 2手机端用户) */
|
||||
@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
|
||||
private Integer operatorType;
|
||||
|
||||
/** 操作人员 */
|
||||
@Excel(name = "操作人员")
|
||||
private String operName;
|
||||
|
||||
/** 部门名称 */
|
||||
@Excel(name = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
/** 请求url */
|
||||
@Excel(name = "请求地址")
|
||||
private String operUrl;
|
||||
|
||||
/** 操作地址 */
|
||||
@Excel(name = "操作地址")
|
||||
private String operIp;
|
||||
|
||||
/** 请求参数 */
|
||||
@Excel(name = "请求参数")
|
||||
private String operParam;
|
||||
|
||||
/** 返回参数 */
|
||||
@Excel(name = "返回参数")
|
||||
private String jsonResult;
|
||||
|
||||
/** 操作状态(0正常 1异常) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=异常")
|
||||
private Integer status;
|
||||
|
||||
/** 错误消息 */
|
||||
@Excel(name = "错误消息")
|
||||
private String errorMsg;
|
||||
|
||||
/** 操作时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date operTime;
|
||||
|
||||
//新增的一些字段 fly
|
||||
/** 电话 */
|
||||
private String opersTime;
|
||||
|
||||
/** 电话 */
|
||||
private String phone;
|
||||
|
||||
private String type;
|
||||
|
||||
private String operatoType;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 角色表 sys_role
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SysRole extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 角色ID */
|
||||
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
|
||||
private Long roleId;
|
||||
|
||||
/** 角色名称 */
|
||||
@Excel(name = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/** 角色权限 */
|
||||
@Excel(name = "角色权限")
|
||||
private String roleKey;
|
||||
|
||||
/** 角色排序 */
|
||||
@Excel(name = "角色排序")
|
||||
private String roleSort;
|
||||
|
||||
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
|
||||
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
||||
private String dataScope;
|
||||
|
||||
/** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
|
||||
private boolean menuCheckStrictly;
|
||||
|
||||
/** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
|
||||
private boolean deptCheckStrictly;
|
||||
|
||||
/** 角色状态(0正常 1停用) */
|
||||
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 用户是否存在此角色标识 默认不存在 */
|
||||
private boolean flag = false;
|
||||
|
||||
/** 菜单组 */
|
||||
private Long[] menuIds;
|
||||
|
||||
/** 部门组(数据权限) */
|
||||
private Long[] deptIds;
|
||||
|
||||
public SysRole()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SysRole(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return isAdmin(this.roleId);
|
||||
}
|
||||
|
||||
public static boolean isAdmin(Long roleId)
|
||||
{
|
||||
return roleId != null && 1L == roleId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
||||
public String getRoleName()
|
||||
{
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName)
|
||||
{
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "权限字符不能为空")
|
||||
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
|
||||
public String getRoleKey()
|
||||
{
|
||||
return roleKey;
|
||||
}
|
||||
|
||||
public void setRoleKey(String roleKey)
|
||||
{
|
||||
this.roleKey = roleKey;
|
||||
}
|
||||
|
||||
@NotBlank(message = "显示顺序不能为空")
|
||||
public String getRoleSort()
|
||||
{
|
||||
return roleSort;
|
||||
}
|
||||
|
||||
public void setRoleSort(String roleSort)
|
||||
{
|
||||
this.roleSort = roleSort;
|
||||
}
|
||||
|
||||
public String getDataScope()
|
||||
{
|
||||
return dataScope;
|
||||
}
|
||||
|
||||
public void setDataScope(String dataScope)
|
||||
{
|
||||
this.dataScope = dataScope;
|
||||
}
|
||||
|
||||
public boolean isMenuCheckStrictly()
|
||||
{
|
||||
return menuCheckStrictly;
|
||||
}
|
||||
|
||||
public void setMenuCheckStrictly(boolean menuCheckStrictly)
|
||||
{
|
||||
this.menuCheckStrictly = menuCheckStrictly;
|
||||
}
|
||||
|
||||
public boolean isDeptCheckStrictly()
|
||||
{
|
||||
return deptCheckStrictly;
|
||||
}
|
||||
|
||||
public void setDeptCheckStrictly(boolean deptCheckStrictly)
|
||||
{
|
||||
this.deptCheckStrictly = deptCheckStrictly;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public boolean isFlag()
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(boolean flag)
|
||||
{
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public Long[] getMenuIds()
|
||||
{
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
public void setMenuIds(Long[] menuIds)
|
||||
{
|
||||
this.menuIds = menuIds;
|
||||
}
|
||||
|
||||
public Long[] getDeptIds()
|
||||
{
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
public void setDeptIds(Long[] deptIds)
|
||||
{
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("roleId", getRoleId())
|
||||
.append("roleName", getRoleName())
|
||||
.append("roleKey", getRoleKey())
|
||||
.append("roleSort", getRoleSort())
|
||||
.append("dataScope", getDataScope())
|
||||
.append("menuCheckStrictly", isMenuCheckStrictly())
|
||||
.append("deptCheckStrictly", isDeptCheckStrictly())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.annotation.Excel.Type;
|
||||
import com.bonus.common.core.annotation.Excels;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户对象 sys_user
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Data
|
||||
public class SysUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
/** 用户账号 */
|
||||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/** 用户邮箱 */
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/** 手机号码 */
|
||||
@Excel(name = "手机号码")
|
||||
private String phonenumber;
|
||||
|
||||
/** 用户性别 */
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/** 用户头像 */
|
||||
private String avatar;
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 帐号状态(1正常 0停用) */
|
||||
@Excel(name = "帐号状态", readConverterExp = "1=正常,0=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 最后登录IP */
|
||||
@Excel(name = "最后登录IP", type = Type.EXPORT)
|
||||
private String loginIp;
|
||||
|
||||
/** 最后登录时间 */
|
||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||
private Date loginDate;
|
||||
|
||||
/** 部门对象 */
|
||||
@Excels({
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
||||
})
|
||||
private SysDept dept;
|
||||
|
||||
/** 角色对象 */
|
||||
private List<SysRole> roles;
|
||||
|
||||
/** 角色组 */
|
||||
private Long[] roleIds;
|
||||
|
||||
/** 岗位组 */
|
||||
private Long[] postIds;
|
||||
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
private String roleName;
|
||||
|
||||
private String roleLevel;
|
||||
|
||||
/** 组织ID */
|
||||
private String orgId;
|
||||
|
||||
private String parentId;
|
||||
|
||||
/** 公司ID */
|
||||
private String companyId;
|
||||
|
||||
private String companyName;
|
||||
|
||||
/** 分公司ID */
|
||||
private String subComId;
|
||||
|
||||
private String subComName;
|
||||
|
||||
/** 工程ID */
|
||||
private String proId;
|
||||
|
||||
/** 分包ID */
|
||||
private String subId;
|
||||
|
||||
private String idNumber;
|
||||
|
||||
private String type;
|
||||
|
||||
private String isExist;
|
||||
|
||||
private String teamId;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userName", getUserName())
|
||||
.append("nickName", getNickName())
|
||||
.append("email", getEmail())
|
||||
.append("phonenumber", getPhonenumber())
|
||||
.append("sex", getSex())
|
||||
.append("avatar", getAvatar())
|
||||
.append("password", getPassword())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("loginIp", getLoginIp())
|
||||
.append("loginDate", getLoginDate())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("dept", getDept())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.system.api.factory;
|
||||
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 文件服务降级处理
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Component
|
||||
public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteFileFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteFileService create(Throwable throwable)
|
||||
{
|
||||
log.error("文件服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteFileService()
|
||||
{
|
||||
@Override
|
||||
public R<SysFile> upload(HttpServletRequest request) {
|
||||
return R.fail("上传文件失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.system.api.factory;
|
||||
|
||||
import com.bonus.system.api.RemoteLogService;
|
||||
import com.bonus.system.api.domain.SysLogininfor;
|
||||
import com.bonus.system.api.domain.SysOperLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.bonus.common.core.domain.R;
|
||||
|
||||
/**
|
||||
* 日志服务降级处理
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Component
|
||||
public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteLogService create(Throwable throwable)
|
||||
{
|
||||
log.error("日志服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteLogService()
|
||||
{
|
||||
@Override
|
||||
public R<Boolean> saveLog(SysOperLog sysOperLog, String source)
|
||||
{
|
||||
return R.fail("获取系统日志失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source)
|
||||
{
|
||||
return R.fail("获取访问记录失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.bonus.system.api.factory;
|
||||
|
||||
import com.bonus.system.api.RemoteUserService;
|
||||
import com.bonus.system.api.model.Dict;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Component
|
||||
public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteUserService create(Throwable throwable)
|
||||
{
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteUserService()
|
||||
{
|
||||
@Override
|
||||
public R<LoginUser> getUserInfo(String username, String source)
|
||||
{
|
||||
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> registerUserInfo(SysUser sysUser, String source)
|
||||
{
|
||||
return R.fail("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> getDictByType(String type, String source) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.bonus.system.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public abstract class BaseEntity<ID extends Serializable> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2054813493011812469L;
|
||||
|
||||
private ID id;
|
||||
private Date createTime = new Date();
|
||||
private Date updateTime = new Date();
|
||||
|
||||
public ID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(ID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.bonus.system.api.model;
|
||||
|
||||
public class Dict extends BaseEntity<Long> {
|
||||
|
||||
private static final long serialVersionUID = -2431140186410912787L;
|
||||
private String type;
|
||||
private String k;
|
||||
private String val;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getK() {
|
||||
return k;
|
||||
}
|
||||
|
||||
public void setK(String k) {
|
||||
this.k = k;
|
||||
}
|
||||
|
||||
public String getVal() {
|
||||
return val;
|
||||
}
|
||||
|
||||
public void setVal(String val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.bonus.system.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Data
|
||||
public class LoginUser implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 用户名id
|
||||
*/
|
||||
private Long userid;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private Long loginTime;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Long expireTime;
|
||||
|
||||
/**
|
||||
* 登录IP地址
|
||||
*/
|
||||
private String ipaddr;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
private List<Permission> permissions;
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
*/
|
||||
private Set<String> roles;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
private SysUser sysUser;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.system.api.model;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Permission{
|
||||
|
||||
private static final long serialVersionUID = 6180869216498363919L;
|
||||
|
||||
private Long id;
|
||||
private Long parentId;
|
||||
private String name;
|
||||
private String css;
|
||||
private String href;
|
||||
private Integer type;
|
||||
private String permission;
|
||||
private Integer sort;
|
||||
private String permissionType;
|
||||
private List<Permission> child;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.bonus.system.api.model;
|
||||
|
||||
public class Role extends BaseEntity<Long> {
|
||||
|
||||
private static final long serialVersionUID = -3802292814767103648L;
|
||||
|
||||
private String name;
|
||||
|
||||
private String oldName;
|
||||
|
||||
private String companyId;
|
||||
|
||||
private String companyName;
|
||||
|
||||
private String description;
|
||||
|
||||
private String type;
|
||||
|
||||
private int level;
|
||||
|
||||
private String status;
|
||||
|
||||
private String changeTime;
|
||||
|
||||
public String getOldName() {
|
||||
return oldName;
|
||||
}
|
||||
|
||||
public void setOldName(String oldName) {
|
||||
this.oldName = oldName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getChangeTime() {
|
||||
return changeTime;
|
||||
}
|
||||
|
||||
public void setChangeTime(String changeTime) {
|
||||
this.changeTime = changeTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.system.api.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoleDto extends Role {
|
||||
|
||||
private static final long serialVersionUID = 4218495592167610193L;
|
||||
|
||||
private List<Long> permissionIds;
|
||||
|
||||
public List<Long> getPermissionIds() {
|
||||
return permissionIds;
|
||||
}
|
||||
|
||||
public void setPermissionIds(List<Long> permissionIds) {
|
||||
this.permissionIds = permissionIds;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
com.bonus.system.api.factory.RemoteUserFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteLogFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteFileFallbackFactory
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$" dumb="true">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>YnRealNameWeb</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<modules>
|
||||
<module>api-system</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>api</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>
|
||||
api系统接口
|
||||
</description>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
<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.bonus</groupId>
|
||||
<artifactId>YnRealNameWeb</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>real-name-auth</artifactId>
|
||||
|
||||
<description>
|
||||
real-name-auth认证授权中心
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Common Security-->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.auth;
|
||||
|
||||
import com.bonus.common.security.annotation.EnableRyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* 认证授权中心
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
|
||||
public class AuthApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApplicationContext applicationContext = SpringApplication.run(AuthApplication.class, args);
|
||||
Environment env = applicationContext.getEnvironment();
|
||||
System.out.println("----run 运行环境:"+env.getProperty("spring.profiles.active")+"----");
|
||||
System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.bonus.auth.controller;
|
||||
|
||||
import com.bonus.auth.form.LoginBody;
|
||||
import com.bonus.auth.form.RegisterBody;
|
||||
import com.bonus.auth.service.SysLoginService;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.JwtUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.security.auth.AuthUtil;
|
||||
import com.bonus.common.security.service.TokenService;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* token 控制
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
public class TokenController
|
||||
{
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private SysLoginService sysLoginService;
|
||||
|
||||
@PostMapping("login")
|
||||
public R<?> login(@RequestBody LoginBody form)
|
||||
{
|
||||
// 用户登录
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),
|
||||
form.getType(),form.getJwtToken());
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
}
|
||||
|
||||
@GetMapping("getTokenKey")
|
||||
@ResponseBody
|
||||
public String getTokenKey(String jwtToken){
|
||||
String userName="";
|
||||
try{
|
||||
Claims claims = JwtUtils.parseToken(jwtToken);
|
||||
userName = (String) claims.get(SecurityConstants.DETAILS_USERNAME);
|
||||
}catch(Exception e){
|
||||
userName = "miss";
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
||||
@DeleteMapping("logout")
|
||||
public R<?> logout(HttpServletRequest request)
|
||||
{
|
||||
String token = SecurityUtils.getToken(request);
|
||||
if (StringUtils.isNotEmpty(token))
|
||||
{
|
||||
String username = JwtUtils.getUserName(token);
|
||||
String userId = SecurityUtils.getLoginUser().getUserid() + "";
|
||||
// 删除用户缓存记录
|
||||
AuthUtil.logoutByToken(token);
|
||||
// 记录用户退出日志
|
||||
sysLoginService.logout(userId);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("refresh")
|
||||
public R<?> refresh(HttpServletRequest request)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
if (StringUtils.isNotNull(loginUser))
|
||||
{
|
||||
// 刷新令牌有效期
|
||||
tokenService.refreshToken(loginUser);
|
||||
return R.ok();
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("register")
|
||||
public R<?> register(@RequestBody RegisterBody registerBody)
|
||||
{
|
||||
// 用户注册
|
||||
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.bonus.auth.form;
|
||||
|
||||
/**
|
||||
* 用户登录对象
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class LoginBody
|
||||
{
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 类型 有值为app登录,无需密码
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String jwtToken;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getJwtToken()
|
||||
{
|
||||
return jwtToken;
|
||||
}
|
||||
|
||||
public void setJwtToken(String jwtToken)
|
||||
{
|
||||
this.jwtToken = jwtToken;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.bonus.auth.form;
|
||||
|
||||
/**
|
||||
* 用户注册对象
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class RegisterBody extends LoginBody
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
package com.bonus.auth.service;
|
||||
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.UserConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.enums.UserStatus;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.AESCBCUtils;
|
||||
import com.bonus.common.core.utils.JwtUtils;
|
||||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.ip.IpUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.RemoteLogService;
|
||||
import com.bonus.system.api.RemoteUserService;
|
||||
import com.bonus.system.api.domain.SysLogininfor;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Component
|
||||
public class SysLoginService
|
||||
{
|
||||
@Autowired
|
||||
private RemoteLogService remoteLogService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
public LoginUser login(String username, String password,
|
||||
String type, String jwtToken)
|
||||
{
|
||||
username = AESCBCUtils.decrypt(username);
|
||||
password = AESCBCUtils.decrypt(password);
|
||||
if(StringUtils.isNotEmpty(jwtToken)){
|
||||
Claims claims = JwtUtils.parseToken(jwtToken);
|
||||
jwtToken = (String) claims.get(SecurityConstants.DETAILS_USERNAME);
|
||||
}
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password))
|
||||
{
|
||||
recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
}
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
|
||||
{
|
||||
recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
|
||||
throw new ServiceException("用户密码不在指定范围");
|
||||
}
|
||||
// 用户名不在指定范围内 错误
|
||||
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
|
||||
{
|
||||
recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
|
||||
throw new ServiceException("用户名不在指定范围");
|
||||
}
|
||||
// 查询用户信息
|
||||
R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||
|
||||
if (R.FAIL == userResult.getCode())
|
||||
{
|
||||
throw new ServiceException(userResult.getMsg());
|
||||
}
|
||||
|
||||
// if ("5".equals(userResult.getData().getSysUser().getRoleLevel()))
|
||||
// {
|
||||
// throw new ServiceException("账号无后台权限");
|
||||
// }
|
||||
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
|
||||
{
|
||||
recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||
}
|
||||
LoginUser userInfo = userResult.getData();
|
||||
SysUser user = userResult.getData().getSysUser();
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||
{
|
||||
recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||
}
|
||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
||||
{
|
||||
recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
||||
}
|
||||
if (!username.equals(jwtToken)) {
|
||||
if (!SecurityUtils.matchesPassword(password, user.getPassword())) {
|
||||
recordLogininfor(user.getUserId() + "", Constants.LOGIN_FAIL, "用户密码错误");
|
||||
throw new ServiceException("用户不存在/密码错误");
|
||||
}
|
||||
}
|
||||
recordLogininfor(user.getUserId() + "", Constants.LOGIN_SUCCESS, "登录成功");
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void logout(String loginName)
|
||||
{
|
||||
recordLogininfor(loginName, Constants.LOGOUT, "退出成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public void register(String username, String password)
|
||||
{
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password))
|
||||
{
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
}
|
||||
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
|
||||
{
|
||||
throw new ServiceException("账户长度必须在2到20个字符之间");
|
||||
}
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
|
||||
{
|
||||
throw new ServiceException("密码长度必须在5到20个字符之间");
|
||||
}
|
||||
|
||||
// 注册用户信息
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName(username);
|
||||
sysUser.setNickName(username);
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
||||
|
||||
if (R.FAIL == registerResult.getCode())
|
||||
{
|
||||
throw new ServiceException(registerResult.getMsg());
|
||||
}
|
||||
recordLogininfor(username, Constants.REGISTER, "注册成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param status 状态
|
||||
* @param message 消息内容
|
||||
* @return
|
||||
*/
|
||||
public void recordLogininfor(String username, String status, String message)
|
||||
{
|
||||
SysLogininfor logininfor = new SysLogininfor();
|
||||
logininfor.setUserName(username);
|
||||
logininfor.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||
logininfor.setMsg(message);
|
||||
// 日志状态
|
||||
if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))
|
||||
{
|
||||
logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS);
|
||||
}
|
||||
else if (Constants.LOGIN_FAIL.equals(status))
|
||||
{
|
||||
logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
|
||||
}
|
||||
remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9200
|
||||
|
||||
## Spring 测试环境
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: auth
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: @profiles.active@
|
||||
cloud:
|
||||
loadbalancer:
|
||||
# 关闭Ribbon的负载均衡器
|
||||
ribbon:
|
||||
enabled: false
|
||||
# 开启Nacos的负载均衡器
|
||||
nacos:
|
||||
enabled: true
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: @nacos.server@
|
||||
namespace: @name.space@
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: @nacos.server@
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: @name.space@
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/auth" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.bonus" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,198 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>common-core</artifactId>
|
||||
|
||||
<description>
|
||||
common-core核心模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.31</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>aspose</groupId>
|
||||
<artifactId>aspose-words</artifactId>
|
||||
<version>15.8.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>aspose</groupId>
|
||||
<artifactId>aspose-slide</artifactId>
|
||||
<version>19.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/aspose-slides-19.6.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<!--xlsx或xls转pdf-->
|
||||
<dependency>
|
||||
<groupId>aspose</groupId>
|
||||
<artifactId>aspose-cells</artifactId>
|
||||
<version>8.5.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/aspose-cells-8.5.2.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SpringCloud Openfeign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Loadbalancer -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Context Support -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Transmittable ThreadLocal -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>transmittable-thread-local</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hibernate Validator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Alibaba Fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jwt -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jaxb -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Apache Lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Commons Io -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Commons Fileupload -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Java Servlet -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>29.0-android</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Hutool Java工具包-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.27</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itextpdf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itext-asian</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package com.bonus.common.core.annotation;
|
||||
|
||||
import com.bonus.common.core.utils.poi.ExcelHandlerAdapter;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 自定义导出Excel数据注解
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Excel
|
||||
{
|
||||
/**
|
||||
* 导出时在excel中排序
|
||||
*/
|
||||
public int sort() default Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 判断是否必填项
|
||||
*/
|
||||
public boolean required() default false;
|
||||
|
||||
/**
|
||||
* 判断符合正则
|
||||
*/
|
||||
public String isRegex() default "";
|
||||
|
||||
/**
|
||||
* 导出到Excel中的名字.
|
||||
*/
|
||||
public String name() default "";
|
||||
|
||||
/**
|
||||
* 日期格式, 如: yyyy-MM-dd
|
||||
*/
|
||||
public String dateFormat() default "";
|
||||
|
||||
/**
|
||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||
*/
|
||||
public String readConverterExp() default "";
|
||||
|
||||
/**
|
||||
* 分隔符,读取字符串组内容
|
||||
*/
|
||||
public String separator() default ",";
|
||||
|
||||
/**
|
||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||
*/
|
||||
public int scale() default -1;
|
||||
|
||||
/**
|
||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||
*/
|
||||
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的高度 单位为字符
|
||||
*/
|
||||
public double height() default 14;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的宽 单位为字符
|
||||
*/
|
||||
public double width() default 16;
|
||||
|
||||
/**
|
||||
* 文字后缀,如% 90 变成90%
|
||||
*/
|
||||
public String suffix() default "";
|
||||
|
||||
/**
|
||||
* 当值为空时,字段的默认值
|
||||
*/
|
||||
public String defaultValue() default "";
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
public String prompt() default "";
|
||||
|
||||
/**
|
||||
* 设置只能选择不能输入的列内容.
|
||||
*/
|
||||
public String[] combo() default {};
|
||||
|
||||
/**
|
||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||
*/
|
||||
public boolean isExport() default true;
|
||||
|
||||
/**
|
||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||
*/
|
||||
public String targetAttr() default "";
|
||||
|
||||
/**
|
||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||
*/
|
||||
public boolean isStatistics() default false;
|
||||
|
||||
/**
|
||||
* 导出类型(0数字 1字符串)
|
||||
*/
|
||||
public ColumnType cellType() default ColumnType.STRING;
|
||||
|
||||
/**
|
||||
* 导出列头背景色
|
||||
*/
|
||||
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||
|
||||
/**
|
||||
* 导出列头字体颜色
|
||||
*/
|
||||
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格背景色
|
||||
*/
|
||||
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格字体颜色
|
||||
*/
|
||||
public IndexedColors color() default IndexedColors.BLACK;
|
||||
|
||||
/**
|
||||
* 导出字段对齐方式
|
||||
*/
|
||||
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器参数
|
||||
*/
|
||||
public String[] args() default {};
|
||||
|
||||
/**
|
||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||
*/
|
||||
Type type() default Type.ALL;
|
||||
|
||||
public enum Type
|
||||
{
|
||||
ALL(0), EXPORT(1), IMPORT(2);
|
||||
private final int value;
|
||||
|
||||
Type(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ColumnType
|
||||
{
|
||||
NUMERIC(0), STRING(1), IMAGE(2);
|
||||
private final int value;
|
||||
|
||||
ColumnType(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.common.core.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Excel注解集
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Excels
|
||||
{
|
||||
Excel[] value();
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 缓存的key 常量
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class CacheConstants
|
||||
{
|
||||
/**
|
||||
* 缓存有效期,默认720(分钟)
|
||||
*/
|
||||
public final static long EXPIRATION = 720;
|
||||
|
||||
/**
|
||||
* 缓存刷新时间,默认120(分钟)
|
||||
*/
|
||||
public final static long REFRESH_TIME = 120;
|
||||
|
||||
/**
|
||||
* 权限缓存前缀
|
||||
*/
|
||||
public final static String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||
}
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class Constants
|
||||
{
|
||||
/**
|
||||
* UTF-8 字符集
|
||||
*/
|
||||
public static final String UTF8 = "UTF-8";
|
||||
|
||||
/**
|
||||
* GBK 字符集
|
||||
*/
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
/**
|
||||
* RMI 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_RMI = "rmi:";
|
||||
|
||||
/**
|
||||
* LDAP 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_LDAP = "ldap:";
|
||||
|
||||
/**
|
||||
* LDAPS 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_LDAPS = "ldaps:";
|
||||
|
||||
/**
|
||||
* http请求
|
||||
*/
|
||||
public static final String HTTP = "http://";
|
||||
|
||||
/**
|
||||
* https请求
|
||||
*/
|
||||
public static final String HTTPS = "https://";
|
||||
|
||||
/**
|
||||
* 成功标记
|
||||
*/
|
||||
public static final Integer SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 失败标记
|
||||
*/
|
||||
public static final Integer FAIL = 500;
|
||||
|
||||
/**
|
||||
* 后台
|
||||
*/
|
||||
public static final String BMW_WORK = "2";
|
||||
|
||||
/**
|
||||
* 移动端-施工
|
||||
*/
|
||||
public static final String APP_WORK = "3";
|
||||
|
||||
/**
|
||||
* 登录成功状态
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS_STATUS = "1";
|
||||
|
||||
/**
|
||||
* 登录失败状态
|
||||
*/
|
||||
public static final String LOGIN_FAIL_STATUS = "0";
|
||||
|
||||
/**
|
||||
* 登录成功
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS = "Success";
|
||||
|
||||
/**
|
||||
* 注销
|
||||
*/
|
||||
public static final String LOGOUT = "Logout";
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public static final String REGISTER = "Register";
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
public static final String LOGIN_FAIL = "Error";
|
||||
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
public static final String PAGE_NUM = "pageNum";
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
public static final String PAGE_SIZE = "pageSize";
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
public static final String ORDER_BY_COLUMN = "orderByColumn";
|
||||
|
||||
/**
|
||||
* 排序的方向 "desc" 或者 "asc".
|
||||
*/
|
||||
public static final String IS_ASC = "isAsc";
|
||||
|
||||
/**
|
||||
* 验证码 redis key
|
||||
*/
|
||||
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
|
||||
|
||||
/**
|
||||
* 验证码有效期(分钟)
|
||||
*/
|
||||
public static final long CAPTCHA_EXPIRATION = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 参数管理 cache key
|
||||
*/
|
||||
public static final String SYS_CONFIG_KEY = "sys_config:";
|
||||
|
||||
/**
|
||||
* 字典管理 cache key
|
||||
*/
|
||||
public static final String SYS_DICT_KEY = "sys_dict:";
|
||||
|
||||
/**
|
||||
* 资源映射路径 前缀
|
||||
*/
|
||||
public static final String RESOURCE_PREFIX = "/profile";
|
||||
|
||||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.bonus" };
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.bonus.common.core.utils.file" };
|
||||
|
||||
/**
|
||||
* 暂无数据
|
||||
*/
|
||||
public final static String NO_DATA = "暂无数据";
|
||||
|
||||
/**
|
||||
* 新增成功
|
||||
*/
|
||||
public final static String INSERT_SUCCESS = "新增成功";
|
||||
|
||||
/**
|
||||
* 新增失败
|
||||
*/
|
||||
public final static String INSERT_FAIL = "新增失败";
|
||||
|
||||
/**
|
||||
* 新增失败或已存在
|
||||
*/
|
||||
public final static String INSERT_FAIL_OR_EXIST = "新增失败或已存在";
|
||||
|
||||
/**
|
||||
* 修改成功
|
||||
*/
|
||||
public final static String UPDATE_SUCCESS = "修改成功";
|
||||
|
||||
/**
|
||||
* 修改失败
|
||||
*/
|
||||
public final static String UPDATE_FAIL = "修改失败";
|
||||
|
||||
/**
|
||||
* 删除成功
|
||||
*/
|
||||
public final static String DELETE_SUCCESS = "删除成功";
|
||||
|
||||
/**
|
||||
* 删除失败
|
||||
*/
|
||||
public final static String DELETE_FAIL = "删除失败";
|
||||
|
||||
/**
|
||||
* 电子合同新增成功
|
||||
*/
|
||||
public final static String INSERT_CONTRACT_SUCCESS = "上传成功,甲方签署后,我们会以短信的形式将电子合同发送到您的手机上。";
|
||||
|
||||
/**
|
||||
* 电子合同新增失败
|
||||
*/
|
||||
public final static String INSERT_CONTRACT_FAIL = "签署失败,请重试";
|
||||
|
||||
/**
|
||||
* 用户查询不是班组长
|
||||
*/
|
||||
public final static String IS_NOT_TEAM = "此用户不是班组长,禁止上报日计划";
|
||||
|
||||
/**
|
||||
* 接口异常
|
||||
*/
|
||||
public final static String API_FAILED = "接口异常,请检查接口";
|
||||
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public final static String OPERATE_SUCCESS = "操作成功";
|
||||
|
||||
/**
|
||||
* 操作失败
|
||||
*/
|
||||
public final static String OPERATE_FAIL = "操作失败";
|
||||
|
||||
/**
|
||||
* 0
|
||||
*/
|
||||
public final static String ZERO = "0";
|
||||
|
||||
/**
|
||||
* 1
|
||||
*/
|
||||
public final static String ONE = "1";
|
||||
|
||||
/**
|
||||
* 2
|
||||
*/
|
||||
public final static String TWO = "2";
|
||||
|
||||
/**
|
||||
* 分公司
|
||||
*/
|
||||
public final static String COMPANY = "company";
|
||||
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
public final static String PROJECT = "pro";
|
||||
|
||||
/**
|
||||
* 人员
|
||||
*/
|
||||
public final static String WORKER = "worker";
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 代码生成通用常量
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class GenConstants
|
||||
{
|
||||
/** 单表(增删改查) */
|
||||
public static final String TPL_CRUD = "crud";
|
||||
|
||||
/** 树表(增删改查) */
|
||||
public static final String TPL_TREE = "tree";
|
||||
|
||||
/** 主子表(增删改查) */
|
||||
public static final String TPL_SUB = "sub";
|
||||
|
||||
/** 树编码字段 */
|
||||
public static final String TREE_CODE = "treeCode";
|
||||
|
||||
/** 树父编码字段 */
|
||||
public static final String TREE_PARENT_CODE = "treeParentCode";
|
||||
|
||||
/** 树名称字段 */
|
||||
public static final String TREE_NAME = "treeName";
|
||||
|
||||
/** 上级菜单ID字段 */
|
||||
public static final String PARENT_MENU_ID = "parentMenuId";
|
||||
|
||||
/** 上级菜单名称字段 */
|
||||
public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||
|
||||
/** 数据库字符串类型 */
|
||||
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
||||
|
||||
/** 数据库文本类型 */
|
||||
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
|
||||
|
||||
/** 数据库时间类型 */
|
||||
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
|
||||
|
||||
/** 数据库数字类型 */
|
||||
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
|
||||
"bigint", "float", "double", "decimal" };
|
||||
|
||||
/** 页面不需要编辑字段 */
|
||||
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
|
||||
|
||||
/** 页面不需要显示的列表字段 */
|
||||
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time" };
|
||||
|
||||
/** 页面不需要查询字段 */
|
||||
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time", "remark" };
|
||||
|
||||
/** Entity基类字段 */
|
||||
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
|
||||
|
||||
/** Tree基类字段 */
|
||||
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" };
|
||||
|
||||
/** 文本框 */
|
||||
public static final String HTML_INPUT = "input";
|
||||
|
||||
/** 文本域 */
|
||||
public static final String HTML_TEXTAREA = "textarea";
|
||||
|
||||
/** 下拉框 */
|
||||
public static final String HTML_SELECT = "select";
|
||||
|
||||
/** 单选框 */
|
||||
public static final String HTML_RADIO = "radio";
|
||||
|
||||
/** 复选框 */
|
||||
public static final String HTML_CHECKBOX = "checkbox";
|
||||
|
||||
/** 日期控件 */
|
||||
public static final String HTML_DATETIME = "datetime";
|
||||
|
||||
/** 图片上传控件 */
|
||||
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||
|
||||
/** 文件上传控件 */
|
||||
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||
|
||||
/** 富文本控件 */
|
||||
public static final String HTML_EDITOR = "editor";
|
||||
|
||||
/** 字符串类型 */
|
||||
public static final String TYPE_STRING = "String";
|
||||
|
||||
/** 整型 */
|
||||
public static final String TYPE_INTEGER = "Integer";
|
||||
|
||||
/** 长整型 */
|
||||
public static final String TYPE_LONG = "Long";
|
||||
|
||||
/** 浮点型 */
|
||||
public static final String TYPE_DOUBLE = "Double";
|
||||
|
||||
/** 高精度计算类型 */
|
||||
public static final String TYPE_BIGDECIMAL = "BigDecimal";
|
||||
|
||||
/** 时间类型 */
|
||||
public static final String TYPE_DATE = "Date";
|
||||
|
||||
/** 模糊查询 */
|
||||
public static final String QUERY_LIKE = "LIKE";
|
||||
|
||||
/** 相等查询 */
|
||||
public static final String QUERY_EQ = "EQ";
|
||||
|
||||
/** 需要 */
|
||||
public static final String REQUIRE = "1";
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 返回状态码
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class HttpStatus
|
||||
{
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public static final int SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 对象创建成功
|
||||
*/
|
||||
public static final int CREATED = 201;
|
||||
|
||||
/**
|
||||
* 请求已经被接受
|
||||
*/
|
||||
public static final int ACCEPTED = 202;
|
||||
|
||||
/**
|
||||
* 操作已经执行成功,但是没有返回数据
|
||||
*/
|
||||
public static final int NO_CONTENT = 204;
|
||||
|
||||
/**
|
||||
* 资源已被移除
|
||||
*/
|
||||
public static final int MOVED_PERM = 301;
|
||||
|
||||
/**
|
||||
* 重定向
|
||||
*/
|
||||
public static final int SEE_OTHER = 303;
|
||||
|
||||
/**
|
||||
* 资源没有被修改
|
||||
*/
|
||||
public static final int NOT_MODIFIED = 304;
|
||||
|
||||
/**
|
||||
* 参数列表错误(缺少,格式不匹配)
|
||||
*/
|
||||
public static final int BAD_REQUEST = 400;
|
||||
|
||||
/**
|
||||
* 未授权
|
||||
*/
|
||||
public static final int UNAUTHORIZED = 401;
|
||||
|
||||
/**
|
||||
* 访问受限,授权过期
|
||||
*/
|
||||
public static final int FORBIDDEN = 403;
|
||||
|
||||
/**
|
||||
* 资源,服务未找到
|
||||
*/
|
||||
public static final int NOT_FOUND = 404;
|
||||
|
||||
/**
|
||||
* 不允许的http方法
|
||||
*/
|
||||
public static final int BAD_METHOD = 405;
|
||||
|
||||
/**
|
||||
* 资源冲突,或者资源被锁
|
||||
*/
|
||||
public static final int CONFLICT = 409;
|
||||
|
||||
/**
|
||||
* 不支持的数据,媒体类型
|
||||
*/
|
||||
public static final int UNSUPPORTED_TYPE = 415;
|
||||
|
||||
/**
|
||||
* 系统内部错误
|
||||
*/
|
||||
public static final int ERROR = 500;
|
||||
|
||||
/**
|
||||
* 接口未实现
|
||||
*/
|
||||
public static final int NOT_IMPLEMENTED = 501;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 正则常量信息
|
||||
*
|
||||
* @author fly
|
||||
*/
|
||||
public class RegexConstants {
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
public static final String IDCARD = "^[1-9]\\d{5}(18|19|20|(3\\d))\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
public static final String PHONE = "^((13[0-9])|(14(0|[5-7]|9))|(15[0-9])|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\\d{8}$";
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 任务调度通用常量
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class ScheduleConstants
|
||||
{
|
||||
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
|
||||
|
||||
/** 执行目标key */
|
||||
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
|
||||
|
||||
/** 默认 */
|
||||
public static final String MISFIRE_DEFAULT = "0";
|
||||
|
||||
/** 立即触发执行 */
|
||||
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
||||
|
||||
/** 触发一次执行 */
|
||||
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
||||
|
||||
/** 不触发立即执行 */
|
||||
public static final String MISFIRE_DO_NOTHING = "3";
|
||||
|
||||
public enum Status
|
||||
{
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
NORMAL("0"),
|
||||
/**
|
||||
* 暂停
|
||||
*/
|
||||
PAUSE("1");
|
||||
|
||||
private String value;
|
||||
|
||||
private Status(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 权限相关通用常量
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SecurityConstants
|
||||
{
|
||||
/**
|
||||
* 用户ID字段
|
||||
*/
|
||||
public static final String DETAILS_USER_ID = "user_id";
|
||||
|
||||
/**
|
||||
* 用户名字段
|
||||
*/
|
||||
public static final String DETAILS_USERNAME = "username";
|
||||
|
||||
/**
|
||||
* 授权信息字段
|
||||
*/
|
||||
public static final String AUTHORIZATION_HEADER = "authorization";
|
||||
|
||||
/**
|
||||
* 请求来源
|
||||
*/
|
||||
public static final String FROM_SOURCE = "from-source";
|
||||
|
||||
/**
|
||||
* 内部请求
|
||||
*/
|
||||
public static final String INNER = "inner";
|
||||
|
||||
/**
|
||||
* 用户标识
|
||||
*/
|
||||
public static final String USER_KEY = "user_key";
|
||||
|
||||
/**
|
||||
* 登录用户
|
||||
*/
|
||||
public static final String LOGIN_USER = "login_user";
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 服务名称
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class ServiceNameConstants
|
||||
{
|
||||
/**
|
||||
* 认证服务的serviceid
|
||||
*/
|
||||
public static final String AUTH_SERVICE = "auth";
|
||||
|
||||
/**
|
||||
* 系统模块的serviceid
|
||||
*/
|
||||
public static final String SYSTEM_SERVICE = "system";
|
||||
|
||||
/**
|
||||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "file";
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* Token的Key常量
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class TokenConstants
|
||||
{
|
||||
/**
|
||||
* 令牌自定义标识
|
||||
*/
|
||||
public static final String AUTHENTICATION = "Authorization";
|
||||
|
||||
/**
|
||||
* 令牌前缀
|
||||
*/
|
||||
public static final String PREFIX = "Bearer ";
|
||||
|
||||
/**
|
||||
* 令牌秘钥
|
||||
*/
|
||||
public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
/**
|
||||
* 用户常量信息
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class UserConstants
|
||||
{
|
||||
/**
|
||||
* 平台内系统用户的唯一标志
|
||||
*/
|
||||
public static final String SYS_USER = "SYS_USER";
|
||||
|
||||
/** 正常状态 */
|
||||
public static final String NORMAL = "0";
|
||||
|
||||
/** 异常状态 */
|
||||
public static final String EXCEPTION = "1";
|
||||
|
||||
/** 用户封禁状态 */
|
||||
public static final String USER_DISABLE = "1";
|
||||
|
||||
/** 角色封禁状态 */
|
||||
public static final String ROLE_DISABLE = "1";
|
||||
|
||||
/** 部门正常状态 */
|
||||
public static final String DEPT_NORMAL = "0";
|
||||
|
||||
/** 部门停用状态 */
|
||||
public static final String DEPT_DISABLE = "1";
|
||||
|
||||
/** 字典正常状态 */
|
||||
public static final String DICT_NORMAL = "0";
|
||||
|
||||
/** 是否为系统默认(是) */
|
||||
public static final String YES = "Y";
|
||||
|
||||
/** 是否菜单外链(是) */
|
||||
public static final String YES_FRAME = "0";
|
||||
|
||||
/** 是否菜单外链(否) */
|
||||
public static final String NO_FRAME = "1";
|
||||
|
||||
/** 菜单类型(目录) */
|
||||
public static final String TYPE_DIR = "M";
|
||||
|
||||
/** 菜单类型(菜单) */
|
||||
public static final String TYPE_MENU = "C";
|
||||
|
||||
/** 菜单类型(按钮) */
|
||||
public static final String TYPE_BUTTON = "F";
|
||||
|
||||
/** Layout组件标识 */
|
||||
public final static String LAYOUT = "Layout";
|
||||
|
||||
/** ParentView组件标识 */
|
||||
public final static String PARENT_VIEW = "ParentView";
|
||||
|
||||
/** InnerLink组件标识 */
|
||||
public final static String INNER_LINK = "InnerLink";
|
||||
|
||||
/** 校验返回结果码 */
|
||||
public final static String UNIQUE = "0";
|
||||
|
||||
public final static String NOT_UNIQUE = "1";
|
||||
|
||||
/**
|
||||
* 用户名长度限制
|
||||
*/
|
||||
public static final int USERNAME_MIN_LENGTH = 2;
|
||||
|
||||
public static final int USERNAME_MAX_LENGTH = 20;
|
||||
|
||||
/**
|
||||
* 密码长度限制
|
||||
*/
|
||||
public static final int PASSWORD_MIN_LENGTH = 5;
|
||||
|
||||
public static final int PASSWORD_MAX_LENGTH = 20;
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.bonus.common.core.context;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 获取当前线程变量中的 用户id、用户名称、Token等信息
|
||||
* 注意: 必须在网关通过请求头的方法传入,同时在HeaderInterceptor拦截器设置值。 否则这里无法获取
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class SecurityContextHolder
|
||||
{
|
||||
private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = new TransmittableThreadLocal<>();
|
||||
|
||||
public static void set(String key, Object value)
|
||||
{
|
||||
Map<String, Object> map = getLocalMap();
|
||||
map.put(key, value == null ? StringUtils.EMPTY : value);
|
||||
}
|
||||
|
||||
public static String get(String key)
|
||||
{
|
||||
Map<String, Object> map = getLocalMap();
|
||||
return Convert.toStr(map.getOrDefault(key, StringUtils.EMPTY));
|
||||
}
|
||||
|
||||
public static <T> T get(String key, Class<T> clazz)
|
||||
{
|
||||
Map<String, Object> map = getLocalMap();
|
||||
return StringUtils.cast(map.getOrDefault(key, null));
|
||||
}
|
||||
|
||||
public static Map<String, Object> getLocalMap()
|
||||
{
|
||||
Map<String, Object> map = THREAD_LOCAL.get();
|
||||
if (map == null)
|
||||
{
|
||||
map = new ConcurrentHashMap<String, Object>();
|
||||
THREAD_LOCAL.set(map);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void setLocalMap(Map<String, Object> threadLocalMap)
|
||||
{
|
||||
THREAD_LOCAL.set(threadLocalMap);
|
||||
}
|
||||
|
||||
public static Long getUserId()
|
||||
{
|
||||
return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L);
|
||||
}
|
||||
|
||||
public static void setUserId(String account)
|
||||
{
|
||||
set(SecurityConstants.DETAILS_USER_ID, account);
|
||||
}
|
||||
|
||||
public static String getUserName()
|
||||
{
|
||||
return get(SecurityConstants.DETAILS_USERNAME);
|
||||
}
|
||||
|
||||
public static void setUserName(String username)
|
||||
{
|
||||
set(SecurityConstants.DETAILS_USERNAME, username);
|
||||
}
|
||||
|
||||
public static String getUserKey()
|
||||
{
|
||||
return get(SecurityConstants.USER_KEY);
|
||||
}
|
||||
|
||||
public static void setUserKey(String userKey)
|
||||
{
|
||||
set(SecurityConstants.USER_KEY, userKey);
|
||||
}
|
||||
|
||||
public static void remove()
|
||||
{
|
||||
THREAD_LOCAL.remove();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Permission {
|
||||
|
||||
private static final long serialVersionUID = 6180869216498363919L;
|
||||
|
||||
private Long id;
|
||||
private Long parentId;
|
||||
private String name;
|
||||
private String css;
|
||||
private String href;
|
||||
private Integer type;
|
||||
private String permission;
|
||||
private String permissionType;
|
||||
private Integer sort;
|
||||
private Integer types;
|
||||
private String status;
|
||||
private String openType;
|
||||
private List<Permission> child;
|
||||
|
||||
private String nodeId;
|
||||
|
||||
public Permission(Long id, Long parentId, String name) {
|
||||
this.id = id;
|
||||
this.parentId = parentId;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 响应信息主体
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class R<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 成功 */
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
|
||||
/** 失败 */
|
||||
public static final int FAIL = Constants.FAIL;
|
||||
|
||||
private int code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private int count;
|
||||
|
||||
private T data;
|
||||
|
||||
public static <T> R<T> ok()
|
||||
{
|
||||
return restResult(null, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data)
|
||||
{
|
||||
return restResult(data, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data, String msg)
|
||||
{
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> okTable(T data, int count)
|
||||
{
|
||||
return restTableResult(data, SUCCESS, null, count);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail()
|
||||
{
|
||||
return restResult(null, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(String msg)
|
||||
{
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data)
|
||||
{
|
||||
return restResult(data, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data, String msg)
|
||||
{
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(int code, String msg)
|
||||
{
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> failTable(String msg)
|
||||
{
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
private static <T> R<T> restResult(T data, int code, String msg)
|
||||
{
|
||||
R<T> apiResult = new R<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
private static <T> R<T> restTableResult(T data, int code, String msg, int count)
|
||||
{
|
||||
R<T> apiResult = new R<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setCount(count);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCount()
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count)
|
||||
{
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Ajax 返 回 JSON 结 果 封 装 数 据
|
||||
* @author zys
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Result<T> implements Serializable {
|
||||
|
||||
/**
|
||||
* 是 否 成 功
|
||||
*/
|
||||
private boolean success;
|
||||
|
||||
/**
|
||||
* 错 误 状 态
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 错 误 消 息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 返 回 数 据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
/**
|
||||
* 成 功 操 作
|
||||
*/
|
||||
public static <T> Result<T> success() {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成 功 操 作 , 携 带 数 据
|
||||
*/
|
||||
public static <T> Result<T> success(T data) {
|
||||
return success(ResultCode.SUCCESS.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成 功 操 作, 携 带 消 息
|
||||
*/
|
||||
public static <T> Result<T> success(String message) {
|
||||
return success(message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成 功 操 作, 携 带 消 息 和 携 带 数 据
|
||||
*/
|
||||
public static <T> Result<T> success(String message, T data) {
|
||||
return success(ResultCode.SUCCESS.getCode(), message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成 功 操 作, 携 带 自 定 义 状 态 码 和 消 息
|
||||
*/
|
||||
public static <T> Result<T> success(int code, String message) {
|
||||
return success(code, message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成 功 操 作, 携 带 自 定义 状 态 码, 消 息 和 数 据
|
||||
*/
|
||||
public static <T> Result<T> success(int code, String message, T data) {
|
||||
Result<T> result = new Result<T>();
|
||||
result.setCode(code);
|
||||
result.setMsg(message);
|
||||
result.setSuccess(true);
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 失 败 操 作, 默 认 数 据
|
||||
*/
|
||||
public static <T> Result<T> failure() {
|
||||
return failure(ResultCode.FAILURE.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 失 败 操 作, 携 带 自 定 义 消 息
|
||||
*/
|
||||
public static <T> Result<T> failure(String message) {
|
||||
return failure(message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失 败 操 作, 携 带 自 定 义 消 息 和 数 据
|
||||
*/
|
||||
public static <T> Result<T> failure(String message, T data) {
|
||||
return failure(ResultCode.FAILURE.getCode(), message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失 败 操 作, 携 带 自 定 义 状 态 码 和 自 定 义 消 息
|
||||
*/
|
||||
public static <T> Result<T> failure(int code, String message) {
|
||||
return failure(ResultCode.FAILURE.getCode(), message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失 败 操 作, 携 带 自 定 义 状 态 码 , 消 息 和 数 据
|
||||
*/
|
||||
public static <T> Result<T> failure(int code, String message, T data) {
|
||||
Result<T> result = new Result<T>();
|
||||
result.setCode(code);
|
||||
result.setMsg(message);
|
||||
result.setSuccess(false);
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Boolean 返 回 操 作, 携 带 默 认 返 回 值
|
||||
*/
|
||||
public static <T> Result<T> decide(boolean b) {
|
||||
return decide(b, ResultCode.SUCCESS.getMessage(), ResultCode.FAILURE.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Boolean 返 回 操 作, 携 带 自 定 义 消 息
|
||||
*/
|
||||
public static <T> Result<T> decide(boolean b, String success, String failure) {
|
||||
if (b) {
|
||||
return success(success);
|
||||
} else {
|
||||
return failure(failure);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 统 一 返 回 状 态 码
|
||||
* @author zys
|
||||
*/
|
||||
public enum ResultCode {
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS(200, "操作成功"),
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAILURE(500, "操作失败"),
|
||||
|
||||
/**
|
||||
* 重复提交
|
||||
* */
|
||||
REPEAT_SUBMIT(701,"不允许重复提交,请稍后再试");
|
||||
|
||||
/**
|
||||
* 状 态 码
|
||||
*/
|
||||
@Getter
|
||||
private final int code;
|
||||
|
||||
/**
|
||||
* 携 带 消 息
|
||||
*/
|
||||
@Getter
|
||||
private final String message;
|
||||
|
||||
/**
|
||||
* 构 造 方 法
|
||||
*/
|
||||
ResultCode(int code, String message) {
|
||||
|
||||
this.code = code;
|
||||
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 统一响应 Controller
|
||||
* @author zys
|
||||
*/
|
||||
public class ResultController {
|
||||
|
||||
/**
|
||||
* Describe: 返回 Tree 数据
|
||||
* Param data
|
||||
* Return Tree数据
|
||||
*/
|
||||
protected static ResultTree dataTree(Object data) {
|
||||
ResultTree tree = new ResultTree();
|
||||
tree.setData(data);
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe: 返回数据表格数据 分页
|
||||
* Param data
|
||||
* Return 表格分页数据
|
||||
*/
|
||||
protected static ResultTable pageTable(Object data, long count) {
|
||||
return ResultTable.pageTable(count, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author syruan
|
||||
* list: 附带数据
|
||||
* Describe: 返回数据表格数据 分页
|
||||
* Param data
|
||||
* Return 表格分页数据
|
||||
*/
|
||||
protected static ResultTable pageTable(Object data, long count, Object list) {
|
||||
return ResultTable.pageTable(count, data, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe: 返回数据表格数据
|
||||
* Param data
|
||||
* Return 表格分页数据
|
||||
*/
|
||||
protected static ResultTable dataTable(Object data) {
|
||||
return ResultTable.dataTable(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe: 返回树状表格数据 分页
|
||||
* Param data
|
||||
* Return 表格分页数据
|
||||
*/
|
||||
protected static ResultTable treeTable(Object data) {
|
||||
return ResultTable.dataTable(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功操作
|
||||
*/
|
||||
public Result success() {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功操作
|
||||
*/
|
||||
public Result success(String msg) {
|
||||
return Result.success(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功操作
|
||||
*/
|
||||
public Result success(Object data) {
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功操作
|
||||
*/
|
||||
public Result success(String msg, Object data) {
|
||||
return Result.success(msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功操作
|
||||
*/
|
||||
public Result success(int code, String message, Object data) {
|
||||
return Result.success(code, message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败操作
|
||||
*/
|
||||
public Result failure() {
|
||||
return Result.failure();
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败操作
|
||||
*/
|
||||
public Result failure(String msg) {
|
||||
return Result.failure(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败操作
|
||||
*/
|
||||
public Result failure(String msg, Object data) {
|
||||
return Result.failure(msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败操作
|
||||
*/
|
||||
public Result failure(int code, String msg, Object data) {
|
||||
return Result.failure(code, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择返回
|
||||
*/
|
||||
public Result decide(Boolean b) {
|
||||
return Result.decide(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择返回
|
||||
*/
|
||||
public Result decide(Boolean b, String success, String failure) {
|
||||
return Result.decide(b, success, failure);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择返回
|
||||
*/
|
||||
public Result decide(int result) {
|
||||
if (result > 0) {
|
||||
return Result.decide(true);
|
||||
} else {
|
||||
return Result.decide(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择返回
|
||||
*/
|
||||
public Result decide(int result, String success, String failure) {
|
||||
if (result > 0) {
|
||||
return Result.decide(true, success, failure);
|
||||
} else {
|
||||
return Result.decide(false, success, failure);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
*
|
||||
* @param pId
|
||||
* @param permissionsAll
|
||||
* @param list
|
||||
*/
|
||||
protected void setPermissionsList(Long pId, List<Permission> permissionsAll, List<Permission> list) {
|
||||
for (Permission per : permissionsAll) {
|
||||
if (per.getParentId().equals(pId)) {
|
||||
list.add(per);
|
||||
if (permissionsAll.stream().filter(p -> p.getParentId().equals(per.getId())).findAny() != null) {
|
||||
setPermissionsList(per.getId(), permissionsAll, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 前 端 表 格 数 据 封 装
|
||||
* @author zys
|
||||
*/
|
||||
@Data
|
||||
public class ResultTable implements Serializable {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 消息总量
|
||||
*/
|
||||
private Long count;
|
||||
|
||||
/**
|
||||
* 数据对象
|
||||
*/
|
||||
private Object data;
|
||||
|
||||
private Object list;
|
||||
|
||||
/**
|
||||
* 构建实体
|
||||
*/
|
||||
public static ResultTable pageTable(long count, Object data) {
|
||||
ResultTable resultTable = new ResultTable();
|
||||
resultTable.setData(data);
|
||||
resultTable.setCode(0);
|
||||
resultTable.setCount(count);
|
||||
return resultTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author syruan
|
||||
* 构建实体 - 附带数据
|
||||
*/
|
||||
public static ResultTable pageTable(long count, Object data, Object list) {
|
||||
ResultTable resultTable = new ResultTable();
|
||||
resultTable.setData(data);
|
||||
resultTable.setCode(0);
|
||||
resultTable.setCount(count);
|
||||
resultTable.setList(list);
|
||||
return resultTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建实体
|
||||
* */
|
||||
public static ResultTable dataTable(Object data) {
|
||||
ResultTable resultTable = new ResultTable();
|
||||
resultTable.setData(data);
|
||||
resultTable.setCode(0);
|
||||
return resultTable;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 前端 tree 结果封装数据
|
||||
* @author zys
|
||||
*/
|
||||
@Data
|
||||
public class ResultTree implements Serializable {
|
||||
|
||||
/**
|
||||
* 状态信息
|
||||
*/
|
||||
private Status status = new Status();
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 所需内部类
|
||||
*/
|
||||
@Data
|
||||
public class Status {
|
||||
|
||||
private Integer code = 200;
|
||||
|
||||
private String message = "默认";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.common.core.domain;
|
||||
|
||||
import com.bonus.common.core.table.PageTableRequest;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表格数据处理
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class TableRequest<T> implements Serializable {
|
||||
|
||||
public static <T> List<T> handleList(List<T> list, PageTableRequest request){
|
||||
List<T> beanList;
|
||||
Integer offset = request.getOffset();
|
||||
Integer limit = request.getLimit();
|
||||
if((offset+limit) < list.size()){
|
||||
beanList = list.subList(offset, offset + limit);
|
||||
}else{
|
||||
beanList = list.subList(offset, list.size());
|
||||
}
|
||||
return beanList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.common.core.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public enum UserStatus
|
||||
{
|
||||
OK("1", "正常"), DISABLE("0", "停用"), DELETED("2", "删除");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
UserStatus(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 验证码错误异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class CaptchaException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CaptchaException(String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 检查异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class CheckedException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CheckedException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CheckedException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public CheckedException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
|
||||
{
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 演示模式异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class DemoModeException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DemoModeException()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 全局异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class GlobalException extends RuntimeException
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
*
|
||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 空构造方法,避免反序列化问题
|
||||
*/
|
||||
public GlobalException()
|
||||
{
|
||||
}
|
||||
|
||||
public GlobalException(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getDetailMessage()
|
||||
{
|
||||
return detailMessage;
|
||||
}
|
||||
|
||||
public GlobalException setDetailMessage(String detailMessage)
|
||||
{
|
||||
this.detailMessage = detailMessage;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
public GlobalException setMessage(String message)
|
||||
{
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 内部认证异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class InnerAuthException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InnerAuthException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 权限异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class PreAuthorizeException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public PreAuthorizeException()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public final class ServiceException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
*
|
||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 空构造方法,避免反序列化问题
|
||||
*/
|
||||
public ServiceException()
|
||||
{
|
||||
}
|
||||
|
||||
public ServiceException(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ServiceException(String message, Integer code)
|
||||
{
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getDetailMessage()
|
||||
{
|
||||
return detailMessage;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
public Integer getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public ServiceException setMessage(String message)
|
||||
{
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ServiceException setDetailMessage(String detailMessage)
|
||||
{
|
||||
this.detailMessage = detailMessage;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.common.core.exception;
|
||||
|
||||
/**
|
||||
* 工具类异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class UtilException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 8247610319171014183L;
|
||||
|
||||
public UtilException(Throwable e)
|
||||
{
|
||||
super(e.getMessage(), e);
|
||||
}
|
||||
|
||||
public UtilException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public UtilException(String message, Throwable throwable)
|
||||
{
|
||||
super(message, throwable);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.common.core.exception.auth;
|
||||
|
||||
/**
|
||||
* 未能通过的登录认证异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class NotLoginException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NotLoginException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.common.core.exception.auth;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 未能通过的权限认证异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class NotPermissionException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NotPermissionException(String permission)
|
||||
{
|
||||
super(permission);
|
||||
}
|
||||
|
||||
public NotPermissionException(String[] permissions)
|
||||
{
|
||||
super(StringUtils.join(permissions, ","));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.common.core.exception.auth;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 未能通过的角色认证异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class NotRoleException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NotRoleException(String role)
|
||||
{
|
||||
super(role);
|
||||
}
|
||||
|
||||
public NotRoleException(String[] roles)
|
||||
{
|
||||
super(StringUtils.join(roles, ","));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.bonus.common.core.exception.base;
|
||||
|
||||
/**
|
||||
* 基础异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class BaseException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 所属模块
|
||||
*/
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 错误码对应的参数
|
||||
*/
|
||||
private Object[] args;
|
||||
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private String defaultMessage;
|
||||
|
||||
public BaseException(String module, String code, Object[] args, String defaultMessage)
|
||||
{
|
||||
this.module = module;
|
||||
this.code = code;
|
||||
this.args = args;
|
||||
this.defaultMessage = defaultMessage;
|
||||
}
|
||||
|
||||
public BaseException(String module, String code, Object[] args)
|
||||
{
|
||||
this(module, code, args, null);
|
||||
}
|
||||
|
||||
public BaseException(String module, String defaultMessage)
|
||||
{
|
||||
this(module, null, null, defaultMessage);
|
||||
}
|
||||
|
||||
public BaseException(String code, Object[] args)
|
||||
{
|
||||
this(null, code, args, null);
|
||||
}
|
||||
|
||||
public BaseException(String defaultMessage)
|
||||
{
|
||||
this(null, null, null, defaultMessage);
|
||||
}
|
||||
|
||||
public String getModule()
|
||||
{
|
||||
return module;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public Object[] getArgs()
|
||||
{
|
||||
return args;
|
||||
}
|
||||
|
||||
public String getDefaultMessage()
|
||||
{
|
||||
return defaultMessage;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.common.core.exception.file;
|
||||
|
||||
import com.bonus.common.core.exception.base.BaseException;
|
||||
|
||||
/**
|
||||
* 文件信息异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class FileException extends BaseException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileException(String code, Object[] args)
|
||||
{
|
||||
super("file", code, args, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.common.core.exception.file;
|
||||
|
||||
/**
|
||||
* 文件名称超长限制异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class FileNameLengthLimitExceededException extends FileException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileNameLengthLimitExceededException(int defaultFileNameLength)
|
||||
{
|
||||
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.common.core.exception.file;
|
||||
|
||||
/**
|
||||
* 文件名大小限制异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class FileSizeLimitExceededException extends FileException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileSizeLimitExceededException(long defaultMaxSize)
|
||||
{
|
||||
super("upload.exceed.maxSize", new Object[] { defaultMaxSize });
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.common.core.exception.file;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.apache.commons.fileupload.FileUploadException;
|
||||
|
||||
/**
|
||||
* 文件上传 误异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class InvalidExtensionException extends FileUploadException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String[] allowedExtension;
|
||||
private String extension;
|
||||
private String filename;
|
||||
|
||||
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
|
||||
{
|
||||
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
|
||||
this.allowedExtension = allowedExtension;
|
||||
this.extension = extension;
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public String[] getAllowedExtension()
|
||||
{
|
||||
return allowedExtension;
|
||||
}
|
||||
|
||||
public String getExtension()
|
||||
{
|
||||
return extension;
|
||||
}
|
||||
|
||||
public String getFilename()
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
public static class InvalidImageExtensionException extends InvalidExtensionException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
|
||||
{
|
||||
super(allowedExtension, extension, filename);
|
||||
}
|
||||
}
|
||||
|
||||
public static class InvalidFlashExtensionException extends InvalidExtensionException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
|
||||
{
|
||||
super(allowedExtension, extension, filename);
|
||||
}
|
||||
}
|
||||
|
||||
public static class InvalidMediaExtensionException extends InvalidExtensionException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
|
||||
{
|
||||
super(allowedExtension, extension, filename);
|
||||
}
|
||||
}
|
||||
|
||||
public static class InvalidVideoExtensionException extends InvalidExtensionException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename)
|
||||
{
|
||||
super(allowedExtension, extension, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.bonus.common.core.exception.job;
|
||||
|
||||
/**
|
||||
* 计划策略异常
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class TaskException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Code code;
|
||||
|
||||
public TaskException(String msg, Code code)
|
||||
{
|
||||
this(msg, code, null);
|
||||
}
|
||||
|
||||
public TaskException(String msg, Code code, Exception nestedEx)
|
||||
{
|
||||
super(msg, nestedEx);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Code getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public enum Code
|
||||
{
|
||||
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.common.core.exception.user;
|
||||
|
||||
/**
|
||||
* 验证码失效异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class CaptchaExpireException extends UserException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CaptchaExpireException()
|
||||
{
|
||||
super("user.jcaptcha.expire", null);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.common.core.exception.user;
|
||||
|
||||
import com.bonus.common.core.exception.base.BaseException;
|
||||
|
||||
/**
|
||||
* 用户信息异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class UserException extends BaseException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UserException(String code, Object[] args)
|
||||
{
|
||||
super("user", code, args, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.common.core.exception.user;
|
||||
|
||||
/**
|
||||
* 用户密码不正确或不符合规范异常类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class UserPasswordNotMatchException extends UserException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UserPasswordNotMatchException()
|
||||
{
|
||||
super("user.password.not.match", null);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.common.core.table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 分 页 参 数 封 装
|
||||
* @author zys 2023/07/12
|
||||
*/
|
||||
@Data
|
||||
public class PageDomain {
|
||||
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
private Integer page;
|
||||
|
||||
/**
|
||||
* 每页数量
|
||||
*/
|
||||
private Integer limit;
|
||||
|
||||
/**
|
||||
* 获取开始的数据行
|
||||
*/
|
||||
public Integer start() {
|
||||
return (this.page - 1) * this.limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结束的数据行
|
||||
*/
|
||||
public Integer end() {
|
||||
return this.page * this.limit;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package com.bonus.common.core.table;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 分页、查询参数解析
|
||||
*
|
||||
*/
|
||||
public class PageTableArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
Class<?> cla = parameter.getParameterType();
|
||||
|
||||
return cla.isAssignableFrom(PageTableRequest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
|
||||
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||
|
||||
PageTableRequest tableRequest = new PageTableRequest();
|
||||
Map<String, String[]> param = request.getParameterMap();
|
||||
if (param.containsKey("start")) {
|
||||
tableRequest.setOffset(Integer.parseInt(request.getParameter("start")));
|
||||
}
|
||||
|
||||
if (param.containsKey("length")) {
|
||||
tableRequest.setLimit(Integer.parseInt(request.getParameter("length")));
|
||||
}
|
||||
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
tableRequest.setParams(map);
|
||||
|
||||
param.forEach((k, v) -> {
|
||||
if (v.length == 1) {
|
||||
map.put(k, v[0]);
|
||||
} else {
|
||||
map.put(k, Arrays.asList(v));
|
||||
}
|
||||
});
|
||||
|
||||
setOrderBy(tableRequest, map);
|
||||
removeParam(tableRequest);
|
||||
|
||||
return tableRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除datatables分页带的一些复杂参数
|
||||
*
|
||||
* @param tableRequest
|
||||
*/
|
||||
private void removeParam(PageTableRequest tableRequest) {
|
||||
Map<String, Object> map = tableRequest.getParams();
|
||||
|
||||
if (!CollectionUtils.isEmpty(map)) {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
map.forEach((k, v) -> {
|
||||
if (k.indexOf("[") < 0 && k.indexOf("]") < 0 && !"_".equals(k)) {
|
||||
param.put(k, v);
|
||||
}
|
||||
});
|
||||
|
||||
tableRequest.setParams(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从datatables分页请求数据中解析排序
|
||||
*
|
||||
* @param tableRequest
|
||||
* @param map
|
||||
*/
|
||||
private void setOrderBy(PageTableRequest tableRequest, Map<String, Object> map) {
|
||||
StringBuilder orderBy = new StringBuilder();
|
||||
int size = map.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
String index = (String) map.get("order[" + i + "][column]");
|
||||
if (StringUtils.isEmpty(index)) {
|
||||
break;
|
||||
}
|
||||
String column = (String) map.get("columns[" + index + "][data]");
|
||||
if (StringUtils.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String sort = (String) map.get("order[" + i + "][dir]");
|
||||
|
||||
orderBy.append(column).append(" ").append(sort).append(", ");
|
||||
}
|
||||
|
||||
if (orderBy.length() > 0) {
|
||||
tableRequest.getParams().put("orderBy",
|
||||
" order by " + StringUtils.substringBeforeLast(orderBy.toString(), ","));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.bonus.common.core.table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页查询处理器
|
||||
*
|
||||
*/
|
||||
|
||||
public class PageTableHandler {
|
||||
|
||||
private CountHandler countHandler;
|
||||
private ListHandler listHandler;
|
||||
private OrderHandler orderHandler;
|
||||
|
||||
public PageTableHandler(CountHandler countHandler, ListHandler listHandler) {
|
||||
super();
|
||||
this.countHandler = countHandler;
|
||||
this.listHandler = listHandler;
|
||||
}
|
||||
|
||||
public PageTableHandler(CountHandler countHandler, ListHandler listHandler, OrderHandler orderHandler) {
|
||||
this(countHandler, listHandler);
|
||||
this.orderHandler = orderHandler;
|
||||
}
|
||||
|
||||
public PageTableResponse handle(PageTableRequest dtRequest) {
|
||||
int count = 0;
|
||||
List<?> list = null;
|
||||
|
||||
count = this.countHandler.count(dtRequest);
|
||||
if (count > 0) {
|
||||
if (orderHandler != null) {
|
||||
dtRequest = orderHandler.order(dtRequest);
|
||||
}
|
||||
list = this.listHandler.list(dtRequest);
|
||||
}
|
||||
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
|
||||
return new PageTableResponse(count, count, list);
|
||||
}
|
||||
|
||||
public interface ListHandler {
|
||||
List<?> list(PageTableRequest request);
|
||||
}
|
||||
|
||||
public interface CountHandler {
|
||||
int count(PageTableRequest request);
|
||||
}
|
||||
|
||||
public interface OrderHandler {
|
||||
PageTableRequest order(PageTableRequest request);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.common.core.table;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 分页查询参数
|
||||
*
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PageTableRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7328071045193618467L;
|
||||
|
||||
private Integer offset;
|
||||
private Integer limit;
|
||||
private Map<String, Object> params;
|
||||
|
||||
public Integer getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(Integer offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public Integer getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(Integer limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params) {
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.bonus.common.core.table;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页查询返回
|
||||
*
|
||||
*/
|
||||
public class PageTableResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 620421858510718076L;
|
||||
|
||||
private Integer recordsTotal;
|
||||
private Integer recordsFiltered;
|
||||
private List<?> data;
|
||||
|
||||
public PageTableResponse(Integer recordsTotal, Integer recordsFiltered, List<?> data) {
|
||||
super();
|
||||
this.recordsTotal = recordsTotal;
|
||||
this.recordsFiltered = recordsFiltered;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Integer getRecordsTotal() {
|
||||
return recordsTotal;
|
||||
}
|
||||
|
||||
public void setRecordsTotal(Integer recordsTotal) {
|
||||
this.recordsTotal = recordsTotal;
|
||||
}
|
||||
|
||||
public Integer getRecordsFiltered() {
|
||||
return recordsFiltered;
|
||||
}
|
||||
|
||||
public void setRecordsFiltered(Integer recordsFiltered) {
|
||||
this.recordsFiltered = recordsFiltered;
|
||||
}
|
||||
|
||||
public List<?> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<?> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bonus.common.core.text;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 字符集工具类
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class CharsetKit
|
||||
{
|
||||
/** ISO-8859-1 */
|
||||
public static final String ISO_8859_1 = "ISO-8859-1";
|
||||
/** UTF-8 */
|
||||
public static final String UTF_8 = "UTF-8";
|
||||
/** GBK */
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
/** ISO-8859-1 */
|
||||
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
|
||||
/** UTF-8 */
|
||||
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
|
||||
/** GBK */
|
||||
public static final Charset CHARSET_GBK = Charset.forName(GBK);
|
||||
|
||||
/**
|
||||
* 转换为Charset对象
|
||||
*
|
||||
* @param charset 字符集,为空则返回默认字符集
|
||||
* @return Charset
|
||||
*/
|
||||
public static Charset charset(String charset)
|
||||
{
|
||||
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换字符串的字符集编码
|
||||
*
|
||||
* @param source 字符串
|
||||
* @param srcCharset 源字符集,默认ISO-8859-1
|
||||
* @param destCharset 目标字符集,默认UTF-8
|
||||
* @return 转换后的字符集
|
||||
*/
|
||||
public static String convert(String source, String srcCharset, String destCharset)
|
||||
{
|
||||
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换字符串的字符集编码
|
||||
*
|
||||
* @param source 字符串
|
||||
* @param srcCharset 源字符集,默认ISO-8859-1
|
||||
* @param destCharset 目标字符集,默认UTF-8
|
||||
* @return 转换后的字符集
|
||||
*/
|
||||
public static String convert(String source, Charset srcCharset, Charset destCharset)
|
||||
{
|
||||
if (null == srcCharset)
|
||||
{
|
||||
srcCharset = StandardCharsets.ISO_8859_1;
|
||||
}
|
||||
|
||||
if (null == destCharset)
|
||||
{
|
||||
destCharset = StandardCharsets.UTF_8;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return new String(source.getBytes(srcCharset), destCharset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 系统字符集编码
|
||||
*/
|
||||
public static String systemCharset()
|
||||
{
|
||||
return Charset.defaultCharset().name();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,92 @@
|
|||
package com.bonus.common.core.text;
|
||||
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 字符串格式化
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
public class StrFormatter
|
||||
{
|
||||
public static final String EMPTY_JSON = "{}";
|
||||
public static final char C_BACKSLASH = '\\';
|
||||
public static final char C_DELIM_START = '{';
|
||||
public static final char C_DELIM_END = '}';
|
||||
|
||||
/**
|
||||
* 格式化字符串<br>
|
||||
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
|
||||
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
|
||||
* 例:<br>
|
||||
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
|
||||
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
|
||||
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
|
||||
*
|
||||
* @param strPattern 字符串模板
|
||||
* @param argArray 参数列表
|
||||
* @return 结果
|
||||
*/
|
||||
public static String format(final String strPattern, final Object... argArray)
|
||||
{
|
||||
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
|
||||
{
|
||||
return strPattern;
|
||||
}
|
||||
final int strPatternLength = strPattern.length();
|
||||
|
||||
// 初始化定义好的长度以获得更好的性能
|
||||
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
|
||||
|
||||
int handledPosition = 0;
|
||||
int delimIndex;// 占位符所在位置
|
||||
for (int argIndex = 0; argIndex < argArray.length; argIndex++)
|
||||
{
|
||||
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
|
||||
if (delimIndex == -1)
|
||||
{
|
||||
if (handledPosition == 0)
|
||||
{
|
||||
return strPattern;
|
||||
}
|
||||
else
|
||||
{ // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
|
||||
sbuf.append(strPattern, handledPosition, strPatternLength);
|
||||
return sbuf.toString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
|
||||
{
|
||||
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
|
||||
{
|
||||
// 转义符之前还有一个转义符,占位符依旧有效
|
||||
sbuf.append(strPattern, handledPosition, delimIndex - 1);
|
||||
sbuf.append(Convert.utf8Str(argArray[argIndex]));
|
||||
handledPosition = delimIndex + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 占位符被转义
|
||||
argIndex--;
|
||||
sbuf.append(strPattern, handledPosition, delimIndex - 1);
|
||||
sbuf.append(C_DELIM_START);
|
||||
handledPosition = delimIndex + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 正常占位符
|
||||
sbuf.append(strPattern, handledPosition, delimIndex);
|
||||
sbuf.append(Convert.utf8Str(argArray[argIndex]));
|
||||
handledPosition = delimIndex + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 加入最后一个占位符后所有的字符
|
||||
sbuf.append(strPattern, handledPosition, strPattern.length());
|
||||
|
||||
return sbuf.toString();
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,110 @@
|
|||
package com.bonus.common.core.utils;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 精确的浮点数运算
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class ArithUtil {
|
||||
|
||||
/**
|
||||
* 默认除法运算精度
|
||||
*/
|
||||
private static final int DEF_DIV_SCALE = 10;
|
||||
|
||||
/**
|
||||
* 这个类不能实例化
|
||||
*/
|
||||
private ArithUtil () {
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的加法运算。
|
||||
*
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static double add (double v1, double v2) {
|
||||
BigDecimal b1 = new BigDecimal( Double.toString( v1 ) );
|
||||
BigDecimal b2 = new BigDecimal( Double.toString( v2 ) );
|
||||
return b1.add( b2 ).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的减法运算。
|
||||
*
|
||||
* @param v1 被减数
|
||||
* @param v2 减数
|
||||
* @return 两个参数的差
|
||||
*/
|
||||
public static double sub (double v1, double v2) {
|
||||
BigDecimal b1 = new BigDecimal( Double.toString( v1 ) );
|
||||
BigDecimal b2 = new BigDecimal( Double.toString( v2 ) );
|
||||
return b1.subtract( b2 ).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的乘法运算。
|
||||
*
|
||||
* @param v1 被乘数
|
||||
* @param v2 乘数
|
||||
* @return 两个参数的积
|
||||
*/
|
||||
public static double mul (double v1, double v2) {
|
||||
BigDecimal b1 = new BigDecimal( Double.toString( v1 ) );
|
||||
BigDecimal b2 = new BigDecimal( Double.toString( v2 ) );
|
||||
return b1.multiply( b2 ).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
|
||||
* 小数点以后10位,以后的数字四舍五入。
|
||||
*
|
||||
* @param v1 被除数
|
||||
* @param v2 除数
|
||||
* @return 两个参数的商
|
||||
*/
|
||||
public static double div (double v1, double v2) {
|
||||
return div( v1, v2, DEF_DIV_SCALE );
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
|
||||
* 定精度,以后的数字四舍五入。
|
||||
*
|
||||
* @param v1 被除数
|
||||
* @param v2 除数
|
||||
* @param scale 表示表示需要精确到小数点以后几位。
|
||||
* @return 两个参数的商
|
||||
*/
|
||||
public static double div (double v1, double v2, int scale) {
|
||||
if (scale < 0) {
|
||||
throw new IllegalArgumentException( "The scale must be a positive integer or zero" );
|
||||
}
|
||||
BigDecimal b1 = new BigDecimal( Double.toString( v1 ) );
|
||||
BigDecimal b2 = new BigDecimal( Double.toString( v2 ) );
|
||||
if (b1.compareTo( BigDecimal.ZERO ) == 0) {
|
||||
return BigDecimal.ZERO.doubleValue();
|
||||
}
|
||||
return b1.divide( b2, scale, RoundingMode.HALF_UP ).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的小数位四舍五入处理。
|
||||
*
|
||||
* @param v 需要四舍五入的数字
|
||||
* @param scale 小数点后保留几位
|
||||
* @return 四舍五入后的结果
|
||||
*/
|
||||
public static double round (double v, int scale) {
|
||||
if (scale < 0) {
|
||||
throw new IllegalArgumentException( "The scale must be a positive integer or zero" );
|
||||
}
|
||||
BigDecimal b = new BigDecimal( Double.toString( v ) );
|
||||
BigDecimal one = new BigDecimal( "1" );
|
||||
return b.divide( one, scale, RoundingMode.HALF_UP ).doubleValue();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue