├── .editorconfig
├── .gitignore
├── Document
├── BS框架系统表结构.pdm
├── BS框架系统表结构3.pdm
├── bs框架系统表结构.rtf
├── 基础研发总图路线图.pptx
└── 框架研发构思图.vsdx
├── README.md
├── framework-system-config
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── centit
│ └── framework
│ └── system
│ └── config
│ └── SystemBeanConfig.java
├── framework-system-demo
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ ├── centit
│ │ │ └── prodcts
│ │ │ │ └── demoapp
│ │ │ │ └── config
│ │ │ │ ├── InstantiationServiceBeanPostProcessor.java
│ │ │ │ ├── NormalSpringMvcConfig.java
│ │ │ │ ├── ServiceConfig.java
│ │ │ │ ├── SwaggerConfig.java
│ │ │ │ └── WebInitializer.java
│ │ │ └── otherpackage
│ │ │ ├── controller
│ │ │ └── TestCaseController.java
│ │ │ ├── dao
│ │ │ └── TestCaseDao.java
│ │ │ ├── package-info.java
│ │ │ ├── po
│ │ │ └── TestCase.java
│ │ │ └── service
│ │ │ ├── TestCaseManager.java
│ │ │ └── impl
│ │ │ └── TestCaseManagerImpl.java
│ ├── resources
│ │ ├── ExtendedSqlMap.xml
│ │ ├── META-INF
│ │ │ ├── MANIFEST.MF
│ │ │ └── web-fragment.xml
│ │ ├── db
│ │ │ └── migration
│ │ │ │ ├── dm
│ │ │ │ ├── V1_1__createSysTablesDM.sql
│ │ │ │ └── V1_2__initSysDataDM.sql
│ │ │ │ ├── gbase
│ │ │ │ ├── V1_1__createSysTablesGB.sql
│ │ │ │ └── V1_2__initSysDataGB.sql
│ │ │ │ ├── h2
│ │ │ │ ├── V1_0__createSysTablesH2.sql
│ │ │ │ └── V1_1__initSysDataH2.sql
│ │ │ │ ├── kbase
│ │ │ │ ├── V1_1__createSysTablesKB.sql
│ │ │ │ └── V1_2__initSysDataKB.sql
│ │ │ │ ├── mysql
│ │ │ │ ├── V1_1__createSysTablesMysql.sql
│ │ │ │ └── V1_2__initSysDataMySql.sql
│ │ │ │ ├── oracle
│ │ │ │ ├── V1_1__createSysTablesOracle.sql
│ │ │ │ └── V1_2__initSysDataOracle.sql
│ │ │ │ ├── postgresql
│ │ │ │ ├── V1_1__createTablePostgresql.sql
│ │ │ │ └── V1_2__initDataPostgresql.sql
│ │ │ │ ├── shentong
│ │ │ │ ├── V1_1__createSysTablesST.sql
│ │ │ │ └── V1_2__initSysDataST.sql
│ │ │ │ └── sqlserver
│ │ │ │ ├── V1_1__createSysTablesSqlserver.sql
│ │ │ │ └── V1_2__initSysDataSqlserver.sql
│ │ ├── log4j2.xml
│ │ ├── messagesource
│ │ │ ├── base
│ │ │ │ ├── messages.properties
│ │ │ │ ├── messages_en_US.properties
│ │ │ │ └── messages_zh_CN.properties
│ │ │ └── validation
│ │ │ │ ├── validation.properties
│ │ │ │ ├── validation_en_US.properties
│ │ │ │ └── validation_zh_CN.properties
│ │ └── system.properties
│ └── webapp
│ │ ├── META-INF
│ │ └── MANIFEST.MF
│ │ ├── WEB-INF
│ │ ├── coderepo.tld
│ │ └── jsp
│ │ │ ├── exception
│ │ │ ├── 400.jsp
│ │ │ ├── 401.jsp
│ │ │ ├── 403.jsp
│ │ │ ├── 404.jsp
│ │ │ └── 500.jsp
│ │ │ └── sys
│ │ │ ├── index.jsp
│ │ │ └── login.jsp
│ │ ├── custom
│ │ └── config.js
│ │ ├── index.jsp
│ │ └── modules
│ │ └── login
│ │ └── sys
│ │ └── img
│ │ └── logo.png
│ └── test
│ └── java
│ └── com
│ └── centit
│ └── framework
│ └── web
│ └── demo
│ └── test
│ ├── TestControllerScanner.java
│ └── TestQuerySystemTable.java
├── framework-system-dubbo-client-config
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── centit
│ │ └── framework
│ │ └── dubbo
│ │ └── config
│ │ └── IpServerDubboClientConfig.java
│ └── resources
│ └── dubbo-ip-client.xml
├── framework-system-module
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── centit
│ │ │ └── framework
│ │ │ └── system
│ │ │ ├── constant
│ │ │ └── TenantConstant.java
│ │ │ ├── dao
│ │ │ ├── DataCatalogDao.java
│ │ │ ├── DataDictionaryDao.java
│ │ │ ├── OptDataScopeDao.java
│ │ │ ├── OptInfoDao.java
│ │ │ ├── OptMethodDao.java
│ │ │ ├── OsInfoDao.java
│ │ │ ├── PlatformDao.java
│ │ │ ├── RoleInfoDao.java
│ │ │ ├── RolePowerDao.java
│ │ │ ├── TenantBusinessLogDao.java
│ │ │ ├── TenantInfoDao.java
│ │ │ ├── TenantMemberApplyDao.java
│ │ │ ├── UnitInfoDao.java
│ │ │ ├── UnitRoleDao.java
│ │ │ ├── UserInfoDao.java
│ │ │ ├── UserPlatDao.java
│ │ │ ├── UserRoleDao.java
│ │ │ ├── UserSettingDao.java
│ │ │ ├── UserSyncDirectoryDao.java
│ │ │ ├── UserUnitDao.java
│ │ │ └── WorkGroupDao.java
│ │ │ ├── po
│ │ │ ├── TenantBusinessLog.java
│ │ │ └── TenantMemberApply.java
│ │ │ ├── service
│ │ │ ├── DataDictionaryManager.java
│ │ │ ├── OptInfoManager.java
│ │ │ ├── OptMethodManager.java
│ │ │ ├── OsInfoManager.java
│ │ │ ├── PlatformService.java
│ │ │ ├── SysRoleManager.java
│ │ │ ├── SysUnitManager.java
│ │ │ ├── SysUnitRoleManager.java
│ │ │ ├── SysUserManager.java
│ │ │ ├── SysUserRoleManager.java
│ │ │ ├── SysUserUnitManager.java
│ │ │ ├── TenantPowerManage.java
│ │ │ ├── TenantService.java
│ │ │ ├── UserDirectory.java
│ │ │ ├── UserPlatService.java
│ │ │ ├── UserSettingManager.java
│ │ │ ├── UserSyncDirectoryManager.java
│ │ │ ├── WorkGroupManager.java
│ │ │ └── impl
│ │ │ │ ├── ActiveDirectoryUserDirectoryImpl.java
│ │ │ │ ├── DBPlatformEnvironment.java
│ │ │ │ ├── DataDictionaryManagerImpl.java
│ │ │ │ ├── OptInfoManagerImpl.java
│ │ │ │ ├── OptMethodManagerImpl.java
│ │ │ │ ├── OsInfoManagerImpl.java
│ │ │ │ ├── PersistenceUtils.java
│ │ │ │ ├── PlatformServiceImpl.java
│ │ │ │ ├── SysRoleManagerImpl.java
│ │ │ │ ├── SysUnitManagerImpl.java
│ │ │ │ ├── SysUnitRoleManagerImpl.java
│ │ │ │ ├── SysUserManagerImpl.java
│ │ │ │ ├── SysUserRoleManagerImpl.java
│ │ │ │ ├── SysUserUnitManagerImpl.java
│ │ │ │ ├── TenantPowerManageImpl.java
│ │ │ │ ├── TenantServiceImpl.java
│ │ │ │ ├── UserPlatServiceImpl.java
│ │ │ │ ├── UserSettingManagerImpl.java
│ │ │ │ ├── UserSyncDirectoryManagerImpl.java
│ │ │ │ └── WorkGroupManagerImpl.java
│ │ │ └── vo
│ │ │ ├── PageListTenantInfoQo.java
│ │ │ ├── TenantMemberApplyVo.java
│ │ │ ├── TenantMemberQo.java
│ │ │ └── WorkGroupParames.java
│ └── resources
│ │ ├── ExtendedSqlMap.xml
│ │ ├── META-INF
│ │ └── MANIFEST.MF
│ │ ├── log4j2.xml
│ │ └── system.properties
│ ├── sqlscript
│ ├── 存储过程
│ │ ├── WORK_DAY_OPT.pck
│ │ └── check_attendance.pck
│ ├── 数据库初始化
│ │ ├── DB2
│ │ │ ├── createSysTablesDB2.sql
│ │ │ ├── createSysViewsDB2.sql
│ │ │ └── initSysDataDB2.sql
│ │ ├── SqlSvr
│ │ │ └── createSequenceSqlSvr.sql
│ │ ├── mysql
│ │ │ ├── createSequenceMySql.sql
│ │ │ ├── createSysTablesMySql.sql
│ │ │ ├── createSysViewsMySql.sql
│ │ │ ├── createVHiUnitinfoMySql.sql
│ │ │ └── initSysDataMySql.sql
│ │ └── oracle
│ │ │ ├── createSysTablesOracle.sql
│ │ │ ├── createVHiUnitinfoOracle.sql
│ │ │ ├── initSysDataOracle.sql
│ │ │ └── rebuildViewOracle.sql
│ ├── 数据清理与备份
│ │ ├── datacheck.sql
│ │ └── 数据字典备份.dmp
│ └── 版本升级和变更
│ │ ├── before3.0.1
│ │ ├── updateToV2.1.1.20160324.sql
│ │ ├── updateToV2.1.1.20160407.sql
│ │ ├── updateToV2.1.1.20160411.sql
│ │ ├── updateToV2.1.1.20160412.sql
│ │ ├── updateToV2.1.1.20160413.sql
│ │ └── updateToV2.1.1.sql
│ │ ├── v3.0.1
│ │ └── update20160714.sql
│ │ ├── v4.0.X
│ │ ├── to_v4.0.3.mysql.patch.sql
│ │ ├── to_v4.0.3.oracle.patch.sql
│ │ ├── to_v4.0.4.mysql.patch.sql
│ │ └── to_v4.0.4.oracle.patch.sql
│ │ ├── v4.3.X
│ │ ├── to_v4.3.mysql.patch.sql
│ │ └── to_v4.3.oracle.patch.sql
│ │ └── 框架表老字段rename到新字段及相应视图.sql
│ └── test
│ ├── java
│ └── com
│ │ └── centit
│ │ ├── sys
│ │ ├── common
│ │ │ └── EntityManagerWithDataPowerImpl.java
│ │ ├── test
│ │ │ ├── TestSqlUtils.java
│ │ │ └── TestUserDetails.java
│ │ └── util
│ │ │ └── SysTypeUtils.java
│ │ └── test
│ │ ├── TestFromPost.java
│ │ ├── TestHttpClient.java
│ │ ├── TestLdap.java
│ │ ├── TestQueryUtils.java
│ │ ├── TestUnitFilter.java
│ │ └── script
│ │ └── TextJavaScript.java
│ └── resources
│ └── test.json
├── framework-system-server
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── centit
│ │ └── framework
│ │ └── ip
│ │ ├── config
│ │ ├── InstantiationServiceBeanPostProcessor.java
│ │ ├── IpServerDubboServerConfig.java
│ │ ├── ServiceConfig.java
│ │ └── WebInitializer.java
│ │ └── security
│ │ └── IpAuthenticationSuccessHandler.java
│ ├── resources
│ ├── db
│ │ └── migration
│ │ │ ├── h2-ui-x
│ │ │ └── V1_4__initSysDataH2.sql
│ │ │ ├── h2
│ │ │ ├── V1_0__createSysTablesH2.sql
│ │ │ ├── V1_1__initSysDataH2.sql
│ │ │ └── V1_3__ipinitH2.sql
│ │ │ ├── mysql-ui-x
│ │ │ └── V1_4__initSysDataMySql.sql
│ │ │ ├── mysql
│ │ │ ├── V1_0__createSysTablesMysql.sql
│ │ │ ├── V1_1__initSysDataMySql.sql
│ │ │ ├── V1_2__ipinitMySql.sql
│ │ │ └── V1_3__tenantinitMySql.sql
│ │ │ ├── oracle-ui-x
│ │ │ └── V1_4__initSysDataOracle.sql
│ │ │ ├── oracle
│ │ │ ├── V1_1__createSysTablesOracle.sql
│ │ │ ├── V1_2__initSysDataOracle.sql
│ │ │ └── V1_3__ipinitOracle.sql
│ │ │ ├── oracleWorkFlow
│ │ │ ├── V1_5__apprflowOracle.sql
│ │ │ └── V1_6__apprDataOracle.sql
│ │ │ ├── postgresql-ui-x
│ │ │ └── V1_4__initDataPostgresql.sql
│ │ │ ├── postgresql
│ │ │ ├── V1_1__createTablePostgresql.sql
│ │ │ ├── V1_2__initDataPostgresql.sql
│ │ │ └── V1_3__ipInitPostgresql.sql
│ │ │ └── sqlserver
│ │ │ ├── .gitkeep
│ │ │ └── V1_1__createSysTablesSqlserver.sql
│ ├── demo
│ │ └── system.properties
│ ├── dubbo-ip-server.xml
│ ├── ehcache.xml
│ ├── log4j2.xml
│ ├── pressure-test
│ │ ├── .gitkeep
│ │ └── system.properties
│ ├── prev
│ │ └── system.properties
│ ├── prod
│ │ └── system.properties
│ ├── system.properties
│ └── test
│ │ └── system.properties
│ └── webapp
│ ├── WEB-INF
│ ├── coderepo.tld
│ └── jsp
│ │ ├── exception
│ │ ├── 400.jsp
│ │ ├── 401.jsp
│ │ ├── 403.jsp
│ │ ├── 404.jsp
│ │ └── 500.jsp
│ │ └── sys
│ │ ├── index.jsp
│ │ └── login.jsp
│ ├── index.jsp
│ └── modules
│ └── sys
│ ├── databaseinfo
│ ├── ctrl
│ │ ├── databaseinfo.add.js
│ │ ├── databaseinfo.edit.js
│ │ ├── databaseinfo.js
│ │ └── databaseinfo.remove.js
│ ├── databaseinfo-info.html
│ └── databaseinfo.html
│ └── osinfo
│ ├── ctrl
│ ├── osinfo.add.js
│ ├── osinfo.edit.js
│ ├── osinfo.js
│ ├── osinfo.refreshall.js
│ ├── osinfo.refreshone.js
│ └── osinfo.remove.js
│ ├── osinfo-info.html
│ └── osinfo.html
├── framework-system-static-config
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── centit
│ └── framework
│ └── staticsystem
│ └── config
│ └── StaticSystemBeanConfig.java
├── framework-system-static-jdbc
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── centit
│ │ └── framework
│ │ └── staticsystem
│ │ └── service
│ │ └── impl
│ │ └── JdbcPlatformEnvironment.java
│ └── resources
│ └── ExtendedSqlMap.xml
├── framework-system-static
├── README.md
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── centit
│ │ └── framework
│ │ └── staticsystem
│ │ ├── security
│ │ └── UserAccessTokenMetadata.java
│ │ └── service
│ │ └── impl
│ │ ├── AbstractStaticPlatformEnvironment.java
│ │ └── JsonPlatformEnvironment.java
│ └── test
│ ├── java
│ └── com
│ │ └── centit
│ │ └── test
│ │ ├── TestJsonParser2.java
│ │ └── TestUserDetailsJson.java
│ └── resources
│ ├── optinfo.josn
│ ├── optinfo2.josn
│ └── test.json
├── framework-system-web
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── centit
│ │ └── framework
│ │ └── system
│ │ ├── controller
│ │ ├── DataDictionaryController.java
│ │ ├── OptInfoController.java
│ │ ├── OsInfoController.java
│ │ ├── PlatformController.java
│ │ ├── RoleInfoController.java
│ │ ├── SystemDataManagerController.java
│ │ ├── SystemSettingController.java
│ │ ├── TenantController.java
│ │ ├── TenantPowerController.java
│ │ ├── UnitInfoController.java
│ │ ├── UnitRoleController.java
│ │ ├── UserInfoController.java
│ │ ├── UserPlatController.java
│ │ ├── UserRoleController.java
│ │ ├── UserSettingController.java
│ │ ├── UserSyncDirectoryController.java
│ │ ├── UserUnitController.java
│ │ ├── VateCodeController.java
│ │ └── WorkGroupController.java
│ │ └── utils
│ │ └── VotaCode.java
│ └── resources
│ ├── ExtendedSqlMap.xml
│ ├── META-INF
│ ├── MANIFEST.MF
│ └── web-fragment.xml
│ ├── log4j2.xml
│ ├── messagesource
│ ├── base
│ │ ├── messages.properties
│ │ ├── messages_en_US.properties
│ │ └── messages_zh_CN.properties
│ └── validation
│ │ ├── validation.properties
│ │ ├── validation_en_US.properties
│ │ └── validation_zh_CN.properties
│ └── system.properties
├── framework-thirdparty-user-plugin
├── README.md
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── centit
│ │ └── framework
│ │ └── users
│ │ ├── config
│ │ ├── AppConfig.java
│ │ ├── UrlConstant.java
│ │ ├── WechatOpenConfig.java
│ │ └── WxAppConfig.java
│ │ ├── constant
│ │ └── AppConstant.java
│ │ ├── controller
│ │ ├── CallBackController.java
│ │ ├── DingTalkLogin.java
│ │ ├── LdapLogin.java
│ │ └── ThirdLogin.java
│ │ ├── dao
│ │ ├── AccessTokenDao.java
│ │ ├── DingTalkSuiteDao.java
│ │ └── SocialDeptAuthDao.java
│ │ ├── dingtalk
│ │ ├── DingTalkEncryptException.java
│ │ ├── DingTalkEncryptor.java
│ │ ├── DingTalkUtil.java
│ │ └── PKCS7Padding.java
│ │ ├── dto
│ │ ├── DingUnitDTO.java
│ │ └── DingUserDTO.java
│ │ ├── po
│ │ ├── AccessToken.java
│ │ ├── AuthCallback.java
│ │ ├── CorpInfo.java
│ │ ├── DingTalkSuite.java
│ │ └── SocialDeptAuth.java
│ │ └── service
│ │ ├── AccessTokenService.java
│ │ ├── AuthSource.java
│ │ ├── DingTalkLoginService.java
│ │ ├── DingTalkSuiteService.java
│ │ ├── LoginService.java
│ │ ├── SocialDeptAuthService.java
│ │ ├── TokenService.java
│ │ ├── WeChatService.java
│ │ └── impl
│ │ ├── AbstractAuthDingtalkRequest.java
│ │ ├── AccessTokenServiceImpl.java
│ │ ├── AuthDefaultRequest.java
│ │ ├── AuthDefaultSource.java
│ │ ├── AuthDingTalkAccountRequest.java
│ │ ├── AuthDingTalkRequest.java
│ │ ├── DingTalkLoginServiceImpl.java
│ │ ├── DingTalkSuiteServiceImpl.java
│ │ ├── LoginServiceImpl.java
│ │ ├── SocialDeptAuthServiceImpl.java
│ │ └── WeChatServiceImpl.java
│ └── test
│ └── java
│ └── com
│ └── centit
│ └── framework
│ └── users
│ └── test
│ └── TestLdapSearch.java
└── pom.xml
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 | [*.html]
4 | indent_style = space
5 | indent_size = 2
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 | [*.js]
11 | indent_style = space
12 | indent_size = 2
13 | end_of_line = lf
14 | charset = utf-8
15 | trim_trailing_whitespace = true
16 | insert_final_newline = true
17 | [*.java]
18 | indent_style = space
19 | indent_size = 4
20 | end_of_line = lf
21 | charset = utf-8
22 | trim_trailing_whitespace = true
23 | insert_final_newline = true
24 | [*.md]
25 | trim_trailing_whitespace = false
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | target
3 | **/*.iml
4 | **/target
5 | **/node_modules
6 | .mvn
7 | mvn*
8 | .settings
9 | **/~$*
10 | out.*
11 | .flattened-pom.xml
12 | .DS_Store
13 | */.DS_Store
14 |
--------------------------------------------------------------------------------
/Document/基础研发总图路线图.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/Document/基础研发总图路线图.pptx
--------------------------------------------------------------------------------
/Document/框架研发构思图.vsdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/Document/框架研发构思图.vsdx
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 系统框架的数据库持久化实现
2 |
3 | 这是开发单应用系统的基础。传统政企业务系统都有个后台的系统维护,维护的内容就是我们框架的基本要素。工程中的模块有:
4 |
5 | 1. framework-persistence-core 模块,定义了持久化对象和持久化接口。框架的开发规范中并没有要求持久化类(Dao)的接口和实现分离,由于框架部分希望能够灵活的绑定不同的持久化模块所以抽象出一个接口。
6 | 2. framework-persistence-\* 三个相同功能模块,分别用jdbc、hibernate、mybatis实现了基本元素的持久化工作。因为单应用系统的业务部分和系统管理部分一般在一个工程中,这样做多个实现是为了给开发人员不同的选择。
7 | 3. framework-system-module 模块,实现了系统维护逻辑操作。
8 | 4. framework-system-web 模块,实现了系统维护的http接口,供前段调用。
9 | 5. framework-system-view-easyui 模块,为系统维护的前端页面。
10 | 6. framework-system-config 为系统模块相关的bean配置。
11 | 7. framework-system-demo 是一个可以运行的示例。
12 |
13 | 如果我们需要开发一个单应用系统[framework-system-demo](./framework-system-demo)是一个最好不过的开发起点。开发人员可以复制这个项目的源代码作为自己项目的基础工程,记得修改java的包名。
14 |
--------------------------------------------------------------------------------
/framework-system-config/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | framework-system-parent
7 | com.centit.framework
8 | ${revision}
9 |
10 | 4.0.0
11 |
12 | framework-system-config
13 | com.centit.framework:framework-system-config
14 | jar
15 | 框架的配置类
16 |
17 |
18 |
19 | com.centit.framework
20 | framework-system-module
21 | ${project.version}
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/framework-system-config/src/main/java/com/centit/framework/system/config/SystemBeanConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.config;
2 |
3 | import com.centit.framework.model.adapter.PlatformEnvironment;
4 | import com.centit.framework.model.security.CentitUserDetailsService;
5 | import com.centit.framework.security.UserDetailsServiceImpl;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.context.EnvironmentAware;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.context.annotation.EnableAspectJAutoProxy;
10 | import org.springframework.core.env.Environment;
11 |
12 | @EnableAspectJAutoProxy(proxyTargetClass = true)
13 | public class SystemBeanConfig implements EnvironmentAware {
14 |
15 | private Environment env;
16 |
17 | @Override
18 | public void setEnvironment(@Autowired Environment environment) {
19 | if(environment!=null) {
20 | this.env = environment;
21 | }
22 | }
23 |
24 | /* 这bean从框架中移除,由开发人员自行定义
25 | @Bean("passwordEncoder")
26 | public StandardPasswordEncoderImpl passwordEncoder() {
27 | return new StandardPasswordEncoderImpl();
28 | }
29 | */
30 | @Bean
31 | public CentitUserDetailsService centitUserDetailsService(@Autowired PlatformEnvironment platformEnvironment) {
32 | UserDetailsServiceImpl userDetailsService = new UserDetailsServiceImpl();
33 | userDetailsService.setPlatformEnvironment(platformEnvironment);
34 | return userDetailsService;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/centit/prodcts/demoapp/config/InstantiationServiceBeanPostProcessor.java:
--------------------------------------------------------------------------------
1 | package com.centit.prodcts.demoapp.config;
2 |
3 | import com.centit.framework.components.CodeRepositoryCache;
4 | import com.centit.framework.components.OperationLogCenter;
5 | import com.centit.framework.model.adapter.NotificationCenter;
6 | import com.centit.framework.model.adapter.OperationLogWriter;
7 | import com.centit.framework.model.adapter.PlatformEnvironment;
8 | import com.centit.support.json.JSONOpt;
9 | import org.springframework.beans.BeansException;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.context.ApplicationContext;
12 | import org.springframework.context.ApplicationContextAware;
13 | import org.springframework.context.ApplicationListener;
14 | import org.springframework.context.event.ContextRefreshedEvent;
15 |
16 | import javax.validation.constraints.NotNull;
17 |
18 | /**
19 | * Created by codefan on 17-7-6.
20 | */
21 | public class InstantiationServiceBeanPostProcessor implements ApplicationListener, ApplicationContextAware
22 | {
23 | @Autowired
24 | protected NotificationCenter notificationCenter;
25 |
26 | @Autowired(required = false)
27 | private OperationLogWriter optLogManager;
28 |
29 |
30 | @Autowired
31 | @NotNull
32 | private PlatformEnvironment platformEnvironment;
33 |
34 |
35 | protected ApplicationContext applicationContext;
36 |
37 | @Override
38 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
39 | this.applicationContext = applicationContext;
40 | }
41 |
42 | @Override
43 | public void onApplicationEvent(ContextRefreshedEvent event)
44 | {
45 | JSONOpt.fastjsonGlobalConfig();
46 | CodeRepositoryCache.setPlatformEnvironment(platformEnvironment);
47 | if(optLogManager!=null) {
48 | OperationLogCenter.registerOperationLogWriter(optLogManager);
49 | }
50 | /*if(operationLogWriter!=null) {
51 | OperationLogCenter.registerOperationLogWriter(operationLogWriter);
52 | }*/
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/centit/prodcts/demoapp/config/NormalSpringMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.prodcts.demoapp.config;
2 |
3 | import com.centit.framework.config.BaseSpringMvcConfig;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.EnableAspectJAutoProxy;
6 |
7 | /**
8 | * Created by zou_wy on 2017/3/29.
9 | */
10 | @EnableAspectJAutoProxy(proxyTargetClass = true)
11 | @ComponentScan(basePackages = {"com.otherpackage.controller"},
12 | includeFilters = {@ComponentScan.Filter(value= org.springframework.stereotype.Controller.class)},
13 | useDefaultFilters = false)
14 | public class NormalSpringMvcConfig extends BaseSpringMvcConfig {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/centit/prodcts/demoapp/config/SwaggerConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.prodcts.demoapp.config;
2 |
3 | import io.swagger.annotations.ApiOperation;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
7 | import springfox.documentation.builders.ApiInfoBuilder;
8 | import springfox.documentation.builders.PathSelectors;
9 | import springfox.documentation.builders.RequestHandlerSelectors;
10 | import springfox.documentation.service.ApiInfo;
11 | import springfox.documentation.service.Contact;
12 | import springfox.documentation.spi.DocumentationType;
13 | import springfox.documentation.spring.web.plugins.Docket;
14 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
15 |
16 | //@Configuration
17 | @EnableSwagger2
18 | public class SwaggerConfig implements WebMvcConfigurer {
19 |
20 | @Bean
21 | public Docket buildDocket(){
22 | return new Docket(DocumentationType.SWAGGER_2)
23 | .apiInfo(buildApiInf())//.pathMapping("../service")
24 | .select()
25 | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class) )
26 | //.apis(RequestHandlerSelectors.basePackage("com.centit.framework.system.controller"))//controller路径
27 | //.apis(RequestHandlerSelectors.basePackage("com.otherpackage.controller"))//controller路径
28 | .paths(PathSelectors.any())
29 | .build();
30 | }
31 |
32 | private ApiInfo buildApiInf(){
33 | return new ApiInfoBuilder()
34 | .title("框架接口")
35 | .termsOfServiceUrl("https://ndxt.github.io")
36 | .description("南大先腾框架接口")
37 | .contact(new Contact("codefan", "https://ndxt.github.io", "codefan@centit.com"))
38 | .build();
39 | }
40 |
41 | @Override
42 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
43 | //registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
44 | registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
45 | registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/centit/prodcts/demoapp/config/WebInitializer.java:
--------------------------------------------------------------------------------
1 | package com.centit.prodcts.demoapp.config;
2 |
3 | import com.centit.framework.config.SystemSpringMvcConfig;
4 | import com.centit.framework.config.WebConfig;
5 | import org.springframework.web.WebApplicationInitializer;
6 |
7 | import javax.servlet.ServletContext;
8 | import javax.servlet.ServletException;
9 |
10 |
11 | /**
12 | * Created by zou_wy on 2017/3/29.
13 | */
14 | public class WebInitializer implements WebApplicationInitializer {
15 |
16 | @Override
17 | public void onStartup(ServletContext servletContext) throws ServletException {
18 |
19 | String[] servletUrlPatterns = {"/system/*", "/test/*"};
20 | WebConfig.registerSpringConfig(servletContext, ServiceConfig.class);
21 | WebConfig.registerServletConfig(servletContext, "system",
22 | "/system/*",
23 | SystemSpringMvcConfig.class, SwaggerConfig.class);
24 | WebConfig.registerServletConfig(servletContext, "test",
25 | "/test/*",
26 | NormalSpringMvcConfig.class, SwaggerConfig.class);
27 |
28 | WebConfig.registerRequestContextListener(servletContext);
29 | WebConfig.registerSingleSignOutHttpSessionListener(servletContext);
30 | WebConfig.registerCharacterEncodingFilter(servletContext, servletUrlPatterns);
31 | WebConfig.registerHttpPutFormContentFilter(servletContext, servletUrlPatterns);
32 | WebConfig.registerHiddenHttpMethodFilter(servletContext, servletUrlPatterns);
33 | WebConfig.registerRequestThreadLocalFilter(servletContext);
34 | WebConfig.registerSpringSecurityFilter(servletContext, servletUrlPatterns);
35 | }
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/otherpackage/controller/TestCaseController.java:
--------------------------------------------------------------------------------
1 | package com.otherpackage.controller;
2 |
3 | import com.centit.framework.common.JsonResultUtils;
4 | import com.centit.framework.common.ResponseData;
5 | import com.centit.framework.common.ResponseSingleData;
6 | import com.centit.framework.core.controller.BaseController;
7 | import com.centit.framework.core.controller.WrapUpResponseBody;
8 | import com.otherpackage.po.TestCase;
9 | import org.springframework.web.bind.annotation.*;
10 |
11 | import javax.servlet.ServletOutputStream;
12 | import javax.servlet.http.HttpServletResponse;
13 | import javax.validation.Valid;
14 | import java.io.IOException;
15 |
16 | @RestController
17 | @RequestMapping("/test")
18 | public class TestCaseController extends BaseController {
19 |
20 | @GetMapping("/lsh/{dateCode}")
21 | @WrapUpResponseBody
22 | public ResponseData getLsh(@PathVariable String dateCode, HttpServletResponse response) throws IOException {
23 | //this.getLoginUser()
24 | String data = "### 下面是返回的数据:";
25 | byte[] bytes = data.getBytes(); // 将字符串转换为字节数组
26 |
27 | response.setContentType("text/plain"); // 设置响应的内容类型
28 | ServletOutputStream outputStream = response.getOutputStream(); // 获取输出流
29 | outputStream.write(bytes); // 写入字节数据
30 | outputStream.flush(); // 刷新流,确保所有数据都已经写入
31 | // outputStream.close();
32 | return ResponseSingleData.makeResponseData( "hello: " + dateCode);
33 | }
34 |
35 | @GetMapping("/lsh2")
36 | public void getLsh2(HttpServletResponse response) throws IOException {
37 | //this.getLoginUser()
38 | String data = "### 下面是返回的数据2:";
39 | byte[] bytes = data.getBytes(); // 将字符串转换为字节数组
40 |
41 | response.setContentType("text/plain"); // 设置响应的内容类型
42 | ServletOutputStream outputStream = response.getOutputStream(); // 获取输出流
43 | outputStream.write(bytes); // 写入字节数据
44 | outputStream.flush(); // 刷新流,确保所有数据都已经写入
45 | // outputStream.close();
46 | JsonResultUtils.writeSingleDataJson("hello 我的祖国", response);
47 | }
48 |
49 | @PostMapping("/save")
50 | @WrapUpResponseBody
51 | public TestCase saveTestCase(@RequestBody @Valid TestCase ts) {
52 |
53 | return ts;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/otherpackage/dao/TestCaseDao.java:
--------------------------------------------------------------------------------
1 | package com.otherpackage.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.otherpackage.po.TestCase;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.HashMap;
9 | import java.util.Map;
10 | @Repository("testCaseDao")
11 | public class TestCaseDao extends BaseDaoImpl {
12 |
13 | @Override
14 | public Map getFilterField() {
15 | Map filterField = new HashMap<>();
16 | filterField.put("caseId", CodeBook.EQUAL_HQL_ID);
17 | return filterField;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/otherpackage/package-info.java:
--------------------------------------------------------------------------------
1 | package com.otherpackage;
2 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/otherpackage/po/TestCase.java:
--------------------------------------------------------------------------------
1 | package com.otherpackage.po;
2 |
3 | import lombok.Data;
4 | import org.hibernate.validator.constraints.Range;
5 |
6 | import javax.persistence.Column;
7 | import javax.persistence.Entity;
8 | import javax.persistence.Id;
9 | import javax.persistence.Table;
10 | import javax.validation.constraints.Size;
11 |
12 | @Entity
13 | @Table(name = "TEST_CASE")
14 | @Data
15 | public class TestCase implements java.io.Serializable{
16 | private static final long serialVersionUID = 1L;
17 |
18 | /**
19 | * 类别代码
20 | */
21 | @Id
22 | @Column(name = "CASE_ID")
23 | private String caseId;
24 |
25 | @Size(max = 20)
26 | private String name;
27 |
28 | @Range(max = 120)
29 | private Integer age;
30 | }
31 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/java/com/otherpackage/service/TestCaseManager.java:
--------------------------------------------------------------------------------
1 | package com.otherpackage.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.centit.framework.model.security.CentitUserDetails;
5 | import com.centit.support.database.utils.PageDesc;
6 | import com.otherpackage.po.TestCase;
7 |
8 | import java.util.Map;
9 |
10 | public interface TestCaseManager {
11 | JSONArray listObjectsAsJson(CentitUserDetails ud,
12 | Map filterMap, PageDesc pageDesc);
13 |
14 | boolean saveNewCase(CentitUserDetails ud, TestCase testCase);
15 | }
16 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/resources/ExtendedSqlMap.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | ]>
7 |
8 |
9 |
18 |
19 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/resources/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Implementation-Vendor: Adobe Systems Inc.
3 | Ant-Version: Apache Ant 1.7.0
4 | Implementation-Title: BlazeDS - BlazeDS Application
5 | Implementation-Version: 3.0.0.544
6 | Sealed: false
7 | Created-By: 1.5.0_13-b05 (Sun Microsystems Inc.)
8 |
9 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/resources/META-INF/web-fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | framework-sys-module
4 | sys
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | D:/Projects/RunData/demo_home/logs
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/resources/messagesource/validation/validation.properties:
--------------------------------------------------------------------------------
1 | #\u901a\u7528\u7684\u9a8c\u8bc1\u63d0\u793a
2 | field.limit.notNull=\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a
3 | field.limit.email=\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u5b50\u90ae\u4ef6\u683c\u5f0f
4 | field.limit.url=\u8bf7\u8f93\u5165\u6b63\u786e\u7684URL
5 |
6 | string.limit.notBlank=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
7 | string.limit.notEmpty=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
8 |
9 | string.limit.pattern=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u5fc5\u987b\u7b26\u5408\u89c4\u5219 {regexp}
10 |
11 | string.length.limit.equal=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4e3a {max}
12 | string.length.limit.max=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7 {max}
13 | string.length.limit.min=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e {min}
14 | string.length.limit.range=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4ecb\u4e8e {min} \u4e0e {max} \u4e4b\u95f4
15 |
16 | number.limit.range=\u8f93\u5165\u7684\u6570\u503c\u5fc5\u987b\u4ecb\u4e8e{min}\u4e0e{max}\u4e4b\u95f4
17 |
18 | #\u5bf9\u8c61\u5c5e\u6027\u7279\u6709\u7684\u9a8c\u8bc1\u63d0\u793a
19 | #key\u7684\u89c4\u5219\u4e3a \u5bf9\u8c61\u540d\uff08\u9996\u5b57\u6bcd\u5c0f\u5199\uff09.\u5c5e\u6027\u540d.\u7ea6\u675f\u540d
20 | userInfo.loginName.maxLength=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7{max}
--------------------------------------------------------------------------------
/framework-system-demo/src/main/resources/messagesource/validation/validation_en_US.properties:
--------------------------------------------------------------------------------
1 | #\u901a\u7528\u7684\u9a8c\u8bc1\u63d0\u793a
2 | field.limit.notNull=field not null
3 | field.limit.email=email
4 | field.limit.url=url
5 |
6 | string.limit.notBlank=string not blank
7 | string.limit.notEmpty=string not empty
8 |
9 | string.limit.patteren=string must match {regexp}
10 |
11 | string.length.limit.equal=field length must be {max}
12 | string.length.limit.max=field length must less than {max}
13 | string.length.limit.min=field length must more than{min}
14 | string.length.limit.range=field length must between {min} and {max}
15 |
16 | number.limit.range=number must between {min} and {max}
17 |
18 | #\u5bf9\u8c61\u5c5e\u6027\u7279\u6709\u7684\u9a8c\u8bc1\u63d0\u793a
19 | #key\u7684\u89c4\u5219\u4e3a \u5bf9\u8c61\u540d\uff08\u9996\u5b57\u6bcd\u5c0f\u5199\uff09.\u5c5e\u6027\u540d.\u7ea6\u675f\u540d
20 | userInfo.loginName.maxLength=field length must less than {max}
--------------------------------------------------------------------------------
/framework-system-demo/src/main/resources/messagesource/validation/validation_zh_CN.properties:
--------------------------------------------------------------------------------
1 | #\u901a\u7528\u7684\u9a8c\u8bc1\u63d0\u793a
2 | field.limit.notNull=\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a
3 | field.limit.email=\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u5b50\u90ae\u4ef6\u683c\u5f0f
4 | field.limit.url=\u8bf7\u8f93\u5165\u6b63\u786e\u7684URL
5 |
6 | string.limit.notBlank=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
7 | string.limit.notEmpty=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
8 |
9 | string.limit.pattern=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u5fc5\u987b\u7b26\u5408\u89c4\u5219{regexp}
10 |
11 | string.length.limit.equal=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4e3a {max}
12 | string.length.limit.max=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7 {max}
13 | string.length.limit.min=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e {min}
14 | string.length.limit.range=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4ecb\u4e8e {min} \u4e0e {max} \u4e4b\u95f4
15 |
16 | number.limit.range=\u8f93\u5165\u7684\u6570\u503c\u5fc5\u987b\u4ecb\u4e8e {min} \u4e0e {max} \u4e4b\u95f4
17 | number.limit.max=\u8f93\u5165\u7684\u6570\u503c\u5fc5\u987b\u5c0f\u4e8e {max}
18 |
19 | #\u5bf9\u8c61\u5c5e\u6027\u7279\u6709\u7684\u9a8c\u8bc1\u63d0\u793a
20 | #key\u7684\u89c4\u5219\u4e3a \u5bf9\u8c61\u540d\uff08\u9996\u5b57\u6bcd\u5c0f\u5199\uff09.\u5c5e\u6027\u540d.\u7ea6\u675f\u540d
21 | userInfo.loginName.maxLength=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7{max}
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/WEB-INF/jsp/exception/400.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 400 - 请求格式错误”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/WEB-INF/jsp/exception/401.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 403 - 用户没有权限,请重新登录”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/WEB-INF/jsp/exception/403.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 403 - 禁止访问:没有访问此资源的权限”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/WEB-INF/jsp/exception/404.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 404 - 此资源找不到”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/WEB-INF/jsp/exception/500.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java"%>
2 |
3 |
4 |
5 |
6 |
7 |
8 | 500
9 |
10 |
11 |
12 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
2 |
--------------------------------------------------------------------------------
/framework-system-demo/src/main/webapp/modules/login/sys/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-demo/src/main/webapp/modules/login/sys/img/logo.png
--------------------------------------------------------------------------------
/framework-system-demo/src/test/java/com/centit/framework/web/demo/test/TestQuerySystemTable.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.web.demo.test;
2 |
3 | import com.centit.framework.common.SysParametersUtils;
4 | import com.centit.prodcts.demoapp.config.ServiceConfig;
5 | import com.centit.support.algorithm.NumberBaseOpt;
6 | import com.centit.support.database.utils.DataSourceDescription;
7 |
8 | import java.lang.annotation.Annotation;
9 | import java.util.Properties;
10 |
11 | /**
12 | * Created by codefan on 17-9-11.
13 | */
14 | public class TestQuerySystemTable {
15 |
16 |
17 | public static DataSourceDescription getDataSource() {
18 | DataSourceDescription dataSource = new DataSourceDescription();
19 | Properties env = SysParametersUtils.loadProperties();
20 | //dataSource.setDriverClassName(env.getProperty("jdbc.driver"));
21 | dataSource.setConnUrl(env.getProperty("jdbc.url"));
22 | dataSource.setUsername(env.getProperty("jdbc.user"));
23 | dataSource.setPassword(env.getProperty("jdbc.password"));
24 | dataSource.setMaxTotal(NumberBaseOpt.castObjectToInteger(env.getProperty("jdbc.maxActive")));
25 | dataSource.setMaxIdle(NumberBaseOpt.castObjectToInteger(env.getProperty("jdbc.maxIdle")));
26 | dataSource.setMaxWaitMillis(NumberBaseOpt.castObjectToInteger(env.getProperty("jdbc.maxWait")));
27 | //dataSource.setDefaultAutoCommit(StringRegularOpt.isTrue(env.getProperty("jdbc.defaultAutoCommit")));
28 | //dataSource.setRemoveAbandonedTimeout(NumberBaseOpt.castObjectToInteger(env.getProperty("jdbc.removeAbandonedTimeout")));
29 | return dataSource;
30 | }
31 |
32 | public static void main(String[] args) {
33 | Annotation[] annotations = ServiceConfig.class.getAnnotations();
34 | System.out.println(annotations.length);
35 | // UserInfoDaoImpl userInfoDao = new UserInfoDaoImpl();
36 | //
37 | // userInfoDao.setDataSource(getDataSource());
38 | // Map filterMap = Collections.createHashMap("unitCode","U00001");
39 | // PageDesc page = new PageDesc();//1,20,userInfoDao.pageCount(filterMap ) );
40 | //
41 | // Map pageQureyMap =
42 | // QueryParameterPrepare.prepPageParams(filterMap, page , 1 /* userInfoDao.pageCount(filterMap )*/);
43 | //
44 | // List users = userInfoDao.pageQuery(pageQureyMap);
45 | // System.out.println(page.getTotalRows());
46 | // System.out.println(users.size());
47 | // if(users.size()>0) {
48 | // System.out.println(users.get(0).getUserName());
49 | // }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/framework-system-dubbo-client-config/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | framework-system-parent
7 | com.centit.framework
8 | ${revision}
9 |
10 | 4.0.0
11 |
12 | framework-system-dubbo-client-config
13 |
14 |
15 |
16 | com.centit.framework
17 | framework-dubbo-config
18 | ${project.version}
19 |
20 |
21 |
22 | com.centit.framework
23 | framework-core
24 | ${project.version}
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/framework-system-dubbo-client-config/src/main/java/com/centit/framework/dubbo/config/IpServerDubboClientConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.dubbo.config;
2 |
3 | import com.centit.framework.model.adapter.PlatformEnvironment;
4 | import com.centit.framework.model.security.CentitUserDetailsService;
5 | import com.centit.framework.security.UserDetailsServiceImpl;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.context.annotation.ImportResource;
9 |
10 | @ImportResource({"classpath:dubbo-ip-client.xml"})
11 | public class IpServerDubboClientConfig {
12 |
13 | @Bean
14 | public CentitUserDetailsService centitUserDetailsService(
15 | @Autowired PlatformEnvironment platformEnvironment) {
16 | UserDetailsServiceImpl userDetailsService = new UserDetailsServiceImpl();
17 | userDetailsService.setPlatformEnvironment(platformEnvironment);
18 | return userDetailsService;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/framework-system-dubbo-client-config/src/main/resources/dubbo-ip-client.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/framework-system-module/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | framework-system-parent
7 | com.centit.framework
8 | ${revision}
9 |
10 | 4.0.0
11 |
12 | framework-system-module
13 | com.centit.framework:framework-system-module
14 | jar
15 | 定义了一组和core兼容的表结构,并用mybatis实现了表的增删改查
16 |
17 |
18 |
19 | com.centit.framework
20 | framework-core
21 | ${project.version}
22 |
23 |
24 |
25 | com.centit.framework
26 | centit-persistence-jdbc
27 | ${project.version}
28 |
29 |
30 |
31 | com.centit.framework
32 | centit-persistence-extend
33 | ${project.version}
34 |
35 |
36 |
37 | org.springframework
38 | spring-tx
39 |
40 |
41 |
42 | javax.servlet
43 | javax.servlet-api
44 | provided
45 |
46 |
47 |
48 | org.projectlombok
49 | lombok
50 |
51 |
52 |
53 |
54 | junit
55 | junit
56 | test
57 |
58 |
59 |
60 |
61 |
62 |
63 | src/main/java
64 |
65 | **/*.xml
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/constant/TenantConstant.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.constant;
2 |
3 | /**
4 | * 租户管理中用到常量
5 | */
6 | public class TenantConstant {
7 |
8 | private TenantConstant(){}
9 |
10 | /**
11 | * 开发人员系统角色
12 | */
13 | public static final String OS_MEMBER="osmember";
14 |
15 | /**
16 | * 平台管理员 系统角色
17 | */
18 | public static final String PLAT_ADMIN="platadmin";
19 |
20 | /**
21 | * 租户管理员 系统角色
22 | */
23 | public static final String TENANT_ADMIN="tenantadmin";
24 |
25 | /**
26 | * 组织管理员 代码 和 系统角色
27 | */
28 | public static final String ORGANIZE_ADMIN="orgadmin";
29 |
30 | public static final String WORKGROUP_ROLE_CODE_LEADER = "组长";
31 |
32 | public static final String WORKGROUP_ROLE_CODE_MEMBER = "组员";
33 |
34 | /**
35 | * 租户管理员角色代码
36 | */
37 | public static final String TENANT_ADMIN_ROLE_CODE = "ZHGLY";
38 |
39 | /**
40 | *租户组员角色代码
41 | */
42 | public static final String TENANT_NORMAL_MEMBER_ROLE_CODE = "ZHZY";
43 | /**
44 | * 租户宿主
45 | */
46 | public static final String TENANT_OWNE_ROLE_CODE = "OWN";
47 |
48 | /**
49 | * 应用中的开发组长
50 | */
51 | public static final String APPLICATION_ADMIN_ROLE_CODE = "OSZZ";
52 | /**
53 | * 应用中的开发组员
54 | */
55 | public static final String APPLICATION_NORMAL_MEMBER_ROLE_CODE = "OSZY";
56 | /**
57 | * 数据库资源类型
58 | */
59 | public static final String DATABASE_SOURCE_TYPE = "D";
60 | /**
61 | * 应用资源类型
62 | */
63 | public static final String OS_SOURCE_TYPE = "O";
64 | /**
65 | * 文件空间资源类型
66 | */
67 | public static final String FILE_SPACE_SOURCE_TYPE = "F";
68 | /**
69 | * 数据空间资源类型
70 | */
71 | public static final String DATA_SPACE_SOURCE_TYPE = "C";
72 |
73 | /**
74 | * 系统租户topUnitCode
75 | */
76 | public static final String SYSTEM_TENANT_TOP_UNIT_CODE = "system";
77 |
78 | /**
79 | * 系统管理员角色code
80 | */
81 | public static final String SYSTEM_ADMIN_ROLE_CODE = "sysadmin";
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/DataCatalogDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.model.basedata.DataCatalog;
6 | import com.centit.support.algorithm.CollectionsOpt;
7 | import org.springframework.stereotype.Repository;
8 | import org.springframework.transaction.annotation.Transactional;
9 |
10 | import java.util.HashMap;
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 | @Repository("dataCatalogDao")
15 | public class DataCatalogDao extends BaseDaoImpl{
16 |
17 | @Override
18 | public Map getFilterField() {
19 | Map filterField = new HashMap<>();
20 | filterField.put("catalogCode", CodeBook.LIKE_HQL_ID);
21 | filterField.put("catalogName", CodeBook.LIKE_HQL_ID);
22 | filterField.put("catalogStyle", CodeBook.EQUAL_HQL_ID);
23 | filterField.put("catalogType", CodeBook.EQUAL_HQL_ID);
24 | filterField.put("optId", CodeBook.EQUAL_HQL_ID);
25 | filterField.put("topUnit", CodeBook.EQUAL_HQL_ID);
26 | filterField.put("osId",
27 | "CATALOG_CODE in (select dictionary_id from m_application_dictionary where os_id = :osId)");
28 |
29 | return filterField;
30 | }
31 |
32 | @Transactional
33 | public DataCatalog getObjectById(String catalogCode) {
34 | return super.getObjectById(catalogCode);
35 | }
36 |
37 | @Transactional
38 | public void deleteObjectById(String catalogCode) {
39 | super.deleteObjectById(catalogCode);
40 | }
41 |
42 | @Transactional
43 | public List listFixCatalog() {
44 | return listObjectsByProperties(CollectionsOpt.createHashMap("catalogStyle","F"));
45 | }
46 |
47 | @Transactional
48 | public List listUserCatalog() {
49 | return listObjectsByProperties(CollectionsOpt.createHashMap("catalogStyle","U"));
50 | }
51 |
52 | @Transactional
53 | public List listSysCatalog() {
54 | return listObjectsByProperties(CollectionsOpt.createHashMap("catalogStyle","S"));
55 | }
56 |
57 | @Transactional
58 | public void updateCatalog(DataCatalog dataCatalog){
59 | super.updateObject(dataCatalog);
60 | }
61 |
62 | @Transactional
63 | public List listDataCatalogByUnit(String topUnit){
64 | return super.listObjectsByProperties(CollectionsOpt.createHashMap("topUnit", topUnit));
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/DataDictionaryDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.model.basedata.DataDictionary;
6 | import com.centit.framework.model.basedata.DataDictionaryId;
7 | import com.centit.support.algorithm.CollectionsOpt;
8 | import org.springframework.stereotype.Repository;
9 | import org.springframework.transaction.annotation.Transactional;
10 |
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 |
15 | @Repository("dataDictionaryDao")
16 | public class DataDictionaryDao
17 | extends BaseDaoImpl{
18 |
19 | // 转换主键中的 字段描述 对应关系
20 | @Override
21 | public Map getFilterField() {
22 | Map filterField = new HashMap<>();
23 | filterField.put("datacode", CodeBook.EQUAL_HQL_ID);
24 | filterField.put("catalogcode", CodeBook.EQUAL_HQL_ID);
25 | filterField.put("catalogCode", CodeBook.EQUAL_HQL_ID);
26 | filterField.put("NP_system", "dataStyle = 'S'");
27 | filterField.put("dataValue", CodeBook.LIKE_HQL_ID);
28 | filterField.put("catalogName", CodeBook.LIKE_HQL_ID);
29 | filterField.put("(splitforin)catalogcodes", "catalog_code in (:catalogcodes)");
30 | filterField.put("treeCode","data_code=:treeCode or extra_code=:treeCode");
31 | return filterField;
32 | }
33 |
34 |
35 |
36 | public DataDictionary getObjectById(DataDictionaryId dd) {
37 | return super.getObjectById(dd);
38 | }
39 |
40 | public void deleteObjectById(DataDictionaryId dd) {
41 | super.deleteObjectById(dd);
42 | }
43 |
44 | public List getWholeDictionary(Map filterMap){
45 | return listObjectsByProperties(filterMap);
46 |
47 | }
48 |
49 | @Transactional
50 | public List listDataDictionary(String catalogCode) {
51 | return listObjectsByProperties(CollectionsOpt.createHashMap("catalogCode", catalogCode));
52 | }
53 |
54 | @Transactional
55 | public void deleteDictionary(String catalog) {
56 | deleteObjectsByProperties(
57 | CollectionsOpt.createHashMap( "catalogCode", catalog));
58 | }
59 |
60 | public void updateDictionary(DataDictionary dataDictionary){
61 | super.updateObject(dataDictionary);
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/OsInfoDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.model.basedata.OsInfo;
6 | import com.centit.support.algorithm.CollectionsOpt;
7 | import org.apache.commons.lang3.StringUtils;
8 | import org.springframework.stereotype.Repository;
9 | import org.springframework.transaction.annotation.Transactional;
10 |
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 |
15 | @Repository
16 | public class OsInfoDao extends BaseDaoImpl {
17 |
18 | public Map getFilterField() {
19 | Map filterField = new HashMap<>();
20 | filterField.put("osId", CodeBook.LIKE_HQL_ID);
21 | filterField.put("osName", CodeBook.LIKE_HQL_ID);
22 | filterField.put("osType", CodeBook.LIKE_HQL_ID);
23 | filterField.put("topUnit", CodeBook.LIKE_HQL_ID);
24 | filterField.put("hasInterface", CodeBook.LIKE_HQL_ID);
25 | filterField.put("interfaceUrl", CodeBook.LIKE_HQL_ID);
26 | filterField.put("created", CodeBook.LIKE_HQL_ID);
27 | filterField.put("lastUpdateTime", CodeBook.LIKE_HQL_ID);
28 | filterField.put("createTime", CodeBook.LIKE_HQL_ID);
29 | return filterField;
30 | }
31 |
32 | @Transactional
33 | public List listOsInfoByUnit(String topUnit){
34 | return super.listObjectsByFilter(
35 | " where IS_DELETE = 'F' AND TOP_UNIT = ?",
36 | new Object[]{topUnit});
37 | }
38 |
39 | @Transactional
40 | public OsInfo getOsInfoByRelOpt(String relOptId){
41 | if(StringUtils.isBlank(relOptId)) return null;
42 | return super.getObjectByProperties(CollectionsOpt.createHashMap("relOptId", relOptId));
43 | }
44 |
45 | public int countOsInfoByTopUnit(String topUnit) {
46 | if(StringUtils.isBlank(topUnit)) return 0;
47 | return this.countObjectByProperties(CollectionsOpt.createHashMap("topUnit", topUnit));
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/PlatformDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.jdbc.dao.DatabaseOptUtils;
6 | import com.centit.framework.model.basedata.Platform;
7 | import com.centit.support.algorithm.CollectionsOpt;
8 | import com.centit.support.algorithm.NumberBaseOpt;
9 | import org.springframework.stereotype.Repository;
10 |
11 | import java.util.HashMap;
12 | import java.util.Map;
13 |
14 | /**
15 | * @author zfg
16 | */
17 | @Repository("platformDao")
18 | public class PlatformDao extends BaseDaoImpl {
19 |
20 | public Map getFilterField() {
21 | Map filterField = new HashMap<>();
22 | filterField.put("platId", CodeBook.EQUAL_HQL_ID);
23 | filterField.put("platSourceCode", CodeBook.EQUAL_HQL_ID);
24 | filterField.put("platType", CodeBook.EQUAL_HQL_ID);
25 | filterField.put("corpId", CodeBook.LIKE_HQL_ID);
26 | filterField.put("appKey", CodeBook.EQUAL_HQL_ID);
27 | filterField.put("appSecret", CodeBook.EQUAL_HQL_ID);
28 |
29 | return filterField;
30 | }
31 |
32 | /**
33 | *
34 | * @param platSourceCode 平台来源代码
35 | * @param platId 平台ID
36 | * @return
37 | */
38 | public boolean isUniquePlat(String platSourceCode, String platId) {
39 | String sql = "select count(*) as hasSameNamePlat from F_PLATFORM u " +
40 | "where u.PLAT_SOURCE_CODE = :platSourceCode and" +
41 | " u.PLAT_ID <> :platId";
42 | Object hasSameNamePlat = DatabaseOptUtils.getScalarObjectQuery(this, sql, CollectionsOpt.createHashMap(
43 | "platSourceCode", platSourceCode, "platId", platId));
44 | return NumberBaseOpt.castObjectToInteger(hasSameNamePlat, 0) > 0;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/TenantBusinessLogDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
4 | import com.centit.framework.system.po.TenantBusinessLog;
5 | import org.springframework.stereotype.Repository;
6 |
7 | @Repository
8 | public class TenantBusinessLogDao extends BaseDaoImpl {
9 | }
10 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/TenantMemberApplyDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
4 | import com.centit.framework.system.po.TenantMemberApply;
5 | import org.springframework.stereotype.Repository;
6 | import org.springframework.transaction.annotation.Transactional;
7 |
8 |
9 | @Repository
10 | public class TenantMemberApplyDao extends BaseDaoImpl {
11 |
12 |
13 | /**
14 | * 还未审批条件
15 | */
16 | public static final String[] NOT_APPROVE_ARRAY = {"1","2"};
17 | /**
18 | * 已经审批列表条件
19 | */
20 | public static final String[] HAS_APPROVE_ARRAY= {"3","4"};
21 |
22 | /**
23 | * 同意条件
24 | */
25 | public static final String[] HAS_AGREE = {"3"};
26 | /**
27 | * 不同意条件
28 | */
29 | public static final String[] NOT_AGREE = {"4"};
30 |
31 | /**
32 | * 用户主动申请
33 | */
34 | public static final String APPLYTYPE_APPLY = "1";
35 |
36 | /**
37 | * 租户邀请
38 | */
39 | public static final String APPLYTYPE_INVITED = "2";
40 |
41 |
42 | /**
43 | * 保存数据前查看数据是否存在,如果存在把applyState修改为重新申请
44 | * @param tenantMemberApply
45 | */
46 | @Transactional
47 | public void saveTenantMemberApply(TenantMemberApply tenantMemberApply) {
48 | TenantMemberApply oldTenantMemberApply = super.getObjectById(tenantMemberApply);
49 | if (null == oldTenantMemberApply){
50 | tenantMemberApply.setApplyState("1");
51 | super.saveNewObject(tenantMemberApply);
52 | }else {
53 | //更新字段为空的数据
54 | tenantMemberApply.setApplyState("2");
55 | String[] fields = new String[]{"inviterUserCode","applyType","applyTime","applyState",
56 | "applyRemark","approveRemark","unitCode"};
57 | super.updateObject(fields,tenantMemberApply);
58 | }
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/UnitRoleDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
4 | import com.centit.framework.model.basedata.UnitRole;
5 | import com.centit.framework.model.basedata.UnitRoleId;
6 | import com.centit.support.algorithm.CollectionsOpt;
7 | import org.springframework.stereotype.Repository;
8 | import org.springframework.transaction.annotation.Transactional;
9 |
10 | import java.util.HashMap;
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 | @Repository("unitRoleDao")
15 | public class UnitRoleDao extends BaseDaoImpl {
16 |
17 | public Map getFilterField() {
18 | Map filterField = new HashMap<>();
19 | filterField.put("roleCode", "ROLE_CODE = :roleCode");
20 | filterField.put("unitCode", "UNIT_CODE = :unitCode");
21 | filterField.put("(StartWith)unitPathPrefix",
22 | "UNIT_CODE in (select UNIT_CODE from f_unitinfo where UNIT_PATH like :unitPathPrefix)");
23 | filterField.put("currentUnitCode",
24 | "ROLE_CODE in (select ROLE_CODE from f_roleinfo where UNIT_CODE = :currentUnitCode)");
25 | filterField.put("unitValid", "unitCode in (select UNIT_CODE from f_unitinfo where IS_VALID = :unitValid)");
26 | filterField.put("roleValid", "roleCode in (select ROLE_CODE from f_roleinfo where IS_VALID = :roleValid)");
27 | return filterField;
28 | }
29 |
30 | @Transactional
31 | public void updateUnitRole(UnitRole dbUnitRole){
32 | super.updateObject(dbUnitRole);
33 | }
34 |
35 | @Transactional
36 | public void mergeUnitRole(UnitRole dbUnitRole) {
37 | super.mergeObject(dbUnitRole);
38 | }
39 |
40 | @Transactional
41 | public void deleteUnitRole(UnitRole dbUnitRole){
42 | super.deleteObject(dbUnitRole);
43 | }
44 |
45 | @Transactional
46 | public void deleteUnitRoleById(UnitRoleId id){
47 | super.deleteObjectById(id);
48 | }
49 |
50 | @Transactional
51 | public UnitRole getUnitRoleById(UnitRoleId id){
52 | return super.getObjectById(id);
53 | }
54 |
55 | @Transactional
56 | public List listUnitRolesByUnitCode(String unitCode){
57 | return super.listObjectsByProperties(CollectionsOpt.createHashMap("unitCode",unitCode));
58 | }
59 |
60 | @Transactional
61 | public List listUnitRolesByRoleCode(String roleCode){
62 | return super.listObjectsByProperties(CollectionsOpt.createHashMap("roleCode",roleCode));
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/UserPlatDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.model.basedata.UserPlat;
6 | import com.centit.support.algorithm.CollectionsOpt;
7 | import org.springframework.stereotype.Repository;
8 | import org.springframework.transaction.annotation.Transactional;
9 |
10 | import java.util.HashMap;
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 | /**
15 | * @author zfg
16 | */
17 | @Repository
18 | public class UserPlatDao extends BaseDaoImpl {
19 |
20 | public Map getFilterField() {
21 | Map filterField = new HashMap<>();
22 | filterField.put("userPlatId", CodeBook.EQUAL_HQL_ID);
23 | filterField.put("userCode", CodeBook.EQUAL_HQL_ID);
24 | filterField.put("corpId", CodeBook.EQUAL_HQL_ID);
25 | filterField.put("appKey", CodeBook.EQUAL_HQL_ID);
26 | filterField.put("appSecret", CodeBook.EQUAL_HQL_ID);
27 | filterField.put("unionId", CodeBook.EQUAL_HQL_ID);
28 | filterField.put("userId", CodeBook.EQUAL_HQL_ID);
29 |
30 | return filterField;
31 | }
32 |
33 | @Transactional
34 | public List listPlatUsersByPlatId(String platId) {
35 | return listObjectsByProperties(CollectionsOpt.createHashMap("platId", platId));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/UserSyncDirectoryDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
4 | import com.centit.framework.model.basedata.UserSyncDirectory;
5 | import org.springframework.stereotype.Repository;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author tian_y
11 | */
12 | @Repository("userSyncDirectoryDao")
13 | public class UserSyncDirectoryDao extends BaseDaoImpl {
14 |
15 | public List listObjectsAll() {
16 | return super.listObjects();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/dao/WorkGroupDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.dao;
2 |
3 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
4 | import com.centit.framework.model.basedata.WorkGroup;
5 | import com.centit.framework.model.basedata.WorkGroupParameter;
6 | import org.springframework.stereotype.Repository;
7 |
8 |
9 | /**
10 | * FileLibraryAccessDao Repository.
11 | * create by scaffold 2020-08-18 13:38:15
12 | *
13 | * @author codefan@sina.com
14 | * 项目库授权信息
15 | */
16 |
17 | @Repository
18 | public class WorkGroupDao extends BaseDaoImpl {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/DataDictionaryManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.centit.framework.model.basedata.DataCatalog;
5 | import com.centit.framework.model.basedata.DataDictionary;
6 | import com.centit.framework.model.basedata.DataDictionaryId;
7 | import com.centit.support.database.utils.PageDesc;
8 |
9 | import java.util.Collection;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | public interface DataDictionaryManager {
14 |
15 | DataCatalog getObjectById(String catalogCode);
16 |
17 | int existCatalogName(String catalogName);
18 |
19 | void saveNewObject(DataCatalog dataCatalog);
20 |
21 | void updateCatalog(DataCatalog dataCatalog);
22 |
23 | @Deprecated
24 | List listSysDataCatalog();
25 |
26 | List listUserDataCatalog();
27 |
28 | List listFixDataCatalog();
29 |
30 | List listAllDataCatalog(Map filterMap);
31 |
32 | JSONArray appendRelativeOsInfo(List catalogList);
33 |
34 | List listDataDictionarys(Map filterDescMap);
35 |
36 | List listObjects(Map filterDescMap,PageDesc pageDesc);
37 |
38 | DataCatalog getCatalogIncludeDataPiece(String catalogCode);
39 |
40 | List saveCatalogIncludeDataPiece(DataCatalog dataCatalog);
41 |
42 | void deleteDataDictionary(String catalogCode);
43 |
44 | void deleteDataDictionaryPiece(DataDictionaryId id);
45 |
46 | void saveDataDictionaryPiece(DataDictionary dd);
47 |
48 | DataDictionary getDataDictionaryPiece(DataDictionaryId id);
49 |
50 | String[] getFieldsDesc(String sDesc, String sType);
51 |
52 | List getDataDictionary(String catalogCode);
53 |
54 | List getWholeDictionary(Collection catalogCodes);
55 | }
56 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/OptInfoManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.OptDataScope;
4 | import com.centit.framework.model.basedata.OptInfo;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | public interface OptInfoManager {
10 |
11 | List listObjects();
12 |
13 | List listObjects(Map filterMap);
14 |
15 | OptInfo getObjectById(String optId);
16 |
17 | boolean hasChildren(String optId);
18 |
19 | /**
20 | * 获取角色菜单中需要权限控制的业务菜单
21 | *
22 | * @return 角色菜单中需要权限控制的业务菜单
23 | */
24 |
25 | List listItemPowerOpts();
26 |
27 | List listSysAndOptPowerOpts();
28 |
29 | List listAllDataScope();
30 |
31 | /**
32 | * 获取用户数据权限过滤器
33 | *
34 | * @param sUserCode sUserCode
35 | * @param sOptid 业务名称
36 | * @param sOptMethod 对应的方法名称
37 | * @return 过滤条件列表,null或者空位不过来
38 | */
39 | List listUserDataFiltersByOptIdAndMethod(String sUserCode, String sOptid, String sOptMethod);
40 |
41 | /**
42 | * 将数据转换为树形结构
43 | *
44 | * @param optInfos optInfos
45 | * @param fillDefAndScope boolean
46 | * @return 将数据转换为树形结构
47 | */
48 | List listObjectFormatTree(List optInfos, boolean fillDefAndScope);
49 |
50 | /**
51 | * 获取某一个机构的权限列表供定义机构角色使用
52 | *
53 | * @param sUnitCode sUnitCode
54 | * @return 某一个机构的权限列表供定义机构角色使用
55 | */
56 | List listOptWithPowerUnderUnit(String sUnitCode);
57 |
58 | void saveNewOptInfo(OptInfo optinfo);
59 |
60 | void updateOptInfo(OptInfo optinfo);
61 |
62 | void updateOperationPower(OptInfo optInfo);
63 |
64 | int countSubOptInfo(String optId);
65 |
66 | void deleteOptInfoById(String optId);
67 |
68 | OptInfo getOptInfoById(String optId);
69 |
70 | /**
71 | * 查询用户全部权限
72 | *
73 | * @param userCode 用户代码
74 | * @param asAdmin 是否作为管理员
75 | * @return List OptInfo
76 | */
77 | List listUserAllPower(String userCode, boolean asAdmin);
78 |
79 | List listFromParent(Map filterMap);
80 |
81 | List listAllOptInfoByUnit(String topUnit);
82 |
83 | List listUserOptinfos(String topUnit, String userCode);
84 | }
85 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/OptMethodManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.OptMethod;
4 |
5 | import java.util.List;
6 |
7 | public interface OptMethodManager{
8 |
9 | List listOptMethodByOptID(String sOptID);
10 |
11 | String getNextOptCode();
12 |
13 | List listObjects();
14 |
15 | OptMethod getObjectById(String optCode);
16 |
17 | void updateOptMethod(OptMethod optMethod);
18 |
19 | void deleteObjectById(String optCode);
20 |
21 | String saveNewObject(OptMethod optMethod);
22 |
23 | List listAllOptMethodByUnit(String topUnit);
24 | }
25 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/OsInfoManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 |
4 | import com.alibaba.fastjson2.JSONArray;
5 | import com.centit.framework.jdbc.service.BaseEntityManager;
6 | import com.centit.framework.model.basedata.OsInfo;
7 | import com.centit.support.database.utils.PageDesc;
8 |
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | public interface OsInfoManager extends BaseEntityManager {
13 |
14 | List listObjects(Map map);
15 |
16 | List listObjects(Map map, PageDesc pageDesc);
17 |
18 | JSONArray listOsInfoAsJson(Map filterMap, PageDesc pageDesc);
19 |
20 | boolean refreshSingle(OsInfo osInfo);
21 |
22 | boolean refreshAll();
23 | }
24 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/PlatformService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.Platform;
4 | import com.centit.support.database.utils.PageDesc;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | /**
10 | * @author zfg
11 | */
12 | public interface PlatformService {
13 |
14 | List listObjects(Map filterMap);
15 |
16 | List listObjects(Map filterMap, PageDesc pageDesc);
17 |
18 | Platform getObjectById(String platId);
19 |
20 | Platform getPlatformByProperties(Map paramsMap);
21 |
22 | boolean hasSamePlat(Platform platform);
23 |
24 | void savePlatform(Platform platform);
25 |
26 | void updatePlatform(Platform platform);
27 |
28 | void deletePlatform(Platform platform);
29 | }
30 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/SysRoleManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.centit.framework.model.basedata.OptMethod;
5 | import com.centit.framework.model.basedata.RoleInfo;
6 | import com.centit.framework.model.basedata.RolePower;
7 | import com.centit.support.database.utils.PageDesc;
8 |
9 | import java.io.Serializable;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | public interface SysRoleManager{
14 |
15 | List listObjects(Map filterMap);
16 |
17 | List listObjects(Map filterMap, PageDesc pageDesc);
18 |
19 | RoleInfo getObjectById(String roleCode);
20 |
21 | List getRolePowers(String rolecode); // 角色操作权限
22 |
23 | List getRolePowersByDefCode(String optCode);
24 |
25 | Serializable saveNewRoleInfo(RoleInfo o);
26 |
27 | void updateRoleInfo(RoleInfo o);
28 |
29 | /**
30 | * 更新角色权限
31 | * @param o 角色对象
32 | * @return 旧的操作权限
33 | */
34 | List updateRolePower(RoleInfo o);
35 |
36 | /**
37 | * 根据单位code更新角色权限
38 | * @param roleInfo RoleInfo
39 | * @param topUnit String
40 | * @return List RolePower
41 | */
42 | List updateRolePower(RoleInfo roleInfo,String topUnit);
43 |
44 | void deleteRoleInfo(String roleCode);
45 |
46 | RoleInfo getRoleInfo(String roleCode);
47 |
48 | List listAllRolePowers();
49 |
50 | List listAllOptMethods();
51 |
52 | int countRoleUserSum(String roleCode);
53 |
54 | /**
55 | * 判断角色名称是否重复
56 | * @param roleName 角色名称
57 | * @param roleCode 角色代码 (新增时设为null)
58 | * @param unitCode 部门代码 (系统角色设为null)
59 | * @return 名称是否可用 (true 可用; false 不可用)
60 | */
61 | boolean judgeSysRoleNameCanBeUsed(String roleName, String roleCode, String unitCode);
62 |
63 | /**
64 | * 根据optCode查询角色信息
65 | * @param optCode String
66 | * @return List RoleInfo
67 | */
68 | List listRoleInfoByOptCode(String optCode);
69 |
70 | JSONArray listRoleInfoAndPowerByOptCode(String optCode);
71 |
72 | /**
73 | * 根据optCode更新F_ROLEPOWER中的信息
74 | * @param optCode 操作code
75 | * @param roleCode 角色code 当roleCode为空时,意味着要删除与optCode相关的所有数据
76 | */
77 | void updateRolePower(String optCode, String roleCode);
78 |
79 | void updateRolePowersByOptCode(String optCode, List rolePowers);
80 | }
81 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/SysUnitManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.UnitInfo;
4 | import com.centit.framework.model.basedata.UserInfo;
5 | import com.centit.support.database.utils.PageDesc;
6 |
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | public interface SysUnitManager{
11 |
12 | List listObjects(Map filterMap);
13 |
14 | List listObjects(Map filterMap, PageDesc pageDesc);
15 |
16 | UnitInfo getObjectById(String unitCode);
17 |
18 | List getUnitUsers(String unitCode);
19 |
20 | UnitInfo getUnitByName(String name);
21 |
22 | List listObjectsAsSort(Map searchColumn);
23 |
24 | /**
25 | * 更新机构及子机构的状态
26 | * @param unitCode 机构代码
27 | * @param isValid 状态码
28 | */
29 | void changeStatus(String unitCode, String isValid);
30 |
31 | /**
32 | * 删除机构
33 | * @param unitinfo 机构对象
34 | */
35 | void deleteUnitInfo(UnitInfo unitinfo);
36 |
37 | String saveNewUnitInfo(UnitInfo unitinfo);
38 |
39 | boolean hasSameName(UnitInfo unitInfo);
40 |
41 | boolean isUniqueOrder(UnitInfo unitInfo);
42 |
43 | void updateUnitInfo(UnitInfo unitinfo);
44 | List listAllSubObjectsAsSort(String primaryUnit);
45 |
46 | void checkState(List objs);
47 |
48 | List listValidSubUnit(String unitCode);
49 |
50 | List listAllSubUnits(String unitCode);
51 |
52 | /**
53 | * 查询启用状态的下级机构
54 | * @param unitCode 当前机构代码
55 | * @return List UnitInfo
56 | */
57 | List listValidSubUnits(String unitCode);
58 |
59 | /**
60 | * 部门编码是否唯一
61 | * @param depNo 部门编码
62 | * @param unitCode 部门代码
63 | * @return true-唯一;false-不唯一
64 | */
65 | boolean isDepNoUnique(String depNo, String unitCode);
66 |
67 | /**
68 | * 部门编码是否唯一
69 | * @param depNo 部门编码
70 | * @param unitCode 部门代码
71 | * @return true-唯一;false-不唯一
72 | */
73 | boolean isUnitWordUnique(String depNo, String unitCode);
74 |
75 | List listUserTopUnits(String userCode);
76 |
77 | List listAllTopUnits();
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/SysUnitRoleManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.centit.framework.model.basedata.UnitRole;
5 | import com.centit.support.database.utils.PageDesc;
6 |
7 | import java.util.Map;
8 |
9 | /**
10 | * @author codefan
11 | */
12 | public interface SysUnitRoleManager {
13 |
14 | JSONArray listObjects(Map filterMap, PageDesc pageDesc);
15 |
16 | JSONArray listUnitRoles(String unitCode,PageDesc pageDesc);
17 |
18 | /**
19 | * 根据机构 该机构关联角色
20 | * @param unitCode 机构代码
21 | * @param pageDesc 分页
22 | * @return 查询结果
23 | */
24 | JSONArray listCurrentUnitRoles(String unitCode, PageDesc pageDesc);
25 |
26 | JSONArray listRoleUnits(String roleCode,PageDesc pageDesc);
27 |
28 | /**
29 | * 根据角色 查询当前部门 机构
30 | * @param roleCode 角色代码
31 | * @param unitPathPrefix 机构路径前缀
32 | * @param pageDesc 分页
33 | * @return 查询结果
34 | */
35 | JSONArray listRoleSubUnits(String roleCode, String unitPathPrefix, PageDesc pageDesc);
36 |
37 | UnitRole getUnitRoleById(String unitCode, String roleCode);
38 |
39 | void saveNewUnitRole(UnitRole dbUnitRole);
40 |
41 | void deleteUnitRole(String unitCode, String roleCode);
42 |
43 | void updateUnitRole(UnitRole unitRole);
44 |
45 | void mergeUnitRole(UnitRole unitRole);
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/SysUserManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.centit.framework.model.basedata.OptMethod;
5 | import com.centit.framework.model.basedata.RoleInfo;
6 | import com.centit.framework.model.basedata.UserInfo;
7 | import com.centit.framework.model.basedata.UserUnit;
8 | import com.centit.support.database.utils.PageDesc;
9 |
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | public interface SysUserManager{
14 |
15 | List listObjects(Map filterMap);
16 |
17 | List listObjects(Map filterMap, PageDesc pageDesc);
18 | JSONArray listObjectsByUnit(Map filterMap, PageDesc pageDesc);
19 |
20 | UserInfo getObjectById(String userCode);
21 |
22 | /**
23 | * getObjectByLoginName
24 | * @param userCode userCode
25 | * @return UserInfo
26 | */
27 | UserInfo loadUserByLoginname(String userCode);
28 |
29 | // return super.getObjectByProperty("regEmail", regEmail);
30 | UserInfo getUserByRegEmail(String regEmail);
31 |
32 | //return super.getObjectByProperty("regCellPhone", regCellPhone);
33 | UserInfo getUserByRegCellPhone(String regCellPhone);
34 |
35 |
36 | void setNewPassword(String userID, String oldPassword, String newPassword);
37 |
38 | void forceSetPassword(String userCode, String newPassword);
39 | /**
40 | * 保存用户信息,包括用户机构、用户角色信息
41 | * @param userinfo userinfo
42 | * @param userUnit 用户机构
43 | */
44 | void saveNewUserInfo(UserInfo userinfo, UserUnit userUnit);
45 |
46 | void updateUserInfo(UserInfo userinfo);
47 |
48 | void updateUserProperities(UserInfo userinfo);
49 |
50 |
51 | void deleteUserInfo(String userCode);
52 |
53 | List listUserValidRoles(String userCode);
54 |
55 | boolean checkIfUserExists(UserInfo user);
56 |
57 | boolean checkUserPassword(String userCode, String oldPassword);
58 |
59 | boolean isLoginNameExist(String userCode, String loginName);
60 | boolean isCellPhoneExist(String userCode, String regPhone);
61 | boolean isEmailExist(String userCode, String regEmail);
62 | boolean isAnyOneExist(String userCode, String loginName,String regPhone,String regEmail);
63 |
64 | UserInfo getUserByUserWord(String userWord);
65 |
66 | List listUserPowers(String topUnit, String userCode);
67 | }
68 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/SysUserUnitManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.UserUnit;
4 | import com.centit.support.database.utils.PageDesc;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | /**
10 | * Created with IntelliJ IDEA.
11 | * User: sx
12 | * Date: 14-10-28
13 | * Time: 下午3:05
14 | * To change this template use File | Settings | File Templates.
15 | */
16 | public interface SysUserUnitManager{
17 | UserUnit getObjectById(String userUnitId);
18 |
19 | void deleteObject(UserUnit userUnit);
20 |
21 | List listObjects(Map filterMap, PageDesc pageDesc);
22 |
23 | List listObjectByUserUnit(String userCode, String unitCode);
24 |
25 | UserUnit getPrimaryUnitByUserCode(String userCode, String topUnit);
26 |
27 | String saveNewUserUnit(UserUnit userUnit);
28 |
29 | void updateUserUnit(UserUnit userunit);
30 |
31 | boolean hasUserStation(String stationCode,String userCode);
32 |
33 | List listUnitUsersByUnitCode(String unitCode);
34 | List listUserUnitssByUserCode(String userCode);
35 |
36 | void deletePrimaryUnitByUserCode(String userCode, String topUnit);
37 |
38 | /**
39 | * 获取 某机构及其子机构下 所有 用户组
40 | * @param unitCode 机构Code
41 | * @param map 过滤条件
42 | * @param pageDesc 分页信息
43 | * @return 用户组列表
44 | */
45 | List listSubUsersByUnitCode(String unitCode, Map map, PageDesc pageDesc);
46 |
47 | List listUserUnitsUnderUnitByUserCode(String userCode, String unitCode, PageDesc pageDesc);
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/TenantPowerManage.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.centit.support.common.ObjectException;
5 |
6 | /**
7 | * 判断用户在租户中具有的权限与角色
8 | * 如果用户登录后,且判断的是当前人员不需要传入参数userCode
9 | */
10 | public interface TenantPowerManage {
11 |
12 | /**
13 | * 判断用户是否为租户所有者
14 | *
15 | * @param userCode 用户code
16 | * @param topUnit 租户id
17 | * @return true:是所有者
18 | */
19 | boolean userIsTenantOwner(String userCode, String topUnit);
20 |
21 | /**
22 | * 判断用户是否为租户管理员
23 | *
24 | * @param userCode 用户code
25 | * @param topUnit 租户id
26 | * @return true:是管理员
27 | */
28 | boolean userIsTenantAdmin(String userCode, String topUnit);
29 |
30 | /**
31 | * 获取租户的管理员列表
32 | * @param topUnit 租户代码
33 | * @return 管理员列表
34 | */
35 | JSONArray listTenantAdmin(String topUnit);
36 | /**
37 | * 租户是否为管理员或所有者
38 | * @param topUnit 租户
39 | * @return String
40 | */
41 | String userTenantRole(String userCode, String topUnit);
42 |
43 | /**
44 | * 判断用户是否为租户成员
45 | *
46 | * @param userCode 用户code
47 | * @param topUnit 租户id
48 | * @return true:是管理员
49 | */
50 | boolean userIsTenantMember(String userCode, String topUnit);
51 |
52 | /**
53 | * 判断用户是否为应用管理员
54 | *
55 | * @param userCode 用户code
56 | * @param osId 应用id
57 | * @return true:是管理员
58 | */
59 | boolean userIsApplicationAdmin(String userCode, String osId);
60 |
61 | /**
62 | * 判断用户是否为应用成员
63 | *
64 | * @param userCode 用户code
65 | * @param osId 应用id
66 | * @return true:是成员
67 | * @throws ObjectException 如果当前用户未登录抛出异常
68 | */
69 | boolean userIsApplicationMember(String userCode, String osId) throws ObjectException;
70 |
71 | /**
72 | * 校验用户是否为system租户成员
73 | * @param userCode 用户code
74 | * @return true:是 false:否
75 | */
76 | boolean userIsSystemMember(String userCode);
77 |
78 | /**
79 | * 校验当前用户是否为system租户管理员
80 | * @param userCode 用户code
81 | * @return true:是 false:否
82 | */
83 | boolean userIsSystemAdmin(String userCode);
84 |
85 | /**
86 | * 租户中用户数量是否达到限制
87 | * @param topUnit 租户
88 | * @return true:超出限制 false:未超出限制
89 | */
90 | boolean userNumberLimitIsOver(String topUnit);
91 |
92 | /**
93 | * 租户中单位数量是否达到限制
94 | * @param topUnit true:超出限制 false:未超出限制
95 | * @return boolean
96 | */
97 | boolean unitNumberLimitIsOver(String topUnit);
98 | }
99 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/UserDirectory.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.UserSyncDirectory;
4 |
5 | public interface UserDirectory {
6 |
7 | int synchroniseUserDirectory(UserSyncDirectory directory);
8 | }
9 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/UserPlatService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.UserPlat;
4 | import com.centit.support.database.utils.PageDesc;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | /**
10 | * @author zfg
11 | */
12 | public interface UserPlatService {
13 |
14 | UserPlat getObjectById(String userPlatId);
15 |
16 | UserPlat getUserPlatByProperties(Map paramsMap);
17 |
18 | List listPlatUsersByPlatId(String platId);
19 |
20 | List listObjects(Map filterMap, PageDesc pageDesc);
21 |
22 | void mergeObject(UserPlat userPlat);
23 |
24 | void deleteObjectById(String userPlatId);
25 |
26 | void saveUserPlat(UserPlat userPlat);
27 |
28 | void updateUserPlat(UserPlat userPlat);
29 |
30 | void deleteObject(UserPlat userPlat);
31 | }
32 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/UserSettingManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.centit.framework.model.basedata.UserSetting;
5 | import com.centit.framework.model.basedata.UserSettingId;
6 | import com.centit.support.database.utils.PageDesc;
7 |
8 | import java.util.List;
9 | import java.util.Map;
10 |
11 | public interface UserSettingManager {
12 |
13 | List getUserSettings(String userCode);
14 |
15 | List getUserSettings(String userCode,String optID);
16 |
17 | UserSetting getUserSetting(String userCode,String paramCode);
18 |
19 | void saveNewUserSetting(UserSetting userSetting);
20 |
21 | void updateUserSetting(UserSetting userSetting);
22 |
23 | void saveUserSetting(String userCode,String paramCode,String paramName,String paramValue,String optId);
24 |
25 | JSONArray listObjects(MapsearchColumn, PageDesc pageDesc);
26 |
27 | /**
28 | * 查询全部默认用户设置
29 | * @param pageDesc 分页信息
30 | * @param map 过滤条件
31 | * @return 个人设置列表
32 | */
33 | List listDefaultSettings(Map map, PageDesc pageDesc);
34 |
35 | List listObjects(MapsearchColumn);
36 |
37 | UserSetting getObjectById(UserSettingId userSettingid);
38 |
39 | void deleteObject(UserSetting userSetting);
40 |
41 | List getAllSettings();
42 | }
43 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/UserSyncDirectoryManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.UserSyncDirectory;
4 | import com.centit.support.database.utils.PageDesc;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | /**
10 | * @author tian_y
11 | */
12 | public interface UserSyncDirectoryManager {
13 |
14 | List listObjects();
15 |
16 | List listLdapDirectory();
17 |
18 | List listObjects(Map filterMap, PageDesc pageDesc, String userCode);
19 |
20 | UserSyncDirectory getObjectById(String Id);
21 |
22 | void saveUserSyncDirectory(UserSyncDirectory userSyncDirectory, String userCode);
23 |
24 | void updateUserSyncDirectory(UserSyncDirectory userSyncDirectory);
25 |
26 | void deleteUserSyncDirectoryById(String id);
27 | }
28 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/WorkGroupManager.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service;
2 |
3 | import com.centit.framework.model.basedata.WorkGroup;
4 | import com.centit.framework.system.vo.WorkGroupParames;
5 | import com.centit.support.database.utils.PageDesc;
6 |
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | /**
11 | * FileLibraryAccess Service.
12 | * create by scaffold 2020-08-18 13:38:15
13 | *
14 | * @author codefan@sina.com
15 | * 项目库授权信息
16 | */
17 |
18 | public interface WorkGroupManager{
19 | void updateWorkGroup(WorkGroup workGroup);
20 |
21 | void deleteWorkGroup(String groupId, String userCode, String roleCode);
22 |
23 | WorkGroup getWorkGroup(String groupId, String userCode, String roleCode);
24 |
25 | void createWorkGroup(WorkGroup workGroup);
26 |
27 | void batchWorkGroup(List workGroups);
28 |
29 | List listWorkGroup(String groupId, String userCode, String roleCode);
30 |
31 | List listWorkGroup(Map param, PageDesc pageDesc);
32 |
33 | int countWorkGroup(Map param);
34 |
35 | /**
36 | * 通过osid 判断当前登录用户是否属于当前工作组成员
37 | * @param osId String
38 | * @param userCode String
39 | * @return boolean
40 | */
41 | boolean loginUserIsExistWorkGroup(String osId, String userCode);
42 |
43 | boolean loginUserIsWorkGroupLeader(String osId,String userCode);
44 |
45 | void leaderHandOver(WorkGroupParames workGroupParames);
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/impl/OptMethodManagerImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service.impl;
2 |
3 | import com.centit.framework.components.CodeRepositoryCache;
4 | import com.centit.framework.model.basedata.OptMethod;
5 | import com.centit.framework.system.dao.OptMethodDao;
6 | import com.centit.framework.system.dao.RolePowerDao;
7 | import com.centit.framework.system.service.OptMethodManager;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 | import org.springframework.transaction.annotation.Transactional;
11 |
12 | import javax.validation.constraints.NotNull;
13 | import java.util.List;
14 |
15 | @Service("optMethodManager")
16 | @Transactional
17 | public class OptMethodManagerImpl implements OptMethodManager {
18 |
19 | @Autowired
20 | @NotNull
21 | protected OptMethodDao optMethodDao;
22 |
23 | @Autowired
24 | @NotNull
25 | protected RolePowerDao rolePowerDao;
26 |
27 | @Override
28 | public void updateOptMethod(OptMethod o) {
29 | optMethodDao.updateOptMethod(o);
30 | CodeRepositoryCache.evictCache("OptMethod");
31 | }
32 |
33 | @Override
34 | public List listOptMethodByOptID(String sOptID) {
35 | return optMethodDao.listOptMethodByOptID(sOptID);
36 | }
37 |
38 | @Override
39 | public String getNextOptCode() {
40 | return optMethodDao.getNextOptCode();
41 | }
42 |
43 | @Override
44 | public List listObjects() {
45 | return optMethodDao.listObjectsAll();
46 | }
47 |
48 | @Override
49 | public OptMethod getObjectById(String optCode) {
50 | return optMethodDao.getObjectById(optCode);
51 | }
52 |
53 | @Override
54 | public void deleteObjectById(String optCode) {
55 | optMethodDao.deleteOptMethodById(optCode);
56 | rolePowerDao.deleteRolePowersByOptCode(optCode);
57 | CodeRepositoryCache.evictCache("OptMethod");
58 | }
59 |
60 | @Override
61 | public String saveNewObject(OptMethod optMethod) {
62 | optMethodDao.saveNewObject(optMethod);
63 | CodeRepositoryCache.evictCache("OptMethod");
64 | return optMethod.getOptCode();
65 | }
66 |
67 | @Override
68 | public List listAllOptMethodByUnit(String topUnit) {
69 | return optMethodDao.listAllOptMethodByUnit(topUnit);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/impl/PersistenceUtils.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service.impl;
2 |
3 | import com.alibaba.fastjson2.JSON;
4 | import com.alibaba.fastjson2.JSONObject;
5 | import com.centit.support.algorithm.NumberBaseOpt;
6 | import com.centit.support.algorithm.StringBaseOpt;
7 | import com.centit.support.algorithm.UuidOpt;
8 | import org.apache.commons.lang3.StringUtils;
9 |
10 | abstract class PersistenceUtils {
11 |
12 | static String makeIdByFormat(String idno, String idFormat,
13 | String defaultPrefix, int defaultLen, String defaultPad){
14 | if(StringUtils.equalsIgnoreCase("uuid",idFormat)){
15 | return UuidOpt.getUuidAsString32();
16 | } else if(StringUtils.equalsIgnoreCase("uuid22",idFormat)){
17 | return UuidOpt.getUuidAsString22();
18 | } else {
19 | //{"prefix":"U","length":8,"pad":"0"}
20 | String prefix = defaultPrefix;
21 | String pad = defaultPad;
22 | int len = defaultLen;
23 | if(StringUtils.isNotBlank(idFormat)) {
24 | JSONObject idJsonFormat = (JSONObject) JSON.parse(idFormat);
25 | if (idJsonFormat != null) {
26 | len = NumberBaseOpt.castObjectToInteger(idJsonFormat.get("length"), 1);
27 | prefix = idJsonFormat.getString("prefix");
28 | pad = idJsonFormat.getString("pad");
29 | }
30 | }
31 | return StringBaseOpt.midPad(idno, len, prefix, pad);
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/impl/PlatformServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service.impl;
2 |
3 | import com.centit.framework.model.basedata.Platform;
4 | import com.centit.framework.system.dao.PlatformDao;
5 | import com.centit.framework.system.service.PlatformService;
6 | import com.centit.support.database.utils.PageDesc;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 | import org.springframework.transaction.annotation.Transactional;
10 |
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 | /**
15 | * @author zfg
16 | */
17 | @Service("platformService")
18 | @Transactional
19 | public class PlatformServiceImpl implements PlatformService {
20 |
21 | @Autowired
22 | private PlatformDao platformDao;
23 |
24 | @Override
25 | public List listObjects(Map filterMap) {
26 | return platformDao.listObjectsByProperties(filterMap);
27 | }
28 |
29 | @Override
30 | public List listObjects(Map filterMap, PageDesc pageDesc) {
31 | return platformDao.listObjectsByProperties(filterMap, pageDesc);
32 | }
33 |
34 | @Override
35 | public Platform getObjectById(String platId) {
36 | return platformDao.getObjectById(platId);
37 | }
38 |
39 | @Override
40 | public Platform getPlatformByProperties(Map paramsMap) {
41 | return platformDao.getObjectByProperties(paramsMap);
42 | }
43 |
44 | @Override
45 | public boolean hasSamePlat(Platform platform) {
46 | return platformDao.isUniquePlat(platform.getPlatSourceCode(), platform.getPlatId());
47 | }
48 |
49 | @Override
50 | public void savePlatform(Platform platform) {
51 | platformDao.saveNewObject(platform);
52 | }
53 |
54 | @Override
55 | public void updatePlatform(Platform platform) {
56 | platformDao.updateObject(platform);
57 | }
58 |
59 | @Override
60 | public void deletePlatform(Platform platform) {
61 | platformDao.deleteObjectById(platform.getPlatId());
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/service/impl/UserPlatServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.service.impl;
2 |
3 | import com.centit.framework.model.basedata.UserPlat;
4 | import com.centit.framework.system.dao.UserPlatDao;
5 | import com.centit.framework.system.service.UserPlatService;
6 | import com.centit.support.database.utils.PageDesc;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | /**
14 | * @author zfg
15 | */
16 | @Service("userPlatService")
17 | public class UserPlatServiceImpl implements UserPlatService {
18 |
19 | @Autowired
20 | private UserPlatDao userPlatDao;
21 |
22 | @Override
23 | public void mergeObject(UserPlat userPlat) {
24 | userPlatDao.mergeObject(userPlat);
25 | }
26 |
27 | @Override
28 | public void deleteObjectById(String userPlatId) {
29 | userPlatDao.deleteObjectById(userPlatId);
30 | }
31 |
32 | @Override
33 | public UserPlat getObjectById(String userPlatId) {
34 | return userPlatDao.getObjectById(userPlatId);
35 | }
36 |
37 | @Override
38 | public UserPlat getUserPlatByProperties(Map paramsMap) {
39 | return userPlatDao.getObjectByProperties(paramsMap);
40 | }
41 |
42 | @Override
43 | public List listPlatUsersByPlatId(String platId) {
44 | return userPlatDao.listPlatUsersByPlatId(platId);
45 | }
46 |
47 | @Override
48 | public List listObjects(Map filterMap, PageDesc pageDesc) {
49 | return userPlatDao.listObjectsByProperties(filterMap, pageDesc);
50 | }
51 |
52 | @Override
53 | public void saveUserPlat(UserPlat userPlat) {
54 | userPlatDao.saveNewObject(userPlat);
55 | }
56 |
57 | @Override
58 | public void updateUserPlat(UserPlat userPlat) {
59 | userPlatDao.updateObject(userPlat);
60 | }
61 |
62 | @Override
63 | public void deleteObject(UserPlat userPlat) {
64 | userPlatDao.deleteObject(userPlat);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/vo/PageListTenantInfoQo.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.vo;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.Data;
6 | import org.hibernate.validator.constraints.Length;
7 |
8 | import java.util.Date;
9 |
10 | /**
11 | * 租户列表分页查询的请求参数
12 | */
13 | @Data
14 | @ApiModel(value = "租户列表分页查询实体类", description = "租户列表分页查询实体类")
15 | public class PageListTenantInfoQo {
16 |
17 | @Length(max = 1)
18 | @ApiModelProperty(value = "租户名称", name = "unitName")
19 | private String unitName;
20 |
21 | @ApiModelProperty(value = "审核状态,1:已审核,2:未审核", name = "checkState")
22 | private String checkState;
23 |
24 | @ApiModelProperty(value = "审核开始时间,示例:yyyy-MM-dd HH:mm:ss", name = "startApplyTime")
25 | private Date startApplyTime;
26 |
27 | @ApiModelProperty(value = "审核结束时间,示例:yyyy-MM-dd HH:mm:ss", name = "endApplyTime")
28 | private Date endApplyTime;
29 |
30 | @ApiModelProperty(value = "使用到期时间开始范围,示例:yyyy-MM-dd HH:mm:ss", name = "startUseLimittime")
31 | private Date startUseLimittime;
32 |
33 | @ApiModelProperty(value = "使用到期时间结束范围,示例:yyyy-MM-dd HH:mm:ss", name = "endUseLimittime")
34 | private Date endUseLimittime;
35 |
36 | @ApiModelProperty(value = "审核通过时间开始范围,示例:yyyy-MM-dd HH:mm:ss", name = "startPassTime")
37 | private Date startPassTime;
38 |
39 | @ApiModelProperty(value = "审核通过时间结束范围,示例:yyyy-MM-dd HH:mm:ss", name = "endPassTime")
40 | private Date endPassTime;
41 |
42 | @ApiModelProperty(value = "是否可以;示例:T:可用,F:不可用", name = "isAvailable")
43 | private String isAvailable;
44 |
45 | @ApiModelProperty(value = "租户所有者;", name = "ownUser")
46 | private String ownUser;
47 |
48 | @Override
49 | public String toString() {
50 | return "PageListTenantInfoQo{" +
51 | "unitName='" + unitName + '\'' +
52 | ", checkState='" + checkState + '\'' +
53 | ", startApplyTime=" + startApplyTime +
54 | ", endApplyTime=" + endApplyTime +
55 | ", startUseLimittime=" + startUseLimittime +
56 | ", endUseLimittime=" + endUseLimittime +
57 | ", startPassTime=" + startPassTime +
58 | ", endPassTime=" + endPassTime +
59 | ", isAvailable='" + isAvailable + '\'' +
60 | ", ownUser='" + ownUser + '\'' +
61 | '}';
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/vo/TenantMemberApplyVo.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.vo;
2 |
3 | import io.swagger.annotations.ApiModelProperty;
4 | import lombok.Data;
5 | import org.hibernate.validator.constraints.Length;
6 |
7 | import javax.validation.constraints.NotEmpty;
8 | import java.sql.Date;
9 |
10 | @Data
11 | public class TenantMemberApplyVo {
12 |
13 | @ApiModelProperty(value = "用户代码", name = "userCode")
14 | @NotEmpty
15 | @Length(max = 32)
16 | private String userCode;
17 |
18 | @ApiModelProperty(value = "用户姓名", name = "userName")
19 | private String userName;
20 |
21 |
22 | @ApiModelProperty(value = "租户代码", name = "topUnit")
23 | @NotEmpty
24 | @Length(max = 32)
25 | private String topUnit;
26 |
27 |
28 | @ApiModelProperty(value = "邀请人,提交人的userCode", name = "inviterUserCode")
29 | private String inviterUserCode;
30 |
31 | @ApiModelProperty(value = "邀请人,提交人的用户名", name = "inviterUserName")
32 | private String inviterUserName;
33 |
34 |
35 | @ApiModelProperty(value = "申请类型,1:申请 2:受邀", name = "applyType")
36 | private String applyType;
37 |
38 | @ApiModelProperty(value = "申请时间", name = "applyTime")
39 | private Date applyTime;
40 |
41 | @ApiModelProperty(value = "是否同意", name = "applyState")
42 | private String applyState;
43 |
44 | @ApiModelProperty(value = "申请备注", name = "applyRemark")
45 | private String applyRemark;
46 |
47 | @ApiModelProperty(value = "受邀备注", name = "approveRemark")
48 | private String approveRemark;
49 |
50 | @ApiModelProperty(value = "机构代码", name = "unitCode")
51 | private String unitCode;
52 |
53 | @ApiModelProperty(value = "机构名称", name = "unitName")
54 | private String unitName;
55 |
56 | @ApiModelProperty(value = "操作人身份1:租户,2:普通用户", name = "optUserType")
57 | @NotEmpty
58 | @Length(max = 1)
59 | private String optUserType;
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/vo/TenantMemberQo.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.vo;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.Data;
6 | import org.hibernate.validator.constraints.Length;
7 |
8 | import javax.validation.constraints.NotEmpty;
9 |
10 | @ApiModel(value = "租户成员查询实体类", description = "租户成员查询实体类")
11 | @Data
12 | public class TenantMemberQo {
13 |
14 | @ApiModelProperty(value = "租户代码", name = "topUnit",required = true)
15 | @NotEmpty
16 | @Length(max = 64)
17 | private String topUnit;
18 |
19 | @ApiModelProperty(value = "用户姓名", name = "userName")
20 | private String userName;
21 |
22 | @ApiModelProperty(value = "用户角色,租户管理员:ZHGLY, 部门管理员 orgadmin ", name = "roleCode")
23 | @Length(max = 32)
24 | private String roleCode;
25 |
26 | @ApiModelProperty(value = "管理部门, 部门管理员 orgadmin ", name = "unitCode")
27 | @Length(max = 32)
28 | private String unitCode;
29 |
30 | @ApiModelProperty(value = "待分配角色用户code", name = "memberUserCode")
31 | private String memberUserCode;
32 |
33 |
34 | @Override
35 | public String toString() {
36 | return "TenantMemberQo{" +
37 | "topUnit='" + topUnit + '\'' +
38 | ", userName='" + userName + '\'' +
39 | ", roleCode='" + roleCode + '\'' +
40 | ", unitCode='" + unitCode + '\'' +
41 | ", memberUserCode='" + memberUserCode + '\'' +
42 | '}';
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/java/com/centit/framework/system/vo/WorkGroupParames.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.vo;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * 移交组长使用参数对象
7 | */
8 | @Data
9 | public class WorkGroupParames {
10 | //这3个字段为主键
11 | private String groupId;
12 |
13 | private String userCode;
14 |
15 | //新组长code
16 | private String newUserCode;
17 | }
18 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/resources/ExtendedSqlMap.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | ]>
7 |
8 |
9 |
18 |
19 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/resources/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Implementation-Vendor: Adobe Systems Inc.
3 | Ant-Version: Apache Ant 1.7.0
4 | Implementation-Title: BlazeDS - BlazeDS Application
5 | Implementation-Version: 3.0.0.544
6 | Sealed: false
7 | Created-By: 1.5.0_13-b05 (Sun Microsystems Inc.)
8 |
9 |
--------------------------------------------------------------------------------
/framework-system-module/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | /D/Projects/RunData/webim_home/logs
6 | mylog
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
16 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/存储过程/WORK_DAY_OPT.pck:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-module/src/sqlscript/存储过程/WORK_DAY_OPT.pck
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/存储过程/check_attendance.pck:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-module/src/sqlscript/存储过程/check_attendance.pck
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/数据库初始化/DB2/createSysViewsDB2.sql:
--------------------------------------------------------------------------------
1 |
2 | /*==============================================================*/
3 | /* View: v_hi_unitinfo */
4 | /*==============================================================*/
5 | /*
6 | create or replace view v_hi_unitinfo as
7 | select b.topunitcode as topunitcode, a.UNITCODE,a.UNITTYPE, a.PARENTUNIT, a.ISVALID,
8 | a.UNITNAME,a.UNITDESC,a.UNITSHORTNAME,a.ADDRBOOKID,a.unitOrder,
9 | a.unitWord,a.unitGrade, b.hi_level, UnitPath
10 | from F_UNITINFO a,
11 | (select level as hi_level,
12 | unitcode,
13 | CONNECT_BY_ROOT unitcode as topunitcode,
14 | SYS_CONNECT_BY_PATH(unitcode, '/') UnitPath
15 | from f_unitinfo t
16 | connect by prior unitcode = parentunit) b
17 | where a.UNITCODE = b.unitcode;
18 | */
19 | create view v_hi_unitinfo as
20 | WITH RPL (LEVEL,UNITCODE,topunitcode,PARENTUNIT,UNITTYPE,ISVALID,
21 | UNITNAME,UNITSHORTNAME,UNITDESC,ADDRBOOKID,
22 | unitOrder,unitWord,unitGrade,UnitPath) AS
23 | (
24 | SELECT 1 as LEVEL,UNITCODE,PARENTUNIT as topunitcode,PARENTUNIT,UNITTYPE,ISVALID,
25 | UNITNAME,UNITSHORTNAME,UNITDESC,ADDRBOOKID,
26 | unitOrder,unitWord,unitGrade,UNITCODE as UnitPath
27 | FROM f_Unitinfo
28 | UNION ALL
29 | SELECT PARENT.LEVEL+1 as LEVEL,CHILD.UNITCODE, PARENT.topunitcode ,
30 | CHILD.PARENTUNIT,CHILD.UNITTYPE, CHILD.ISVALID,
31 | CHILD.UNITNAME,CHILD.UNITSHORTNAME,CHILD.UNITDESC,CHILD.ADDRBOOKID,
32 | CHILD.unitOrder,CHILD.unitWord,CHILD.unitGrade,PARENT.UnitPath + '/'+ CHILD.UNITCODE as UnitPath
33 | FROM RPL PARENT, f_Unitinfo CHILD
34 | WHERE PARENT.UNITCODE = CHILD.PARENTUNIT
35 | )
36 | SELECT LEVEL,UNITCODE,topunitcode,PARENTUNIT,UNITTYPE,ISVALID,
37 | UNITNAME,UNITSHORTNAME,UNITDESC,ADDRBOOKID,
38 | unitOrder,unitWord,unitGrade,UnitPath
39 | FROM RPL
40 | ORDER BY LEVEL,unitorder
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/数据库初始化/SqlSvr/createSequenceSqlSvr.sql:
--------------------------------------------------------------------------------
1 |
2 | reate table sequence_table (
3 | sequence_Name varchar(100) not null primary key,
4 | current_value integer
5 | );
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/数据库初始化/mysql/createSequenceMySql.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-module/src/sqlscript/数据库初始化/mysql/createSequenceMySql.sql
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/数据库初始化/mysql/createVHiUnitinfoMySql.sql:
--------------------------------------------------------------------------------
1 | --mysql
2 | alter table F_DATACATALOG modify FieldDesc varchar(1024);
3 | alter table F_UNITINFO add UNITPATH VARCHAR(1000);
4 |
5 | DELIMITER $$
6 |
7 | CREATE FUNCTION calcUnitPath (chrId varchar(32))
8 | RETURNS varchar(1000)
9 | BEGIN
10 | DECLARE sTemp VARCHAR(32);
11 | DECLARE sPreTemp VARCHAR(32);
12 | DECLARE path VARCHAR(1000);
13 | DECLARE rs VARCHAR(1000);
14 | SET sTemp = trim(chrId);
15 | SET path = '';
16 | REPEAT
17 | SET path = concat('/',sTemp, path);
18 | set sPreTemp = sTemp;
19 | SELECT unitcode INTO sTemp
20 | FROM f_unitinfo
21 | where unitcode =
22 | (select parentunit FROM f_unitinfo where unitcode = sTemp);
23 | until sTemp is null or sTemp='' or sPreTemp = sTemp
24 | END REPEAT;
25 |
26 | RETURN path;
27 | END$$
28 |
29 | DELIMITER ;
30 |
31 | SET SQL_SAFE_UPDATES = 0;
32 |
33 | --手动更新UnitPath值
34 | update f_unitinfo t set t.UnitPath = calcUnitPath(t.unitcode);
35 |
36 | --v_hi_unitinfo视图脚本
37 |
38 | CREATE OR REPLACE VIEW v_hi_unitinfo AS
39 | SELECT a.unitcode AS topunitcode, b.unitcode,b.unittype, b.parentunit, b.isvalid, b.unitname,b.unitdesc,b.unitshortname,b.addrbookid,b.unitorder,b.depno,
40 | b.unitword,b.unitgrade,
41 | LENGTH(b.UnitPath)- LENGTH(REPLACE(b.UnitPath,'/','')) - LENGTH(a.UnitPath) + LENGTH(REPLACE(a.UnitPath,'/',''))+1 AS hi_level,
42 | substr(b.UnitPath , LENGTH(a.UnitPath)+1) AS UnitPath
43 | FROM f_unitinfo a , f_unitinfo b
44 | WHERE b.UnitPath LIKE CONCAT(a.UnitPath,'%' );
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/数据库初始化/oracle/createVHiUnitinfoOracle.sql:
--------------------------------------------------------------------------------
1 | --oracle
2 | ---方案一
3 | create or replace view v_hi_unitinfo as
4 | select b.topunitcode as topunitcode, a.unitcode,a.unittype, a.parentunit, a.isvalid,
5 | a.unitname,a.unitdesc,a.unitshortname,a.addrbookid,a.unitorder,a.depno,
6 | a.unitword,a.unitgrade, b.hi_level,b.UnitPath
7 | from f_unitinfo a,
8 | (select level as hi_level,
9 | unitcode,
10 | CONNECT_BY_ROOT unitcode as topunitcode,
11 | SYS_CONNECT_BY_PATH(unitcode, '/') UnitPath
12 | from f_unitinfo t
13 | connect by prior unitcode = parentunit) b
14 | where a.unitcode = b.unitcode;
15 |
16 | ---方案二
17 | alter table F_DATACATALOG modify FieldDesc varchar2(1024);
18 | alter table F_UNITINFO add UNITPATH VARCHAR2(1000);
19 |
20 | update f_unitinfo t set t.unitpath = (
21 | select b.UnitPath from (
22 | select level as hi_level,
23 | t.unitcode,
24 | t.parentunit,
25 | CONNECT_BY_ROOT t.unitcode as topunitcode,
26 | SYS_CONNECT_BY_PATH(t.unitcode, '/') UnitPath
27 | from f_unitinfo t
28 | start with t.parentunit is null or not exists (select f.* from f_unitinfo f where f.unitcode=t.parentunit)
29 | connect by prior unitcode = parentunit) b
30 | where b.unitcode=t.unitcode);
31 |
32 |
33 | create or replace view v_hi_unitinfo as
34 | select b.unitcode as topunitcode, a.unitcode,a.unittype, a.parentunit, a.isvalid,
35 | a.unitname,a.unitdesc,a.unitshortname,a.addrbookid,a.unitorder,a.depno,
36 | a.unitword,a.unitgrade,
37 | LENGTHB(b.UnitPath)- LENGTHB(REPLACE(b.UnitPath,'/','')) - LENGTHB(a.UnitPath) + LENGTHB(REPLACE(a.UnitPath,'/','')) as hi_level,
38 | substrb(b.UnitPath , LENGTHB(a.UnitPath)) as UnitPath
39 | from f_unitinfo a , f_unitinfo b
40 | where b.UnitPath like a.UnitPath||'/%';
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/数据清理与备份/datacheck.sql:
--------------------------------------------------------------------------------
1 | -- 删除数据不一致的地方
2 | delete from f_optdef where optid not in(select optid from f_optinfo)
3 | /
4 |
5 | delete from f_rolepower where rolecode not in(select rolecode from f_roleinfo)
6 | /
7 |
8 | commit
9 | /
10 | -- 检查业务系统设置一致性
11 | update f_optinfo set preoptid='0'
12 | where preoptid is null or
13 | ( preoptid <> '0'
14 | and preoptid not in(select optid from f_optinfo))
15 | /
16 |
17 | update f_optinfo set optroute = '...'
18 | where optroute is null or
19 | ( optroute != '...'
20 | and optid in (select preoptid from f_optinfo))
21 | /
22 |
23 | commit
24 | /
25 |
26 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/数据清理与备份/数据字典备份.dmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-module/src/sqlscript/数据清理与备份/数据字典备份.dmp
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/before3.0.1/updateToV2.1.1.20160324.sql:
--------------------------------------------------------------------------------
1 | alter table F_OPTDEF modify OPTCODE varchar2(32)
2 | /
3 | alter table F_OPTDEF modify OPTID varchar2(32)
4 | /
5 | alter table F_OPTDEF modify OptName varchar2(100)
6 | /
7 |
8 | alter table F_OPTINFO modify PREOPTID varchar2(32)
9 | /
10 | alter table F_OPTINFO modify OPTID varchar2(32)
11 | /
12 | alter table F_OPTINFO modify OptName varchar2(100)
13 | /
14 |
15 |
16 | alter table F_ROLEINFO modify ROLENAME varchar2(300)
17 | /
18 | alter table F_ROLEINFO add ROLETYPE CHAR
19 | /
20 | alter table F_ROLEINFO add UNITCODE varchar2(32)
21 | /
22 |
23 | alter table F_ROLEPOWER modify OPTCODE varchar2(32)
24 | /
25 |
26 | alter table F_UNITINFO modify UNITCODE varchar2(32)
27 | /
28 | alter table F_UNITINFO add UNITTAG varchar2(100)
29 | /
30 |
31 | alter table F_UNITINFO modify PARENTUNIT varchar2(32)
32 | /
33 | alter table F_UNITINFO modify UNITNAME varchar2(300)
34 | /
35 |
36 | alter table F_UNITINFO modify DEPNO varchar2(100)
37 | /
38 | alter table F_UNITINFO modify UNITWORD varchar2(100)
39 | /
40 | alter table F_UNITINFO modify ENGLISHNAME varchar2(300)
41 | /
42 |
43 | alter table F_USERINFO modify USERCODE varchar2(32)
44 | /
45 | alter table F_USERINFO add USERTAG varchar2(100)
46 | /
47 | alter table F_USERINFO modify USERNAME varchar2(300)
48 | /
49 | alter table F_USERINFO modify LOGINNAME varchar2(100)
50 | /
51 | alter table F_USERINFO modify ENGLISHNAME varchar2(300)
52 | /
53 | alter table F_USERINFO modify primaryUnit varchar2(32)
54 | /
55 | alter table F_USERINFO modify userWord varchar2(100)
56 | /
57 |
58 |
59 | alter table F_USERROLE modify USERCODE varchar2(32)
60 | /
61 |
62 | alter table F_USERROLE modify ROLECODE varchar2(32)
63 | /
64 |
65 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/before3.0.1/updateToV2.1.1.20160407.sql:
--------------------------------------------------------------------------------
1 | delete from f_datadictionary where CATALOGCODE='OptType'
2 | /
3 |
4 | insert into f_datadictionary (CATALOGCODE, DATACODE, EXTRACODE, EXTRACODE2, DATATAG, DATAVALUE, DATASTYLE, DATADESC, LASTMODIFYDATE, CREATEDATE, DATAORDER)
5 | values ('OptType', 'S', null, null, 'T', '实施业务', 'F', '实施业务', to_date('2015-1-1','YYYY-HH-DD'), to_date('2015-1-1','YYYY-HH-DD'), 2);
6 |
7 | insert into f_datadictionary (CATALOGCODE, DATACODE, EXTRACODE, EXTRACODE2, DATATAG, DATAVALUE, DATASTYLE, DATADESC, LASTMODIFYDATE, CREATEDATE, DATAORDER)
8 | values ('OptType', 'O', null, null, 'T', '普通业务', 'F', '普通业务', to_date('2015-1-1','YYYY-HH-DD'), to_date('2015-1-1','YYYY-HH-DD'), 1);
9 |
10 | insert into f_datadictionary (CATALOGCODE, DATACODE, EXTRACODE, EXTRACODE2, DATATAG, DATAVALUE, DATASTYLE, DATADESC, LASTMODIFYDATE, CREATEDATE, DATAORDER)
11 | values ('OptType', 'I', null, null, 'T', '项目业务', 'F', '项目业务', to_date('2015-1-1','YYYY-HH-DD'), to_date('2015-1-1','YYYY-HH-DD'), 3);
12 |
13 | insert into f_datadictionary (CATALOGCODE, DATACODE, EXTRACODE, EXTRACODE2, DATATAG, DATAVALUE, DATASTYLE, DATADESC, LASTMODIFYDATE, CREATEDATE, DATAORDER)
14 | values ('OptType', 'W', null, null, 'T', '工作流业务', 'F', '工作流业务', to_date('2015-1-1','YYYY-HH-DD'), to_date('2015-1-1','YYYY-HH-DD'), 4);
15 |
16 |
17 | update f_optinfo set opttype='O' where opttype='S';
18 | update f_optinfo set opttype='S' where opttype='I';
19 |
20 | commit
21 | /
22 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/before3.0.1/updateToV2.1.1.20160411.sql:
--------------------------------------------------------------------------------
1 | --oracle
2 | alter table F_UNITINFO add CREATOR VARCHAR2(32);
3 | alter table F_UNITINFO add UPDATOR VARCHAR2(32);
4 | alter table F_UNITINFO RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
5 |
6 | alter table F_ROLEINFO add CREATOR VARCHAR2(32);
7 | alter table F_ROLEINFO add UPDATOR VARCHAR2(32);
8 | alter table F_ROLEINFO RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
9 |
10 | alter table F_USERINFO add CREATOR VARCHAR2(32);
11 | alter table F_USERINFO add UPDATOR VARCHAR2(32);
12 | alter table F_USERINFO RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
13 |
14 |
15 | --mysql
16 |
17 | alter table F_UNITINFO add CREATOR VARCHAR(32);
18 | alter table F_UNITINFO add UPDATOR VARCHAR(32);
19 | alter table F_UNITINFO change LASTMODIFYDATE UPDATEDATE date;
20 |
21 | alter table F_ROLEINFO add CREATOR VARCHAR(32);
22 | alter table F_ROLEINFO add UPDATOR VARCHAR(32);
23 | alter table F_ROLEINFO change LASTMODIFYDATE UPDATEDATE date;
24 |
25 | alter table F_USERINFO add CREATOR VARCHAR(32);
26 | alter table F_USERINFO add UPDATOR VARCHAR(32);
27 | alter table F_USERINFO change LASTMODIFYDATE UPDATEDATE date;
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/before3.0.1/updateToV2.1.1.20160412.sql:
--------------------------------------------------------------------------------
1 | --oracle
2 | alter table F_DATACATALOG add CREATOR VARCHAR2(32);
3 | alter table F_DATACATALOG add UPDATOR VARCHAR2(32);
4 | alter table F_DATACATALOG RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
5 |
6 | alter table F_OPTDEF add CREATOR VARCHAR2(32);
7 | alter table F_OPTDEF add UPDATOR VARCHAR2(32);
8 | alter table F_OPTDEF RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
9 |
10 | alter table F_OPTINFO add CREATOR VARCHAR2(32);
11 | alter table F_OPTINFO add UPDATOR VARCHAR2(32);
12 | alter table F_OPTINFO RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
13 |
14 | alter table F_ROLEPOWER add CREATOR VARCHAR2(32);
15 | alter table F_ROLEPOWER add UPDATOR VARCHAR2(32);
16 | alter table F_ROLEPOWER RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
17 |
18 | alter table F_USERROLE add CREATOR VARCHAR2(32);
19 | alter table F_USERROLE add UPDATOR VARCHAR2(32);
20 | alter table F_USERROLE RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
21 |
22 | alter table F_USERUNIT add CREATOR VARCHAR2(32);
23 | alter table F_USERUNIT add UPDATOR VARCHAR2(32);
24 | alter table F_USERUNIT RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
25 |
26 |
27 | --mysql
28 |
29 | alter table F_DATACATALOG add CREATOR VARCHAR(32);
30 | alter table F_DATACATALOG add UPDATOR VARCHAR(32);
31 | alter table F_DATACATALOG change LASTMODIFYDATE UPDATEDATE date;
32 |
33 | alter table F_OPTDEF add CREATOR VARCHAR(32);
34 | alter table F_OPTDEF add UPDATOR VARCHAR(32);
35 | alter table F_OPTDEF change LASTMODIFYDATE UPDATEDATE date;
36 |
37 | alter table F_OPTINFO add CREATOR VARCHAR(32);
38 | alter table F_OPTINFO add UPDATOR VARCHAR(32);
39 | alter table F_OPTINFO change LASTMODIFYDATE UPDATEDATE date;
40 |
41 | alter table F_ROLEPOWER add CREATOR VARCHAR(32);
42 | alter table F_ROLEPOWER add UPDATOR VARCHAR(32);
43 | alter table F_ROLEPOWER change LASTMODIFYDATE UPDATEDATE date;
44 |
45 | alter table F_USERROLE add CREATOR VARCHAR(32);
46 | alter table F_USERROLE add UPDATOR VARCHAR(32);
47 | alter table F_USERROLE change LASTMODIFYDATE UPDATEDATE date;
48 |
49 | alter table F_USERUNIT add CREATOR VARCHAR(32);
50 | alter table F_USERUNIT add UPDATOR VARCHAR(32);
51 | alter table F_USERUNIT change LASTMODIFYDATE UPDATEDATE date;
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/before3.0.1/updateToV2.1.1.20160413.sql:
--------------------------------------------------------------------------------
1 | --oracle
2 | alter table F_DATACATALOG modify FieldDesc varchar2(1024);
3 | alter table F_UNITINFO add UNITPATH VARCHAR2(1000);
4 |
5 | update f_unitinfo t set t.unit_path = (
6 | select b.UnitPath from (
7 | select level as hi_level,
8 | t.unit_code,
9 | t.parent_unit,
10 | CONNECT_BY_ROOT t.unit_code as topunitcode,
11 | SYS_CONNECT_BY_PATH(t.unit_code, '/') UnitPath
12 | from f_unitinfo t
13 | start with t.parent_unit is null or not exists (select f.* from f_unitinfo f where f.unit_code=t.parent_unit)
14 | connect by prior unit_code = parent_unit) b
15 | where b.unit_code=t.unit_code);
16 |
17 | --mysql
18 | alter table F_DATACATALOG modify FieldDesc varchar(1024);
19 | alter table F_UNITINFO add UNITPATH VARCHAR(1000);
20 |
21 | DELIMITER $$
22 |
23 | CREATE FUNCTION calcUnitPath (chrId varchar(32))
24 | RETURNS varchar(1000)
25 | BEGIN
26 | DECLARE sTemp VARCHAR(32);
27 | DECLARE sPreTemp VARCHAR(32);
28 | DECLARE path VARCHAR(1000);
29 | DECLARE rs VARCHAR(1000);
30 | SET sTemp = trim(chrId);
31 | SET path = '';
32 | REPEAT
33 | SET path = concat('/',sTemp, path);
34 | set sPreTemp = sTemp;
35 | SELECT unitcode INTO sTemp
36 | FROM f_unitinfo
37 | where unitcode =
38 | (select parentunit FROM f_unitinfo where unitcode = sTemp);
39 | until sTemp is null or sTemp='' or sPreTemp = sTemp
40 | END REPEAT;
41 |
42 | RETURN path;
43 | END$$
44 |
45 | DELIMITER ;
46 |
47 | SET SQL_SAFE_UPDATES = 0;
48 | update f_unitinfo t set t.UnitPath = calcUnitPath(t.unitcode);
49 |
50 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/v3.0.1/update20160714.sql:
--------------------------------------------------------------------------------
1 | --Oracle
2 | /*添加操作方法的排序功能,便于操作方法作为下拉框选择时排序*/
3 | alter table F_OPTDEF add optOrder number(6);
4 | /*添加机构管理员*/
5 | alter table F_UNITINFO add UNITMANAGER VARCHAR2(32);
6 |
7 | --DB2 mySQL
8 | alter table F_OPTDEF add optOrder decimal(6);
9 | alter table F_UNITINFO add UNITMANAGER VARCHAR(32);
10 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/v4.0.X/to_v4.0.3.mysql.patch.sql:
--------------------------------------------------------------------------------
1 |
2 | /*==============================================================*/
3 | /* Table: F_USERROLE */
4 | /*==============================================================*/
5 | create table F_UNITROLE
6 | (
7 | UNIT_CODE varchar(32) not null,
8 | ROLE_CODE varchar(32) not null,
9 | OBTAIN_DATE datetime not null,
10 | SECEDE_DATE datetime,
11 | CHANGE_DESC varchar(256),
12 | update_Date datetime,
13 | Create_Date datetime,
14 | creator varchar(32),
15 | updator varchar(32)
16 | );
17 |
18 | alter table F_UNITROLE
19 | add primary key (UNIT_CODE, ROLE_CODE);
20 |
21 | /*==============================================================*/
22 | /* View: F_V_USERROLES */
23 | /*==============================================================*/
24 | create or replace view F_V_USERROLES as
25 | select b.ROLE_CODE, b.ROLE_NAME, b.IS_VALID, 'D' as OBTAIN_TYPE,
26 | b.ROLE_DESC, b.CREATE_DATE, b.UPDATE_DATE ,a.USER_CODE, NULL as INHERITED_FROM
27 | from F_USERROLE a join F_ROLEINFO b on (a.ROLE_CODE=b.ROLE_CODE)
28 | where a.OBTAIN_DATE <= now() and (a.SECEDE_DATE is null or a.SECEDE_DATE > now()) and b.IS_VALID='T'
29 | union
30 | select b.ROLE_CODE, b.ROLE_NAME, b.IS_VALID, 'I' as OBTAIN_TYPE,
31 | b.ROLE_DESC, b.CREATE_DATE, b.UPDATE_DATE ,c.USER_CODE, a.UNIT_CODE as INHERITED_FROM
32 | from F_UNITROLE a join F_ROLEINFO b on (a.ROLE_CODE = b.ROLE_CODE) JOIN F_USERUNIT c on( a.UNIT_CODE = c.UNIT_CODE)
33 | where a.OBTAIN_DATE <= now() and (a.SECEDE_DATE is null or a.SECEDE_DATE > now()) and b.IS_VALID='T'
34 |
35 |
36 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/v4.0.X/to_v4.0.3.oracle.patch.sql:
--------------------------------------------------------------------------------
1 |
2 | create table F_UNITROLE
3 | (
4 | UNIT_CODE varchar2(32) not null,
5 | ROLE_CODE varchar2(32) not null,
6 | OBTAIN_DATE date not null,
7 | SECEDE_DATE date,
8 | CHANGE_DESC varchar2(256),
9 | update_Date date,
10 | Create_Date date,
11 | creator varchar2(32),
12 | updator varchar2(32)
13 | );
14 |
15 | alter table F_UNITROLE add primary key (UNIT_CODE, ROLE_CODE);
16 |
17 | create or replace view F_V_USERROLES as
18 | select b.ROLE_CODE, b.ROLE_NAME, b.IS_VALID, 'D' as OBTAIN_TYPE,
19 | b.ROLE_DESC, b.CREATE_DATE, b.UPDATE_DATE ,a.USER_CODE, null as INHERITED_FROM
20 | from F_USERROLE a join F_ROLEINFO b on (a.ROLE_CODE=b.ROLE_CODE)
21 | where a.OBTAIN_DATE <= sysdate and (a.SECEDE_DATE is null or a.SECEDE_DATE > sysdate) and b.IS_VALID='T'
22 | union
23 | select b.ROLE_CODE, b.ROLE_NAME, b.IS_VALID, 'I' as OBTAIN_TYPE,
24 | b.ROLE_DESC, b.CREATE_DATE, b.UPDATE_DATE ,c.USER_CODE, a.UNIT_CODE as INHERITED_FROM
25 | from F_UNITROLE a join F_ROLEINFO b on (a.ROLE_CODE = b.ROLE_CODE) JOIN F_USERUNIT c on( a.UNIT_CODE = c.UNIT_CODE)
26 | where a.OBTAIN_DATE <= sysdate and (a.SECEDE_DATE is null or a.SECEDE_DATE > sysdate) and b.IS_VALID='T'
27 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/v4.3.X/to_v4.3.mysql.patch.sql:
--------------------------------------------------------------------------------
1 | -- 添加顶级机构 用于 帐套管理
2 | alter table F_USERINFO add TOP_UNIT varchar(32);
3 |
4 | CREATE OR REPLACE VIEW v_hi_unitinfo AS
5 | SELECT a.unit_code AS top_unit_code, b.unit_code,b.unit_type, b.parent_unit, b.is_valid, b.unit_name,b.unit_desc,b.unit_short_name, b.unit_order,b.dep_no,
6 | b.unit_word,b.unit_grade,
7 | LENGTH(b.Unit_Path)- LENGTH(REPLACE(b.Unit_Path,'/','')) - LENGTH(a.Unit_Path) + LENGTH(REPLACE(a.Unit_Path,'/',''))+1 AS hi_level,
8 | substr(b.Unit_Path , LENGTH(a.Unit_Path)+1) AS Unit_Path
9 | FROM F_UNITINFO a , F_UNITINFO b
10 | WHERE b.Unit_Path LIKE CONCAT(a.Unit_Path,'%' );
11 |
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/v4.3.X/to_v4.3.oracle.patch.sql:
--------------------------------------------------------------------------------
1 | -- 添加顶级机构 用于 帐套管理
2 | alter table F_USERINFO add TOP_UNIT varchar2(32);
3 |
4 |
5 | CREATE OR REPLACE VIEW v_hi_unitinfo AS
6 | SELECT a.unit_code AS top_unit_code, b.unit_code, b.unit_type, b.parent_unit, b.is_valid, b.unit_name,b.unit_desc,b.unit_short_name, b.unit_order, b.dep_no,
7 | b.unit_word,b.unit_grade,
8 | LENGTH(b.Unit_Path)- LENGTH(REPLACE(b.Unit_Path,'/','')) - LENGTH(a.Unit_Path) + LENGTH(REPLACE(a.Unit_Path,'/',''))+1 AS hi_level,
9 | substr(b.Unit_Path , LENGTH(a.Unit_Path)+1) AS Unit_Path
10 | FROM F_UNITINFO a , F_UNITINFO b
11 | WHERE b.Unit_Path LIKE CONCAT(a.Unit_Path,'%' );
--------------------------------------------------------------------------------
/framework-system-module/src/sqlscript/版本升级和变更/框架表老字段rename到新字段及相应视图.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-module/src/sqlscript/版本升级和变更/框架表老字段rename到新字段及相应视图.sql
--------------------------------------------------------------------------------
/framework-system-module/src/test/java/com/centit/sys/common/EntityManagerWithDataPowerImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.sys.common;
2 |
3 | import org.springframework.stereotype.Service;
4 |
5 | /**
6 | * 在基础的manager基础之上添加了数据权限控制的方法,
7 | * 数据权限控制主要的参数有两个,
8 | * 一、用户,即当前session用户的userCode
9 | * 二、业务操作ID(optCode,由于optCode是没有意义的,所以需要用 optId + method来获取optCode)
10 | *
11 | * @author codefan@sina.com
12 | * @create 2012-2-16
13 | */
14 | @Service
15 | public abstract class EntityManagerWithDataPowerImpl{
16 | //>
17 | /*extends BaseEntityManagerImpl
18 | implements EntityManagerWithDataPower {
19 |
20 | public DataPowerFilter createDataPowerFilter(String userCode){
21 | DataPowerFilter dpf = new DataPowerFilter();
22 | UserInfo currUser = CodeRepositoryUtil.getUserInfoByCode(userCode);
23 | dpf.addSourceData( currUser );
24 | dpf.addSourceData("PrimaryUnit",CodeRepositoryUtil.getUnitInfoByCode(currUser.getPrimaryUnit()) );
25 | dpf.addSourceData("UserUnits", CodeRepositoryUtil.getUserUnits(userCode));
26 | return dpf;
27 | }
28 |
29 |
30 | @Autowired
31 | private OptInfoManager optInfoManager;
32 | public List listObjecesDemo(String userCode,String optid,String method){
33 | List filters = optInfoManager.listUserDataFiltersByOptIdAndMethod(userCode, optid, method);
34 | DataPowerFilter dpf = createDataPowerFilter(userCode);
35 | //dpf.setSourceDatas(sourceData);
36 | QueryAndNamedParams hql = dpf.makeHQL("T className" , filters, false);
37 | return baseDao.listObjectsAll(hql.getHql(),hql.getParams());
38 | }*/
39 | }
40 |
--------------------------------------------------------------------------------
/framework-system-module/src/test/java/com/centit/sys/test/TestSqlUtils.java:
--------------------------------------------------------------------------------
1 | package com.centit.sys.test;
2 |
3 | import com.centit.support.database.utils.QueryUtils;
4 |
5 | public class TestSqlUtils {
6 |
7 | public static void main(String[] args) {
8 |
9 |
10 | System.out.println(QueryUtils.trimSqlOrderByField(
11 | ""
12 | ));
13 | System.out.println(QueryUtils.trimSqlOrderByField(
14 | ",,,,, ,, "
15 | ));
16 | System.out.println(QueryUtils.trimSqlOrderByField(
17 | ",,,,, ,a, "
18 | ));
19 | System.out.println(QueryUtils.trimSqlOrderByField(
20 | ",,, adb desc ,adc asc def,defe,tp,,,"
21 | ));
22 |
23 |
24 | /* String sql = "Select a,b,c d , count(1) ,(select count(1) from b) from table join (select * from table3) tab2";
25 | List sqls = QueryUtils.splitSqlByFields(sql);
26 | List fileds = QueryUtils.getSqlFiledNames(sql);
27 |
28 | for(String s:sqls)
29 | System.out.println(s);
30 | System.out.println("----------------------");
31 | for(String s:fileds)
32 | System.out.println(s);*/
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/framework-system-module/src/test/java/com/centit/sys/test/TestUserDetails.java:
--------------------------------------------------------------------------------
1 | package com.centit.sys.test;
2 |
3 | import com.alibaba.fastjson2.JSON;
4 | import com.centit.framework.model.security.CentitUserDetails;
5 |
6 | public class TestUserDetails {
7 |
8 | @org.junit.Test
9 | public void testUserDetailJson() throws Exception {
10 | String userJson="{\"accountNonExpired\":true,\"accountNonLocked\":true,\"authenticated\":true,\"credentialsNonExpired\":true,\"currentStationId\":\"U00002\",\"enabled\":true,\"name\":\"anonymoususer\",\"userInfo\":{\"createDate\":1522133499181,\"enabled\":true,\"isValid\":\"T\",\"lastModifyDate\":1522133499183,\"loginName\":\"anonymoususer\",\"userCode\":\"anonymousUser\",\"userName\":\"anonymousUser\",\"userOrder\":1000,\"userUnits\":[{\"isPrimary\":\"F\",\"unitCode\":\"U00001\",\"userCode\":\"anonymousUser\",\"userRank\":\"zz\",\"userStation\":\"nq\",\"userUnitId\":\"00001\"},{\"isPrimary\":\"T\",\"unitCode\":\"U00002\",\"userCode\":\"anonymousUser\",\"userRank\":\"zr\",\"userStation\":\"gl\",\"userUnitId\":\"00002\"}]},\"userOptList\":{},\"userRoles\":[{\"isValid\":\"T\",\"roleCode\":\"anonymous\",\"roleDesc\":\"匿名用户角色\",\"roleName\":\"匿名用户角色\",\"roleOwner\":\"U00001\",\"rolePowers\":[],\"roleType\":\"G\",\"unitCode\":\"U00001\"},{\"isValid\":\"T\",\"roleCode\":\"admin\",\"roleDesc\":\"管理员角色\",\"roleName\":\"管理员角色\",\"roleOwner\":\"U00002\",\"rolePowers\":[],\"roleType\":\"G\",\"unitCode\":\"U00002\"}],\"userSettings\":{},\"username\":\"anonymoususer\"}";
11 |
12 | CentitUserDetails userDetails =
13 | JSON.parseObject(userJson, CentitUserDetails.class);
14 | String s = JSON.toJSONString(userDetails);
15 |
16 | System.out.println(s);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/framework-system-module/src/test/java/com/centit/sys/util/SysTypeUtils.java:
--------------------------------------------------------------------------------
1 | package com.centit.sys.util;
2 |
3 | import com.alibaba.fastjson2.JSON;
4 | import com.alibaba.fastjson2.filter.SimplePropertyPreFilter;
5 | import com.centit.framework.model.basedata.UserInfo;
6 |
7 | import java.util.ArrayList;
8 | import java.util.HashMap;
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | public class SysTypeUtils {
13 |
14 | public static final int sysType = 1;
15 |
16 | public static void main(String[] args) {
17 | //JSONObject jsonObject = new JSONObject();
18 |
19 |
20 | List userInfos = new ArrayList();
21 |
22 | for (int i = 0; i < 10; i++) {
23 | UserInfo u = new UserInfo();
24 |
25 | u.setUserCode("usercode_" + i);
26 | u.setUserName("username_" + i);
27 |
28 | userInfos.add(u);
29 | }
30 |
31 |
32 | Map params = new HashMap();
33 | params.put("errorcode", 1);
34 | params.put("userinfos", userInfos);
35 |
36 | SimplePropertyPreFilter p = new SimplePropertyPreFilter(UserInfo.class);
37 | p.getExcludes().add("loginName");
38 |
39 |
40 | String text = JSON.toJSONString(params, p);
41 |
42 | System.out.println(text);
43 |
44 | }
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/framework-system-module/src/test/java/com/centit/test/TestUnitFilter.java:
--------------------------------------------------------------------------------
1 | package com.centit.test;
2 |
3 | import com.centit.framework.components.SysUnitFilterEngine;
4 |
5 | import java.util.Set;
6 |
7 | public class TestUnitFilter {
8 | public static void main(String arg[]){
9 |
10 | Set ss = SysUnitFilterEngine.calcSystemUnitsByExp("u0001||u0002||u0003",
11 | "system", null,null);
12 |
13 | for(String s:ss)
14 | System.out.println(s);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/framework-system-module/src/test/java/com/centit/test/script/TextJavaScript.java:
--------------------------------------------------------------------------------
1 | package com.centit.test.script;
2 |
3 | import javax.script.ScriptEngine;
4 | import javax.script.ScriptEngineManager;
5 | import javax.script.ScriptException;
6 | import java.util.Arrays;
7 | import java.util.List;
8 | /**
9 | * 测试javascript的引擎,jdk 1.6 引入 Rhino 引擎。
10 | *
11 | * @author codefan
12 | * @create 2015年10月9日
13 | * @version
14 | */
15 | public class TextJavaScript {
16 |
17 | @SuppressWarnings("unchecked")
18 | public static void main(String[] args) {
19 | ScriptEngineManager mgr = new ScriptEngineManager();
20 | // we are using the rhino javascript engine
21 | ScriptEngine engine = mgr.getEngineByName("javascript");
22 |
23 | // pass a Java collection to javascript
24 | List list1 = Arrays.asList
25 | ("Homer", "Bart", "Marge", "Maggie", "Lisa");
26 | engine.put("list1", list1);
27 |
28 | String jsCode =
29 | "var index; "
30 | + "var values =list1.toArray();"
31 | + "println('*** Java object to Javascript');"
32 | + "for(index in values) {"
33 | + " println(values[index]);"
34 | + "}";
35 | try {
36 | engine.eval(jsCode);
37 | }
38 | catch (ScriptException se) {
39 | se.printStackTrace();
40 | }
41 |
42 | // pass a collection from javascript to java
43 | jsCode =
44 | "importPackage(java.util);"
45 | + "var list2 = Arrays.asList(['Moe', 'Barney', 'Ned']); ";
46 | try {
47 | engine.eval(jsCode);
48 | }
49 | catch (ScriptException se) {
50 | se.printStackTrace();
51 | }
52 | List list2 = (List) engine.get("list2");
53 | System.out.println("*** Javascript object to Java");
54 | for (String val : list2) {
55 | System.out.println(val);
56 | }
57 | }
58 | }
59 | /*
60 | 输出 :
61 | *** Java object to Javascript
62 | Homer
63 | Bart
64 | Marge
65 | Maggie
66 | Lisa
67 | *** Javascript object to Java
68 | Moe
69 | Barney
70 | Ned
71 | */
72 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/java/com/centit/framework/ip/config/InstantiationServiceBeanPostProcessor.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.ip.config;
2 |
3 | import com.centit.framework.common.WebOptUtils;
4 | import com.centit.framework.components.CodeRepositoryCache;
5 | import com.centit.framework.components.OperationLogCenter;
6 | import com.centit.framework.model.adapter.OperationLogWriter;
7 | import com.centit.framework.model.adapter.PlatformEnvironment;
8 | import com.centit.support.json.JSONOpt;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.beans.factory.annotation.Value;
11 | import org.springframework.context.ApplicationListener;
12 | import org.springframework.context.event.ContextRefreshedEvent;
13 |
14 | /**
15 | * Created by codefan on 17-7-6.
16 | */
17 | public class InstantiationServiceBeanPostProcessor implements ApplicationListener {
18 |
19 | @Autowired(required = false)
20 | private OperationLogWriter optLogManager;
21 |
22 | @Autowired
23 | private PlatformEnvironment platformEnvironment;
24 |
25 | @Value("${http.exception.notAsHttpError:false}")
26 | protected boolean httpExceptionNotAsHttpError;
27 |
28 | @Autowired
29 | protected CodeRepositoryCache.EvictCacheExtOpt osInfoManager;
30 |
31 | @Override
32 | public void onApplicationEvent(ContextRefreshedEvent event) {
33 | JSONOpt.fastjsonGlobalConfig();
34 | CodeRepositoryCache.setAllCacheFreshPeriod(CodeRepositoryCache.CACHE_FRESH_PERIOD_SECONDS);
35 |
36 | WebOptUtils.setExceptionNotAsHttpError(httpExceptionNotAsHttpError);
37 | if (optLogManager != null) {
38 | OperationLogCenter.registerOperationLogWriter(optLogManager);
39 | }
40 | CodeRepositoryCache.setPlatformEnvironment(platformEnvironment);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/java/com/centit/framework/ip/config/IpServerDubboServerConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.ip.config;
2 |
3 | import org.springframework.context.annotation.Configuration;
4 | import org.springframework.context.annotation.ImportResource;
5 |
6 | @Configuration
7 | @ImportResource({"classpath:dubbo-ip-server.xml"})
8 | public class IpServerDubboServerConfig {
9 | }
10 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/java/com/centit/framework/ip/config/WebInitializer.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.ip.config;
2 |
3 | import com.centit.framework.config.SystemSpringMvcConfig;
4 | import com.centit.framework.config.WebConfig;
5 | import org.springframework.web.WebApplicationInitializer;
6 |
7 | import javax.servlet.ServletContext;
8 | import javax.servlet.ServletException;
9 | /**
10 | * Created by zou_wy on 2017/3/29.
11 | */
12 | public class WebInitializer implements WebApplicationInitializer {
13 | @Override
14 | public void onStartup(ServletContext servletContext) throws ServletException {
15 | String [] servletUrlPatterns = {"/system/*"};
16 | WebConfig.registerSpringConfig(servletContext, ServiceConfig.class);
17 | WebConfig.registerServletConfig(servletContext, "system",
18 | "/system/*",
19 | SystemSpringMvcConfig.class);
20 | WebConfig.registerRequestContextListener(servletContext);
21 | WebConfig.registerSingleSignOutHttpSessionListener(servletContext);
22 |
23 | WebConfig.registerCharacterEncodingFilter(servletContext, servletUrlPatterns);
24 | WebConfig.registerHttpPutFormContentFilter(servletContext, servletUrlPatterns);
25 | WebConfig.registerHiddenHttpMethodFilter(servletContext, servletUrlPatterns);
26 | WebConfig.registerRequestThreadLocalFilter(servletContext);
27 | WebConfig.registerSpringSecurityFilter(servletContext, servletUrlPatterns);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/java/com/centit/framework/ip/security/IpAuthenticationSuccessHandler.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.ip.security;
2 |
3 | import com.centit.framework.security.AjaxAuthenticationSuccessHandler;
4 | import com.centit.framework.system.controller.MainFrameController;
5 | import org.springframework.security.core.Authentication;
6 |
7 | import javax.servlet.ServletException;
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 | import java.io.IOException;
11 | /**
12 | * 在集成平台中登录 只能进入 部署平台,不能进入任何业务系统
13 | * @author codefan
14 | *
15 | */
16 | public class IpAuthenticationSuccessHandler extends AjaxAuthenticationSuccessHandler{
17 | public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
18 | Authentication authentication) throws IOException, ServletException {
19 | request.getSession().setAttribute(
20 | MainFrameController.ENTRANCE_TYPE, MainFrameController.DEPLOY_LOGIN);
21 | super.onAuthenticationSuccess(request,response,authentication);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/resources/db/migration/sqlserver/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-server/src/main/resources/db/migration/sqlserver/.gitkeep
--------------------------------------------------------------------------------
/framework-system-server/src/main/resources/dubbo-ip-server.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/resources/ehcache.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/resources/pressure-test/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ndxt/centit-framework-system/275488605f54f910d5292fa5d4096b875e2ab158/framework-system-server/src/main/resources/pressure-test/.gitkeep
--------------------------------------------------------------------------------
/framework-system-server/src/main/resources/prev/system.properties:
--------------------------------------------------------------------------------
1 | nacos.server-addr=192.168.134.250:30849
2 | nacos.system-dataid=prod
3 | #test
4 | #nacos.server-addr=192.168.137.63:30848
5 | #nacos.system-dataid=test
6 | #nacos.server-addr=192.168.137.44:8848
7 | #nacos.system-dataid=test
8 | login.dao.enable= true
9 | login.cas.enable= false
10 | #jdbc.show.sql = true
11 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/resources/system.properties:
--------------------------------------------------------------------------------
1 | #nacos.server-addr=nacos.platform5-2:8848
2 | #nacos.system-dataid=prod
3 | #test
4 |
5 | nacos.server-addr=192.168.134.250:30849
6 | nacos.system-dataid=prod
7 |
8 | #nacos.server-addr=192.168.137.44:8848
9 | #nacos.system-dataid=test
10 | login.dao.enable= true
11 | login.cas.enable= false
12 | #jdbc.show.sql = true
13 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/WEB-INF/jsp/exception/400.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 400 - 请求格式错误”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/WEB-INF/jsp/exception/401.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 401 - 用户没有权限,请重新登录”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/WEB-INF/jsp/exception/403.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 403 - 禁止访问:没有访问此资源的权限”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/WEB-INF/jsp/exception/404.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 | “HTTP 错误 404 - 此资源找不到”
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/WEB-INF/jsp/exception/500.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java"%>
2 |
3 |
4 |
5 |
6 |
7 |
8 | 500
9 |
10 |
11 |
12 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/WEB-INF/jsp/sys/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
2 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/databaseinfo/ctrl/databaseinfo.edit.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 | var DatabaseInfoAdd = require('../ctrl/databaseinfo.add');
6 |
7 | // 编辑角色信息
8 | var DatabaseInfoEdit = DatabaseInfoAdd.extend(function() {
9 | var _self = this;
10 |
11 | // @override
12 | this.load = function(panel, data) {
13 | var form = panel.find('form');
14 | Core.ajax(Config.ContextPath + 'system/sys/database/' + data.databaseCode, {
15 | type: 'json',
16 | method: 'get'
17 | }).then(function(data) {
18 |
19 | _self.data = $.extend(_self.object, data);
20 |
21 | form.form('load', data)
22 | .form('disableValidation')
23 | // .form('readonly', 'databaseUrl')
24 | //.form('readonly', 'password')
25 | .form('focus');
26 | });
27 | };
28 |
29 | // @override
30 | this.submit = function(panel, data, closeCallback) {
31 | var form = panel.find('form');
32 |
33 | // 开启校验
34 | var isValid = form.form('enableValidation').form('validate');
35 | var value=form.form('value');
36 | //value.dataDesc=value.dataDesc.replace(/\+/g,"%2B");
37 | //value.dataDesc=value.dataDesc.replace(/\&/g,"%26");
38 | $.extend(data,value,{_method:'put',contentType:'application/json'});
39 | if (isValid) {
40 | Core.ajax(Config.ContextPath + 'system/sys/database/' + data.databaseCode, {
41 | type: 'json',
42 | method:'POST',
43 | data:data
44 | }).then(closeCallback);
45 | /*form.form('ajax', {
46 | url: Config.ContextPath + 'system/sys/database/' + data.databaseCode,
47 | method: 'put',
48 | data: data,
49 | })*/
50 | }
51 |
52 | return false;
53 | };
54 |
55 | });
56 |
57 | return DatabaseInfoEdit;
58 | });
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/databaseinfo/ctrl/databaseinfo.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 |
6 | var DatabaseInfoAdd = require('./databaseinfo.add');
7 | var DatabaseInfoEdit = require('./databaseinfo.edit');
8 | var DatabaseInfoRemove = require('./databaseinfo.remove');
9 |
10 | // 角色信息列表
11 | var DatabaseInfo = Page.extend(function() {
12 | this.injecte([
13 | new DatabaseInfoAdd('databaseinfo_add'),
14 | new DatabaseInfoEdit('databaseinfo_edit'),
15 | new DatabaseInfoRemove('databaseinfo_remove')
16 | ]);
17 |
18 | // @override
19 | this.load = function(panel) {
20 | panel.find('table').cdatagrid({
21 | // 必须要加此项!!
22 | controller: this
23 |
24 | });
25 | };
26 | });
27 |
28 | return DatabaseInfo;
29 | });
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/databaseinfo/ctrl/databaseinfo.remove.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 |
6 | // 删除数据字典
7 | var DatabaseInfoRemove = Page.extend(function() {
8 |
9 | // @override
10 | this.submit = function(table, data) {
11 | Core.ajax(Config.ContextPath+'system/sys/database/'+data.databaseCode, {
12 | type: 'json',
13 | method: 'post',
14 | data: {
15 | _method: 'delete'
16 | }
17 | }).then(function(){
18 | table.datagrid('reload');
19 | });
20 | };
21 | });
22 |
23 | return DatabaseInfoRemove;
24 | });
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/databaseinfo/databaseinfo-info.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
40 |
41 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/osinfo/ctrl/osinfo.add.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 |
6 | // 新增角色信息
7 | var OsInfoAdd = Page.extend(function() {
8 |
9 |
10 | // @override
11 | this.load = function(panel) {
12 | form = panel.find('form');
13 | this.object.hasInterface='T';
14 | form.form('load', this.object)
15 | .form('addValidation', 'osId', {
16 | required: true,
17 | validType: {
18 | remote: Config.ContextPath+'system/sys/os/noexists/'
19 | }
20 | })
21 | .form('disableValidation')
22 | .form('focus');
23 | };
24 |
25 | // @override
26 | this.submit = function(panel, data, ClosecallBack) {
27 | var form = panel.find('form');
28 |
29 | var isValid = form.form('enableValidation').form('validate');
30 |
31 | if (isValid) {
32 | form.form('ajax', {
33 | url: Config.ContextPath + 'system/sys/os',
34 | method: 'post'
35 |
36 | }).then(ClosecallBack);
37 | }
38 |
39 | return false;
40 | };
41 |
42 | // @override
43 | this.onClose = function(table, data) {
44 | table.datagrid('reload');
45 | };
46 | });
47 |
48 | return OsInfoAdd;
49 | });
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/osinfo/ctrl/osinfo.edit.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 | var OsInfoAdd = require('./osinfo.add');
6 |
7 | // 编辑角色信息
8 | var OsInfoEdit = OsInfoAdd.extend(function() {
9 | var _self = this;
10 |
11 | // @override
12 | this.load = function(panel, data) {
13 | var form = panel.find('form');
14 |
15 | Core.ajax(Config.ContextPath + 'system/sys/os/' + data.osId, {
16 | method: 'get'
17 | }).then(
18 | function(data) {
19 |
20 | _self.data = $.extend(_self.object, data);
21 |
22 | form.form('load', data)
23 | .form('disableValidation')
24 | .form('readonly', 'osId')
25 | .form('focus');
26 | }
27 | );
28 | };
29 |
30 | // @override
31 | this.submit = function(panel, data, ClosecallBack) {
32 | var form = panel.find('form');
33 |
34 | // 开启校验
35 | var isValid = form.form('enableValidation').form('validate');
36 |
37 | if (isValid) {
38 | form.form('ajax', {
39 | url: Config.ContextPath + 'system/sys/os/' + data.osId,
40 | method: 'put',
41 | data: data
42 | }).then(function(){
43 | var table=_self.panel.find('#osinfoTable');
44 | table.datagrid('reload');
45 | ClosecallBack();
46 | });
47 |
48 | }
49 |
50 | return false;
51 | };
52 |
53 | });
54 |
55 | return OsInfoEdit;
56 | });
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/osinfo/ctrl/osinfo.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 |
6 | var OsInfoAdd = require('./osinfo.add');
7 | var OsInfoEdit = require('./osinfo.edit');
8 | var OsInfoRemove = require('./osinfo.remove');
9 | var OsInfoRefreshOne = require('./osinfo.refreshone');
10 | var OsInfoRefreshAll = require('./osinfo.refreshall');
11 |
12 | // 角色信息列表
13 | var OsInfo = Page.extend(function() {
14 | this.injecte([
15 | new OsInfoAdd('osinfo_add'),
16 | new OsInfoEdit('osinfo_edit'),
17 | new OsInfoRemove('osinfo_remove'),
18 | new OsInfoRefreshOne('osinfo_refreshone'),
19 | new OsInfoRefreshAll('osinfo_refreshall')
20 | ]);
21 |
22 | // @override
23 | this.load = function(panel) {
24 | panel.find('table').cdatagrid({
25 | // 必须要加此项!!
26 | controller: this
27 |
28 | });
29 | };
30 | });
31 |
32 | return OsInfo;
33 | });
34 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/osinfo/ctrl/osinfo.refreshall.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 |
6 | // 刷新所以系统数据
7 | var OsInfoRefreshAll = Page.extend(function() {
8 |
9 | // @override
10 | this.submit = function(table) {
11 |
12 | $.ajax({
13 | type: 'GET',
14 | url: Config.ContextPath+'system/sys/os/data/refresh/all',
15 | dataType:"json",
16 | contentType:"application/json",
17 | success: function (e) {
18 | if(e.data){
19 | $.messager.alert("操作提示", "所有系统数据刷新成功!","info");
20 | }else{
21 | $.messager.alert("操作提示", "部分或所有系统数据刷新失败!","error");
22 | }
23 | }
24 | });
25 |
26 | };
27 | });
28 |
29 | return OsInfoRefreshAll;
30 | });
31 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/osinfo/ctrl/osinfo.refreshone.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 |
6 | // 刷新单个系统数据
7 | var OsInfoRegreshOne = Page.extend(function() {
8 |
9 | // @override
10 | this.submit = function(table, data) {
11 |
12 | $.ajax({
13 | type: 'POST',
14 | url: Config.ContextPath+'system/sys/os/data/refresh/single',
15 | dataType:"json",
16 | contentType:"application/json",
17 | data: JSON.stringify(data),
18 | success: function (e) {
19 | if(e.data){
20 | $.messager.alert("操作提示", "所选系统数据刷新成功!","info");
21 | }else{
22 | $.messager.alert("操作提示", "所选系统数据刷新失败!","error");
23 | }
24 | }
25 | });
26 |
27 |
28 | };
29 | });
30 |
31 | return OsInfoRegreshOne;
32 | });
33 |
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/osinfo/ctrl/osinfo.remove.js:
--------------------------------------------------------------------------------
1 | define(function(require) {
2 | var Core = require('core/core');
3 | var Page = require('core/page');
4 | var Config = require('config');
5 |
6 | // 删除数据字典
7 | var OsInfoRemove = Page.extend(function() {
8 |
9 | // @override
10 | this.submit = function(table, data) {
11 | Core.ajax(Config.ContextPath+'system/sys/os/'+data.osId, {
12 | type: 'json',
13 | method: 'post',
14 | data: {
15 | _method: 'delete'
16 | }
17 | }).then(function(){
18 | table.datagrid('reload');
19 | });
20 | };
21 | });
22 |
23 | return OsInfoRemove;
24 | });
--------------------------------------------------------------------------------
/framework-system-server/src/main/webapp/modules/sys/osinfo/osinfo-info.html:
--------------------------------------------------------------------------------
1 |
2 |
29 |
--------------------------------------------------------------------------------
/framework-system-static-config/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | framework-system-parent
7 | com.centit.framework
8 | ${revision}
9 |
10 | 4.0.0
11 |
12 | framework-system-static-config
13 | com.centit.framework:framework-system-static-config
14 | jar
15 | 配置信息
16 |
17 |
18 |
19 | com.centit.framework
20 | framework-system-static-jdbc
21 | ${project.version}
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/framework-system-static-jdbc/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | framework-system-parent
7 | com.centit.framework
8 | ${revision}
9 |
10 | 4.0.0
11 |
12 | framework-system-static-jdbc
13 | com.centit.framework:framework-system-static-jdbc
14 | jar
15 | 用jdbc实现易购的数据库基数数据查询
16 |
17 |
18 |
19 | com.centit.framework
20 | framework-system-static
21 | ${project.version}
22 |
23 |
24 |
25 | com.centit.framework
26 | centit-persistence-jdbc
27 | ${project.version}
28 |
29 |
30 |
31 | com.centit.support
32 | centit-database-datasource
33 | ${project.version}
34 |
35 |
36 |
37 |
38 | junit
39 | junit
40 | test
41 |
42 |
43 |
44 | javax.servlet
45 | javax.servlet-api
46 | provided
47 |
48 |
49 |
50 |
51 |
52 |
53 | src/main/java
54 |
55 | **/*.xml
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/framework-system-static/README.md:
--------------------------------------------------------------------------------
1 | # 框架基于JSON的最简静态实现
2 |
3 |
--------------------------------------------------------------------------------
/framework-system-static/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | framework-system-parent
7 | com.centit.framework
8 | ${revision}
9 |
10 | 4.0.0
11 |
12 | framework-system-static
13 | com.centit.framework:framework-system-static
14 | jar
15 | 用json实现了和core兼容的表结构,另外也可以用jdbc直接读取其他框架系统兼容的表结构,
16 | 同时提供了一个和基于框架开发的集成平台对接的接口
17 |
18 |
19 |
20 | com.centit.framework
21 | framework-core
22 | ${project.version}
23 |
24 |
25 |
26 | javax.persistence
27 | javax.persistence-api
28 | test
29 |
30 |
31 |
32 | junit
33 | junit
34 | test
35 |
36 |
37 | org.projectlombok
38 | lombok
39 |
40 |
41 |
42 | javax.servlet
43 | javax.servlet-api
44 | ${servlet-api.version}
45 | provided
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/framework-system-static/src/test/java/com/centit/test/TestUserDetailsJson.java:
--------------------------------------------------------------------------------
1 | package com.centit.test;
2 |
3 | import com.alibaba.fastjson2.JSON;
4 | import com.centit.framework.model.basedata.RoleInfo;
5 | import com.centit.framework.model.basedata.UserInfo;
6 | import com.centit.framework.model.basedata.UserUnit;
7 | import com.centit.framework.model.security.CentitUserDetails;
8 | import org.junit.Test;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class TestUserDetailsJson {
14 | @Test
15 | public void createUserDetails() throws Exception {
16 | CentitUserDetails userDetails = new CentitUserDetails();
17 | UserInfo userInfo = new UserInfo();
18 | userInfo.setUserName("anonymousUser");
19 | userInfo.setIsValid("T");
20 | userInfo.setLoginName("anonymousUser");
21 | userInfo.setUserCode("anonymousUser");
22 | List uus = new ArrayList<>();
23 | UserUnit uu = new UserUnit("00001", "nq","zz","F");
24 | uu.setUserCode("anonymousUser");
25 | uu.setUnitCode("U00001");
26 | uus.add(uu);
27 |
28 | uu = new UserUnit("00002", "gl","zr","T");
29 | uu.setUserCode("anonymousUser");
30 | uu.setUnitCode("U00002");
31 | uus.add(uu);
32 |
33 | userDetails.setUserUnits(uus);
34 | List roles = new ArrayList<>(2);
35 | RoleInfo roleInfo = new RoleInfo("anonymous", "匿名用户角色","G",
36 | "U00001","T","匿名用户角色");
37 | roles.add(roleInfo);
38 | roleInfo = new RoleInfo("admin", "管理员角色","G",
39 | "U00002","T","管理员角色");
40 | roles.add(roleInfo);
41 |
42 | userDetails.setUserInfo(userInfo);
43 |
44 | userDetails.mapAuthoritiesByRoles(roles);
45 |
46 | String s = JSON.toJSONString(userDetails);
47 |
48 | System.out.println(s);
49 |
50 | userDetails = JSON.parseObject(s, CentitUserDetails.class);
51 | s = JSON.toJSONString(userDetails);
52 |
53 | System.out.println(s);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/framework-system-static/src/test/resources/optinfo.josn:
--------------------------------------------------------------------------------
1 | {
2 | "text":"数据库定义",
3 | "optId":"DatabaseInfo",
4 | "preOptId":"MF_MDFORMMGR",
5 | "pid":"MF_MDFORMMGR",
6 | "optUrl":"service/sys/databaseinfo",
7 | "url":"modules/sys/databaseinfo/databaseinfo.html",
8 | "updateDate":"2016-07-29 16:46:48",
9 | "id":"DatabaseInfo",
10 | "optType":"O",
11 | "pageType":"D",
12 | "optRoute":"modules/sys/databaseinfo/databaseinfo.html",
13 | "optName":"数据库定义",
14 | "isInToolbar":"Y",
15 | "dataScopes":[
16 |
17 | ],
18 | "lastModifyDate":"2016-07-29 16:46:48",
19 | "attributes":{
20 | "external":false
21 | },
22 | "optMethods":[
23 |
24 | ]
25 |
26 | }
27 | {
28 | "icon":"icon-base icon-base-user",
29 | "text":"下属部门管理",
30 | "optId":"DEPTPOW",
31 | "updator":"u0000000",
32 | "preOptId":"DEPTMAG",
33 | "pid":"DEPTMAG",
34 | "optUrl":"/system/deptManager",
35 | "url":"modules/sys/deptpow/deptpow.html",
36 | "updateDate":"2016-05-27 15:19:33",
37 | "creator":"u0000000",
38 | "optType":"O",
39 | "pageType":"D",
40 | "id":"DEPTPOW",
41 | "orderInd":1,
42 | "optRoute":"modules/sys/deptpow/deptpow.html",
43 | "optName":"下属部门管理",
44 | "isInToolbar":"Y",
45 | "dataScopes":[
46 |
47 | ],
48 | "lastModifyDate":"2016-05-27 15:19:33",
49 | "optMethods":[
50 |
51 | ],
52 | "attributes":{
53 | "external":false
54 | }
55 | }
--------------------------------------------------------------------------------
/framework-system-web/src/main/java/com/centit/framework/system/controller/SystemDataManagerController.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.controller;
2 |
3 | import com.centit.framework.core.controller.BaseController;
4 | import com.centit.framework.core.controller.WrapUpResponseBody;
5 | import com.centit.framework.model.basedata.UserSyncDirectory;
6 | import com.centit.framework.system.service.UserDirectory;
7 | import com.centit.framework.system.service.UserSyncDirectoryManager;
8 | import io.swagger.annotations.Api;
9 | import io.swagger.annotations.ApiOperation;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.beans.factory.annotation.Qualifier;
12 | import org.springframework.stereotype.Controller;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 | import org.springframework.web.bind.annotation.RequestMethod;
15 | import org.springframework.web.bind.annotation.RequestParam;
16 |
17 | @Controller
18 | @RequestMapping("/datamanager")
19 | @Api(tags= "用户组织同步接口",value = "用户组织同步接口")
20 | public class SystemDataManagerController extends BaseController {
21 |
22 | @Autowired
23 | @Qualifier("activeDirectoryUserDirectory")
24 | private UserDirectory activeDirectoryUserDirectory;
25 |
26 | @Autowired
27 | private UserSyncDirectoryManager userSyncDirectoryManager;
28 |
29 | @ApiOperation(value="用户组织同步",notes="用户组织同步")
30 | @WrapUpResponseBody
31 | @RequestMapping(value = "/syncuserdirectory",
32 | method = RequestMethod.POST)
33 | public void syncUserDirectory(@RequestParam("directory") String directory) {
34 | UserSyncDirectory userSyncDirectory = userSyncDirectoryManager.getObjectById(directory);
35 | if(userSyncDirectory != null && userSyncDirectory.getType().equalsIgnoreCase("LDAP")){
36 | activeDirectoryUserDirectory.synchroniseUserDirectory(userSyncDirectory);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/framework-system-web/src/main/java/com/centit/framework/system/controller/SystemSettingController.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.controller;
2 |
3 | import com.centit.framework.common.ResponseData;
4 | import com.centit.framework.core.controller.BaseController;
5 | import com.centit.framework.core.controller.WrapUpResponseBody;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RequestMethod;
9 |
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import java.io.*;
13 |
14 | /*
15 | * 系统设置
16 | *
17 | * @author zou_wy@centit.com
18 | */
19 | @Controller
20 | @RequestMapping("/systemsetting")
21 | public class SystemSettingController extends BaseController {
22 |
23 | /*
24 | * 系统日志中记录
25 | *
26 | * @return 业务标识ID
27 | */
28 | public String getOptId() {
29 | return "SystemSetting";
30 | }
31 |
32 | @RequestMapping(value = "update", method = RequestMethod.POST)
33 | public void updateSystemName(String systemName) {
34 |
35 | }
36 |
37 | @RequestMapping(value = "/uploadico", method = RequestMethod.POST)
38 | @WrapUpResponseBody
39 | public ResponseData replaceIcon(HttpServletRequest request) {
40 | String webPath = request.getSession().getServletContext().getRealPath("");
41 | request.getServletContext().getRealPath("");
42 | String filePath = webPath + "/ui/favicon.ico";
43 |
44 | try (OutputStream fileOutputStream = new FileOutputStream(new File(filePath));
45 | InputStream inputStream = request.getInputStream()) {
46 |
47 | int ch = 0;
48 | while ((ch = inputStream.read()) != -1) {
49 | fileOutputStream.write(ch);
50 | }
51 |
52 | } catch (IOException e) {
53 |
54 | }
55 | return ResponseData.successResponse;
56 | }
57 |
58 | @RequestMapping(method = RequestMethod.POST)
59 | public void setSystemParameter(String systemName, HttpServletResponse response) {
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/framework-system-web/src/main/java/com/centit/framework/system/utils/VotaCode.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.system.utils;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class VotaCode {
7 | Long createTime;
8 | String verifyCode;
9 | String email;
10 | String phone;
11 | }
12 |
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/ExtendedSqlMap.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | ]>
7 |
8 |
9 |
18 |
19 |
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Implementation-Vendor: Adobe Systems Inc.
3 | Ant-Version: Apache Ant 1.7.0
4 | Implementation-Title: BlazeDS - BlazeDS Application
5 | Implementation-Version: 3.0.0.544
6 | Sealed: false
7 | Created-By: 1.5.0_13-b05 (Sun Microsystems Inc.)
8 |
9 |
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/META-INF/web-fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | framework-sys-module
4 | sys
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | /D/Projects/RunData/webim_home/logs
6 | mylog
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
16 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/messagesource/validation/validation.properties:
--------------------------------------------------------------------------------
1 | #\u901a\u7528\u7684\u9a8c\u8bc1\u63d0\u793a
2 | field.limit.notNull=\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a
3 | field.limit.email=\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u5b50\u90ae\u4ef6\u683c\u5f0f
4 | field.limit.url=\u8bf7\u8f93\u5165\u6b63\u786e\u7684URL
5 |
6 | string.limit.notBlank=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
7 | string.limit.notEmpty=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
8 |
9 | string.limit.pattern=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u5fc5\u987b\u7b26\u5408\u89c4\u5219 {regexp}
10 |
11 | string.length.limit.equal=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4e3a {max}
12 | string.length.limit.max=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7 {max}
13 | string.length.limit.min=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e {min}
14 | string.length.limit.range=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4ecb\u4e8e {min} \u4e0e {max} \u4e4b\u95f4
15 |
16 | number.limit.range=\u8f93\u5165\u7684\u6570\u503c\u5fc5\u987b\u4ecb\u4e8e{min}\u4e0e{max}\u4e4b\u95f4
17 |
18 | #\u5bf9\u8c61\u5c5e\u6027\u7279\u6709\u7684\u9a8c\u8bc1\u63d0\u793a
19 | #key\u7684\u89c4\u5219\u4e3a \u5bf9\u8c61\u540d\uff08\u9996\u5b57\u6bcd\u5c0f\u5199\uff09.\u5c5e\u6027\u540d.\u7ea6\u675f\u540d
20 | userInfo.loginName.maxLength=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7{max}
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/messagesource/validation/validation_en_US.properties:
--------------------------------------------------------------------------------
1 | #\u901a\u7528\u7684\u9a8c\u8bc1\u63d0\u793a
2 | field.limit.notNull=field not null
3 | field.limit.email=email
4 | field.limit.url=url
5 |
6 | string.limit.notBlank=string not blank
7 | string.limit.notEmpty=string not empty
8 |
9 | string.limit.patteren=string must match {regexp}
10 |
11 | string.length.limit.equal=field length must be {max}
12 | string.length.limit.max=field length must less than {max}
13 | string.length.limit.min=field length must more than{min}
14 | string.length.limit.range=field length must between {min} and {max}
15 |
16 | number.limit.range=number must between {min} and {max}
17 |
18 | #\u5bf9\u8c61\u5c5e\u6027\u7279\u6709\u7684\u9a8c\u8bc1\u63d0\u793a
19 | #key\u7684\u89c4\u5219\u4e3a \u5bf9\u8c61\u540d\uff08\u9996\u5b57\u6bcd\u5c0f\u5199\uff09.\u5c5e\u6027\u540d.\u7ea6\u675f\u540d
20 | userInfo.loginName.maxLength=field length must less than {max}
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/messagesource/validation/validation_zh_CN.properties:
--------------------------------------------------------------------------------
1 | #\u901a\u7528\u7684\u9a8c\u8bc1\u63d0\u793a
2 | field.limit.notNull=\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a
3 | field.limit.email=\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u5b50\u90ae\u4ef6\u683c\u5f0f
4 | field.limit.url=\u8bf7\u8f93\u5165\u6b63\u786e\u7684URL
5 |
6 | string.limit.notBlank=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
7 | string.limit.notEmpty=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u4e0d\u80fd\u4e3a\u7a7a
8 |
9 | string.limit.pattern=\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u5fc5\u987b\u7b26\u5408\u89c4\u5219{regexp}
10 |
11 | string.length.limit.equal=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4e3a {max}
12 | string.length.limit.max=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7 {max}
13 | string.length.limit.min=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e {min}
14 | string.length.limit.range=\u5b57\u6bb5\u957f\u5ea6\u5fc5\u987b\u4ecb\u4e8e {min} \u4e0e {max} \u4e4b\u95f4
15 |
16 | number.limit.range=\u8f93\u5165\u7684\u6570\u503c\u5fc5\u987b\u4ecb\u4e8e {min} \u4e0e {max} \u4e4b\u95f4
17 | number.limit.max=\u8f93\u5165\u7684\u6570\u503c\u5fc5\u987b\u5c0f\u4e8e {max}
18 |
19 | #\u5bf9\u8c61\u5c5e\u6027\u7279\u6709\u7684\u9a8c\u8bc1\u63d0\u793a
20 | #key\u7684\u89c4\u5219\u4e3a \u5bf9\u8c61\u540d\uff08\u9996\u5b57\u6bcd\u5c0f\u5199\uff09.\u5c5e\u6027\u540d.\u7ea6\u675f\u540d
21 | userInfo.loginName.maxLength=\u5b57\u6bb5\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7{max}
--------------------------------------------------------------------------------
/framework-system-web/src/main/resources/system.properties:
--------------------------------------------------------------------------------
1 | nacos.server-addr=192.168.134.250:30848
2 | #prod
3 | #nacos.server-addr=192.168.137.63:30849
4 | nacos.system-dataid=prod
5 | login.dao.enable= true
6 | login.cas.enable= false
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/README.md:
--------------------------------------------------------------------------------
1 | # 用户注册
2 |
3 | # 用户集成,和第三方用户对接,比如:钉钉、QQ、微信等等
4 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.config;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | /**
7 | * 应用凭证配置
8 | */
9 | @Configuration
10 | public class AppConfig {
11 | @Value("${dingtalk.app_key}")
12 | private String appKey;
13 |
14 | @Value("${dingtalk.app_secret}")
15 | private String appSecret;
16 |
17 | @Value("${dingtalk.agent_id}")
18 | private String agentId;
19 |
20 | @Value("${dingtalk.corp_id}")
21 | private String corpId;
22 |
23 | @Value("${third.redirect_uri}")
24 | private String redirectUri;
25 |
26 | @Value("${third.redirect_binduri}")
27 | private String redirectBindUri;
28 |
29 | @Value("${third.redirect_loginuri}")
30 | private String redirectLoginUrl;
31 |
32 | public String getAppKey() {
33 | return appKey;
34 | }
35 |
36 | public void setAppKey(String appKey) {
37 | this.appKey = appKey;
38 | }
39 |
40 | public String getAppSecret() {
41 | return appSecret;
42 | }
43 |
44 | public void setAppSecret(String appSecret) {
45 | this.appSecret = appSecret;
46 | }
47 |
48 | public String getAgentId() {
49 | return agentId;
50 | }
51 |
52 | public void setAgentId(String agentId) {
53 | this.agentId = agentId;
54 | }
55 |
56 | public String getCorpId() {
57 | return corpId;
58 | }
59 |
60 | public void setCorpId(String corpId) {
61 | this.corpId = corpId;
62 | }
63 |
64 | public String getRedirectUri() {
65 | return redirectUri;
66 | }
67 |
68 | public void setRedirectUri(String redirectUri) {
69 | this.redirectUri = redirectUri;
70 | }
71 |
72 | public String getRedirectBindUri() {
73 | return redirectBindUri;
74 | }
75 |
76 | public void setRedirectBindUri(String redirectBindUri) {
77 | this.redirectBindUri = redirectBindUri;
78 | }
79 |
80 | public String getRedirectLoginUrl() {
81 | return redirectLoginUrl;
82 | }
83 |
84 | public void setRedirectLoginUrl(String redirectLoginUrl) {
85 | this.redirectLoginUrl = redirectLoginUrl;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/config/WechatOpenConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.config;
2 |
3 | import me.chanjar.weixin.mp.api.WxMpConfigStorage;
4 | import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
5 | import me.chanjar.weixin.mp.api.WxMpService;
6 | import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
7 | import org.apache.commons.lang3.StringUtils;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.Configuration;
11 |
12 | import java.util.Base64;
13 |
14 | @Configuration
15 | public class WechatOpenConfig {
16 |
17 | @Autowired
18 | private WxAppConfig wxAppConfig;
19 |
20 | @Bean
21 | public WxMpService wxOpenService() {
22 | WxMpService wxOpenService = new WxMpServiceImpl();
23 | wxOpenService.setWxMpConfigStorage(wxOpenConfigStorage());
24 | return wxOpenService;
25 | }
26 |
27 | @Bean
28 | public WxMpConfigStorage wxOpenConfigStorage() {
29 | WxMpInMemoryConfigStorage wxMpInMemoryConfigStorage = new WxMpInMemoryConfigStorage();
30 | wxMpInMemoryConfigStorage.setAppId(wxAppConfig.getAppID());
31 | String secret = wxAppConfig.getAppSecret();
32 | if(StringUtils.isNotBlank(secret)) {
33 | byte[] decoded = Base64.getDecoder().decode(secret);
34 | String decodeStr = new String(decoded);
35 | wxMpInMemoryConfigStorage.setSecret(decodeStr);
36 | }
37 | return wxMpInMemoryConfigStorage;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/config/WxAppConfig.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.config;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | @Configuration
7 | public class WxAppConfig {
8 |
9 | @Value("${wechat.appid:}")
10 | private String appID;
11 |
12 | @Value("${wechat.appsecret:}")
13 | private String appSecret;
14 |
15 | @Value("${wechat.mobileAppid:}")
16 | private String moblieAppId;
17 |
18 | @Value("${wechat.mobileAppSecret:}")
19 | private String moblieAppSecret;
20 |
21 | @Value("${third.redirect_uri:}")
22 | private String redirectLoginUri;
23 |
24 | @Value("${third.redirect_binduri:}")
25 | private String redirectBindUri;
26 |
27 | public String getAppID() {
28 | return appID;
29 | }
30 |
31 | public void setAppID(String appID) {
32 | this.appID = appID;
33 | }
34 |
35 | public String getAppSecret() {
36 | return appSecret;
37 | }
38 |
39 | public void setAppSecret(String appSecret) {
40 | this.appSecret = appSecret;
41 | }
42 |
43 | public String getRedirectLoginUri() {
44 | return redirectLoginUri;
45 | }
46 |
47 | public void setRedirectLoginUri(String redirectLoginUri) {
48 | this.redirectLoginUri = redirectLoginUri;
49 | }
50 |
51 | public String getRedirectBindUri() {
52 | return redirectBindUri;
53 | }
54 |
55 | public void setRedirectBindUri(String redirectBindUri) {
56 | this.redirectBindUri = redirectBindUri;
57 | }
58 |
59 | public String getMoblieAppId() {
60 | return moblieAppId;
61 | }
62 |
63 | public void setMoblieAppId(String moblieAppId) {
64 | this.moblieAppId = moblieAppId;
65 | }
66 |
67 | public String getMoblieAppSecret() {
68 | return moblieAppSecret;
69 | }
70 |
71 | public void setMoblieAppSecret(String moblieAppSecret) {
72 | this.moblieAppSecret = moblieAppSecret;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/constant/AppConstant.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.constant;
2 |
3 | /**
4 | * 应用凭证常量
5 | */
6 | public class AppConstant {
7 |
8 | /**
9 | * 开发者后台-应用开发-企业内部应用-选择您的小程序-凭证与基础信息-AppKey
10 | */
11 | public static final String APP_KEY = "***";
12 | /**
13 | * 开发者后台-应用开发-企业内部应用-选择您的小程序-凭证与基础信息-AppSecret
14 | */
15 | public static final String APP_SECRET="***";
16 | /**
17 | * 开发者后台-开放能力-场景群-机器人-ID
18 | */
19 | public static final String ROBOT_CODE = "***";
20 |
21 | /**
22 | * 场景群ID 调用创建场景群接口时返回的 open_conversation_id
23 | */
24 | public static final String OPEN_CONVERSATION_ID = "***";
25 | }
26 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/dao/AccessTokenDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.users.po.AccessToken;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | /**
12 | * @author zfg
13 | */
14 | @Repository("accessTokenDao")
15 | public class AccessTokenDao extends BaseDaoImpl {
16 |
17 | public Map getFilterField() {
18 | Map filterField = new HashMap<>();
19 | filterField.put("appId", CodeBook.EQUAL_HQL_ID);
20 | filterField.put("accessToken", CodeBook.EQUAL_HQL_ID);
21 | filterField.put("expireIn", CodeBook.EQUAL_HQL_ID);
22 | filterField.put("expireTime", CodeBook.EQUAL_HQL_ID);
23 |
24 | return filterField;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/dao/DingTalkSuiteDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.users.po.DingTalkSuite;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | /**
12 | * @author zfg
13 | */
14 | @Repository("dingTalkSuiteDao")
15 | public class DingTalkSuiteDao extends BaseDaoImpl {
16 |
17 | public Map getFilterField() {
18 | Map filterField = new HashMap<>();
19 | filterField.put("id", CodeBook.EQUAL_HQL_ID);
20 | filterField.put("suiteid", CodeBook.EQUAL_HQL_ID);
21 | filterField.put("name", CodeBook.LIKE_HQL_ID);
22 | filterField.put("token", CodeBook.EQUAL_HQL_ID);
23 | filterField.put("encodingAesKey", CodeBook.EQUAL_HQL_ID);
24 | filterField.put("suiteKey", CodeBook.EQUAL_HQL_ID);
25 | filterField.put("suiteSecret", CodeBook.EQUAL_HQL_ID);
26 | filterField.put("suitTicket", CodeBook.EQUAL_HQL_ID);
27 | filterField.put("suiteAccessToken", CodeBook.EQUAL_HQL_ID);
28 |
29 | return filterField;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/dao/SocialDeptAuthDao.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.dao;
2 |
3 | import com.centit.framework.core.dao.CodeBook;
4 | import com.centit.framework.jdbc.dao.BaseDaoImpl;
5 | import com.centit.framework.users.po.SocialDeptAuth;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | @Repository
12 | public class SocialDeptAuthDao extends BaseDaoImpl {
13 |
14 | public Map getFilterField() {
15 | Map filterField = new HashMap<>();
16 | filterField.put("unitCode", CodeBook.EQUAL_HQL_ID);
17 | filterField.put("deptId", CodeBook.EQUAL_HQL_ID);
18 |
19 | return filterField;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/dingtalk/DingTalkEncryptException.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.dingtalk;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | /**
7 | * 钉钉开放平台加解密异常类
8 | */
9 | public class DingTalkEncryptException extends Exception {
10 | /**
11 | * 成功
12 | **/
13 | public static final int SUCCESS = 0;
14 | /**
15 | * 加密明文文本非法
16 | **/
17 | public static final int ENCRYPTION_PLAINTEXT_ILLEGAL = 900001;
18 | /**
19 | * 加密时间戳参数非法
20 | **/
21 | public static final int ENCRYPTION_TIMESTAMP_ILLEGAL = 900002;
22 | /**
23 | * 加密随机字符串参数非法
24 | **/
25 | public static final int ENCRYPTION_NONCE_ILLEGAL = 900003;
26 | /**
27 | * 不合法的aeskey
28 | **/
29 | public static final int AES_KEY_ILLEGAL = 900004;
30 | /**
31 | * 签名不匹配
32 | **/
33 | public static final int SIGNATURE_NOT_MATCH = 900005;
34 | /**
35 | * 计算签名错误
36 | **/
37 | public static final int COMPUTE_SIGNATURE_ERROR = 900006;
38 | /**
39 | * 计算加密文字错误
40 | **/
41 | public static final int COMPUTE_ENCRYPT_TEXT_ERROR = 900007;
42 | /**
43 | * 计算解密文字错误
44 | **/
45 | public static final int COMPUTE_DECRYPT_TEXT_ERROR = 900008;
46 | /**
47 | * 计算解密文字长度不匹配
48 | **/
49 | public static final int COMPUTE_DECRYPT_TEXT_LENGTH_ERROR = 900009;
50 | /**
51 | * 计算解密文字suiteKey(ISV)或者corpid(普通企业)不匹配
52 | **/
53 | public static final int COMPUTE_DECRYPT_TEXT_CORPID_ERROR = 900010;
54 |
55 | private static Map msgMap = new HashMap<>();
56 |
57 | static {
58 | msgMap.put(SUCCESS, "成功");
59 | msgMap.put(ENCRYPTION_PLAINTEXT_ILLEGAL, "加密明文文本非法");
60 | msgMap.put(ENCRYPTION_TIMESTAMP_ILLEGAL, "加密时间戳参数非法");
61 | msgMap.put(ENCRYPTION_NONCE_ILLEGAL, "加密随机字符串参数非法");
62 | msgMap.put(SIGNATURE_NOT_MATCH, "签名不匹配");
63 | msgMap.put(COMPUTE_SIGNATURE_ERROR, "签名计算失败");
64 | msgMap.put(AES_KEY_ILLEGAL, "不合法的aes key");
65 | msgMap.put(COMPUTE_ENCRYPT_TEXT_ERROR, "计算加密文字错误");
66 | msgMap.put(COMPUTE_DECRYPT_TEXT_ERROR, "计算解密文字错误");
67 | msgMap.put(COMPUTE_DECRYPT_TEXT_LENGTH_ERROR, "计算解密文字长度不匹配");
68 | msgMap.put(COMPUTE_DECRYPT_TEXT_CORPID_ERROR, "计算解密文字suiteKey(ISV)或者corpid(普通企业)不匹配");
69 | }
70 |
71 | private Integer code;
72 |
73 | public DingTalkEncryptException(Integer exceptionCode) {
74 | super(msgMap.get(exceptionCode));
75 | this.code = exceptionCode;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/dingtalk/PKCS7Padding.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.dingtalk;
2 |
3 | import java.nio.charset.Charset;
4 | import java.util.Arrays;
5 |
6 | /*
7 | * PKCS7算法的加密填充
8 | */
9 |
10 | public class PKCS7Padding {
11 | private final static Charset CHARSET = Charset.forName("utf-8");
12 | private final static int BLOCK_SIZE = 32;
13 |
14 | /**
15 | * 填充mode字节
16 | *
17 | * @param count
18 | * @return
19 | */
20 | public static byte[] getPaddingBytes(int count) {
21 | int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
22 | if (amountToPad == 0) {
23 | amountToPad = BLOCK_SIZE;
24 | }
25 | char padChr = chr(amountToPad);
26 | StringBuilder tmp = new StringBuilder();
27 | for (int index = 0; index < amountToPad; index++) {
28 | tmp.append(padChr);
29 | }
30 | return tmp.toString().getBytes(CHARSET);
31 | }
32 |
33 | /**
34 | * 移除mode填充字节
35 | *
36 | * @param decrypted
37 | * @return
38 | */
39 | public static byte[] removePaddingBytes(byte[] decrypted) {
40 | int pad = (int) decrypted[decrypted.length - 1];
41 | if (pad < 1 || pad > BLOCK_SIZE) {
42 | pad = 0;
43 | }
44 | return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
45 | }
46 |
47 | private static char chr(int a) {
48 | byte target = (byte) (a & 0xFF);
49 | return (char) target;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/dto/DingUnitDTO.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.dto;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import org.hibernate.validator.constraints.Length;
6 |
7 | /**
8 | * @author zfg
9 | */
10 | @ApiModel(value = "同步系统机构至钉钉机构部门", description = "同步系统机构至钉钉机构部门")
11 | public class DingUnitDTO {
12 |
13 | @ApiModelProperty(value = "机构代码", name = "unitCode", required = true)
14 | @Length(max = 32)
15 | private String unitCode;
16 |
17 | @ApiModelProperty(value = "机构名称", name = "unitName", required = true)
18 | @Length(max = 300)
19 | private String unitName;
20 |
21 | @ApiModelProperty(value = "上级机构代码", name = "parentUnit", required = true)
22 | @Length(max = 32)
23 | private String parentUnit;
24 |
25 | public String getUnitCode() {
26 | return unitCode;
27 | }
28 |
29 | public void setUnitCode(String unitCode) {
30 | this.unitCode = unitCode;
31 | }
32 |
33 | public String getUnitName() {
34 | return unitName;
35 | }
36 |
37 | public void setUnitName(String unitName) {
38 | this.unitName = unitName;
39 | }
40 |
41 | public String getParentUnit() {
42 | return parentUnit;
43 | }
44 |
45 | public void setParentUnit(String parentUnit) {
46 | this.parentUnit = parentUnit;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/dto/DingUserDTO.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.dto;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import org.hibernate.validator.constraints.Length;
6 |
7 | /**
8 | * @author zfg
9 | */
10 | @ApiModel(value = "同步系统用户至钉钉用户", description = "同步系统用户至钉钉用户")
11 | public class DingUserDTO {
12 |
13 | @ApiModelProperty(value = "用户姓名", name = "userName", required = true)
14 | @Length(max = 300)
15 | private String userName;
16 |
17 | @ApiModelProperty(value = "手机号码", name = "regCellPhone", required = true)
18 | @Length(max = 15)
19 | private String regCellPhone;
20 |
21 | @ApiModelProperty(value = "默认部门", name = "primaryUnit", required = true)
22 | @Length(max = 32)
23 | private String primaryUnit;
24 |
25 | public String getUserName() {
26 | return userName;
27 | }
28 |
29 | public void setUserName(String userName) {
30 | this.userName = userName;
31 | }
32 |
33 | public String getRegCellPhone() {
34 | return regCellPhone;
35 | }
36 |
37 | public void setRegCellPhone(String regCellPhone) {
38 | this.regCellPhone = regCellPhone;
39 | }
40 |
41 | public String getPrimaryUnit() {
42 | return primaryUnit;
43 | }
44 |
45 | public void setPrimaryUnit(String primaryUnit) {
46 | this.primaryUnit = primaryUnit;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/po/AuthCallback.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.po;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 授权回调时的参数类
7 | */
8 | public class AuthCallback implements Serializable {
9 |
10 | private static final long serialVersionUID = 9023382676927471854L;
11 |
12 | /**
13 | * 访问AuthorizeUrl后回调时带的参数code
14 | */
15 | private String code;
16 |
17 | /**
18 | * 访问AuthorizeUrl后回调时带的参数auth_code,该参数目前只使用于支付宝登录
19 | */
20 | private String auth_code;
21 |
22 | /**
23 | * 访问AuthorizeUrl后回调时带的参数state,用于和请求AuthorizeUrl前的state比较,防止CSRF攻击
24 | */
25 | private String state;
26 |
27 | public String getCode() {
28 | return code;
29 | }
30 |
31 | public void setCode(String code) {
32 | this.code = code;
33 | }
34 |
35 | public String getAuth_code() {
36 | return auth_code;
37 | }
38 |
39 | public void setAuth_code(String auth_code) {
40 | this.auth_code = auth_code;
41 | }
42 |
43 | public String getState() {
44 | return state;
45 | }
46 |
47 | public void setState(String state) {
48 | this.state = state;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/po/SocialDeptAuth.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.po;
2 |
3 | import com.centit.support.database.orm.GeneratorCondition;
4 | import com.centit.support.database.orm.GeneratorTime;
5 | import com.centit.support.database.orm.GeneratorType;
6 | import com.centit.support.database.orm.ValueGenerator;
7 | import io.swagger.annotations.ApiModel;
8 | import io.swagger.annotations.ApiModelProperty;
9 | import org.hibernate.validator.constraints.Length;
10 |
11 | import javax.persistence.*;
12 | import java.util.Date;
13 |
14 | @Entity
15 | @Table(name = "F_SOCIAL_DEPT_AUTH")
16 | @ApiModel(value = "系统部门平台关联", description = "系统部门平台关联 SocialDept")
17 | public class SocialDeptAuth implements java.io.Serializable {
18 | private static final long serialVersionUID = -2538006375160615889L;
19 |
20 | @Id
21 | @Column(name = "UNIT_CODE")
22 | @ApiModelProperty(value = "机构代码", name = "unitCode")
23 | private String unitCode;
24 |
25 |
26 | @Column(name = "DEPT_ID")
27 | @Length(max = 64, message = "字段长度不能大于{max}")
28 | @ApiModelProperty(value = "平台部门", name = "appKey")
29 | private String deptId;
30 |
31 | @Column(name = "CREATE_DATE", nullable = false)
32 | @Temporal(TemporalType.TIMESTAMP)
33 | @ValueGenerator(strategy = GeneratorType.FUNCTION, value = "today()")
34 | protected Date createDate;
35 |
36 | /**
37 | * UPDATEDATE(更新时间) 更新时间
38 | */
39 | @Column(name = "UPDATE_DATE")
40 | @ValueGenerator(strategy = GeneratorType.FUNCTION, occasion = GeneratorTime.NEW_UPDATE,
41 | condition = GeneratorCondition.ALWAYS, value = "today()")
42 | private Date updateDate;
43 |
44 | /**
45 | * default constructor
46 | */
47 | public SocialDeptAuth() {
48 | }
49 |
50 | public String getUnitCode() {
51 | return unitCode;
52 | }
53 |
54 | public void setUnitCode(String unitCode) {
55 | this.unitCode = unitCode;
56 | }
57 |
58 | public String getDeptId() {
59 | return deptId;
60 | }
61 |
62 | public void setDeptId(String deptId) {
63 | this.deptId = deptId;
64 | }
65 |
66 | public Date getCreateDate() {
67 | return createDate;
68 | }
69 |
70 | public void setCreateDate(Date createDate) {
71 | this.createDate = createDate;
72 | }
73 |
74 | public Date getUpdateDate() {
75 | return updateDate;
76 | }
77 |
78 | public void setUpdateDate(Date updateDate) {
79 | this.updateDate = updateDate;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/AccessTokenService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service;
2 |
3 | import com.centit.framework.users.po.AccessToken;
4 |
5 | /**
6 | * @author zfg
7 | */
8 | public interface AccessTokenService {
9 |
10 | AccessToken getObjectById(String appId);
11 |
12 | void saveAccessToke(AccessToken accessToken);
13 |
14 | void updateAccessToken(AccessToken accessToken);
15 | }
16 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/AuthSource.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service;
2 |
3 | /**
4 | * OAuth平台的API地址的统一接口,提供以下方法:
5 | * 1) {@link AuthSource#authorize()}: 获取授权url. 必须实现
6 | * 2) {@link AuthSource#accessToken()}: 获取accessToken的url. 必须实现
7 | * 3) {@link AuthSource#userInfo()}: 获取用户信息的url. 必须实现
8 | * 4) {@link AuthSource#revoke()}: 获取取消授权的url. 非必须实现接口(部分平台不支持)
9 | * 5) {@link AuthSource#refresh()}: 获取刷新授权的url. 非必须实现接口(部分平台不支持)
10 | *
11 | * @author zfg
12 | */
13 | public interface AuthSource {
14 |
15 | /**
16 | * 授权的api
17 | *
18 | * @return url
19 | */
20 | String authorize();
21 |
22 | /**
23 | * 获取accessToken的api
24 | *
25 | * @return url
26 | */
27 | String accessToken();
28 |
29 | /**
30 | * 获取用户信息的api
31 | *
32 | * @return url
33 | */
34 | String userInfo();
35 |
36 | /**
37 | * 取消授权的api
38 | *
39 | * @return url
40 | */
41 | default String revoke() {
42 | return "";
43 | }
44 |
45 | /**
46 | * 刷新授权的api
47 | *
48 | * @return url
49 | */
50 | default String refresh() {
51 | return "";
52 | }
53 |
54 | /**
55 | * 获取Source的字符串名字
56 | *
57 | * @return name
58 | */
59 | default String getName() {
60 | if (this instanceof Enum) {
61 | return String.valueOf(this);
62 | }
63 | return this.getClass().getSimpleName();
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/DingTalkLoginService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service;
2 |
3 | import com.alibaba.fastjson2.JSONArray;
4 | import com.alibaba.fastjson2.JSONObject;
5 | import com.centit.framework.common.ResponseData;
6 | import com.centit.framework.model.basedata.UserSyncDirectory;
7 | import com.centit.framework.users.dto.DingUnitDTO;
8 | import com.centit.framework.users.dto.DingUserDTO;
9 |
10 | /**
11 | * @author zfg
12 | */
13 | public interface DingTalkLoginService {
14 |
15 | ResponseData getUserByCode(String authCode);
16 |
17 | ResponseData getUserByUnionId(String accessToken, String unionId);
18 |
19 | ResponseData getUserInfo(String accessToken, String userId);
20 |
21 | ResponseData userCreate(String accessToken, DingUserDTO userInfo);
22 |
23 | ResponseData unitCreate(String accessToken, DingUnitDTO unitInfo);
24 |
25 | ResponseData getUnitInfo(String accessToken, String deptId);
26 |
27 | JSONArray getUnitList(String accessToken, String deptId);
28 |
29 | JSONObject getUnitUserList(String accessToken, String deptId);
30 |
31 | int synchroniseUserDirectory(UserSyncDirectory directory);
32 |
33 | ResponseData getUserByMobile(String accessToken, String mobile);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/DingTalkSuiteService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service;
2 |
3 | import com.centit.framework.users.po.DingTalkSuite;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * @author zfg
9 | */
10 | public interface DingTalkSuiteService {
11 |
12 | DingTalkSuite getDingTalkSuiteByProperty(Map paramsMap);
13 |
14 | void saveDingTalkSuiteInfo(DingTalkSuite dingTalkSuite);
15 |
16 | void updateDingTalkSuiteInfo(DingTalkSuite dingTalkSuite);
17 | }
18 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/LoginService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service;
2 |
3 | import com.centit.framework.common.ResponseData;
4 | import com.centit.framework.common.ResponseSingleData;
5 | import com.centit.framework.users.po.AccessToken;
6 | import com.centit.framework.users.po.AuthCallback;
7 |
8 | /**
9 | * @author zfg
10 | */
11 | public interface LoginService {
12 |
13 | /**
14 | * 返回带{@code state}参数的授权url,可自行跳转页面,授权回调时会带上这个{@code state}
15 | *
16 | * @param state state 验证授权流程的参数,可以防止csrf
17 | * @return 返回授权地址
18 | */
19 | String authorize(String state);
20 |
21 | /**
22 | * 第三方登录
23 | *
24 | * @param authCallback 用于接收回调参数的实体
25 | * @return 返回登录成功后的用户信息
26 | */
27 | ResponseData login(AuthCallback authCallback);
28 |
29 | /**
30 | * 撤销授权
31 | *
32 | * @param accessToken 登录成功后返回的Token信息
33 | * @return ResponseSingleData
34 | */
35 | default ResponseData revoke(AccessToken accessToken) {
36 | return ResponseSingleData.makeResponseData("");
37 | }
38 |
39 | /**
40 | * 刷新access token (续期)
41 | *
42 | * @param accessToken 登录成功后返回的Token信息
43 | * @return ResponseSingleData
44 | */
45 | default ResponseData refresh(AccessToken accessToken) {
46 | return ResponseSingleData.makeResponseData("");
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/SocialDeptAuthService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service;
2 |
3 | import com.centit.framework.users.po.SocialDeptAuth;
4 | import com.centit.support.database.utils.PageDesc;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | public interface SocialDeptAuthService {
10 |
11 | SocialDeptAuth getObjectById(String unitCode);
12 |
13 | SocialDeptAuth getSocialDeptAuthByProperties(Map paramsMap);
14 |
15 | List listObjects(Map filterMap, PageDesc pageDesc);
16 |
17 | void mergeObject(SocialDeptAuth socialDeptAuth);
18 |
19 | void deleteObjectById(String unitCode);
20 |
21 | void saveSocialDeptAuth(SocialDeptAuth socialDeptAuth);
22 |
23 | void updateSocialDeptAuth(SocialDeptAuth socialDeptAuth);
24 |
25 | void deleteObject(SocialDeptAuth socialDeptAuth);
26 | }
27 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/WeChatService.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service;
2 |
3 | import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
4 | import me.chanjar.weixin.mp.bean.result.WxMpUser;
5 |
6 | public interface WeChatService {
7 |
8 | WxMpUser getWxUser(String code);
9 |
10 | WxMpOAuth2AccessToken getAccessToken(String code);
11 | }
12 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/AccessTokenServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.users.dao.AccessTokenDao;
4 | import com.centit.framework.users.po.AccessToken;
5 | import com.centit.framework.users.service.AccessTokenService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | * @author zfg
11 | */
12 | @Service("accessTokenService")
13 | public class AccessTokenServiceImpl implements AccessTokenService {
14 |
15 | @Autowired
16 | private AccessTokenDao accessTokenDao;
17 |
18 | @Override
19 | public AccessToken getObjectById(String appId) {
20 | return accessTokenDao.getObjectById(appId);
21 | }
22 |
23 | @Override
24 | public void saveAccessToke(AccessToken accessToken) {
25 | accessTokenDao.mergeObject(accessToken);
26 | }
27 |
28 | @Override
29 | public void updateAccessToken(AccessToken accessToken) {
30 | accessTokenDao.updateObject(accessToken);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/AuthDefaultSource.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.users.service.AuthSource;
4 |
5 | /**
6 | * @author zfg
7 | */
8 | public enum AuthDefaultSource implements AuthSource {
9 |
10 | /**
11 | * 钉钉扫码登录
12 | */
13 | DINGTALK {
14 | @Override
15 | public String authorize() {
16 | return "https://oapi.dingtalk.com/connect/qrconnect";
17 | }
18 |
19 | @Override
20 | public String accessToken() {
21 | return "https://oapi.dingtalk.com/gettoken";
22 | }
23 |
24 | @Override
25 | public String userInfo() {
26 | return "https://oapi.dingtalk.com/sns/getuserinfo_bycode";
27 | }
28 | },
29 |
30 | /**
31 | * 钉钉账号登录
32 | */
33 | DINGTALK_ACCOUNT {
34 | @Override
35 | public String authorize() {
36 | return "https://oapi.dingtalk.com/connect/oauth2/sns_authorize";
37 | }
38 |
39 | @Override
40 | public String accessToken() {
41 | return DINGTALK.accessToken();
42 | }
43 |
44 | @Override
45 | public String userInfo() {
46 | return DINGTALK.userInfo();
47 | }
48 | },
49 | }
50 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/AuthDingTalkAccountRequest.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.users.config.AppConfig;
4 |
5 | /**
6 | * 钉钉账号登录
7 | *
8 | * @author zfg
9 | */
10 | public class AuthDingTalkAccountRequest extends AbstractAuthDingtalkRequest {
11 |
12 | public AuthDingTalkAccountRequest(AppConfig config) {
13 | super(config, AuthDefaultSource.DINGTALK_ACCOUNT);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/AuthDingTalkRequest.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.users.config.AppConfig;
4 |
5 | /**
6 | * 钉钉二维码登录
7 | *
8 | * @author zfg
9 | */
10 | public class AuthDingTalkRequest extends AbstractAuthDingtalkRequest {
11 |
12 | public AuthDingTalkRequest(AppConfig config) {
13 | super(config, AuthDefaultSource.DINGTALK);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/DingTalkSuiteServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.users.dao.DingTalkSuiteDao;
4 | import com.centit.framework.users.po.DingTalkSuite;
5 | import com.centit.framework.users.service.DingTalkSuiteService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 | import org.springframework.transaction.annotation.Transactional;
9 |
10 | import java.util.Map;
11 |
12 | /**
13 | * @author zfg
14 | */
15 | @Service("dingTalkSuiteService")
16 | public class DingTalkSuiteServiceImpl implements DingTalkSuiteService {
17 |
18 | @Autowired
19 | private DingTalkSuiteDao dingTalkSuiteDao;
20 |
21 | @Override
22 | public DingTalkSuite getDingTalkSuiteByProperty(Map paramsMap) {
23 | return dingTalkSuiteDao.getObjectByProperties(paramsMap);
24 | }
25 |
26 | @Override
27 | @Transactional
28 | public void saveDingTalkSuiteInfo(DingTalkSuite dingTalkSuite) {
29 | dingTalkSuiteDao.saveNewObject(dingTalkSuite);
30 | }
31 |
32 | @Override
33 | @Transactional
34 | public void updateDingTalkSuiteInfo(DingTalkSuite dingTalkSuite) {
35 | dingTalkSuiteDao.updateObject(dingTalkSuite);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/LoginServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.common.ResponseData;
4 | import com.centit.framework.users.po.AccessToken;
5 | import com.centit.framework.users.po.AuthCallback;
6 | import com.centit.framework.users.service.LoginService;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | * @author zfg
11 | */
12 | @Service
13 | public class LoginServiceImpl implements LoginService {
14 |
15 | @Override
16 | public String authorize(String state) {
17 | return null;
18 | }
19 |
20 | @Override
21 | public ResponseData login(AuthCallback authCallback) {
22 | return null;
23 | }
24 |
25 | @Override
26 | public ResponseData revoke(AccessToken accessToken) {
27 | return null;
28 | }
29 |
30 | @Override
31 | public ResponseData refresh(AccessToken accessToken) {
32 | return null;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/SocialDeptAuthServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.users.dao.SocialDeptAuthDao;
4 | import com.centit.framework.users.po.SocialDeptAuth;
5 | import com.centit.framework.users.service.SocialDeptAuthService;
6 | import com.centit.support.database.utils.PageDesc;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | @Service("socialDeptAuthServiceImpl")
14 | public class SocialDeptAuthServiceImpl implements SocialDeptAuthService {
15 |
16 |
17 | @Autowired
18 | private SocialDeptAuthDao socialDeptAuthDao;
19 |
20 | @Override
21 | public void mergeObject(SocialDeptAuth socialDeptAuth) {
22 | socialDeptAuthDao.mergeObject(socialDeptAuth);
23 | }
24 |
25 | @Override
26 | public SocialDeptAuth getObjectById(String unitCode) {
27 | return socialDeptAuthDao.getObjectById(unitCode);
28 | }
29 |
30 | @Override
31 | public SocialDeptAuth getSocialDeptAuthByProperties(Map paramsMap) {
32 | return socialDeptAuthDao.getObjectByProperties(paramsMap);
33 | }
34 |
35 | @Override
36 | public List listObjects(Map filterMap, PageDesc pageDesc) {
37 | return socialDeptAuthDao.listObjectsByProperties(filterMap, pageDesc);
38 | }
39 |
40 | @Override
41 | public void deleteObjectById(String unitCode) {
42 | socialDeptAuthDao.deleteObjectById(unitCode);
43 | }
44 |
45 | @Override
46 | public void saveSocialDeptAuth(SocialDeptAuth socialDeptAuth) {
47 | socialDeptAuthDao.saveNewObject(socialDeptAuth);
48 | }
49 |
50 | @Override
51 | public void updateSocialDeptAuth(SocialDeptAuth socialDeptAuth) {
52 | socialDeptAuthDao.updateObject(socialDeptAuth);
53 | }
54 |
55 | @Override
56 | public void deleteObject(SocialDeptAuth socialDeptAuth) {
57 | socialDeptAuthDao.deleteObject(socialDeptAuth);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/main/java/com/centit/framework/users/service/impl/WeChatServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.service.impl;
2 |
3 | import com.centit.framework.users.service.WeChatService;
4 | import me.chanjar.weixin.common.exception.WxErrorException;
5 | import me.chanjar.weixin.mp.api.WxMpService;
6 | import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
7 | import me.chanjar.weixin.mp.bean.result.WxMpUser;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | @Service("weChatService")
12 | public class WeChatServiceImpl implements WeChatService {
13 |
14 | @Autowired
15 | private WxMpService wxOpenService;
16 |
17 | @Override
18 | public WxMpUser getWxUser(String code) {
19 | WxMpUser wxMpUser = new WxMpUser();
20 | try {
21 | WxMpOAuth2AccessToken wxMpOAuth2AccessToken = this.getAccessToken(code);
22 | wxMpUser = wxOpenService.oauth2getUserInfo(wxMpOAuth2AccessToken, null);
23 | } catch (WxErrorException e) {
24 | e.printStackTrace();
25 | }
26 | return wxMpUser;
27 | }
28 |
29 | @Override
30 | public WxMpOAuth2AccessToken getAccessToken(String code) {
31 | WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken();
32 | try {
33 | //通过code获取access_token
34 | wxMpOAuth2AccessToken = wxOpenService.oauth2getAccessToken(code);
35 | } catch (WxErrorException e) {
36 | e.printStackTrace();
37 | }
38 | return wxMpOAuth2AccessToken;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/framework-thirdparty-user-plugin/src/test/java/com/centit/framework/users/test/TestLdapSearch.java:
--------------------------------------------------------------------------------
1 | package com.centit.framework.users.test;
2 |
3 | import com.alibaba.fastjson2.JSON;
4 | import com.centit.framework.model.basedata.UserSyncDirectory;
5 | import com.centit.framework.users.controller.LdapLogin;
6 |
7 | public class TestLdapSearch {
8 |
9 | public static void main(String[] args) {
10 | UserSyncDirectory directory = new UserSyncDirectory();
11 | directory.setTopUnit("centit");
12 | directory.setUrl("LDAP://192.168.128.5:389");
13 | directory.setUser("accountcentit@centit.com");
14 | directory.setUserPwd("*********");
15 | directory.setSearchBase("{ " +
16 | " userSearchBase : \"CN=Users,DC=centit,DC=com\", "+
17 | " userSearchFilter : \"(&(objectCategory=person)(objectClass=user))\", "+
18 | " unitSearchBase : \"CN=Users,DC=centit,DC=com\", "+
19 | " unitSearchFilter : \"(objectCategory=group)\", "+
20 | " userUnitField : \"memberOf\", "+
21 | " userFieldMap : { "+
22 | " userName : \"displayName\", "+
23 | " loginName : \"sAMAccountName\", "+
24 | " regEmail : \"mail\", "+
25 | " regCellPhone : \"mobilePhone\", "+
26 | " userDesc : \"description\" "+
27 | " }, "+
28 | " unitFieldMap : { "+
29 | " unitTag : \"distinguishedName\", "+
30 | " unitName : \"name\", "+
31 | " unitDesc : \"description\" "+
32 | " }, "+
33 | //" userURIFormat : \"distinguishedName=CN={name},CN=Users,DC=centit,DC=com\" "+
34 | " userURIFormat : \"{loginName}@centit.com\" "+
35 | "}");
36 | //Map userInfo = LdapLogin.searchLdapUserByloginName(directory, "codefan");
37 | boolean pass = LdapLogin.checkUserPasswordByDn(directory, "codefan", "******");
38 | System.out.println(JSON.toJSONString(pass));
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------