Browse Source

add system functions

main
wangshaoping 1 year ago
parent
commit
c3dd410f39
  1. 2
      app.platform/src/main/java/app/platform/Application.java
  2. 8
      com.xxl.job.core/build.gradle
  3. 223
      config/application.properties
  4. 48
      config/banner.txt
  5. 216
      config/license.txt
  6. 66
      config/logback-spring.xml
  7. 2
      gradle.properties
  8. 2
      io.sc.platform.app/build.gradle
  9. 2
      io.sc.platform.core.frontend/.npmrc
  10. 2
      io.sc.platform.gradle/templates/pgp/app/src/main/java/app/platform/Application.java.txt
  11. 2
      io.sc.platform.mvc/src/main/java/io/sc/platform/mvc/controller/IndexWebController.java
  12. 2
      io.sc.platform.orm.mybatis/build.gradle
  13. 8
      io.sc.platform.security/src/main/java/io/sc/platform/security/initializer/RoleAndUserInitializer.java
  14. 2
      io.sc.platform.security/src/main/resources/META-INF/services/io.sc.platform.core.initializer.ApplicationInitializer
  15. 3
      io.sc.platform.system/src/main/java/io/sc/platform/system/announcement/controller/AnnouncementWebController.java
  16. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/auditlog/controller/AuditLogWebController.java
  17. 4
      io.sc.platform.system/src/main/java/io/sc/platform/system/corporation/controller/CorporationWebController.java
  18. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/dictionary/controller/DictionaryWebController.java
  19. 3
      io.sc.platform.system/src/main/java/io/sc/platform/system/ds/controller/DsWebController.java
  20. 10
      io.sc.platform.system/src/main/java/io/sc/platform/system/i18n/controller/I18nWebController.java
  21. 92
      io.sc.platform.system/src/main/java/io/sc/platform/system/initializer/RoleAndMenuInitializer.java
  22. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/menu/controller/MenuWebController.java
  23. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/menu/service/MenuService.java
  24. 51
      io.sc.platform.system/src/main/java/io/sc/platform/system/menu/service/impl/MenuServiceImpl.java
  25. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/monitor/controller/LogViewerWebController.java
  26. 9
      io.sc.platform.system/src/main/java/io/sc/platform/system/org/controller/OrgWebController.java
  27. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/parameter/controller/ParameterWebController.java
  28. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/preference/controller/PreferencesWebController.java
  29. 4
      io.sc.platform.system/src/main/java/io/sc/platform/system/role/controller/RoleWebController.java
  30. 20
      io.sc.platform.system/src/main/java/io/sc/platform/system/user/controller/UserWebController.java
  31. 2
      io.sc.platform.system/src/main/java/io/sc/platform/system/user/service/UserService.java
  32. 6
      io.sc.platform.system/src/main/java/io/sc/platform/system/user/service/impl/UserServiceImpl.java
  33. 1
      io.sc.platform.system/src/main/resources/META-INF/services/io.sc.platform.core.initializer.ApplicationInitializer
  34. 3
      settings.gradle

2
app.platform/src/main/java/app/platform/Application.java

@ -2,6 +2,7 @@ package app.platform;
import io.sc.platform.core.ApplicationLauncher;
import io.sc.platform.core.PlatformSpringBootServletInitializer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.WebApplicationInitializer;
@ -9,6 +10,7 @@ import org.springframework.web.WebApplicationInitializer;
* 应用程序入口
*/
@SpringBootApplication(proxyBeanMethods = false)
@MapperScan("com.xxl.job.admin.dao")
public class Application extends PlatformSpringBootServletInitializer implements WebApplicationInitializer {
public static void main(String[] args) throws Exception {
ApplicationLauncher.run(Application.class,args);

8
com.xxl.job.core/build.gradle

@ -0,0 +1,8 @@
dependencies {
api(
"org.springframework.boot:spring-boot-starter-web",
"io.netty:netty-codec-http",
"com.google.code.gson:gson",
"org.codehaus.groovy:groovy",
)
}

223
config/application.properties

@ -1,223 +0,0 @@
##########################################################################
#(100) excluded auto configuration - io.sc.platform.core
##########################################################################
spring.autoconfigure.exclude =
##########################################################################
#(150) application configuration - io.sc.platform.core
##########################################################################
# - io.sc.platform.core
application.audit-log-mode = none
#application.audit-log-mode = none
#application.audit-log-mode = log
#application.audit-log-mode = database
# - io.sc.platform.installer
application.installer.enabled = true
# - io.sc.platform.jdbc.liquibase
application.updater.enabled = true
# - io.sc.platform.security
application.default-password = password
##########################################################################
#(200) spring.main configuration - io.sc.platform.core
##########################################################################
spring.main.allow-bean-definition-overriding = false
spring.main.banner-mode = console
spring.main.lazy-initialization = false
spring.main.log-startup-info = true
spring.main.register-shutdown-hook = true
##########################################################################
#(210) jasypt encryptor configuration - io.sc.platform.core
##########################################################################
jasypt.encryptor.bean = platformJasyptStringEncryptor
##########################################################################
#(300) web server configuration - io.sc.platform.mvc
##########################################################################
#server.address = 127.0.0.1
server.port = 8080
server.servlet.context-path = /
server.servlet.session.timeout = 30m
server.error.path = /error
server.error.whitelabel.enabled = true
server.error.include-exception = true
server.error.include-binding-errors = always
server.error.include-message = always
server.error.include-stacktrace = always
##########################################################################
#(1000) dataSource configuration - io.sc.platform.jdbc
##########################################################################
spring.datasource.items[primary].driver-class-name = org.h2.Driver
spring.datasource.items[primary].url = jdbc:h2:mem:DB_PLATFORM;DB_CLOSE_DELAY=-1
spring.datasource.items[primary].username = platform
spring.datasource.items[primary].password = platform
##########################################################################
#(1100) jpa configuration - io.sc.platform.orm.jpa
##########################################################################
spring.jpa.open-in-view = false
spring.jpa.show-sql = false
spring.jpa.generate-ddl = false
spring.jpa.hibernate.ddl-auto = none
spring.jpa.hibernate.jdbc.batch_size = 25
spring.jpa.properties.hibernate.enable_lazy_load_no_trans =true
spring.jpa.properties.hibernate.dialect =org.hibernate.dialect.H2Dialect
##########################################################################
#(1500) hikari configuration - io.sc.platform.jdbc
##########################################################################
#spring.datasource.items[primary].hikari.autoCommit = true
#spring.datasource.items[primary].hikari.connectionTimeout = 10000
#spring.datasource.items[primary].hikari.idleTimeout = 600000
#spring.datasource.items[primary].hikari.maxLifetime = 1800000
#spring.datasource.items[primary].hikari.minimumIdle = 10
#spring.datasource.items[primary].hikari.maximumPoolSize = 10
#spring.datasource.items[primary].hikari.metricRegistry =
#spring.datasource.items[primary].hikari.healthCheckRegistry =
#spring.datasource.items[primary].hikari.poolName =
#spring.datasource.items[primary].hikari.initializationFailTimeout = 1
#spring.datasource.items[primary].hikari.isolateInternalQueries = false
#spring.datasource.items[primary].hikari.allowPoolSuspension = false
#spring.datasource.items[primary].hikari.readOnly = false
#spring.datasource.items[primary].hikari.registerMbeans = false
#spring.datasource.items[primary].hikari.catalog =
#spring.datasource.items[primary].hikari.connectionInitSql =
#spring.datasource.items[primary].hikari.driverClassName =
#spring.datasource.items[primary].hikari.transactionIsolation =
#spring.datasource.items[primary].hikari.validationTimeout = 5000
#spring.datasource.items[primary].hikari.leakDetectionThreshold = 0
#spring.datasource.items[primary].hikari.dataSource =
#spring.datasource.items[primary].hikari.schema =
#spring.datasource.items[primary].hikari.threadFactory =
#spring.datasource.items[primary].hikari.scheduledExecutor =
##########################################################################
#(2100) spring.session configuration - io.sc.platform.mvc
##########################################################################
spring.session.store-type = none
#spring.session.store-type = jdbc
#spring.session.store-type = redis
spring.session.jdbc.initializer.enabled = false
spring.session.jdbc.cleanup-cron = 0 */5 * * * *
spring.session.redis.namespace = spring:session
spring.session.redis.cleanupCron = 0 */5 * * * *
##########################################################################
#(2200) spring web configuration (WebProperties) - io.sc.platform.mvc
##########################################################################
spring.web.resources.add-mappings = true
spring.web.resources.cache.cachecontrol.cache-public = true
spring.web.resources.cache.cachecontrol.must-revalidate = true
spring.web.resources.chain.cache = true
spring.web.resources.chain.compressed = true
##########################################################################
#(2300) management http server configuration - io.sc.platform.mvc
##########################################################################
management.endpoints.enabled-by-default = true
management.endpoints.web.exposure.include = *
management.context-path = /actuator
management.security.enabled = false
##########################################################################
#(2400) thymeleaf configuration - io.sc.platform.mvc
##########################################################################
spring.thymeleaf.enabled = true
spring.thymeleaf.cache = false
spring.thymeleaf.encoding = UTF-8
spring.thymeleaf.mode = HTML
spring.thymeleaf.prefix = classpath:/templates/
spring.thymeleaf.check-template = false
spring.thymeleaf.check-template-location = false
spring.thymeleaf.servlet.content-type = text/html
##########################################################################
#(2500) jackson configuration - io.sc.platform.mvc
##########################################################################
spring.jackson.time-zone = Asia/Shanghai
spring.jackson.date-format = yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.indent_output = true
spring.jackson.serialization.fail_on_empty_beans = false
spring.jackson.deserialization.fail_on_ignored_properties = false
spring.jackson.parser.allow_comments = true
spring.jackson.parser.allow_single_quotes = true
spring.jackson.parser.allow_trailing_comma = true
spring.jackson.parser.allow_unquoted_field_names = true
spring.jackson.parser.ignore_undefined = true
spring.jackson.parser.allow_unquoted_control_chars = true
##########################################################################
#(2600) i18n message source configuration - io.sc.platform.mvc
##########################################################################
spring.messages.alwaysUseMessageFormat = false
spring.messages.cacheDuration = -1
spring.messages.encoding = UTF-8
spring.messages.fallbackToSystemLocale = false
spring.messages.useCodeAsDefaultMessage = true
##########################################################################
#(3000) platform security configuration - io.sc.platform.security.loginform
##########################################################################
spring.security.formLogin.loginPage = /login
spring.security.formLogin.loginProcessingUrl = /login
spring.security.formLogin.failureUrl = /login-error
spring.security.logout.logoutUrl = /logout
spring.security.logout.logoutSuccessUrl = /
##########################################################################
#(4000) email configuration - io.sc.platform.communication
##########################################################################
spring.mail.host=zzz.xxx.yyy
spring.mail.port=25
spring.mail.protocol=smtp
spring.mail.test-connection=false
spring.mail.default-encoding=UTF-8
spring.mail.properties.mail.smtp.auth=true
spring.mail.username=xxx
spring.mail.password=yyy
##########################################################################
#(5000) flowable bpm configuration - io.sc.platform.flowable
##########################################################################
# core
flowable.asyncExecutorActivate =false
flowable.asyncHistoryExecutorActivate = false
flowable.check-process-definitions=false
flowable.custom-mybatis-mappers=
flowable.custom-mybatis-x-m-l-mappers=
flowable.database-schema=
flowable.database-schema-update=true
flowable.db-history-used=true
flowable.deployment-name=SpringBootAutoDeployment
flowable.history-level=
flowable.process-definition-location-prefix=classpath*:/processes/
flowable.process-definition-location-suffixes=**.bpmn20.xml,**.bpmn
# process
flowable.process.definition-cache-limit=-1
flowable.process.enable-safe-xml=true
flowable.process.servlet.load-on-startup=-1
flowable.process.servlet.name=Flowable BPMN Rest API
flowable.process.servlet.path=/process-api
# cmmn
flowable.cmmn.enabled=false
# content
flowable.content.enabled=false
# dmn
flowable.dmn.enabled=false
# form
flowable.form.enabled=false
# idm
flowable.idm.enabled=false
##########################################################################
#(8000) cxf configuration - io.sc.platform.ws.cxf
##########################################################################
cxf.path = /webservices
##########################################################################
#(9000) p6spy configuration - io.sc.platform.jdbc
##########################################################################
p6spy.enabled = true
p6spy.ignorePattern = false

48
config/banner.txt

@ -1,48 +0,0 @@
**************************************************************************************
Name: app.platform
Version: ${application.version}
Base on Spring Boot ${spring-boot.version}
**************************************************************************************
System.environment:
--------------------------------------------------------------------------------------
java.specification.version = 1.8
java.specification.vendor = Oracle Corporation
java.specification.name = Java Platform API Specification
java.vm.specification.version = 1.8
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.name = Java Virtual Machine Specification
java.home = /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre
java.version = 1.8.0_332
java.vendor = Azul Systems, Inc.
java.vendor.url = http://www.azul.com/
java.vm.version = 25.332-b09
java.vm.vendor = Azul Systems, Inc.
java.vm.name = OpenJDK 64-Bit Server VM
java.class.version = 52.0
java.class.path = ${java.class.path2}
java.library.path = /Users/wangshaoping/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
java.io.tmpdir = /var/folders/82/6m96_g610hj1v1tcpvhtjysr0000gn/T/
java.ext.dirs = /Users/wangshaoping/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
os.name = Mac OS X
os.arch = aarch64
os.version = 13.5.1
user.name = wangshaoping
user.home = /Users/wangshaoping
user.dir = /Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform
Application.environment
--------------------------------------------------------------------------------------
application.name = app.platform
application.is-running-in-development = false
application.is-running-in-web-container = false
application.home.dir = /Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform
application.installer.enabled = ${application.installer.enabled}
application.updater.enabled = ${application.updater.enabled}
application.audit-log-mode = ${application.audit-log-mode}
spring.config.location = file:/Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform/config/application.properties
spring.banner.location = file:/Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform/config/banner.txt
logging.config = file:/Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform/config/logback-spring.xml
p6spy.enabled = ${p6spy.enabled}
p6spy.ignorePattern = ${p6spy.ignorePattern}
**************************************************************************************

216
config/license.txt

@ -1,216 +0,0 @@
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=======================================================================
To the extent any open source subcomponents are licensed under the EPL and/or other
similar licenses that require the source code and/or modifications to
source code to be made available (as would be noted above), you may obtain a
copy of the source code corresponding to the binaries for such open source
components and modifications thereto, if any, (the "Source Files"), by
downloading the Source Files from https://www.springsource.org/download,
or by sending a request, with your name and address to: VMware, Inc., 3401 Hillview
Avenue, Palo Alto, CA 94304, United States of America or email info@vmware.com. All
such requests should clearly specify: OPEN SOURCE FILES REQUEST, Attention General
Counsel. VMware shall mail a copy of the Source Files to you on a CD or equivalent
physical medium. This offer to obtain a copy of the Source Files is valid for three
years from the date you acquired this Software product.

66
config/logback-spring.xml

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 自动扫描本文件,如果发生变化,则重新初始化日志系统,并设置每隔5秒钟扫描一次 -->
<configuration debug="false" scan="true" scanPeriod="5 seconds">
<!--
以下为 logback 的 spring 扩展支持的功能,即支持从 application.properties 文件中获取属性,并在此文件中采用 ${} 方式使用。
要使用此功能,必须使用 logback-ext-spring 扩展 jar 包,以 gradle 构建系统,则需要加入以下依赖
dependencies {
compile(
"org.logback-extensions:logback-ext-spring:0.1.2"
)
}
-->
<property name="homedir" value="/Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform"/>
<property name="pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{36} - %msg%n"/>
<!-- 在控制台中输出日志 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder><pattern>${pattern}</pattern></encoder>
</appender>
<!-- 在磁盘文件中输出日志 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder><pattern>${pattern}</pattern></encoder>
<file>${homedir}/logs/log.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${homedir}/logs/log.%d.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
<logger name="org.wsp.engine.model.core.code" level="info" additivity="false"/>
<logger name="org.wsp.engine.rule.core.code" level="debug" additivity="false">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</logger>
<logger name="org.springframework.security" level="info" additivity="false">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</logger>
<!-- 可对不同的日志写入不同的文件示例 -->
<!--
<appender name="RULE_ENGINE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder><pattern>${pattern}</pattern></encoder>
<file>${homedir}/logs/rule-engine.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${homedir}/logs/rule-engine.%d.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
<logger name="org.wsp.engine.rule.core.code" level="debug" additivity="false">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="RULE_ENGINE_FILE" />
</logger>
-->
</configuration>

2
gradle.properties

@ -37,7 +37,7 @@ application_version=1.0.0
###########################################################
platform_group=io.sc
platform_version=8.1.13
platform_plugin_version=8.1.11
platform_plugin_version=8.1.13
platform_core_frontend_version=8.1.42
###########################################################

2
io.sc.platform.app/build.gradle

@ -1,5 +1,7 @@
dependencies {
api(
// project(":com.xxl.job.admin"),
// project(":com.xxl.job.core"),
project(":io.sc.platform.csv"),
project(":io.sc.platform.communication"),
project(":io.sc.platform.flowable"),

2
io.sc.platform.core.frontend/.npmrc

@ -8,4 +8,4 @@ email=
# 登录 npm 仓库的用户认证信息, 在 npm publish 时使用, publish 的 npm registry 在 package.json 文件中 publishConfig 部分配置
# _authToken 可通过以下命令获取
# curl -X PUT -H "Content-Type:application/json" -d '{"_id":"org.couchdb.user:admin","name":"admin","password":"admin"}' http://nexus.sc.io:8000/repository/npm-releases/-/user/org.couchdb.user:admin
//nexus.sc.io:8000/repository/npm-releases/:_authToken=NpmToken.25afcf59-9193-3068-bcfa-faf76ceadb13
//nexus.sc.io:8000/repository/npm-releases/:_authToken=NpmToken.193db44c-7ca5-3cb6-a990-d24b93fb0d10

2
io.sc.platform.gradle/templates/pgp/app/src/main/java/app/platform/Application.java.txt

@ -2,6 +2,7 @@ package app.platform;
import io.sc.platform.core.ApplicationLauncher;
import io.sc.platform.core.PlatformSpringBootServletInitializer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.WebApplicationInitializer;
@ -9,6 +10,7 @@ import org.springframework.web.WebApplicationInitializer;
* 应用程序入口
*/
@SpringBootApplication(proxyBeanMethods = false)
@MapperScan("com.xxl.job.admin.dao")
public class Application extends PlatformSpringBootServletInitializer implements WebApplicationInitializer {
public static void main(String[] args) throws Exception {
ApplicationLauncher.run(Application.class,args);

2
io.sc.platform.mvc/src/main/java/io/sc/platform/mvc/controller/IndexWebController.java

@ -19,7 +19,7 @@ public class IndexWebController {
@RequestMapping(value={"","/","index.html"})
public ModelAndView index(HttpServletRequest request) {
ModelAndView mv =new ModelAndView(systemParameterService.getParameter("parameter.system.indexPageTemplate"));
ModelAndView mv =new ModelAndView("io.sc.platform.mvc.frontend.html");
return mv;
}
}

2
io.sc.platform.orm.mybatis/build.gradle

@ -1,6 +1,6 @@
dependencies {
api(
project(":io.sc.platform.orm"),
"org.mybatis:mybatis:${mybatis_version}",
"org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.2",
)
}

8
io.sc.platform.security/src/main/java/io/sc/platform/security/initializer/AdministratorRoleAndUserInitializer.java → io.sc.platform.security/src/main/java/io/sc/platform/security/initializer/RoleAndUserInitializer.java

@ -14,8 +14,8 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import java.util.Date;
public class AdministratorRoleAndUserInitializer implements ApplicationInitializer{
private static final Logger log =LoggerFactory.getLogger(AdministratorRoleAndUserInitializer.class);
public class RoleAndUserInitializer implements ApplicationInitializer{
private static final Logger log =LoggerFactory.getLogger(RoleAndUserInitializer.class);
private Boolean isInitialized =null;
private PasswordEncoder passwordEncoder;
private JdbcTemplate jdbcTemplate;
@ -28,12 +28,12 @@ public class AdministratorRoleAndUserInitializer implements ApplicationInitializ
@Override
public String getName() {
return "Role Initializer";
return "User and Role Initializer";
}
@Override
public String getDescription() {
return "Initialize administrator role";
return "Initialize User and Role";
}
@Override

2
io.sc.platform.security/src/main/resources/META-INF/services/io.sc.platform.core.initializer.ApplicationInitializer

@ -1,2 +1,2 @@
io.sc.platform.security.initializer.CorporationInitializer
io.sc.platform.security.initializer.AdministratorRoleAndUserInitializer
io.sc.platform.security.initializer.RoleAndUserInitializer

3
io.sc.platform.system/src/main/java/io/sc/platform/system/announcement/controller/AnnouncementController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/announcement/controller/AnnouncementWebController.java

@ -1,7 +1,6 @@
package io.sc.platform.system.announcement.controller;
import io.sc.platform.mvc.controller.support.RestCrudController;
import io.sc.platform.system.announcement.convertor.AnnouncementEntityVoConverter;
import io.sc.platform.system.announcement.jpa.entity.AnnouncementEntity;
import io.sc.platform.system.announcement.jpa.repository.AnnouncementRepository;
import io.sc.platform.system.announcement.service.AnnouncementService;
@ -10,5 +9,5 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("api/system/announcement")
public class AnnouncementController extends RestCrudController<AnnouncementEntity,String, AnnouncementRepository, AnnouncementService> {
public class AnnouncementWebController extends RestCrudController<AnnouncementEntity,String, AnnouncementRepository, AnnouncementService> {
}

2
io.sc.platform.system/src/main/java/io/sc/platform/system/auditlog/controller/AuditLogController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/auditlog/controller/AuditLogWebController.java

@ -9,6 +9,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/system/monitor/auditlog")
public class AuditLogController extends RestCrudController<AuditLogEntity,String,AuditLogRepository, AuditLogService> {
public class AuditLogWebController extends RestCrudController<AuditLogEntity,String,AuditLogRepository, AuditLogService> {
}

4
io.sc.platform.system/src/main/java/io/sc/platform/system/corporation/controller/CorporationController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/corporation/controller/CorporationWebController.java

@ -1,17 +1,15 @@
package io.sc.platform.system.corporation.controller;
import io.sc.platform.mvc.controller.support.RestCrudController;
import io.sc.platform.system.api.corporation.CorporationVo;
import io.sc.platform.system.corporation.convertor.CorporationEntityVoConverter;
import io.sc.platform.system.corporation.jpa.entity.CorporationEntity;
import io.sc.platform.system.corporation.jpa.repository.CorporationRepository;
import io.sc.platform.system.corporation.service.CorporationService;
import io.sc.platform.system.org.convertor.OrgEntityVoConverter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("api/system/corporation")
public class CorporationController extends RestCrudController<CorporationEntity,String,CorporationRepository, CorporationService> {
public class CorporationWebController extends RestCrudController<CorporationEntity,String,CorporationRepository, CorporationService> {
private CorporationEntityVoConverter converter =new CorporationEntityVoConverter();
}

2
io.sc.platform.system/src/main/java/io/sc/platform/system/dictionary/controller/DictionaryController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/dictionary/controller/DictionaryWebController.java

@ -14,7 +14,7 @@ import java.util.List;
@RestController
@RequestMapping("api/system/dictionary")
public class DictionaryController extends RestCrudController<DictionaryEntity,String,DictionaryRepository, DictionaryService> {
public class DictionaryWebController extends RestCrudController<DictionaryEntity,String,DictionaryRepository, DictionaryService> {
@PostMapping("updateDictionariesOrder")
public void updateDictionariesOrder(@RequestBody List<OrderItem<String,Integer>> orderItems) throws Exception{

3
io.sc.platform.system/src/main/java/io/sc/platform/system/ds/controller/DsController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/ds/controller/DsWebController.java

@ -1,7 +1,6 @@
package io.sc.platform.system.ds.controller;
import io.sc.platform.mvc.controller.support.RestCrudController;
import io.sc.platform.system.api.ds.DsVo;
import io.sc.platform.system.ds.jpa.entity.DsEntity;
import io.sc.platform.system.ds.jpa.repository.DsRepository;
import io.sc.platform.system.ds.service.DsService;
@ -10,6 +9,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/datasource")
public class DsController extends RestCrudController<DsEntity,String,DsRepository, DsService> {
public class DsWebController extends RestCrudController<DsEntity,String,DsRepository, DsService> {
}

10
io.sc.platform.system/src/main/java/io/sc/platform/system/i18n/controller/I18nController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/i18n/controller/I18nWebController.java

@ -2,23 +2,15 @@ package io.sc.platform.system.i18n.controller;
import io.sc.platform.core.service.MessageSourceService;
import io.sc.platform.mvc.controller.support.RestCrudController;
import io.sc.platform.system.api.i18n.I18n;
import io.sc.platform.system.api.i18n.I18nLanguage;
import io.sc.platform.system.auditlog.jpa.entity.AuditLogEntity;
import io.sc.platform.system.auditlog.jpa.repository.AuditLogRepository;
import io.sc.platform.system.auditlog.service.AuditLogService;
import io.sc.platform.system.i18n.jpa.entity.I18nEntity;
import io.sc.platform.system.i18n.jpa.repository.I18nRepository;
import io.sc.platform.system.i18n.service.I18nService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/api/system/i18n")
public class I18nController extends RestCrudController<I18nEntity,String, I18nRepository, I18nService> {
public class I18nWebController extends RestCrudController<I18nEntity,String, I18nRepository, I18nService> {
@Autowired private MessageSourceService messageSourceService;
@PostMapping("importMessages")

92
io.sc.platform.system/src/main/java/io/sc/platform/system/initializer/RoleAndMenuInitializer.java

@ -0,0 +1,92 @@
package io.sc.platform.system.initializer;
import io.sc.platform.core.initializer.ApplicationInitializer;
import io.sc.platform.core.initializer.ApplicationInitializerExecuteException;
import io.sc.platform.jdbc.sql.builder.SqlBuilder;
import io.sc.platform.security.service.support.Role;
import io.sc.platform.system.menu.convertor.MenuEntityVoConvertor;
import io.sc.platform.system.menu.jpa.entity.MenuEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.List;
public class RoleAndMenuInitializer implements ApplicationInitializer{
private static final Logger log =LoggerFactory.getLogger(RoleAndMenuInitializer.class);
private Boolean isInitialized =null;
private JdbcTemplate jdbcTemplate;
@Override
public void init(ApplicationContext applicationContext) {
this.jdbcTemplate =applicationContext.getBean(JdbcTemplate.class);
}
@Override
public String getName() {
return "Role and Menu Initializer";
}
@Override
public String getDescription() {
return "Initialize Role and Menu";
}
@Override
public int getOrder() {
return 3000;
}
@Override
public synchronized boolean isInitialized() {
if(isInitialized!=null) {
return isInitialized;
}
try {
int count = countRoleAndMenu();
if(count==0) {
isInitialized =false;
return isInitialized;
}
} catch (Exception e) {
log.error("",e);
}
isInitialized =true;
return isInitialized;
}
@Override
public void execute() throws ApplicationInitializerExecuteException {
Role role =findAdminRole();
if(role!=null){
List<MenuEntity> menus =findMenus();
if(menus!=null && !menus.isEmpty()){
for(MenuEntity menu : menus){
insertRoleAndMenu(role.getId(),menu.getId());
}
}
}
}
private Role findAdminRole(){
return jdbcTemplate.query("select * from SYS_ROLE where CODE_='admin'", Role.getResultSetExtractor());
}
private List<MenuEntity> findMenus(){
return jdbcTemplate.query("select * from SYS_MENU",new MenuEntityVoConvertor());
}
private void insertRoleAndMenu(String roleId,String menuId){
SqlBuilder.getInsertIntoSqlBuilder()
.table("SYS_ROLE_MENU")
.field("ROLE_ID_",roleId)
.field("MENU_ID_",menuId)
.insert(jdbcTemplate);
}
private int countRoleAndMenu(){
return jdbcTemplate.queryForObject("select count(*) from SYS_ROLE_MENU", Integer.class);
}
}

2
io.sc.platform.system/src/main/java/io/sc/platform/system/menu/controller/MenuController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/menu/controller/MenuWebController.java

@ -15,7 +15,7 @@ import java.util.List;
@RestController
@RequestMapping("/api/system/menu")
public class MenuController extends RestCrudController<MenuEntity,String, MenuRepository, MenuService> {
public class MenuWebController extends RestCrudController<MenuEntity,String, MenuRepository, MenuService> {
/**
* 列出所有菜单树,并且将角色所拥有的菜单列表作出标记
* @param roleId 角色ID

2
io.sc.platform.system/src/main/java/io/sc/platform/system/menu/service/MenuService.java

@ -12,6 +12,8 @@ import java.util.List;
public interface MenuService extends DaoService<MenuEntity, String, MenuRepository> {
public List<MenuEntity> getMenusByUser(String userId) throws Exception;
/**
* 列出所有菜单树,并且将角色所拥有的菜单列表作出标记
* @param roleId 角色ID

51
io.sc.platform.system/src/main/java/io/sc/platform/system/menu/service/impl/MenuServiceImpl.java

@ -37,6 +37,57 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
private TreeBuilder<MenuEntity,String> treeBuilder =new MenuEntityTreeBuilder();
@Autowired private JdbcTemplate jdbcTemplate;
@Override
public List<MenuEntity> getMenusByUser(String userId) throws Exception {
if(!StringUtils.hasText(userId)){
throw new IllegalArgumentException("user's login name is empty!");
}
String sql =""
+ " select * from SYS_MENU"
+ " where "
+ " ID_ in ("
+ " select distinct MENU_ID_ from SYS_ROLE_MENU"
+ " where ROLE_ID_ in ("
+ " select distinct ROLE_ID_ from SYS_USER_ROLE"
+ " where USER_ID_=?"
+ " )"
+ " )"
+ " and ENABLE_=1"
+ " order by ORDER_";
List<MenuEntity> roleMenus =jdbcTemplate.query(sql, new MenuEntityVoConvertor(),userId);
//获取用户所属机构的有权访问的菜单
sql =""
+ " select * from SYS_MENU"
+ " where "
+ " ID_ in ("
+ " select distinct MENU_ID_ from SYS_ORG_MENU"
+ " where ORG_ID_ in ("
+ " select distinct ORG_ID_ from SYS_USER_ORG"
+ " where USER_ID_=?"
+ " )"
+ " )"
+ " and ENABLE_=1"
+ " order by ORDER_";
List<MenuEntity> orgMenus =jdbcTemplate.query(sql, new MenuEntityVoConvertor(),userId);
//最终合并后的菜单
List<MenuEntity> menus =null;
if(orgMenus!=null && orgMenus.size()>0){
menus =new ArrayList<MenuEntity>();
for(MenuEntity roleMenu : roleMenus){
if(orgMenus.contains(roleMenu)){
menus.add(roleMenu);
}
}
}else{
menus =roleMenus;
}
return menus;
}
@Override
public List<MenuVo> listAllMenusWithSelectedStatusByRole(String roleId, QueryParameter queryParameter) throws Exception {
MenuEntityVoConvertor converter =new MenuEntityVoConvertor();

2
io.sc.platform.system/src/main/java/io/sc/platform/system/monitor/controller/LogViewerController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/monitor/controller/LogViewerWebController.java

@ -22,7 +22,7 @@ import java.util.*;
@RestController
@RequestMapping("/api/monitor/logger")
public class LogViewerController {
public class LogViewerWebController {
@Autowired private LoggersEndpoint loggersEndpoint;
@PostMapping("getLogFileContents")

9
io.sc.platform.system/src/main/java/io/sc/platform/system/org/controller/OrgController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/org/controller/OrgWebController.java

@ -5,25 +5,18 @@ import io.sc.platform.mvc.support.One2Many;
import io.sc.platform.orm.service.support.QueryParameter;
import io.sc.platform.orm.service.support.QueryResult;
import io.sc.platform.system.api.org.OrgVo;
import io.sc.platform.system.api.role.RoleVo;
import io.sc.platform.system.org.convertor.OrgEntityVoConverter;
import io.sc.platform.system.org.jpa.entity.OrgEntity;
import io.sc.platform.system.org.jpa.repository.OrgRepository;
import io.sc.platform.system.org.service.OrgService;
import io.sc.platform.system.role.convertor.RoleEntityVoConverter;
import io.sc.platform.system.role.jpa.entity.RoleEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.domain.Page;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/api/system/org")
public class OrgController extends RestCrudController<OrgEntity,String,OrgRepository, OrgService> {
public class OrgWebController extends RestCrudController<OrgEntity,String,OrgRepository, OrgService> {
private OrgEntityVoConverter converter =new OrgEntityVoConverter();
/**

2
io.sc.platform.system/src/main/java/io/sc/platform/system/parameter/controller/ParameterController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/parameter/controller/ParameterWebController.java

@ -9,6 +9,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("api/system/parameter")
public class ParameterController extends RestCrudController<ParameterEntity,String, ParameterRepository, ParameterService> {
public class ParameterWebController extends RestCrudController<ParameterEntity,String, ParameterRepository, ParameterService> {
}

2
io.sc.platform.system/src/main/java/io/sc/platform/system/preference/controller/PreferencesController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/preference/controller/PreferencesWebController.java

@ -5,6 +5,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/preferences")
public class PreferencesController {
public class PreferencesWebController {
}

4
io.sc.platform.system/src/main/java/io/sc/platform/system/role/controller/RoleController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/role/controller/RoleWebController.java

@ -9,15 +9,13 @@ import io.sc.platform.system.role.convertor.RoleEntityVoConverter;
import io.sc.platform.system.role.jpa.entity.RoleEntity;
import io.sc.platform.system.role.jpa.repository.RoleRepository;
import io.sc.platform.system.role.service.RoleService;
import io.sc.platform.system.user.convertor.UserEntityVoConverter;
import io.sc.platform.system.user.jpa.entity.UserEntity;
import org.springframework.data.domain.Page;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/system/role")
public class RoleController extends RestCrudController<RoleEntity,String,RoleRepository, RoleService> {
public class RoleWebController extends RestCrudController<RoleEntity,String,RoleRepository, RoleService> {
private RoleEntityVoConverter converter =new RoleEntityVoConverter();
/**

20
io.sc.platform.system/src/main/java/io/sc/platform/system/user/controller/UserController.java → io.sc.platform.system/src/main/java/io/sc/platform/system/user/controller/UserWebController.java

@ -1,7 +1,5 @@
package io.sc.platform.system.user.controller;
import io.sc.platform.jdbc.meta.MetaDataLoader;
import io.sc.platform.jdbc.meta.support.Table;
import io.sc.platform.mvc.controller.support.RestCrudController;
import io.sc.platform.mvc.support.One2Many;
import io.sc.platform.orm.api.exception.UserNewPasswordAndConfirmNewPasswordNotMatchException;
@ -16,26 +14,22 @@ import io.sc.platform.system.user.jpa.repository.UserRepository;
import io.sc.platform.system.user.service.UserService;
import io.sc.platform.system.user.service.support.SetUserPasswordWrapper;
import io.sc.platform.system.user.service.support.UserSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;
import java.security.Principal;
import java.util.List;
import java.util.Map;
import io.sc.platform.jdbc.meta.MetaDataLoader;
@RestController
@RequestMapping("/api/system/user")
public class UserController extends RestCrudController<UserEntity,String, UserRepository, UserService> {
private UserEntityVoConverter converter =new UserEntityVoConverter();
public class UserWebController extends RestCrudController<UserEntity,String, UserRepository, UserService> {
private UserEntityVoConverter userConverter =new UserEntityVoConverter();
@GetMapping("session")
public UserSession session(HttpServletRequest request){
public UserSession session(HttpServletRequest request) throws Exception {
return service.getUserSession(request);
}
@ -131,7 +125,7 @@ public class UserController extends RestCrudController<UserEntity,String, UserRe
public Page<UserVo> queryUsersByRole(@RequestParam(name="roleId",required=false) String roleId, QueryParameter parameter) throws Exception{
if(StringUtils.hasText(roleId)){
Page<UserEntity> result =service.queryUsersByRole(roleId,parameter);
return converter.toVo(result);
return userConverter.toVo(result);
}
return QueryResult.emptyPage();
}
@ -147,7 +141,7 @@ public class UserController extends RestCrudController<UserEntity,String, UserRe
public Page<UserVo> queryOtherUsersByRole(@RequestParam(name="roleId",required=false) String roleId,QueryParameter parameter) throws Exception{
if(StringUtils.hasText(roleId)){
Page<UserEntity> result =service.queryOtherUsersByRole(roleId,parameter);
return converter.toVo(result);
return userConverter.toVo(result);
}
return QueryResult.emptyPage();
}
@ -163,7 +157,7 @@ public class UserController extends RestCrudController<UserEntity,String, UserRe
public Page<UserVo> queryUsersByOrg(@RequestParam(name="orgId",required=false) String orgId,QueryParameter parameter) throws Exception{
if(StringUtils.hasText(orgId)){
Page<UserEntity> result =service.queryUsersByOrg(orgId,parameter);
return converter.toVo(result);
return userConverter.toVo(result);
}
return QueryResult.emptyPage();
}
@ -179,7 +173,7 @@ public class UserController extends RestCrudController<UserEntity,String, UserRe
public Page<UserVo> queryOtherUsersByOrg(@RequestParam(name="orgId",required=false) String orgId,QueryParameter parameter) throws Exception{
if(StringUtils.hasText(orgId)){
Page<UserEntity> result =service.queryOtherUsersByOrg(orgId,parameter);
return converter.toVo(result);
return userConverter.toVo(result);
}
return QueryResult.emptyPage();
}

2
io.sc.platform.system/src/main/java/io/sc/platform/system/user/service/UserService.java

@ -13,7 +13,7 @@ import java.util.List;
import java.util.Set;
public interface UserService extends DaoService<UserEntity, String, UserRepository> {
public UserSession getUserSession(HttpServletRequest request);
public UserSession getUserSession(HttpServletRequest request) throws Exception;
/**
* 重置用户密码

6
io.sc.platform.system/src/main/java/io/sc/platform/system/user/service/impl/UserServiceImpl.java

@ -12,6 +12,8 @@ import io.sc.platform.security.util.SecurityUtil;
import io.sc.platform.system.api.menu.MenuRouteVo;
import io.sc.platform.system.api.menu.MenuVo;
import io.sc.platform.system.i18n.service.I18nService;
import io.sc.platform.system.menu.convertor.MenuEntityVoConvertor;
import io.sc.platform.system.menu.jpa.entity.MenuEntity;
import io.sc.platform.system.menu.service.MenuService;
import io.sc.platform.system.org.jpa.entity.OrgEntity;
import io.sc.platform.system.org.service.OrgService;
@ -56,8 +58,8 @@ public class UserServiceImpl extends DaoServiceImpl<UserEntity, String, UserRepo
@Autowired private OrgService orgService;
@Override
public UserSession getUserSession(HttpServletRequest request) {
List<MenuVo> menus =menuService.getAllMenus();
public UserSession getUserSession(HttpServletRequest request) throws Exception {
List<MenuVo> menus =new MenuEntityVoConvertor().toVo(menuService.getMenusByUser(request.getUserPrincipal().getName()));
UserSession result =new UserSession();
result.setUser(SecurityUtil.securityUser2map());
result.setMenus(menus);

1
io.sc.platform.system/src/main/resources/META-INF/services/io.sc.platform.core.initializer.ApplicationInitializer

@ -1,2 +1,3 @@
io.sc.platform.system.initializer.MenuInitializer
io.sc.platform.system.initializer.RoleAndMenuInitializer
io.sc.platform.system.initializer.ParameterInitializer

3
settings.gradle

@ -1,6 +1,9 @@
include ':app.platform'
//include ':com.xuxueli.xxl-job-admin'
//include ':com.xuxueli.xxl-job-core'
include ':com.xxl.job.admin'
include ':com.xxl.job.core'
include ':com.xxl.job.executor'
include ':io.sc.example'
include ':io.sc.platform.app'
include ':io.sc.platform.app-nacos'

Loading…
Cancel
Save