├── web ├── wsm-manage │ ├── static │ │ └── .gitkeep │ ├── config │ │ ├── prod.env.js │ │ └── dev.env.js │ ├── build │ │ ├── logo.png │ │ ├── vue-loader.conf.js │ │ └── build.js │ ├── src │ │ ├── assets │ │ │ ├── logo.png │ │ │ ├── img │ │ │ │ └── qq_photo.jpg │ │ │ ├── fonts │ │ │ │ ├── iconfont.eot │ │ │ │ ├── iconfont.ttf │ │ │ │ └── iconfont.woff │ │ │ └── css │ │ │ │ └── main.scss │ │ ├── components │ │ │ ├── Home.vue │ │ │ ├── Job.vue │ │ │ └── RecruitPlatform.vue │ │ ├── main.js │ │ └── App.vue │ ├── .editorconfig │ ├── .babelrc │ ├── .postcssrc.js │ ├── index.html │ └── README.md └── wsm-manage1 │ ├── static │ └── .gitkeep │ ├── config │ ├── prod.env.js │ └── dev.env.js │ ├── build │ ├── logo.png │ ├── vue-loader.conf.js │ └── build.js │ ├── src │ ├── assets │ │ └── img │ │ │ └── qq_photo.jpg │ ├── components │ │ ├── Home.vue │ │ ├── Job.vue │ │ └── RecruitPlatform.vue │ ├── App.vue │ └── main.js │ ├── .editorconfig │ ├── .babelrc │ ├── .postcssrc.js │ ├── index.html │ └── README.md ├── config-file └── wsm-config-dev.yml ├── java ├── v1 │ ├── wsm-oauth │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── mytest.jks │ │ │ ├── publicKey.txt │ │ │ └── application.yml │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ ├── mapper │ │ │ └── PublicMapper.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ └── OauthStart.java │ ├── wsm-upms │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── study │ │ │ │ │ ├── mapper │ │ │ │ │ ├── UserMapper.java │ │ │ │ │ ├── ProjectMapper.java │ │ │ │ │ ├── ResourceMapper.java │ │ │ │ │ ├── UserRoleMapper.java │ │ │ │ │ ├── OauthClientDetailsMapper.java │ │ │ │ │ ├── RoleMapper.java │ │ │ │ │ ├── RegionMapper.java │ │ │ │ │ └── ResourceRoleMapper.java │ │ │ │ │ ├── service │ │ │ │ │ ├── UserRoleService.java │ │ │ │ │ ├── ResourceRoleService.java │ │ │ │ │ └── OauthClientDetailsService.java │ │ │ │ │ ├── feign │ │ │ │ │ ├── WorkFeign.java │ │ │ │ │ ├── WorkHystrix.java │ │ │ │ │ ├── OauthHystrix.java │ │ │ │ │ └── OauthFeign.java │ │ │ │ │ ├── config │ │ │ │ │ ├── MybatisPlusConfig.java │ │ │ │ │ ├── MyConfig.java │ │ │ │ │ └── Swagger2Config.java │ │ │ │ │ ├── UpmsStart.java │ │ │ │ │ ├── controller │ │ │ │ │ └── TestCotroller.java │ │ │ │ │ └── model │ │ │ │ │ └── UserRoleModel.java │ │ │ └── resources │ │ │ │ ├── publicKey.txt │ │ │ │ └── mapper │ │ │ │ ├── UserRoleMapper.xml │ │ │ │ ├── ProjectMapper.xml │ │ │ │ ├── ResourceMapper.xml │ │ │ │ └── OauthClientDetailsMapper.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ └── UserApplicationTests.java │ ├── wsm-work │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── study │ │ │ │ │ ├── mapper │ │ │ │ │ ├── WorkMapper.java │ │ │ │ │ ├── RecruitPlatformMapper.java │ │ │ │ │ └── JobMapper.java │ │ │ │ │ ├── WorkStart.java │ │ │ │ │ ├── controller │ │ │ │ │ └── PublicController.java │ │ │ │ │ ├── config │ │ │ │ │ ├── MybatisPlusConfig.java │ │ │ │ │ ├── MyConfig.java │ │ │ │ │ └── Swagger2Config.java │ │ │ │ │ └── feign │ │ │ │ │ ├── UpmsHystrix.java │ │ │ │ │ └── UpmsFeign.java │ │ │ └── resources │ │ │ │ ├── publicKey.txt │ │ │ │ └── mapper │ │ │ │ ├── RecruitPlatformMapper.xml │ │ │ │ ├── JobMapper.xml │ │ │ │ └── WorkMapper.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ └── AppTest.java │ ├── wsm-discovery │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.yml │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── study │ │ │ │ └── DiscoveryStart.java │ │ └── pom.xml │ ├── utils │ │ └── wsm-common-utils │ │ │ ├── pom.xml │ │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ ├── exception │ │ │ └── MyRuntimeException.java │ │ │ ├── dto │ │ │ └── BaseDto.java │ │ │ └── MyConstant.java │ ├── wsm-common-utils │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── study │ │ │ │ ├── exception │ │ │ │ └── MyRuntimeException.java │ │ │ │ ├── dto │ │ │ │ └── BaseDto.java │ │ │ │ └── MyConstant.java │ │ └── pom.xml │ ├── wsm-zull │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── study │ │ │ ├── ZullStrat.java │ │ │ └── config │ │ │ └── WebSecurityConfig.java │ ├── wsm-gateway │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ └── controller │ │ │ └── FallbackController.java │ └── README.md ├── v2 │ ├── wsm-oauth │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── mytest.jks │ │ │ ├── publicKey.txt │ │ │ └── application.yml │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ ├── mapper │ │ │ └── PublicMapper.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ └── OauthStart.java │ ├── wsm-upms │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── study │ │ │ │ │ ├── mapper │ │ │ │ │ ├── UserMapper.java │ │ │ │ │ ├── ProjectMapper.java │ │ │ │ │ ├── ResourceMapper.java │ │ │ │ │ ├── UserRoleMapper.java │ │ │ │ │ ├── ResourceRoleMapper.java │ │ │ │ │ ├── OauthClientDetailsMapper.java │ │ │ │ │ ├── RoleMapper.java │ │ │ │ │ └── RegionMapper.java │ │ │ │ │ ├── service │ │ │ │ │ ├── UserRoleService.java │ │ │ │ │ ├── ResourceRoleService.java │ │ │ │ │ └── OauthClientDetailsService.java │ │ │ │ │ ├── feign │ │ │ │ │ ├── WorkFeign.java │ │ │ │ │ ├── WorkHystrix.java │ │ │ │ │ └── OauthHystrix.java │ │ │ │ │ ├── config │ │ │ │ │ ├── MybatisPlusConfig.java │ │ │ │ │ └── Swagger2Config.java │ │ │ │ │ ├── UpmsStart.java │ │ │ │ │ ├── controller │ │ │ │ │ └── TestCotroller.java │ │ │ │ │ └── model │ │ │ │ │ └── UserRoleModel.java │ │ │ └── resources │ │ │ │ ├── mapper │ │ │ │ ├── UserRoleMapper.xml │ │ │ │ ├── ResourceRoleMapper.xml │ │ │ │ ├── ProjectMapper.xml │ │ │ │ ├── ResourceMapper.xml │ │ │ │ └── OauthClientDetailsMapper.xml │ │ │ │ └── application.yml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ └── UserApplicationTests.java │ ├── wsm-work │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── study │ │ │ │ │ ├── mapper │ │ │ │ │ ├── WorkMapper.java │ │ │ │ │ ├── RecruitPlatformMapper.java │ │ │ │ │ └── JobMapper.java │ │ │ │ │ ├── WorkStart.java │ │ │ │ │ └── config │ │ │ │ │ ├── MybatisPlusConfig.java │ │ │ │ │ └── Swagger2Config.java │ │ │ └── resources │ │ │ │ ├── application.yml │ │ │ │ └── mapper │ │ │ │ ├── RecruitPlatformMapper.xml │ │ │ │ ├── JobMapper.xml │ │ │ │ └── WorkMapper.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ └── AppTest.java │ ├── wsm-discovery │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.yml │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── study │ │ │ │ └── DiscoveryStart.java │ │ └── pom.xml │ ├── utils │ │ └── wsm-common-utils │ │ │ ├── pom.xml │ │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ ├── exception │ │ │ └── MyRuntimeException.java │ │ │ ├── dto │ │ │ └── BaseDto.java │ │ │ └── MyConstant.java │ ├── wsm-gateway │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ ├── config │ │ │ ├── MyInit.java │ │ │ └── MyConfig.java │ │ │ ├── mapper │ │ │ └── ResourceRoleMapper.java │ │ │ └── controller │ │ │ ├── FallbackController.java │ │ │ └── PublicController.java │ ├── wsm-common-utils │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── study │ │ │ │ ├── exception │ │ │ │ └── MyRuntimeException.java │ │ │ │ ├── dto │ │ │ │ └── BaseDto.java │ │ │ │ └── MyConstant.java │ │ └── pom.xml │ ├── wsm-zull │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ ├── mapper │ │ │ └── ResourceRoleMapper.java │ │ │ ├── ZullStrat.java │ │ │ ├── config │ │ │ └── MyConfig.java │ │ │ └── controller │ │ │ └── PublicController.java │ └── README.md └── wsm-demo │ ├── wsm-oauth │ └── src │ │ └── main │ │ ├── resources │ │ ├── mytest.jks │ │ └── publicKey.txt │ │ └── java │ │ └── com │ │ └── study │ │ ├── exception │ │ └── ServiceExceptionHandler.java │ │ ├── mapper │ │ └── PublicMapper.java │ │ ├── controller │ │ └── TestController.java │ │ ├── OauthStart.java │ │ └── model │ │ └── OauthClientDetailsModel.java │ ├── wsm-demo │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── study │ │ │ ├── model │ │ │ └── TestModel.java │ │ │ ├── exception │ │ │ ├── ServiceExceptionHandler.java │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── feign │ │ │ ├── WorkHystrix.java │ │ │ └── WorkFeign.java │ │ │ ├── mapper │ │ │ └── RegionMapper.java │ │ │ ├── config │ │ │ ├── WebSocketConfig.java │ │ │ ├── MybatisPlusConfig.java │ │ │ └── Swagger2Config.java │ │ │ ├── controller │ │ │ ├── TestClass.java │ │ │ ├── TestWebSocketController.java │ │ │ └── TestFeignController.java │ │ │ └── DemoStart.java │ │ └── resources │ │ └── html │ │ └── webSocket │ │ └── 2.html │ ├── wsm-public │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── study │ │ ├── exception │ │ └── ServiceExceptionHandler.java │ │ ├── PublicStart.java │ │ ├── controller │ │ └── TestController.java │ │ └── config │ │ └── Swagger2Config.java │ ├── wsm-work │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── study │ │ │ │ ├── exception │ │ │ │ └── ServiceExceptionHandler.java │ │ │ │ ├── mapper │ │ │ │ ├── WorkMapper.java │ │ │ │ ├── RecruitPlatformMapper.java │ │ │ │ └── JobMapper.java │ │ │ │ ├── WorkStart.java │ │ │ │ ├── service │ │ │ │ └── RabbitConsumerService.java │ │ │ │ ├── feign │ │ │ │ ├── UpmsHystrix.java │ │ │ │ └── UpmsFeign.java │ │ │ │ ├── config │ │ │ │ ├── MybatisPlusConfig.java │ │ │ │ └── Swagger2Config.java │ │ │ │ └── controller │ │ │ │ └── PublicController.java │ │ └── resources │ │ │ ├── publicKey.txt │ │ │ ├── mapper │ │ │ ├── RecruitPlatformMapper.xml │ │ │ ├── JobMapper.xml │ │ │ └── WorkMapper.xml │ │ │ ├── registry.conf │ │ │ └── file.conf │ │ └── test │ │ └── java │ │ └── com │ │ └── study │ │ └── AppTest.java │ ├── wsm-common-utils │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── study │ │ ├── utils │ │ └── StringUtil.java │ │ ├── dto │ │ ├── BaseDto.java │ │ └── ResourceRoleInfoDto.java │ │ ├── exception │ │ └── MyRuntimeException.java │ │ ├── model │ │ └── ResourceRoleModel.java │ │ └── MyConstant.java │ ├── wsm-upms │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── study │ │ │ │ ├── mapper │ │ │ │ ├── ProjectMapper.java │ │ │ │ ├── UserRoleMapper.java │ │ │ │ ├── ResourceMapper.java │ │ │ │ ├── OauthClientDetailsMapper.java │ │ │ │ ├── UserMapper.java │ │ │ │ ├── RoleMapper.java │ │ │ │ ├── RegionMapper.java │ │ │ │ └── ResourceRoleMapper.java │ │ │ │ ├── service │ │ │ │ ├── UserRoleService.java │ │ │ │ ├── ResourceRoleService.java │ │ │ │ ├── RabbitConsumerService.java │ │ │ │ └── OauthClientDetailsService.java │ │ │ │ ├── MyApplicationRunner.java │ │ │ │ ├── exception │ │ │ │ ├── CustomBlockExceptionHandler.java │ │ │ │ └── ServiceExceptionHandler.java │ │ │ │ ├── feign │ │ │ │ ├── WorkFeign.java │ │ │ │ ├── WorkHystrix.java │ │ │ │ └── OauthHystrix.java │ │ │ │ ├── model │ │ │ │ ├── UserRoleModel.java │ │ │ │ ├── ResourceRoleModel.java │ │ │ │ └── OauthClientDetailsModel.java │ │ │ │ ├── UpmsStart.java │ │ │ │ ├── config │ │ │ │ ├── MybatisPlusConfig.java │ │ │ │ └── Swagger2Config.java │ │ │ │ ├── dto │ │ │ │ └── UserAddDTO.java │ │ │ │ └── controller │ │ │ │ └── RabbitProducerController.java │ │ └── resources │ │ │ ├── publicKey.txt │ │ │ ├── mapper │ │ │ ├── UserRoleMapper.xml │ │ │ ├── ProjectMapper.xml │ │ │ ├── ResourceMapper.xml │ │ │ └── OauthClientDetailsMapper.xml │ │ │ ├── registry.conf │ │ │ └── file.conf │ │ └── test │ │ └── java │ │ └── com │ │ └── study │ │ └── UserApplicationTests.java │ ├── wsm-admin-server │ └── src │ │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── study │ │ └── AdminServerStart.java │ ├── wsm-discovery │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.yml │ │ │ └── java │ │ │ └── com │ │ │ └── study │ │ │ └── DiscoveryStart.java │ └── pom.xml │ ├── wsm-gateway │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── study │ │ ├── exception │ │ └── ServiceExceptionHandler.java │ │ └── controller │ │ └── FallbackController.java │ ├── wsm-zull │ └── src │ │ └── main │ │ └── java │ │ └── study │ │ ├── ZullStrat.java │ │ ├── exception │ │ └── ServiceExceptionHandler.java │ │ ├── config │ │ ├── WebSecurityConfig.java │ │ └── CustomZuulConfig.java │ │ └── service │ │ └── RefreshRouteService.java │ └── wsm-config-server │ └── src │ └── main │ ├── java │ └── com │ │ └── study │ │ └── ConfigServerStart.java │ └── resources │ └── bootstrap.yml └── .gitignore /web/wsm-manage/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/wsm-manage1/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config-file/wsm-config-dev.yml: -------------------------------------------------------------------------------- 1 | wsm: 2 | name: 王帅比 3 | age: 24 4 | 5 | -------------------------------------------------------------------------------- /web/wsm-manage/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /web/wsm-manage1/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /web/wsm-manage/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage/build/logo.png -------------------------------------------------------------------------------- /web/wsm-manage1/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage1/build/logo.png -------------------------------------------------------------------------------- /web/wsm-manage/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage/src/assets/logo.png -------------------------------------------------------------------------------- /web/wsm-manage/src/assets/img/qq_photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage/src/assets/img/qq_photo.jpg -------------------------------------------------------------------------------- /web/wsm-manage/src/assets/fonts/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage/src/assets/fonts/iconfont.eot -------------------------------------------------------------------------------- /web/wsm-manage/src/assets/fonts/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage/src/assets/fonts/iconfont.ttf -------------------------------------------------------------------------------- /web/wsm-manage/src/assets/fonts/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage/src/assets/fonts/iconfont.woff -------------------------------------------------------------------------------- /web/wsm-manage1/src/assets/img/qq_photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/web/wsm-manage1/src/assets/img/qq_photo.jpg -------------------------------------------------------------------------------- /java/v1/wsm-oauth/src/main/resources/mytest.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/java/v1/wsm-oauth/src/main/resources/mytest.jks -------------------------------------------------------------------------------- /java/v2/wsm-oauth/src/main/resources/mytest.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/java/v2/wsm-oauth/src/main/resources/mytest.jks -------------------------------------------------------------------------------- /java/wsm-demo/wsm-oauth/src/main/resources/mytest.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsm1217395196/my-study/HEAD/java/wsm-demo/wsm-oauth/src/main/resources/mytest.jks -------------------------------------------------------------------------------- /web/wsm-manage/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /web/wsm-manage1/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /web/wsm-manage/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /web/wsm-manage1/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | node_modules 3 | .idea 4 | .gitignore 5 | maven-wrapper.properties 6 | mvnw 7 | mvnw.cmd 8 | /java/logs 9 | *.iml 10 | logs 11 | /java/SpringCloud-Oauth2介绍.pptx 12 | /java/wsm-demo/wsm-demo/src/main/java/com/study/job/log 13 | -------------------------------------------------------------------------------- /web/wsm-manage/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /web/wsm-manage1/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/model/TestModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | @Data 7 | @AllArgsConstructor 8 | public class TestModel { 9 | 10 | private String name; 11 | 12 | private Integer age; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /web/wsm-manage/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /web/wsm-manage1/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /web/wsm-manage1/src/components/Home.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /web/wsm-manage/src/components/Home.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /web/wsm-manage/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wsm-manage 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/exception/ServiceExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import org.springframework.web.bind.annotation.RestControllerAdvice; 4 | 5 | 6 | /** 7 | * 服务异常处理 8 | */ 9 | @RestControllerAdvice 10 | public class ServiceExceptionHandler extends GlobalExceptionHandler { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-oauth/src/main/java/com/study/exception/ServiceExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import org.springframework.web.bind.annotation.RestControllerAdvice; 4 | 5 | 6 | /** 7 | * 服务异常处理 8 | */ 9 | @RestControllerAdvice 10 | public class ServiceExceptionHandler extends GlobalExceptionHandler { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-public/src/main/java/com/study/exception/ServiceExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import org.springframework.web.bind.annotation.RestControllerAdvice; 4 | 5 | 6 | /** 7 | * 服务异常处理 8 | */ 9 | @RestControllerAdvice 10 | public class ServiceExceptionHandler extends GlobalExceptionHandler { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/exception/ServiceExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import org.springframework.web.bind.annotation.RestControllerAdvice; 4 | 5 | 6 | /** 7 | * 服务异常处理 8 | */ 9 | @RestControllerAdvice 10 | public class ServiceExceptionHandler extends GlobalExceptionHandler { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /web/wsm-manage1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wsm-manage1 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.UserModel; 5 | 6 | /** 7 | *

8 | * 用户 Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-01-28 13 | */ 14 | public interface UserMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.UserModel; 5 | 6 | /** 7 | *

8 | * 用户 Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-01-28 13 | */ 14 | public interface UserMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-common-utils/src/main/java/com/study/utils/StringUtil.java: -------------------------------------------------------------------------------- 1 | package com.study.utils; 2 | 3 | /** 4 | * String相关工具类 5 | */ 6 | public class StringUtil { 7 | 8 | /** 9 | * 给字符串加反引号 10 | * 11 | * @return 12 | */ 13 | public static String addBackquote(String str) { 14 | return "`" + str + "`"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/mapper/WorkMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.WorkModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 职业信息表 Mapper 接口 9 | *

10 | * 11 | * @author wsm123 12 | * @since 2019-02-28 13 | */ 14 | public interface WorkMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/java/com/study/mapper/WorkMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.WorkModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 职业信息表 Mapper 接口 9 | *

10 | * 11 | * @author wsm123 12 | * @since 2019-02-28 13 | */ 14 | public interface WorkMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/mapper/WorkMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.WorkModel; 5 | 6 | /** 7 | *

8 | * 职业信息表 Mapper 接口 9 | *

10 | * 11 | * @author wsm123 12 | * @since 2019-02-28 13 | */ 14 | public interface WorkMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /web/wsm-manage1/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 27 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/ProjectMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.ProjectModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 项目(如公司里某个项目) Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-16 13 | */ 14 | public interface ProjectMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/ResourceMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.ResourceModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 资源(如前台某个菜单) Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-16 13 | */ 14 | public interface ResourceMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.UserRoleModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 用户-角色-关系表 Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-18 13 | */ 14 | public interface UserRoleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/ProjectMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.ProjectModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 项目(如公司里某个项目) Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-16 13 | */ 14 | public interface ProjectMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/ResourceMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.ResourceModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 资源(如前台某个菜单) Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-16 13 | */ 14 | public interface ResourceMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.UserRoleModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 用户-角色-关系表 Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-18 13 | */ 14 | public interface UserRoleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/ProjectMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.ProjectModel; 5 | 6 | /** 7 | *

8 | * 项目(如公司里某个项目) Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-16 13 | */ 14 | public interface ProjectMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.UserRoleModel; 5 | 6 | /** 7 | *

8 | * 用户-角色-关系表 Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-18 13 | */ 14 | public interface UserRoleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/test/java/com/study/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | { 12 | /** 13 | * Rigorous Test :-) 14 | */ 15 | @Test 16 | public void shouldAnswerWithTrue() 17 | { 18 | assertTrue( true ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/ResourceRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.ResourceRoleModel; 5 | 6 | /** 7 | *

8 | * 资源-角色-关系表 Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-18 13 | */ 14 | public interface ResourceRoleMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/test/java/com/study/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | { 12 | /** 13 | * Rigorous Test :-) 14 | */ 15 | @Test 16 | public void shouldAnswerWithTrue() 17 | { 18 | assertTrue( true ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/ResourceMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.ResourceModel; 5 | 6 | /** 7 | *

8 | * 资源(如前台某个菜单) Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-16 13 | */ 14 | public interface ResourceMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/test/java/com/study/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | { 12 | /** 13 | * Rigorous Test :-) 14 | */ 15 | @Test 16 | public void shouldAnswerWithTrue() 17 | { 18 | assertTrue( true ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/mapper/RecruitPlatformMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.RecruitPlatformModel; 5 | 6 | /** 7 | *

8 | * 招聘平台表 Mapper 接口 9 | *

10 | * 11 | * @author wsm123 12 | * @since 2019-02-28 13 | */ 14 | public interface RecruitPlatformMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/java/com/study/mapper/RecruitPlatformMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.RecruitPlatformModel; 5 | 6 | /** 7 | *

8 | * 招聘平台表 Mapper 接口 9 | *

10 | * 11 | * @author wsm123 12 | * @since 2019-02-28 13 | */ 14 | public interface RecruitPlatformMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/OauthClientDetailsMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.OauthClientDetailsModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-26 13 | */ 14 | public interface OauthClientDetailsMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/OauthClientDetailsMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.model.OauthClientDetailsModel; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-26 13 | */ 14 | public interface OauthClientDetailsMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/OauthClientDetailsMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.OauthClientDetailsModel; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author wsm 12 | * @since 2019-07-26 13 | */ 14 | public interface OauthClientDetailsMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/mapper/RecruitPlatformMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.RecruitPlatformModel; 5 | 6 | /** 7 | *

8 | * 招聘平台表 Mapper 接口 9 | *

10 | * 11 | * @author wsm123 12 | * @since 2019-02-28 13 | */ 14 | public interface RecruitPlatformMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /web/wsm-manage1/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | 7 | Vue.config.productionTip = false 8 | 9 | /* eslint-disable no-new */ 10 | new Vue({ 11 | el: '#app', 12 | router, 13 | components: { App }, 14 | template: '' 15 | }) 16 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/feign/WorkHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.result.ResultView; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class WorkHystrix implements WorkFeign { 9 | 10 | @Override 11 | public ResultView getById(Long id) { 12 | return ResultView.hystrixError(MyConstant.wsm_work); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /web/wsm-manage1/src/components/Job.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 19 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-admin-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8004 3 | 4 | eureka: 5 | instance: 6 | hostname: localhost #地址 7 | prefer-ip-address: true 8 | client: 9 | service-url: 10 | # 向注册中心注册服务 11 | defaultZone: http://wsm:1@${eureka.instance.hostname}:8000/eureka 12 | register-with-eureka: false # 不注册到 Eureka 中 13 | 14 | spring: 15 | application: 16 | name: wsm-admin-server -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.UserModel; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * 用户 Mapper 接口 10 | *

11 | * 12 | * @author wsm 13 | * @since 2019-01-28 14 | */ 15 | @Mapper 16 | public interface UserMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.dto.BaseDto; 5 | import com.study.model.RoleModel; 6 | 7 | /** 8 | *

9 | * 角色 Mapper 接口 10 | *

11 | * 12 | * @author wsm 13 | * @since 2019-07-18 14 | */ 15 | public interface RoleMapper extends BaseMapper { 16 | 17 | BaseDto getRoleByUserId(Long userId); 18 | } 19 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.dto.BaseDto; 5 | import com.study.model.RoleModel; 6 | 7 | /** 8 | *

9 | * 角色 Mapper 接口 10 | *

11 | * 12 | * @author wsm 13 | * @since 2019-07-18 14 | */ 15 | public interface RoleMapper extends BaseMapper { 16 | 17 | BaseDto getRoleByUserId(Long userId); 18 | } 19 | -------------------------------------------------------------------------------- /web/wsm-manage/src/components/Job.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 19 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/test/java/com/study/UserApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class UserApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/test/java/com/study/UserApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class UserApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /java/v1/wsm-discovery/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8000 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | prefer-ip-address: true 9 | client: 10 | fetch-registry: false 11 | register-with-eureka: false 12 | service-url: 13 | defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka 14 | 15 | spring: 16 | application: 17 | name: wsm-discovery #服务名 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/v2/wsm-discovery/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8000 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | prefer-ip-address: true 9 | client: 10 | fetch-registry: false 11 | register-with-eureka: false 12 | service-url: 13 | defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka 14 | 15 | spring: 16 | application: 17 | name: wsm-discovery #服务名 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.dto.BaseDto; 5 | import com.study.model.RoleModel; 6 | 7 | /** 8 | *

9 | * 角色 Mapper 接口 10 | *

11 | * 12 | * @author wsm 13 | * @since 2019-07-18 14 | */ 15 | public interface RoleMapper extends BaseMapper { 16 | 17 | BaseDto getRoleByUserId(Long userId); 18 | } 19 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/test/java/com/study/UserApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class UserApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /web/wsm-manage1/src/components/RecruitPlatform.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 19 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-discovery/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8000 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | prefer-ip-address: true 9 | client: 10 | fetch-registry: false 11 | register-with-eureka: false 12 | service-url: 13 | defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka 14 | 15 | spring: 16 | application: 17 | name: wsm-discovery #服务名 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/RegionMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.RegionModel; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 域(如一个公司) Mapper 接口 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-16 15 | */ 16 | public interface RegionMapper extends BaseMapper { 17 | 18 | int batchAdd(List models); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/mapper/RegionMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.RegionModel; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 域(如一个公司) Mapper 接口 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-16 15 | */ 16 | public interface RegionMapper extends BaseMapper { 17 | 18 | int batchAdd(List models); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /web/wsm-manage/src/components/RecruitPlatform.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 19 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/mapper/RegionMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.RegionModel; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 域(如一个公司) Mapper 接口 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-16 15 | */ 16 | public interface RegionMapper extends BaseMapper { 17 | 18 | int batchAdd(List models); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /java/v1/utils/wsm-common-utils/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.study 8 | wsm-common-utils 9 | 1.0-SNAPSHOT 10 | 11 | -------------------------------------------------------------------------------- /java/v2/utils/wsm-common-utils/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.study 8 | wsm-common-utils 9 | 1.0-SNAPSHOT 10 | 11 | -------------------------------------------------------------------------------- /java/v1/wsm-oauth/src/main/resources/publicKey.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXMFMxrDwJnOOtMw5OWF 3 | M1LVdFo1zfhoUY0flsCe7dabFEw5+V1LrdpLg79oNe4wvdRKY0w1GPNY3zlrLwuW 4 | VVEnl/wBK5zOign2KzeQR3PW+lsew63xMZFcIaGwes3RVpUs2yQhE3Qfd0hYZ6O4 5 | 4ZtBPGVIlmsYM8QEvK8+gTwDBjK3PB0Z4J1ZH6aCVZ9Xyrm0v9Rm3VZRdRfsABSG 6 | B7/3NPJwc3E4dTp1LkslaJfAherTYHmB02EkIjpnk5GwnTcgNLG47IVYP82cqxwE 7 | QOh3xSgSWf+o4+AWNafk6WZX5cVXla4B7AlptnZ+mAMPnVFRAc5qKQO28hNKcID1 8 | dwIDAQAB 9 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/resources/publicKey.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXMFMxrDwJnOOtMw5OWF 3 | M1LVdFo1zfhoUY0flsCe7dabFEw5+V1LrdpLg79oNe4wvdRKY0w1GPNY3zlrLwuW 4 | VVEnl/wBK5zOign2KzeQR3PW+lsew63xMZFcIaGwes3RVpUs2yQhE3Qfd0hYZ6O4 5 | 4ZtBPGVIlmsYM8QEvK8+gTwDBjK3PB0Z4J1ZH6aCVZ9Xyrm0v9Rm3VZRdRfsABSG 6 | B7/3NPJwc3E4dTp1LkslaJfAherTYHmB02EkIjpnk5GwnTcgNLG47IVYP82cqxwE 7 | QOh3xSgSWf+o4+AWNafk6WZX5cVXla4B7AlptnZ+mAMPnVFRAc5qKQO28hNKcID1 8 | dwIDAQAB 9 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/resources/publicKey.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXMFMxrDwJnOOtMw5OWF 3 | M1LVdFo1zfhoUY0flsCe7dabFEw5+V1LrdpLg79oNe4wvdRKY0w1GPNY3zlrLwuW 4 | VVEnl/wBK5zOign2KzeQR3PW+lsew63xMZFcIaGwes3RVpUs2yQhE3Qfd0hYZ6O4 5 | 4ZtBPGVIlmsYM8QEvK8+gTwDBjK3PB0Z4J1ZH6aCVZ9Xyrm0v9Rm3VZRdRfsABSG 6 | B7/3NPJwc3E4dTp1LkslaJfAherTYHmB02EkIjpnk5GwnTcgNLG47IVYP82cqxwE 7 | QOh3xSgSWf+o4+AWNafk6WZX5cVXla4B7AlptnZ+mAMPnVFRAc5qKQO28hNKcID1 8 | dwIDAQAB 9 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /java/v2/wsm-oauth/src/main/resources/publicKey.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXMFMxrDwJnOOtMw5OWF 3 | M1LVdFo1zfhoUY0flsCe7dabFEw5+V1LrdpLg79oNe4wvdRKY0w1GPNY3zlrLwuW 4 | VVEnl/wBK5zOign2KzeQR3PW+lsew63xMZFcIaGwes3RVpUs2yQhE3Qfd0hYZ6O4 5 | 4ZtBPGVIlmsYM8QEvK8+gTwDBjK3PB0Z4J1ZH6aCVZ9Xyrm0v9Rm3VZRdRfsABSG 6 | B7/3NPJwc3E4dTp1LkslaJfAherTYHmB02EkIjpnk5GwnTcgNLG47IVYP82cqxwE 7 | QOh3xSgSWf+o4+AWNafk6WZX5cVXla4B7AlptnZ+mAMPnVFRAc5qKQO28hNKcID1 8 | dwIDAQAB 9 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /java/wsm-demo/wsm-oauth/src/main/resources/publicKey.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXMFMxrDwJnOOtMw5OWF 3 | M1LVdFo1zfhoUY0flsCe7dabFEw5+V1LrdpLg79oNe4wvdRKY0w1GPNY3zlrLwuW 4 | VVEnl/wBK5zOign2KzeQR3PW+lsew63xMZFcIaGwes3RVpUs2yQhE3Qfd0hYZ6O4 5 | 4ZtBPGVIlmsYM8QEvK8+gTwDBjK3PB0Z4J1ZH6aCVZ9Xyrm0v9Rm3VZRdRfsABSG 6 | B7/3NPJwc3E4dTp1LkslaJfAherTYHmB02EkIjpnk5GwnTcgNLG47IVYP82cqxwE 7 | QOh3xSgSWf+o4+AWNafk6WZX5cVXla4B7AlptnZ+mAMPnVFRAc5qKQO28hNKcID1 8 | dwIDAQAB 9 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/resources/publicKey.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXMFMxrDwJnOOtMw5OWF 3 | M1LVdFo1zfhoUY0flsCe7dabFEw5+V1LrdpLg79oNe4wvdRKY0w1GPNY3zlrLwuW 4 | VVEnl/wBK5zOign2KzeQR3PW+lsew63xMZFcIaGwes3RVpUs2yQhE3Qfd0hYZ6O4 5 | 4ZtBPGVIlmsYM8QEvK8+gTwDBjK3PB0Z4J1ZH6aCVZ9Xyrm0v9Rm3VZRdRfsABSG 6 | B7/3NPJwc3E4dTp1LkslaJfAherTYHmB02EkIjpnk5GwnTcgNLG47IVYP82cqxwE 7 | QOh3xSgSWf+o4+AWNafk6WZX5cVXla4B7AlptnZ+mAMPnVFRAc5qKQO28hNKcID1 8 | dwIDAQAB 9 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/resources/publicKey.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXMFMxrDwJnOOtMw5OWF 3 | M1LVdFo1zfhoUY0flsCe7dabFEw5+V1LrdpLg79oNe4wvdRKY0w1GPNY3zlrLwuW 4 | VVEnl/wBK5zOign2KzeQR3PW+lsew63xMZFcIaGwes3RVpUs2yQhE3Qfd0hYZ6O4 5 | 4ZtBPGVIlmsYM8QEvK8+gTwDBjK3PB0Z4J1ZH6aCVZ9Xyrm0v9Rm3VZRdRfsABSG 6 | B7/3NPJwc3E4dTp1LkslaJfAherTYHmB02EkIjpnk5GwnTcgNLG47IVYP82cqxwE 7 | QOh3xSgSWf+o4+AWNafk6WZX5cVXla4B7AlptnZ+mAMPnVFRAc5qKQO28hNKcID1 8 | dwIDAQAB 9 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/resources/mapper/UserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/resources/mapper/UserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/service/UserRoleService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 4 | import com.study.mapper.UserRoleMapper; 5 | import com.study.model.UserRoleModel; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | *

10 | * 用户-角色-关系表 服务实现类 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-18 15 | */ 16 | @Service 17 | public class UserRoleService extends ServiceImpl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/service/UserRoleService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 4 | import com.study.mapper.UserRoleMapper; 5 | import com.study.model.UserRoleModel; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | *

10 | * 用户-角色-关系表 服务实现类 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-18 15 | */ 16 | @Service 17 | public class UserRoleService extends ServiceImpl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/feign/WorkFeign.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.result.ResultView; 4 | import org.springframework.cloud.openfeign.FeignClient; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | 8 | @FeignClient(value = "wsm-work",fallback = WorkHystrix.class) 9 | public interface WorkFeign { 10 | 11 | @GetMapping("/work/getById/{id}") 12 | ResultView getById(@PathVariable("id") Long id); 13 | } 14 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/resources/mapper/UserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/service/UserRoleService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.study.mapper.UserRoleMapper; 5 | import com.study.model.UserRoleModel; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | *

10 | * 用户-角色-关系表 服务实现类 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-18 15 | */ 16 | @Service 17 | public class UserRoleService extends ServiceImpl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/service/ResourceRoleService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 4 | import com.study.mapper.ResourceRoleMapper; 5 | import com.study.model.ResourceRoleModel; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | *

10 | * 资源-角色-关系表 服务实现类 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-18 15 | */ 16 | @Service 17 | public class ResourceRoleService extends ServiceImpl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/service/ResourceRoleService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 4 | import com.study.mapper.ResourceRoleMapper; 5 | import com.study.model.ResourceRoleModel; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | *

10 | * 资源-角色-关系表 服务实现类 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-18 15 | */ 16 | @Service 17 | public class ResourceRoleService extends ServiceImpl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.socket.server.standard.ServerEndpointExporter; 6 | 7 | /** 8 | * 开启WebSocket支持 9 | */ 10 | @Configuration 11 | public class WebSocketConfig { 12 | 13 | @Bean 14 | public ServerEndpointExporter serverEndpointExporter(){ 15 | return new ServerEndpointExporter(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /web/wsm-manage/README.md: -------------------------------------------------------------------------------- 1 | # wsm-manage 2 | 3 | > 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | ``` 20 | 21 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 22 | -------------------------------------------------------------------------------- /web/wsm-manage1/README.md: -------------------------------------------------------------------------------- 1 | # wsm-manage1 2 | 3 | > 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | ``` 20 | 21 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 22 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/service/ResourceRoleService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.study.mapper.ResourceRoleMapper; 5 | import com.study.model.ResourceRoleModel; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | *

10 | * 资源-角色-关系表 服务实现类 11 | *

12 | * 13 | * @author wsm 14 | * @since 2019-07-18 15 | */ 16 | @Service 17 | public class ResourceRoleService extends ServiceImpl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /web/wsm-manage/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | 7 | import 'element-ui/lib/theme-chalk/index.css'; 8 | import '@/assets/css/iconfont.css' 9 | import '@/assets/css/main.scss' 10 | 11 | Vue.config.productionTip = false 12 | 13 | /* eslint-disable no-new */ 14 | new Vue({ 15 | el: '#app', 16 | router, 17 | components: { App }, 18 | template: '' 19 | }) 20 | -------------------------------------------------------------------------------- /java/v1/wsm-discovery/src/main/java/com/study/DiscoveryStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | 8 | @SpringBootApplication 9 | @EnableEurekaServer 10 | public class DiscoveryStart { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(DiscoveryStart.class, args); 14 | System.err.println("discovery启动了!!!"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /java/v2/wsm-discovery/src/main/java/com/study/DiscoveryStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | 8 | @SpringBootApplication 9 | @EnableEurekaServer 10 | public class DiscoveryStart { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(DiscoveryStart.class, args); 14 | System.err.println("discovery启动了!!!"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/java/com/study/mapper/JobMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.JobModel; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 职位表 Mapper 接口 13 | *

14 | * 15 | * @author wsm123 16 | * @since 2019-02-28 17 | */ 18 | public interface JobMapper extends BaseMapper { 19 | 20 | List test(@Param("startTime") Date startTime, @Param("endTime") Date endTime); 21 | } 22 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-discovery/src/main/java/com/study/DiscoveryStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | 8 | @SpringBootApplication 9 | @EnableEurekaServer 10 | public class DiscoveryStart { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(DiscoveryStart.class, args); 14 | System.err.println("discovery启动了!!!"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /java/v1/wsm-oauth/src/main/java/com/study/mapper/PublicMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.dto.BaseDto; 4 | import com.study.model.OauthClientDetailsModel; 5 | import com.study.model.UserModel; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 公共接口 11 | */ 12 | public interface PublicMapper { 13 | 14 | UserModel getUserByName(String name); 15 | 16 | List getRoleByUserId(Long userId); 17 | 18 | OauthClientDetailsModel getOauthClientDetailsByClientId(String clientId); 19 | 20 | String getResourceIdsByClientId(String clientId); 21 | } 22 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/mapper/JobMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.model.JobModel; 5 | import io.lettuce.core.dynamic.annotation.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 职位表 Mapper 接口 13 | *

14 | * 15 | * @author wsm123 16 | * @since 2019-02-28 17 | */ 18 | public interface JobMapper extends BaseMapper { 19 | 20 | List test(@Param("startTime") Date startTime, @Param("endTime") Date endTime); 21 | } 22 | -------------------------------------------------------------------------------- /java/v2/wsm-oauth/src/main/java/com/study/mapper/PublicMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.dto.BaseDto; 4 | import com.study.model.OauthClientDetailsModel; 5 | import com.study.model.UserModel; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 公共接口 11 | */ 12 | public interface PublicMapper { 13 | 14 | UserModel getUserByName(String name); 15 | 16 | List getRoleByUserId(Long userId); 17 | 18 | OauthClientDetailsModel getOauthClientDetailsByClientId(String clientId); 19 | 20 | String getResourceIdsByClientId(String clientId); 21 | } 22 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-common-utils/src/main/java/com/study/dto/BaseDto.java: -------------------------------------------------------------------------------- 1 | package com.study.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | /** 10 | * 通用BaseDto 11 | */ 12 | @Getter 13 | @Setter 14 | @ToString 15 | @ApiModel(value = "BaseDto对象", description = "通用BaseDto") 16 | public class BaseDto { 17 | 18 | private Long id; 19 | /** 20 | * 名称 21 | */ 22 | @ApiModelProperty(value = "名称") 23 | private String name; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-oauth/src/main/java/com/study/mapper/PublicMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.study.dto.BaseDto; 4 | import com.study.model.OauthClientDetailsModel; 5 | import com.study.model.UserModel; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 公共接口 11 | */ 12 | public interface PublicMapper { 13 | 14 | UserModel getUserByName(String name); 15 | 16 | List getRoleByUserId(Long userId); 17 | 18 | OauthClientDetailsModel getOauthClientDetailsByClientId(String clientId); 19 | 20 | String getResourceIdsByClientId(String clientId); 21 | } 22 | -------------------------------------------------------------------------------- /java/v1/wsm-oauth/src/main/java/com/study/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultView; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | @RequestMapping("/test") 10 | public class TestController { 11 | 12 | @GetMapping("/getName") 13 | public ResultView getName() { 14 | String name = "王帅逼"; 15 | return ResultView.success(name); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/v2/wsm-oauth/src/main/java/com/study/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultView; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | @RequestMapping("/test") 10 | public class TestController { 11 | 12 | @GetMapping("/getName") 13 | public ResultView getName() { 14 | String name = "王帅逼"; 15 | return ResultView.success(name); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/mapper/JobMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.JobModel; 5 | import io.lettuce.core.dynamic.annotation.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 职位表 Mapper 接口 13 | *

14 | * 15 | * @author wsm123 16 | * @since 2019-02-28 17 | */ 18 | public interface JobMapper extends BaseMapper { 19 | 20 | List test(@Param("startTime") Date startTime, @Param("endTime") Date endTime); 21 | } 22 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-oauth/src/main/java/com/study/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultView; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | @RequestMapping("/test") 10 | public class TestController { 11 | 12 | @GetMapping("/getName") 13 | public ResultView getName() { 14 | String name = "王帅逼"; 15 | return ResultView.success(name); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/resources/mapper/ResourceRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/RegionMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.model.RegionModel; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * 域(如一个公司) Mapper 接口 12 | *

13 | * 14 | * @author wsm 15 | * @since 2019-07-16 16 | */ 17 | public interface RegionMapper extends BaseMapper { 18 | 19 | int batchAdd(List models); 20 | 21 | int testUpdateLock(@Param("id") Long id, @Param("addNum") Integer addNum); 22 | } 23 | -------------------------------------------------------------------------------- /java/v1/wsm-oauth/src/main/java/com/study/OauthStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | @MapperScan("com.study.mapper") 9 | @SpringBootApplication 10 | @EnableDiscoveryClient 11 | public class OauthStart { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(OauthStart.class, args); 15 | System.err.println("oauth启动了!"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/v2/wsm-gateway/src/main/java/com/study/config/MyInit.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.CommandLineRunner; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class MyInit implements CommandLineRunner { 10 | 11 | @Autowired 12 | private MyReactiveAuthorizationManager myReactiveAuthorizationManager; 13 | 14 | @Override 15 | public void run(String... args) { 16 | myReactiveAuthorizationManager.loadResourceDefine(); 17 | } 18 | 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /java/v2/wsm-oauth/src/main/java/com/study/OauthStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | @MapperScan("com.study.mapper") 9 | @SpringBootApplication 10 | @EnableDiscoveryClient 11 | public class OauthStart { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(OauthStart.class, args); 15 | System.err.println("oauth启动了!"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-admin-server/src/main/java/com/study/AdminServerStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import de.codecentric.boot.admin.server.config.EnableAdminServer; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | @SpringBootApplication 9 | @EnableAdminServer 10 | @EnableDiscoveryClient 11 | public class AdminServerStart { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(AdminServerStart.class, args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-oauth/src/main/java/com/study/OauthStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | @MapperScan("com.study.mapper") 9 | @SpringBootApplication 10 | @EnableDiscoveryClient 11 | public class OauthStart { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(OauthStart.class, args); 15 | System.err.println("oauth启动了!"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/java/com/study/WorkStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | 9 | @MapperScan("com.study.mapper") 10 | @SpringBootApplication 11 | @EnableDiscoveryClient 12 | public class WorkStart { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(WorkStart.class, args); 16 | System.err.println("work启动了!!!"); 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /java/v1/wsm-common-utils/src/main/java/com/study/exception/MyRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.study.result.ResultView; 4 | 5 | /** 6 | * 自定义运行时异常 7 | */ 8 | public class MyRuntimeException extends RuntimeException { 9 | 10 | private ResultView resultView; 11 | 12 | public MyRuntimeException(ResultView resultView) { 13 | super(resultView.getMsg()); 14 | this.resultView = resultView; 15 | } 16 | 17 | public ResultView getResultView() { 18 | return resultView; 19 | } 20 | 21 | public void setResultView(ResultView resultView) { 22 | this.resultView = resultView; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/v2/wsm-common-utils/src/main/java/com/study/exception/MyRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.study.result.ResultView; 4 | 5 | /** 6 | * 自定义运行时异常 7 | */ 8 | public class MyRuntimeException extends RuntimeException { 9 | 10 | private ResultView resultView; 11 | 12 | public MyRuntimeException(ResultView resultView) { 13 | super(resultView.getMsg()); 14 | this.resultView = resultView; 15 | } 16 | 17 | public ResultView getResultView() { 18 | return resultView; 19 | } 20 | 21 | public void setResultView(ResultView resultView) { 22 | this.resultView = resultView; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/v1/utils/wsm-common-utils/src/main/java/com/study/exception/MyRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.study.result.ResultView; 4 | 5 | /** 6 | * 自定义运行时异常 7 | */ 8 | public class MyRuntimeException extends RuntimeException { 9 | 10 | private ResultView resultView; 11 | 12 | public MyRuntimeException(ResultView resultView) { 13 | super(resultView.getMsg()); 14 | this.resultView = resultView; 15 | } 16 | 17 | public ResultView getResultView() { 18 | return resultView; 19 | } 20 | 21 | public void setResultView(ResultView resultView) { 22 | this.resultView = resultView; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/v2/utils/wsm-common-utils/src/main/java/com/study/exception/MyRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.study.result.ResultView; 4 | 5 | /** 6 | * 自定义运行时异常 7 | */ 8 | public class MyRuntimeException extends RuntimeException { 9 | 10 | private ResultView resultView; 11 | 12 | public MyRuntimeException(ResultView resultView) { 13 | super(resultView.getMsg()); 14 | this.resultView = resultView; 15 | } 16 | 17 | public ResultView getResultView() { 18 | return resultView; 19 | } 20 | 21 | public void setResultView(ResultView resultView) { 22 | this.resultView = resultView; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /web/wsm-manage/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /web/wsm-manage1/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-public/src/main/java/com/study/PublicStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) 9 | @EnableDiscoveryClient 10 | public class PublicStart { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(PublicStart.class, args); 14 | System.err.println("public启动了"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /web/wsm-manage/src/App.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 31 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-gateway/src/main/java/com/study/exception/ServiceExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.web.bind.annotation.RestControllerAdvice; 6 | 7 | 8 | /** 9 | * 服务异常处理 10 | */ 11 | @Data 12 | @RestControllerAdvice 13 | public class ServiceExceptionHandler extends GlobalExceptionHandler { 14 | 15 | @Value("${spring.servlet.multipart.max-request-size}") 16 | private String maxRequestSize; 17 | 18 | public ServiceExceptionHandler() { 19 | } 20 | 21 | public ServiceExceptionHandler(String maxRequestSize) { 22 | super(maxRequestSize); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/WorkStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | 9 | 10 | @MapperScan("com.study.mapper") 11 | @SpringBootApplication 12 | @EnableDiscoveryClient 13 | @EnableFeignClients 14 | public class WorkStart { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(WorkStart.class, args); 18 | System.err.println("work启动了!!!"); 19 | } 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /java/v1/wsm-zull/src/main/java/study/ZullStrat.java: -------------------------------------------------------------------------------- 1 | package study; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 8 | 9 | @EnableZuulProxy 10 | @SpringBootApplication 11 | @EnableDiscoveryClient 12 | @EnableOAuth2Sso 13 | public class ZullStrat { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(ZullStrat.class, args); 17 | System.err.println("网关wsm-zull启动了!!"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /java/v1/wsm-common-utils/src/main/java/com/study/dto/BaseDto.java: -------------------------------------------------------------------------------- 1 | package com.study.dto; 2 | 3 | public class BaseDto { 4 | 5 | private Long id; 6 | /** 7 | * 名称 8 | */ 9 | private String name; 10 | 11 | public Long getId() { 12 | return id; 13 | } 14 | 15 | public void setId(Long id) { 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "BaseDto{" + 30 | "id=" + id + 31 | ", name='" + name + '\'' + 32 | '}'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /java/v2/wsm-common-utils/src/main/java/com/study/dto/BaseDto.java: -------------------------------------------------------------------------------- 1 | package com.study.dto; 2 | 3 | public class BaseDto { 4 | 5 | private Long id; 6 | /** 7 | * 名称 8 | */ 9 | private String name; 10 | 11 | public Long getId() { 12 | return id; 13 | } 14 | 15 | public void setId(Long id) { 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "BaseDto{" + 30 | "id=" + id + 31 | ", name='" + name + '\'' + 32 | '}'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/WorkStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | 9 | 10 | @MapperScan("com.study.mapper") 11 | @SpringBootApplication 12 | @EnableDiscoveryClient 13 | @EnableFeignClients 14 | public class WorkStart { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(WorkStart.class, args); 18 | System.err.println("work启动了!!!"); 19 | } 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-zull/src/main/java/study/ZullStrat.java: -------------------------------------------------------------------------------- 1 | package study; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 8 | 9 | @EnableZuulProxy 10 | @SpringBootApplication 11 | @EnableDiscoveryClient 12 | @EnableOAuth2Sso 13 | public class ZullStrat { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(ZullStrat.class, args); 17 | System.err.println("网关wsm-zull启动了!!"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /java/v1/utils/wsm-common-utils/src/main/java/com/study/dto/BaseDto.java: -------------------------------------------------------------------------------- 1 | package com.study.dto; 2 | 3 | public class BaseDto { 4 | 5 | private Long id; 6 | /** 7 | * 名称 8 | */ 9 | private String name; 10 | 11 | public Long getId() { 12 | return id; 13 | } 14 | 15 | public void setId(Long id) { 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "BaseDto{" + 30 | "id=" + id + 31 | ", name='" + name + '\'' + 32 | '}'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /java/v2/utils/wsm-common-utils/src/main/java/com/study/dto/BaseDto.java: -------------------------------------------------------------------------------- 1 | package com.study.dto; 2 | 3 | public class BaseDto { 4 | 5 | private Long id; 6 | /** 7 | * 名称 8 | */ 9 | private String name; 10 | 11 | public Long getId() { 12 | return id; 13 | } 14 | 15 | public void setId(Long id) { 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "BaseDto{" + 30 | "id=" + id + 31 | ", name='" + name + '\'' + 32 | '}'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /java/v2/wsm-zull/src/main/java/com/study/mapper/ResourceRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.dto.ResourceRoleInfoDto; 5 | import com.study.model.ResourceRoleModel; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 资源-角色-关系表 Mapper 接口 13 | *

14 | * 15 | * @author wsm 16 | * @since 2019-07-18 17 | */ 18 | public interface ResourceRoleMapper extends BaseMapper { 19 | 20 | /** 21 | * 查当前项目的资源角色信息 22 | * 23 | * @param regionCode 24 | * @return 25 | */ 26 | List getResourceRoleInfo(@Param("regionCode") String regionCode); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-gateway/src/main/java/com/study/controller/FallbackController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultEnum; 4 | import com.study.result.ResultView; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * 通用熔断器 11 | */ 12 | @Slf4j 13 | @RestController 14 | @RequestMapping("common") 15 | public class FallbackController { 16 | 17 | @RequestMapping("fallback") 18 | public ResultView fallback() { 19 | ResultView resultView = ResultView.error(ResultEnum.CODE_504); 20 | log.error(resultView.toString()); 21 | return resultView; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/mapper/ResourceRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.dto.ResourceRoleInfoDto; 5 | import com.study.model.ResourceRoleModel; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 资源-角色-关系表 Mapper 接口 13 | *

14 | * 15 | * @author wsm 16 | * @since 2019-07-18 17 | */ 18 | public interface ResourceRoleMapper extends BaseMapper { 19 | 20 | /** 21 | * 查当前项目的资源角色信息 22 | * 23 | * @param projectCode 24 | * @return 25 | */ 26 | List getResourceRoleInfo(@Param("projectCode") String projectCode); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /java/v2/wsm-gateway/src/main/java/com/study/mapper/ResourceRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.mapper.BaseMapper; 4 | import com.study.dto.ResourceRoleInfoDto; 5 | import com.study.model.ResourceRoleModel; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 资源-角色-关系表 Mapper 接口 13 | *

14 | * 15 | * @author wsm 16 | * @since 2019-07-18 17 | */ 18 | public interface ResourceRoleMapper extends BaseMapper { 19 | 20 | /** 21 | * 查当前项目的资源角色信息 22 | * 23 | * @param regionCode 24 | * @return 25 | */ 26 | List getResourceRoleInfo(@Param("regionCode") String regionCode); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/MyApplicationRunner.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.springframework.boot.ApplicationArguments; 4 | import org.springframework.boot.ApplicationRunner; 5 | import org.springframework.core.annotation.Order; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * 在SpringBoot中,有两种接口方式实现启动执行, 10 | * 分别是ApplicationRunner和CommandLineRunner,除了可接受参数不同,其他的大同小异。 11 | * 我们也可以设置Order来设定执行的顺序, 12 | * 分别是注解@Order(value = 1)和实现接口implements Ordered的方式 13 | */ 14 | @Component 15 | @Order(value = 1) 16 | public class MyApplicationRunner implements ApplicationRunner { 17 | 18 | @Override 19 | public void run(ApplicationArguments args) throws Exception { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-zull/src/main/java/study/exception/ServiceExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package study.exception; 2 | 3 | import com.study.exception.GlobalExceptionHandler; 4 | import lombok.Data; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.web.bind.annotation.RestControllerAdvice; 7 | 8 | 9 | /** 10 | * 服务异常处理 11 | */ 12 | @Data 13 | @RestControllerAdvice 14 | public class ServiceExceptionHandler extends GlobalExceptionHandler { 15 | 16 | @Value("${spring.servlet.multipart.max-request-size}") 17 | private String maxRequestSize; 18 | 19 | public ServiceExceptionHandler() { 20 | } 21 | 22 | public ServiceExceptionHandler(String maxRequestSize) { 23 | super(maxRequestSize); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/mapper/ResourceRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.study.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.study.dto.ResourceRoleInfoDto; 5 | import com.study.model.ResourceRoleModel; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 资源-角色-关系表 Mapper 接口 13 | *

14 | * 15 | * @author wsm 16 | * @since 2019-07-18 17 | */ 18 | public interface ResourceRoleMapper extends BaseMapper { 19 | 20 | /** 21 | * 查当前项目的资源角色信息 22 | * 23 | * @param projectCode 24 | * @return 25 | */ 26 | List getResourceRoleInfo(@Param("projectCode") String projectCode); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/exception/CustomBlockExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler; 4 | import com.alibaba.csp.sentinel.slots.block.BlockException; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | /** 11 | * 抛出Sentinel的异常 12 | */ 13 | @Component 14 | public class CustomBlockExceptionHandler implements BlockExceptionHandler { 15 | 16 | @Override 17 | public void handle(HttpServletRequest request, HttpServletResponse response, BlockException e) throws Exception { 18 | throw e; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /java/v1/wsm-zull/src/main/java/study/config/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package study.config; 2 | 3 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 6 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 7 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 8 | 9 | @Configuration 10 | @EnableOAuth2Sso 11 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 12 | 13 | @Override 14 | protected void configure(HttpSecurity http) throws Exception { 15 | http.csrf().disable(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-zull/src/main/java/study/config/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package study.config; 2 | 3 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 6 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 7 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 8 | 9 | @Configuration 10 | @EnableOAuth2Sso 11 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 12 | 13 | @Override 14 | protected void configure(HttpSecurity http) throws Exception { 15 | http.csrf().disable(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/controller/TestClass.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.model.TestModel; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.stream.Collectors; 8 | 9 | public class TestClass { 10 | 11 | public static void main(String[] args) { 12 | TestModel TestModel1 = new TestModel("wsm1", 20); 13 | TestModel TestModel2 = new TestModel("wsm2", 20); 14 | List list = new ArrayList<>(); 15 | list.add(TestModel1); 16 | list.add(TestModel2); 17 | 18 | list.stream().filter(x -> !x.getName().contains("1")).collect(Collectors.toList()).forEach(System.out::println); 19 | list.forEach((x) -> System.err.println("name:" + x.getName())); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/feign/WorkFeign.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.model.JobModel; 5 | import com.study.result.ResultView; 6 | import org.springframework.cloud.openfeign.FeignClient; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | 11 | /** 12 | * feign调用wsm-work服务 13 | */ 14 | @FeignClient(value = MyConstant.wsm_work, fallback = WorkHystrix.class) 15 | public interface WorkFeign { 16 | 17 | @GetMapping("/job/authority/getAll") 18 | ResultView getAll_job(); 19 | 20 | @PostMapping("/job/authority_button/add") 21 | ResultView add_job(@RequestBody JobModel model); 22 | } 23 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/feign/WorkFeign.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.model.JobModel; 5 | import com.study.result.ResultView; 6 | import org.springframework.cloud.openfeign.FeignClient; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | 11 | /** 12 | * feign调用wsm-work服务 13 | */ 14 | @FeignClient(value = MyConstant.wsm_work, fallback = WorkHystrix.class) 15 | public interface WorkFeign { 16 | 17 | @GetMapping("/job/authority/getAll") 18 | ResultView getAll_job(); 19 | 20 | @PostMapping("/job/authority_button/add") 21 | ResultView add_job(@RequestBody JobModel model); 22 | } 23 | -------------------------------------------------------------------------------- /java/v2/wsm-zull/src/main/java/com/study/ZullStrat.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 9 | 10 | @MapperScan("com.study.mapper") 11 | @EnableZuulProxy 12 | @SpringBootApplication 13 | @EnableDiscoveryClient 14 | public class ZullStrat { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(ZullStrat.class, args); 18 | System.err.println("网关wsm-zull启动了!!"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8012 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | prefer-ip-address: true 9 | client: 10 | service-url: 11 | # 向注册中心注册服务 12 | defaultZone: http://wsm:1@${eureka.instance.hostname}:8000/eureka 13 | 14 | spring: 15 | application: 16 | name: wsm-work #服务名 17 | 18 | datasource: # mysql配置 19 | driver-class-name: com.mysql.jdbc.Driver 20 | username: admin 21 | password: admin 22 | url: jdbc:mysql://${eureka.instance.hostname}:3306/wsm-work?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC 23 | 24 | # 配置mybatis-plus 25 | mybatis-plus: 26 | # 配置扫描xml 27 | mapper-locations: classpath:/mapper/*Mapper.xml 28 | # 实体扫描,多个package用逗号或者分号分隔 29 | type-aliases-package: com.study.model 30 | -------------------------------------------------------------------------------- /java/v2/wsm-zull/src/main/java/com/study/config/MyConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | @ConfigurationProperties(prefix = "my-config") 8 | public class MyConfig { 9 | 10 | private boolean isUseSecurity; 11 | private String regionCode; 12 | 13 | public boolean getIsUseSecurity() { 14 | return isUseSecurity; 15 | } 16 | 17 | public void setIsUseSecurity(boolean isUseSecurity) { 18 | this.isUseSecurity = isUseSecurity; 19 | } 20 | 21 | public String getRegionCode() { 22 | return regionCode; 23 | } 24 | 25 | public void setRegionCode(String regionCode) { 26 | this.regionCode = regionCode; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /java/v2/wsm-gateway/src/main/java/com/study/config/MyConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | @ConfigurationProperties(prefix = "my-config") 8 | public class MyConfig { 9 | 10 | private boolean isUseSecurity; 11 | private String regionCode; 12 | 13 | public boolean getIsUseSecurity() { 14 | return isUseSecurity; 15 | } 16 | 17 | public void setIsUseSecurity(boolean isUseSecurity) { 18 | this.isUseSecurity = isUseSecurity; 19 | } 20 | 21 | public String getRegionCode() { 22 | return regionCode; 23 | } 24 | 25 | public void setRegionCode(String regionCode) { 26 | this.regionCode = regionCode; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/service/RabbitConsumerService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.study.config.MySecurityMetadataSource; 4 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * rabbitmq消费者 10 | */ 11 | @Component 12 | public class RabbitConsumerService { 13 | 14 | @Autowired 15 | private MySecurityMetadataSource mySecurityMetadataSource; 16 | 17 | /** 18 | * 刷新权限 19 | * 20 | * @param msg 21 | */ 22 | @RabbitListener(queues = "wsm-upms-queue1") 23 | public void loadResourceDefine(String msg) { 24 | mySecurityMetadataSource.loadResourceDefine(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/service/RabbitConsumerService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.study.config.MySecurityMetadataSource; 4 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * rabbitmq消费者 10 | */ 11 | @Component 12 | public class RabbitConsumerService { 13 | 14 | @Autowired 15 | private MySecurityMetadataSource mySecurityMetadataSource; 16 | 17 | /** 18 | * 刷新权限 19 | * 20 | * @param msg 21 | */ 22 | @RabbitListener(queues = "wsm-work-queue1") 23 | public void loadResourceDefine(String msg) { 24 | mySecurityMetadataSource.loadResourceDefine(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/v1/wsm-gateway/src/main/java/com/study/controller/FallbackController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultEnum; 4 | import com.study.result.ResultView; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * 通用熔断器 12 | */ 13 | @RestController 14 | @RequestMapping("common") 15 | public class FallbackController { 16 | 17 | Logger logger = LoggerFactory.getLogger(FallbackController.class); 18 | 19 | @RequestMapping("fallback") 20 | public ResultView fallback() { 21 | ResultView resultView = ResultView.error(ResultEnum.CODE_504); 22 | logger.error(resultView.toString()); 23 | return resultView; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/v2/wsm-gateway/src/main/java/com/study/controller/FallbackController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultEnum; 4 | import com.study.result.ResultView; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * 通用熔断器 12 | */ 13 | @RestController 14 | @RequestMapping("common") 15 | public class FallbackController { 16 | 17 | Logger logger = LoggerFactory.getLogger(FallbackController.class); 18 | 19 | @RequestMapping("fallback") 20 | public ResultView fallback() { 21 | ResultView resultView = ResultView.error(ResultEnum.CODE_504); 22 | logger.error(resultView.toString()); 23 | return resultView; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-zull/src/main/java/study/service/RefreshRouteService.java: -------------------------------------------------------------------------------- 1 | package study.service; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.netflix.zuul.RoutesRefreshedEvent; 5 | import org.springframework.cloud.netflix.zuul.filters.RouteLocator; 6 | import org.springframework.context.ApplicationEventPublisher; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class RefreshRouteService { 11 | 12 | @Autowired 13 | ApplicationEventPublisher publisher; 14 | 15 | @Autowired 16 | RouteLocator routeLocator; 17 | 18 | public void refreshRoute() { 19 | RoutesRefreshedEvent routesRefreshedEvent = new RoutesRefreshedEvent(routeLocator); 20 | publisher.publishEvent(routesRefreshedEvent); 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/feign/WorkFeign.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.config.FeignRequestInterceptorConfig; 5 | import com.study.model.JobModel; 6 | import com.study.result.ResultView; 7 | import org.springframework.cloud.openfeign.FeignClient; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | 12 | /** 13 | * feign调用wsm-work服务 14 | */ 15 | @FeignClient(value = MyConstant.wsm_work, fallback = WorkHystrix.class) 16 | public interface WorkFeign { 17 | 18 | @GetMapping("/job/authority/getAll") 19 | ResultView getAll_job(); 20 | 21 | @PostMapping("/job/authority_button/add") 22 | ResultView add_job(@RequestBody JobModel model); 23 | } 24 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/exception/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.study.result.ResultEnum; 4 | import com.study.result.ResultView; 5 | import org.springframework.web.bind.annotation.ExceptionHandler; 6 | import org.springframework.web.bind.annotation.RestControllerAdvice; 7 | 8 | /** 9 | * 全局异常处理 10 | */ 11 | @RestControllerAdvice 12 | public class GlobalExceptionHandler { 13 | 14 | @ExceptionHandler(value = MyRuntimeException.class) 15 | public ResultView defaultErrorHandler(MyRuntimeException e) { 16 | e.printStackTrace(); 17 | return e.getResultView(); 18 | } 19 | 20 | @ExceptionHandler(value = RuntimeException.class) 21 | public ResultView defaultErrorHandler(RuntimeException e) { 22 | e.printStackTrace(); 23 | return ResultView.error(ResultEnum.CODE_666); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/resources/mapper/RecruitPlatformMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/resources/mapper/RecruitPlatformMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/resources/mapper/RecruitPlatformMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/controller/PublicController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.config.MySecurityMetadataSource; 4 | import com.study.result.ResultView; 5 | import io.swagger.annotations.Api; 6 | import io.swagger.annotations.ApiOperation; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | 11 | /** 12 | * 公共控制器 13 | */ 14 | @Api(description = "公共控制器") 15 | @RestController 16 | @RequestMapping("/public") 17 | public class PublicController { 18 | 19 | @Autowired 20 | private MySecurityMetadataSource mySecurityMetadataSource; 21 | 22 | @ApiOperation(value = "刷新本服务权限") 23 | @GetMapping("/loadResourceDefine") 24 | public ResultView loadResourceDefine() { 25 | mySecurityMetadataSource.loadResourceDefine(); 26 | return ResultView.success(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /java/v1/wsm-discovery/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | parent 8 | com.study 9 | 0.0.1-SNAPSHOT 10 | ../parent/pom.xml 11 | 12 | wsm-discovery 13 | eureka注册中心 14 | 15 | 16 | 17 | org.springframework.cloud 18 | spring-cloud-starter-netflix-eureka-server 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /java/v2/wsm-discovery/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | parent 8 | com.study 9 | 0.0.1-SNAPSHOT 10 | ../parent/pom.xml 11 | 12 | wsm-discovery 13 | eureka注册中心 14 | 15 | 16 | 17 | org.springframework.cloud 18 | spring-cloud-starter-netflix-eureka-server 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-discovery/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | parent 8 | com.study 9 | 0.0.1-SNAPSHOT 10 | ../parent/pom.xml 11 | 12 | wsm-discovery 13 | eureka注册中心 14 | 15 | 16 | 17 | org.springframework.cloud 18 | spring-cloud-starter-netflix-eureka-server 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/feign/UpmsHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.dto.ResourceRoleInfoDto; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * wsm-upms服务的熔断器 11 | */ 12 | @Slf4j 13 | @Component 14 | public class UpmsHystrix implements UpmsFeign { 15 | 16 | @Override 17 | public List getResourceRoleInfo(String projectCode) { 18 | System.err.println("调用wsm-upms服务getResourceRoleInfo方法失败"); 19 | log.error("调用wsm-upms服务getResourceRoleInfo方法失败"); 20 | return null; 21 | } 22 | 23 | @Override 24 | public String getResourceIdsByClientId(String clientId) { 25 | System.err.println("调用wsm-upms服务getResourceIdsByClientId方法失败"); 26 | log.error("调用wsm-upms服务getResourceIdsByClientId方法失败"); 27 | return null; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-common-utils/src/main/java/com/study/exception/MyRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.study.result.ResultEnum; 4 | import com.study.result.ResultView; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | /** 10 | * 自定义运行时异常 11 | */ 12 | @Getter 13 | @Setter 14 | @ToString 15 | public class MyRuntimeException extends RuntimeException { 16 | 17 | private ResultView resultView; 18 | 19 | public MyRuntimeException(ResultView resultView) { 20 | super(resultView.getMsg()); 21 | this.resultView = resultView; 22 | } 23 | 24 | public MyRuntimeException(String msg) { 25 | super(msg); 26 | this.resultView = ResultView.error(msg); 27 | } 28 | 29 | public MyRuntimeException(ResultEnum resultEnum) { 30 | super(resultEnum.getMsg()); 31 | this.resultView = ResultView.error(resultEnum); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/feign/WorkHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.model.JobModel; 5 | import com.study.result.ResultView; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * wsm-work服务的熔断器 11 | */ 12 | @Slf4j 13 | @Component 14 | public class WorkHystrix implements WorkFeign { 15 | 16 | @Override 17 | public ResultView getAll_job() { 18 | System.err.println("调用wsm-work服务getAll_job方法失败!"); 19 | log.error("调用wsm-work服务getAll_job方法失败!"); 20 | return ResultView.hystrixError(MyConstant.wsm_work); 21 | } 22 | 23 | @Override 24 | public ResultView add_job(JobModel model) { 25 | System.err.println("调用wsm-work服务add_job方法失败!"); 26 | log.error("调用wsm-work服务add_job方法失败!"); 27 | return ResultView.hystrixError(MyConstant.wsm_work); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 4 | import com.baomidou.mybatisplus.plugins.PerformanceInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MybatisPlusConfig { 10 | /** 11 | * mybatis - plus 分页插件 12 | * 13 | * @return 14 | */ 15 | @Bean 16 | public PaginationInterceptor paginationInterceptor() { 17 | PaginationInterceptor page = new PaginationInterceptor(); 18 | page.setDialectType("mysql"); 19 | return page; 20 | } 21 | 22 | /** 23 | * mybatis-plus SQL打印执行效率插件【生产环境可以关闭】 24 | */ 25 | @Bean 26 | public PerformanceInterceptor performanceInterceptor() { 27 | return new PerformanceInterceptor(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 4 | import com.baomidou.mybatisplus.plugins.PerformanceInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MybatisPlusConfig { 10 | /** 11 | * mybatis - plus 分页插件 12 | * 13 | * @return 14 | */ 15 | @Bean 16 | public PaginationInterceptor paginationInterceptor() { 17 | PaginationInterceptor page = new PaginationInterceptor(); 18 | page.setDialectType("mysql"); 19 | return page; 20 | } 21 | 22 | /** 23 | * mybatis-plus SQL打印执行效率插件【生产环境可以关闭】 24 | */ 25 | @Bean 26 | public PerformanceInterceptor performanceInterceptor() { 27 | return new PerformanceInterceptor(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 4 | import com.baomidou.mybatisplus.plugins.PerformanceInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MybatisPlusConfig { 10 | /** 11 | * mybatis - plus 分页插件 12 | * 13 | * @return 14 | */ 15 | @Bean 16 | public PaginationInterceptor paginationInterceptor() { 17 | PaginationInterceptor page = new PaginationInterceptor(); 18 | page.setDialectType("mysql"); 19 | return page; 20 | } 21 | 22 | /** 23 | * mybatis-plus SQL打印执行效率插件【生产环境可以关闭】 24 | */ 25 | @Bean 26 | public PerformanceInterceptor performanceInterceptor() { 27 | return new PerformanceInterceptor(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/java/com/study/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 4 | import com.baomidou.mybatisplus.plugins.PerformanceInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MybatisPlusConfig { 10 | /** 11 | * mybatis - plus 分页插件 12 | * 13 | * @return 14 | */ 15 | @Bean 16 | public PaginationInterceptor paginationInterceptor() { 17 | PaginationInterceptor page = new PaginationInterceptor(); 18 | page.setDialectType("mysql"); 19 | return page; 20 | } 21 | 22 | /** 23 | * mybatis-plus SQL打印执行效率插件【生产环境可以关闭】 24 | */ 25 | @Bean 26 | public PerformanceInterceptor performanceInterceptor() { 27 | return new PerformanceInterceptor(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/model/UserRoleModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | *

14 | * 用户-角色-关系表 15 | *

16 | * 17 | * @author wsm 18 | * @since 2019-10-24 19 | */ 20 | @Getter 21 | @Setter 22 | @ToString 23 | @TableName("user_role") 24 | @ApiModel(value="UserRoleModel对象", description="用户-角色-关系表") 25 | public class UserRoleModel implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @ApiModelProperty(value = "用户id") 30 | private Long userId; 31 | 32 | @ApiModelProperty(value = "角色id") 33 | private Long roleId; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /java/v2/wsm-zull/src/main/java/com/study/controller/PublicController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.config.MySecurityMetadataSource; 4 | import com.study.result.ResultView; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | @RequestMapping("/public") 12 | public class PublicController { 13 | 14 | @Autowired 15 | private MySecurityMetadataSource mySecurityMetadataSource; 16 | 17 | /** 18 | * 刷新权限 19 | * 20 | * @return 21 | */ 22 | @GetMapping("/loadResourceDefine") 23 | public ResultView loadResourceDefine() { 24 | mySecurityMetadataSource.loadResourceDefine(); 25 | return ResultView.success(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/UpmsStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.web.client.RestTemplate; 10 | 11 | 12 | @MapperScan("com.study.mapper") 13 | @SpringBootApplication 14 | @EnableDiscoveryClient 15 | @EnableFeignClients 16 | public class UpmsStart { 17 | 18 | @Bean 19 | public RestTemplate restTemplate() { 20 | return new RestTemplate(); 21 | } 22 | 23 | public static void main(String[] args) { 24 | SpringApplication.run(UpmsStart.class, args); 25 | System.err.println("upms启动了!!!"); 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/UpmsStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.web.client.RestTemplate; 10 | 11 | 12 | @MapperScan("com.study.mapper") 13 | @SpringBootApplication 14 | @EnableDiscoveryClient 15 | @EnableFeignClients 16 | public class UpmsStart { 17 | 18 | @Bean 19 | public RestTemplate restTemplate() { 20 | return new RestTemplate(); 21 | } 22 | 23 | public static void main(String[] args) { 24 | SpringApplication.run(UpmsStart.class, args); 25 | System.err.println("upms启动了!!!"); 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/UpmsStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.web.client.RestTemplate; 10 | 11 | 12 | @MapperScan("com.study.mapper") 13 | @SpringBootApplication 14 | @EnableDiscoveryClient 15 | @EnableFeignClients 16 | public class UpmsStart { 17 | 18 | @Bean 19 | public RestTemplate restTemplate() { 20 | return new RestTemplate(); 21 | } 22 | 23 | public static void main(String[] args) { 24 | SpringApplication.run(UpmsStart.class, args); 25 | System.err.println("upms启动了!!!"); 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /java/v2/wsm-gateway/src/main/java/com/study/controller/PublicController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.config.MyReactiveAuthorizationManager; 4 | import com.study.result.ResultView; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | @RequestMapping("/public") 12 | public class PublicController { 13 | 14 | @Autowired 15 | private MyReactiveAuthorizationManager myReactiveAuthorizationManager; 16 | 17 | /** 18 | * 刷新权限 19 | * 20 | * @return 21 | */ 22 | @GetMapping("/loadResourceDefine") 23 | public ResultView loadResourceDefine() { 24 | myReactiveAuthorizationManager.loadResourceDefine(); 25 | return ResultView.success(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/resources/mapper/ProjectMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/resources/mapper/ProjectMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/resources/mapper/ProjectMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /java/v1/wsm-common-utils/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | parent 7 | com.study 8 | 0.0.1-SNAPSHOT 9 | ../parent/pom.xml 10 | 11 | 4.0.0 12 | 13 | wsm-common-utils 14 | 公共工具 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-maven-plugin 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /java/v2/wsm-common-utils/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | parent 7 | com.study 8 | 0.0.1-SNAPSHOT 9 | ../parent/pom.xml 10 | 11 | 4.0.0 12 | 13 | wsm-common-utils 14 | 公共工具 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-maven-plugin 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/controller/TestCotroller.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.feign.WorkFeign; 4 | import com.study.result.ResultView; 5 | import io.swagger.annotations.ApiOperation; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * 测试控制器 13 | */ 14 | @RestController 15 | @RequestMapping("/test") 16 | public class TestCotroller { 17 | 18 | @Autowired 19 | private WorkFeign workFeign; 20 | 21 | /** 22 | * 测试传递token到wsm-work服务中 23 | * 24 | * @return 25 | */ 26 | @ApiOperation(value = "测试传递token到wsm-work服务中") 27 | @GetMapping("/transmitToken") 28 | public ResultView transmitToken() { 29 | ResultView resultView = workFeign.getAll_job(); 30 | return resultView; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/controller/TestCotroller.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.feign.WorkFeign; 4 | import com.study.result.ResultView; 5 | import io.swagger.annotations.ApiOperation; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * 测试控制器 13 | */ 14 | @RestController 15 | @RequestMapping("/test") 16 | public class TestCotroller { 17 | 18 | @Autowired 19 | private WorkFeign workFeign; 20 | 21 | /** 22 | * 测试传递token到wsm-work服务中 23 | * 24 | * @return 25 | */ 26 | @ApiOperation(value = "测试传递token到wsm-work服务中") 27 | @GetMapping("/transmitToken") 28 | public ResultView transmitToken() { 29 | ResultView resultView = workFeign.getAll_job(); 30 | return resultView; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/feign/OauthHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.result.ResultView; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * wsm-oauth服务的熔断器 12 | */ 13 | @Slf4j 14 | @Component 15 | public class OauthHystrix implements OauthFeign { 16 | 17 | @Override 18 | public Map getOauthToken(String username, String password, String client_id, String client_secret, String grant_type, String scope) { 19 | System.err.println("调用wsm-oauth服务getOauthToken方法失败!"); 20 | log.error("调用wsm-oauth服务getOauthToken方法失败!"); 21 | return null; 22 | } 23 | 24 | @Override 25 | public ResultView logout(String token) { 26 | System.err.println("调用wsm-oauth服务logout方法失败!"); 27 | log.error("调用wsm-oauth服务logout方法失败!"); 28 | return ResultView.hystrixError(MyConstant.wsm_oauth); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8011 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | prefer-ip-address: true 9 | client: 10 | service-url: 11 | # 向注册中心注册服务 12 | defaultZone: http://wsm:1@${eureka.instance.hostname}:8000/eureka 13 | 14 | spring: 15 | application: 16 | name: wsm-upms #服务名 17 | # mysql配置 18 | datasource: 19 | driver-class-name: com.mysql.jdbc.Driver 20 | username: admin 21 | password: admin 22 | url: jdbc:mysql://${eureka.instance.hostname}:3306/wsm-upms?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC 23 | 24 | # 配置mybatis-plus 25 | mybatis-plus: 26 | # 配置扫描xml 27 | mapper-locations: classpath:/mapper/*Mapper.xml 28 | # 实体扫描,多个package用逗号或者分号分隔 29 | type-aliases-package: com.study.model 30 | 31 | ribbon: 32 | ReadTimeout: 10000 33 | ConnectTimeout: 10000 34 | MaxAutoRetries: 1 35 | MaxAutoRetriesNextServer: 2 36 | 37 | #熔断器开启 38 | feign: 39 | hystrix: 40 | enabled: true 41 | 42 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MybatisPlusConfig { 10 | /** 11 | * mybatis - plus 分页插件 12 | * 13 | * @return 14 | */ 15 | @Bean 16 | public PaginationInterceptor paginationInterceptor() { 17 | PaginationInterceptor page = new PaginationInterceptor(); 18 | page.setDialectType("mysql"); 19 | return page; 20 | } 21 | 22 | /** 23 | * mybatis-plus SQL打印执行效率插件【生产环境可以关闭】 24 | * 设置 dev test 环境开启 25 | */ 26 | @Bean 27 | // @Profile({"dev", "test"}) 28 | public PerformanceInterceptor performanceInterceptor() { 29 | return new PerformanceInterceptor(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 5 | import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | @Configuration 10 | public class MybatisPlusConfig { 11 | /** 12 | * mybatis - plus 分页插件 13 | * 14 | * @return 15 | */ 16 | @Bean 17 | public PaginationInterceptor paginationInterceptor() { 18 | PaginationInterceptor page = new PaginationInterceptor(); 19 | page.setDialectType("mysql"); 20 | return page; 21 | } 22 | 23 | /** 24 | * mybatis-plus SQL打印执行效率插件【生产环境可以关闭】 25 | * 设置 dev test 环境开启 26 | */ 27 | @Bean 28 | // @Profile({"dev", "test"}) 29 | public PerformanceInterceptor performanceInterceptor() { 30 | return new PerformanceInterceptor(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/feign/UpmsHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.dto.ResourceRoleInfoDto; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * wsm-upms服务的熔断器 12 | */ 13 | @Component 14 | public class UpmsHystrix implements UpmsFeign { 15 | 16 | private final Logger logger = LoggerFactory.getLogger(UpmsHystrix.class); 17 | 18 | @Override 19 | public List getResourceRoleInfo(String projectCode) { 20 | System.err.println("调用wsm-upms服务getResourceRoleInfo方法失败!"); 21 | logger.error("调用wsm-upms服务getResourceRoleInfo方法失败!"); 22 | return null; 23 | } 24 | 25 | @Override 26 | public String getResourceIdsByClientId(String clientId) { 27 | System.err.println("调用wsm-upms服务getResourceIdsByClientId方法失败!"); 28 | logger.error("调用wsm-upms服务getResourceIdsByClientId方法失败!"); 29 | return null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/feign/WorkHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.model.JobModel; 5 | import com.study.result.ResultView; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * wsm-work服务的熔断器 12 | */ 13 | @Component 14 | public class WorkHystrix implements WorkFeign { 15 | 16 | private final Logger logger = LoggerFactory.getLogger(OauthHystrix.class); 17 | 18 | @Override 19 | public ResultView getAll_job() { 20 | System.err.println("调用wsm-work服务getAll_job方法失败!"); 21 | logger.error("调用wsm-work服务getAll_job方法失败!"); 22 | return ResultView.hystrixError(MyConstant.wsm_work); 23 | } 24 | 25 | @Override 26 | public ResultView add_job(JobModel model) { 27 | System.err.println("调用wsm-work服务add_job方法失败!"); 28 | logger.error("调用wsm-work服务add_job方法失败!"); 29 | return ResultView.hystrixError(MyConstant.wsm_work); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/config/MyConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | @ConfigurationProperties("my-config") 8 | public class MyConfig { 9 | 10 | private boolean isUseSecurity; 11 | private String projectCode; 12 | private String clientId; 13 | 14 | public boolean getIsUseSecurity() { 15 | return isUseSecurity; 16 | } 17 | 18 | public void setIsUseSecurity(boolean isUseSecurity) { 19 | this.isUseSecurity = isUseSecurity; 20 | } 21 | 22 | public String getProjectCode() { 23 | return projectCode; 24 | } 25 | 26 | public void setProjectCode(String projectCode) { 27 | this.projectCode = projectCode; 28 | } 29 | 30 | public String getClientId() { 31 | return clientId; 32 | } 33 | 34 | public void setClientId(String clientId) { 35 | this.clientId = clientId; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/feign/WorkHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.model.JobModel; 5 | import com.study.result.ResultView; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * wsm-work服务的熔断器 12 | */ 13 | @Component 14 | public class WorkHystrix implements WorkFeign { 15 | 16 | private final Logger logger = LoggerFactory.getLogger(OauthHystrix.class); 17 | 18 | @Override 19 | public ResultView getAll_job() { 20 | System.err.println("调用wsm-work服务getAll_job方法失败!"); 21 | logger.error("调用wsm-work服务getAll_job方法失败!"); 22 | return ResultView.hystrixError(MyConstant.wsm_work); 23 | } 24 | 25 | @Override 26 | public ResultView add_job(JobModel model) { 27 | System.err.println("调用wsm-work服务add_job方法失败!"); 28 | logger.error("调用wsm-work服务add_job方法失败!"); 29 | return ResultView.hystrixError(MyConstant.wsm_work); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/config/MyConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | @ConfigurationProperties(prefix = "my-config") 8 | public class MyConfig { 9 | 10 | private boolean isUseSecurity; 11 | private String projectCode; 12 | private String clientId; 13 | 14 | public boolean getIsUseSecurity() { 15 | return isUseSecurity; 16 | } 17 | 18 | public void setIsUseSecurity(boolean isUseSecurity) { 19 | this.isUseSecurity = isUseSecurity; 20 | } 21 | 22 | public String getProjectCode() { 23 | return projectCode; 24 | } 25 | 26 | public void setProjectCode(String projectCode) { 27 | this.projectCode = projectCode; 28 | } 29 | 30 | public String getClientId() { 31 | return clientId; 32 | } 33 | 34 | public void setClientId(String clientId) { 35 | this.clientId = clientId; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/controller/PublicController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.config.MySecurityMetadataSource; 4 | import com.study.result.ResultView; 5 | import io.swagger.annotations.Api; 6 | import io.swagger.annotations.ApiOperation; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | 13 | /** 14 | * 公共控制器 15 | */ 16 | @Api(tags = "公共控制器") 17 | @RestController 18 | @RequestMapping("/public") 19 | public class PublicController { 20 | 21 | @Autowired 22 | private MySecurityMetadataSource mySecurityMetadataSource; 23 | 24 | @ApiOperation(value = "刷新本服务权限") 25 | @GetMapping("/loadResourceDefine") 26 | public ResultView loadResourceDefine() { 27 | mySecurityMetadataSource.loadResourceDefine(); 28 | return ResultView.success(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-zull/src/main/java/study/config/CustomZuulConfig.java: -------------------------------------------------------------------------------- 1 | package study.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.autoconfigure.web.ServerProperties; 5 | import org.springframework.cloud.netflix.zuul.filters.ZuulProperties; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.jdbc.core.JdbcTemplate; 9 | 10 | @Configuration 11 | public class CustomZuulConfig { 12 | 13 | @Autowired 14 | ZuulProperties zuulProperties; 15 | @Autowired 16 | ServerProperties server; 17 | @Autowired 18 | JdbcTemplate jdbcTemplate; 19 | 20 | @Bean 21 | public CustomRouteLocator routeLocator() { 22 | CustomRouteLocator routeLocator = new CustomRouteLocator(this.server.getServlet().getContextPath(), this.zuulProperties); 23 | routeLocator.setJdbcTemplate(jdbcTemplate); 24 | return routeLocator; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/controller/TestWebSocketController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultView; 4 | import com.study.service.WebSoketService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.io.IOException; 12 | 13 | @RestController 14 | @RequestMapping("/testWebSocket") 15 | public class TestWebSocketController { 16 | 17 | @Autowired 18 | private WebSoketService webSoketService; 19 | 20 | /** 21 | * 发送消息 22 | * 23 | * @return 24 | */ 25 | @GetMapping("/sendMessage/{message}") 26 | public ResultView sendMessage(@PathVariable String message) throws IOException { 27 | webSoketService.sendMessage(message); 28 | return ResultView.success(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/model/ResourceRoleModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | *

14 | * 资源-角色-关系表 15 | *

16 | * 17 | * @author wsm 18 | * @since 2019-10-24 19 | */ 20 | @Getter 21 | @Setter 22 | @ToString 23 | @TableName("resource_role") 24 | @ApiModel(value="ResourceRoleModel对象", description="资源-角色-关系表") 25 | public class ResourceRoleModel implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @ApiModelProperty(value = "资源id") 30 | private Long resourceId; 31 | 32 | @ApiModelProperty(value = "资源按钮(页面要权限控制的按钮,也是后台接口方法名,多个用逗号分隔)") 33 | private String resourceButton; 34 | 35 | @ApiModelProperty(value = "角色id") 36 | private Long roleId; 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /java/v1/wsm-oauth/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8002 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | client: 9 | service-url: 10 | # 向注册中心注册服务 11 | defaultZone: http://wsm:1@${eureka.instance.hostname}:8000/eureka 12 | 13 | spring: 14 | application: 15 | name: wsm-oauth #服务名 16 | # mysql配置 17 | datasource: 18 | driver-class-name: com.mysql.jdbc.Driver 19 | username: admin 20 | password: admin 21 | url: jdbc:mysql://${eureka.instance.hostname}:3306/wsm-upms?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC 22 | 23 | redis: 24 | database: 0 #Redis数据库索引(默认为0) 25 | timeout: 5000ms # 连接超时时间(毫秒) 26 | host: 127.0.0.1 27 | port: 6379 28 | password: # Redis服务器连接密码(默认为空) 29 | jedis: 30 | pool: 31 | max-active: 8 # 连接池中的最大连接 32 | max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) 33 | max-idle: 8 # 连接池中的最大空闲连接 34 | min-idle: 0 # 连接池中的最小空闲连接 35 | 36 | mybatis: 37 | mapper-locations: classpath:/mapper/*Mapper.xml 38 | 39 | my-config: 40 | clientId: client_oauth 41 | 42 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/feign/UpmsFeign.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.dto.ResourceRoleInfoDto; 5 | import org.springframework.cloud.openfeign.FeignClient; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * feign调用wsm-upms服务 13 | */ 14 | @FeignClient(value = MyConstant.wsm_upms, fallback = UpmsHystrix.class) 15 | public interface UpmsFeign { 16 | 17 | /** 18 | * 查当前项目的资源角色信息 19 | * 20 | * @param projectCode 21 | * @return 22 | */ 23 | @GetMapping("/public/getResourceRoleInfo") 24 | List getResourceRoleInfo(@RequestParam("projectCode") String projectCode); 25 | 26 | /** 27 | * 根据client_id查询客户端resource_ids 28 | * 29 | * @param clientId 30 | * @return 31 | */ 32 | @GetMapping("/public/getResourceIdsByClientId") 33 | String getResourceIdsByClientId(@RequestParam("clientId") String clientId); 34 | } 35 | -------------------------------------------------------------------------------- /java/v2/wsm-oauth/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8002 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | client: 9 | service-url: 10 | # 向注册中心注册服务 11 | defaultZone: http://wsm:1@${eureka.instance.hostname}:8000/eureka 12 | 13 | spring: 14 | application: 15 | name: wsm-oauth #服务名 16 | # mysql配置 17 | datasource: 18 | driver-class-name: com.mysql.jdbc.Driver 19 | username: admin 20 | password: admin 21 | url: jdbc:mysql://${eureka.instance.hostname}:3306/wsm-upms?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC 22 | 23 | redis: 24 | database: 0 #Redis数据库索引(默认为0) 25 | timeout: 5000ms # 连接超时时间(毫秒) 26 | host: 127.0.0.1 27 | port: 6379 28 | password: # Redis服务器连接密码(默认为空) 29 | jedis: 30 | pool: 31 | max-active: 8 # 连接池中的最大连接 32 | max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) 33 | max-idle: 8 # 连接池中的最大空闲连接 34 | min-idle: 0 # 连接池中的最小空闲连接 35 | 36 | mybatis: 37 | mapper-locations: classpath:/mapper/*Mapper.xml 38 | 39 | my-config: 40 | clientId: client_oauth 41 | 42 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/service/OauthClientDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.study.mapper.OauthClientDetailsMapper; 6 | import com.study.model.OauthClientDetailsModel; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author wsm 15 | * @since 2019-07-26 16 | */ 17 | @Service 18 | public class OauthClientDetailsService extends ServiceImpl { 19 | 20 | /** 21 | * 根据client_id查询客户端resource_ids 22 | * 23 | * @param clientId 24 | * @return 25 | */ 26 | public String getResourceIdsByClientId(String clientId) { 27 | EntityWrapper ew = new EntityWrapper(); 28 | ew.eq("client_id", clientId); 29 | ew.setSqlSelect("resource_ids resourceIds"); 30 | OauthClientDetailsModel model = this.selectOne(ew); 31 | return model.getResourceIds(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/service/OauthClientDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 4 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 5 | import com.study.mapper.OauthClientDetailsMapper; 6 | import com.study.model.OauthClientDetailsModel; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author wsm 15 | * @since 2019-07-26 16 | */ 17 | @Service 18 | public class OauthClientDetailsService extends ServiceImpl { 19 | 20 | /** 21 | * 根据client_id查询客户端resource_ids 22 | * 23 | * @param clientId 24 | * @return 25 | */ 26 | public String getResourceIdsByClientId(String clientId) { 27 | EntityWrapper ew = new EntityWrapper(); 28 | ew.eq("client_id", clientId); 29 | ew.setSqlSelect("resource_ids resourceIds"); 30 | OauthClientDetailsModel model = this.selectOne(ew); 31 | return model.getResourceIds(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/feign/UpmsFeign.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.dto.ResourceRoleInfoDto; 5 | import org.springframework.cloud.openfeign.FeignClient; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * feign调用wsm-upms服务 13 | */ 14 | @FeignClient(value = MyConstant.wsm_upms, fallback = UpmsHystrix.class) 15 | public interface UpmsFeign { 16 | 17 | /** 18 | * 查当前项目的资源角色信息 19 | * 20 | * @param projectCode 21 | * @return 22 | */ 23 | @GetMapping("/public/getResourceRoleInfo") 24 | List getResourceRoleInfo(@RequestParam("projectCode") String projectCode); 25 | 26 | /** 27 | * 根据client_id查询客户端resource_ids 28 | * 29 | * @param clientId 30 | * @return 31 | */ 32 | @GetMapping("/public/getResourceIdsByClientId") 33 | String getResourceIdsByClientId(@RequestParam("clientId") String clientId); 34 | } 35 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-public/src/main/java/com/study/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.cloud.context.config.annotation.RefreshScope; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * 测试相关控制器 13 | */ 14 | @Api(description = "测试相关控制器") 15 | @RefreshScope 16 | @RestController 17 | @RequestMapping("/test") 18 | public class TestController { 19 | 20 | @Value("${wsm.name}") 21 | private String wsmName; 22 | 23 | @Value("${wsm.age}") 24 | private Integer wsmAge; 25 | 26 | @ApiOperation("测试读取git配置中的值") 27 | @GetMapping("/getGitConfigValue") 28 | public String getGitConfigValue() { 29 | System.err.println(wsmName); 30 | System.err.println(wsmAge); 31 | return wsmName; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 5 | import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Profile; 9 | 10 | @Configuration 11 | public class MybatisPlusConfig { 12 | /** 13 | * mybatis - plus 分页插件 14 | * 15 | * @return 16 | */ 17 | @Bean 18 | public PaginationInterceptor paginationInterceptor() { 19 | PaginationInterceptor page = new PaginationInterceptor(); 20 | page.setDialectType("mysql"); 21 | return page; 22 | } 23 | 24 | /** 25 | * mybatis-plus SQL打印执行效率插件【生产环境可以关闭】 26 | * 设置 dev test 环境开启 27 | */ 28 | @Bean 29 | @Profile({"dev", "test"}) 30 | public PerformanceInterceptor performanceInterceptor() { 31 | return new PerformanceInterceptor(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-common-utils/src/main/java/com/study/model/ResourceRoleModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | *

13 | * 资源-角色-关系表 14 | *

15 | * 16 | * @author wsm 17 | * @since 2019-07-24 18 | */ 19 | @Getter 20 | @Setter 21 | @ToString 22 | @ApiModel(value = "ResourceRoleModel对象", description = "资源-角色-关系表") 23 | public class ResourceRoleModel implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | /** 28 | * 资源id 29 | */ 30 | @ApiModelProperty(value = "资源id") 31 | private Long resourceId; 32 | /** 33 | * 资源按钮(页面要权限控制的按钮,也是后台接口方法名,多个用逗号分隔) 34 | */ 35 | @ApiModelProperty(value = "资源按钮(页面要权限控制的按钮,也是后台接口方法名,多个用逗号分隔)") 36 | private String resourceButton; 37 | /** 38 | * 角色id 39 | */ 40 | @ApiModelProperty(value = "角色id") 41 | private Long roleId; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/exception/ServiceExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.study.exception; 2 | 3 | import com.alibaba.csp.sentinel.slots.block.BlockException; 4 | import com.study.result.ResultView; 5 | import lombok.Data; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.web.bind.annotation.ExceptionHandler; 8 | import org.springframework.web.bind.annotation.RestControllerAdvice; 9 | 10 | 11 | /** 12 | * 服务异常处理 13 | */ 14 | @Data 15 | @RestControllerAdvice 16 | public class ServiceExceptionHandler extends GlobalExceptionHandler { 17 | 18 | @Value("${spring.servlet.multipart.max-request-size}") 19 | private String maxRequestSize; 20 | 21 | @ExceptionHandler(value = BlockException.class) 22 | public ResultView blockExceptionHandler(BlockException e) { 23 | return ResultView.error("请求被拦截,拦截类型为 " + e.getClass().getSimpleName()); 24 | } 25 | 26 | public ServiceExceptionHandler() { 27 | } 28 | 29 | public ServiceExceptionHandler(String maxRequestSize) { 30 | super(maxRequestSize); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/resources/mapper/ResourceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/resources/mapper/ResourceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/service/OauthClientDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.study.mapper.OauthClientDetailsMapper; 7 | import com.study.model.OauthClientDetailsModel; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

12 | * 服务实现类 13 | *

14 | * 15 | * @author wsm 16 | * @since 2019-07-26 17 | */ 18 | @Service 19 | public class OauthClientDetailsService extends ServiceImpl { 20 | 21 | /** 22 | * 根据client_id查询客户端resource_ids 23 | * 24 | * @param clientId 25 | * @return 26 | */ 27 | public String getResourceIdsByClientId(String clientId) { 28 | QueryWrapper qw = new QueryWrapper(); 29 | qw.eq("client_id", clientId); 30 | qw.select("resource_ids resourceIds"); 31 | OauthClientDetailsModel model = this.getOne(qw); 32 | return model.getResourceIds(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/resources/html/webSocket/2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 |

通过controller 进行发送消息

9 | 10 | 11 | 33 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/resources/mapper/ResourceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/feign/OauthHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.result.ResultView; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | * wsm-oauth服务的熔断器 13 | */ 14 | @Component 15 | public class OauthHystrix implements OauthFeign { 16 | 17 | private final Logger logger = LoggerFactory.getLogger(OauthHystrix.class); 18 | 19 | @Override 20 | public Map getOauthToken(String username, String password, String client_id, String client_secret, String grant_type, String scope) { 21 | System.err.println("调用wsm-oauth服务getOauthToken方法失败!"); 22 | logger.error("调用wsm-oauth服务getOauthToken方法失败!"); 23 | return null; 24 | } 25 | 26 | @Override 27 | public ResultView logout(String token) { 28 | System.err.println("调用wsm-oauth服务logout方法失败!"); 29 | logger.error("调用wsm-oauth服务logout方法失败!"); 30 | return ResultView.hystrixError(MyConstant.wsm_oauth); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/feign/OauthHystrix.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.result.ResultView; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | * wsm-oauth服务的熔断器 13 | */ 14 | @Component 15 | public class OauthHystrix implements OauthFeign { 16 | 17 | private final Logger logger = LoggerFactory.getLogger(OauthHystrix.class); 18 | 19 | @Override 20 | public Map getOauthToken(String username, String password, String client_id, String client_secret, String grant_type, String scope) { 21 | System.err.println("调用wsm-oauth服务getOauthToken方法失败!"); 22 | logger.error("调用wsm-oauth服务getOauthToken方法失败!"); 23 | return null; 24 | } 25 | 26 | @Override 27 | public ResultView logout(String token) { 28 | System.err.println("调用wsm-oauth服务logout方法失败!"); 29 | logger.error("调用wsm-oauth服务logout方法失败!"); 30 | return ResultView.hystrixError(MyConstant.wsm_oauth); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/resources/mapper/JobMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/resources/mapper/JobMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/resources/mapper/JobMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/DemoStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cache.annotation.EnableCaching; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.cloud.netflix.hystrix.EnableHystrix; 9 | import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; 10 | import org.springframework.cloud.openfeign.EnableFeignClients; 11 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 12 | 13 | 14 | @MapperScan("com.study.mapper") 15 | @SpringBootApplication 16 | @EnableDiscoveryClient 17 | @EnableFeignClients 18 | @EnableHystrix 19 | @EnableHystrixDashboard 20 | @EnableCaching 21 | @EnableAspectJAutoProxy(exposeProxy = true) 22 | public class DemoStart { 23 | 24 | public static void main(String[] args) { 25 | SpringApplication.run(DemoStart.class, args); 26 | System.err.println("demo启动了!!!"); 27 | } 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-oauth/src/main/java/com/study/model/OauthClientDetailsModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | *

12 | * 13 | *

14 | * 15 | * @author wsm 16 | * @since 2019-10-24 17 | */ 18 | @Getter 19 | @Setter 20 | @ToString 21 | @ApiModel(value="OauthClientDetailsModel对象", description="") 22 | public class OauthClientDetailsModel implements Serializable { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | private String clientId; 27 | 28 | private String resourceIds; 29 | 30 | private String clientSecret; 31 | 32 | private String scope; 33 | 34 | private String authorizedGrantTypes; 35 | 36 | private String webServerRedirectUri; 37 | 38 | private String authorities; 39 | 40 | private Integer accessTokenValidity; 41 | 42 | private Integer refreshTokenValidity; 43 | 44 | private String additionalInformation; 45 | 46 | private String autoapprove; 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/resources/mapper/WorkMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/resources/mapper/WorkMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/resources/registry.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | # file 、nacos 、eureka、redis、zk 3 | type = "eureka" 4 | 5 | nacos { 6 | serverAddr = "localhost" 7 | namespace = "public" 8 | cluster = "default" 9 | } 10 | eureka { 11 | # eureka地址 12 | serviceUrl = "http://wsm:1@127.0.0.1:8000/eureka" 13 | # seata server application名称 14 | application = "default" 15 | weight = "1" 16 | } 17 | redis { 18 | serverAddr = "localhost:6381" 19 | db = "0" 20 | } 21 | zk { 22 | cluster = "default" 23 | serverAddr = "127.0.0.1:2181" 24 | session.timeout = 6000 25 | connect.timeout = 2000 26 | } 27 | file { 28 | name = "file.conf" 29 | } 30 | } 31 | 32 | config { 33 | # file、nacos 、apollo、zk 34 | type = "file" 35 | 36 | nacos { 37 | serverAddr = "localhost" 38 | namespace = "public" 39 | cluster = "default" 40 | } 41 | apollo { 42 | app.id = "fescar-server" 43 | apollo.meta = "http://192.168.1.204:8801" 44 | } 45 | zk { 46 | serverAddr = "127.0.0.1:2181" 47 | session.timeout = 6000 48 | connect.timeout = 2000 49 | } 50 | file { 51 | name = "file.conf" 52 | } 53 | } -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/resources/registry.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | # file 、nacos 、eureka、redis、zk 3 | type = "eureka" 4 | 5 | nacos { 6 | serverAddr = "localhost" 7 | namespace = "public" 8 | cluster = "default" 9 | } 10 | eureka { 11 | # eureka地址 12 | serviceUrl = "http://wsm:1@127.0.0.1:8000/eureka" 13 | # seata server application名称 14 | application = "default" 15 | weight = "1" 16 | } 17 | redis { 18 | serverAddr = "localhost:6381" 19 | db = "0" 20 | } 21 | zk { 22 | cluster = "default" 23 | serverAddr = "127.0.0.1:2181" 24 | session.timeout = 6000 25 | connect.timeout = 2000 26 | } 27 | file { 28 | name = "file.conf" 29 | } 30 | } 31 | 32 | config { 33 | # file、nacos 、apollo、zk 34 | type = "file" 35 | 36 | nacos { 37 | serverAddr = "localhost" 38 | namespace = "public" 39 | cluster = "default" 40 | } 41 | apollo { 42 | app.id = "fescar-server" 43 | apollo.meta = "http://192.168.1.204:8801" 44 | } 45 | zk { 46 | serverAddr = "127.0.0.1:2181" 47 | session.timeout = 6000 48 | connect.timeout = 2000 49 | } 50 | file { 51 | name = "file.conf" 52 | } 53 | } -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/controller/TestFeignController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | 4 | import com.study.result.ResultView; 5 | import com.study.feign.WorkFeign; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiOperation; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PathVariable; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | /** 15 | *

16 | * 测试 前端控制器 17 | *

18 | * 19 | * @author wsm 20 | * @since 2019-01-28 21 | */ 22 | @Api(description = "测试控制器") 23 | @RestController 24 | @RequestMapping("/testFeign") 25 | public class TestFeignController { 26 | 27 | @Autowired 28 | private WorkFeign workInterface; 29 | 30 | @ApiOperation(value = "根据id查询work", notes = "") 31 | @GetMapping("/getById/{id}") 32 | public ResultView getById(@PathVariable Long id) { 33 | ResultView resultView = workInterface.getById(id); 34 | return resultView; 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/resources/mapper/WorkMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-config-server/src/main/java/com/study/ConfigServerStart.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.config.server.EnableConfigServer; 8 | 9 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) 10 | @EnableConfigServer 11 | @EnableDiscoveryClient 12 | public class ConfigServerStart { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(ConfigServerStart.class, args); 16 | System.err.println("configServer启动了"); 17 | } 18 | 19 | // /** 20 | // * 解决从git 配置文件中获取不到值的bean 21 | // * 22 | // * @return 23 | // */ 24 | // @Bean 25 | // public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { 26 | // PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); 27 | // c.setIgnoreUnresolvablePlaceholders(true); 28 | // return c; 29 | // } 30 | } 31 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-config-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | #端口号 2 | server: 3 | port: 8003 4 | 5 | eureka: 6 | instance: 7 | hostname: localhost #地址 8 | client: 9 | service-url: 10 | # 向注册中心注册服务 11 | defaultZone: http://wsm:1@${eureka.instance.hostname}:8000/eureka 12 | 13 | spring: 14 | application: 15 | name: wsm-config-server #服务名 16 | 17 | #config server 相关配置 18 | cloud: 19 | config: 20 | server: 21 | git: 22 | uri: https://github.com/wsm1217395196/my-study.git # 配置git仓库的地址 23 | search-paths: config-file # git仓库地址下的相对地址,可以配置多个,用,分割。 24 | # username: git用户名 # git仓库的账号(私有库必填) 25 | # password: git密码 # git仓库的密码(私有库必填) 26 | label: master 27 | 28 | # Rabbitmq配置 Spring Cloud Bus刷新配置(刷新config) 29 | rabbitmq: 30 | host: localhost 31 | port: 5672 32 | username: guest 33 | password: guest 34 | cache: 35 | channel: 36 | checkout-timeout: 1s 37 | 38 | #暴露/actuator/bus-refresh接口 39 | management: 40 | endpoints: 41 | web: 42 | exposure: 43 | include: "*" 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /java/v1/wsm-common-utils/src/main/java/com/study/MyConstant.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | /** 4 | * 常量类 5 | */ 6 | public class MyConstant { 7 | 8 | //服务名 9 | public static final String wsm_config_server = "wsm-config-server"; 10 | public static final String wsm_demo = "wsm-demo"; 11 | public static final String wsm_discovery = "wsm-discovery"; 12 | public static final String wsm_gateway = "wsm-gateway"; 13 | public static final String wsm_oauth = "wsm-oauth"; 14 | public static final String wsm_public = "wsm-public"; 15 | public static final String wsm_upms = "wsm-upms"; 16 | public static final String wsm_work = "wsm-work"; 17 | public static final String wsm_zull = "wsm-zull"; 18 | 19 | //表名 20 | public static final String T_User = "用户"; 21 | public static final String T_Work = "职业信息"; 22 | public static final String T_RecruitPlatform = "招聘平台"; 23 | public static final String T_Job = "岗位"; 24 | 25 | //是否 26 | public static final int One = 1; 27 | public static final int Zero = 0; 28 | 29 | //外键删除提示 30 | public static final String ForignKeyMsg = ",不能删除!"; 31 | 32 | //设置无效提示 33 | public static final String NotEnableMsg = ",不能设置为无效!"; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /java/v1/utils/wsm-common-utils/src/main/java/com/study/MyConstant.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | /** 4 | * 常量类 5 | */ 6 | public class MyConstant { 7 | 8 | //服务名 9 | public static final String wsm_config_server = "wsm-config-server"; 10 | public static final String wsm_demo = "wsm-demo"; 11 | public static final String wsm_discovery = "wsm-discovery"; 12 | public static final String wsm_gateway = "wsm-gateway"; 13 | public static final String wsm_oauth = "wsm-oauth"; 14 | public static final String wsm_public = "wsm-public"; 15 | public static final String wsm_upms = "wsm-upms"; 16 | public static final String wsm_work = "wsm-work"; 17 | public static final String wsm_zull = "wsm-zull"; 18 | 19 | //表名 20 | public static final String T_User = "用户"; 21 | public static final String T_Work = "职业信息"; 22 | public static final String T_RecruitPlatform = "招聘平台"; 23 | public static final String T_Job = "岗位"; 24 | 25 | //是否 26 | public static final int One = 1; 27 | public static final int Zero = 0; 28 | 29 | //外键删除提示 30 | public static final String ForignKeyMsg = ",不能删除!"; 31 | 32 | //设置无效提示 33 | public static final String NotEnableMsg = ",不能设置为无效!"; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/resources/mapper/OauthClientDetailsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java/v2/utils/wsm-common-utils/src/main/java/com/study/MyConstant.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | /** 4 | * 常量类 5 | */ 6 | public class MyConstant { 7 | 8 | //服务名 9 | public static final String wsm_config_server = "wsm-config-server"; 10 | public static final String wsm_demo = "wsm-demo"; 11 | public static final String wsm_discovery = "wsm-discovery"; 12 | public static final String wsm_gateway = "wsm-gateway"; 13 | public static final String wsm_oauth = "wsm-oauth"; 14 | public static final String wsm_public = "wsm-public"; 15 | public static final String wsm_upms = "wsm-upms"; 16 | public static final String wsm_work = "wsm-work"; 17 | public static final String wsm_zull = "wsm-zull"; 18 | 19 | //表名 20 | public static final String T_User = "用户"; 21 | public static final String T_Work = "职业信息"; 22 | public static final String T_RecruitPlatform = "招聘平台"; 23 | public static final String T_Job = "岗位"; 24 | 25 | //是否 26 | public static final int One = 1; 27 | public static final int Zero = 0; 28 | 29 | //外键删除提示 30 | public static final String ForignKeyMsg = ",不能删除!"; 31 | 32 | //设置无效提示 33 | public static final String NotEnableMsg = ",不能设置为无效!"; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/resources/mapper/OauthClientDetailsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-common-utils/src/main/java/com/study/MyConstant.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | /** 4 | * 常量类 5 | */ 6 | public class MyConstant { 7 | 8 | //服务名 9 | public static final String wsm_config_server = "wsm-config-server"; 10 | public static final String wsm_demo = "wsm-demo"; 11 | public static final String wsm_discovery = "wsm-discovery"; 12 | public static final String wsm_gateway = "wsm-gateway"; 13 | public static final String wsm_oauth = "wsm-oauth"; 14 | public static final String wsm_public = "wsm-public"; 15 | public static final String wsm_upms = "wsm-upms"; 16 | public static final String wsm_work = "wsm-work"; 17 | public static final String wsm_zull = "wsm-zull"; 18 | 19 | //表名 20 | public static final String T_User = "用户"; 21 | public static final String T_Work = "职业信息"; 22 | public static final String T_RecruitPlatform = "招聘平台"; 23 | public static final String T_Job = "岗位"; 24 | 25 | //是否 26 | public static final int One = 1; 27 | public static final int Zero = 0; 28 | 29 | //外键删除提示 30 | public static final String ForignKeyMsg = ",不能删除!"; 31 | 32 | //设置无效提示 33 | public static final String NotEnableMsg = ",不能设置为无效!"; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/resources/mapper/OauthClientDetailsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/model/UserRoleModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import java.io.Serializable; 6 | 7 | /** 8 | *

9 | * 用户-角色-关系表 10 | *

11 | * 12 | * @author wsm 13 | * @since 2019-07-18 14 | */ 15 | @TableName("user_role") 16 | public class UserRoleModel implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * 用户id 22 | */ 23 | @TableField("user_id") 24 | private Long userId; 25 | /** 26 | * 角色id 27 | */ 28 | @TableField("role_id") 29 | private Long roleId; 30 | 31 | 32 | public Long getUserId() { 33 | return userId; 34 | } 35 | 36 | public void setUserId(Long userId) { 37 | this.userId = userId; 38 | } 39 | 40 | public Long getRoleId() { 41 | return roleId; 42 | } 43 | 44 | public void setRoleId(Long roleId) { 45 | this.roleId = roleId; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "UserRoleModel{" + 51 | ", userId=" + userId + 52 | ", roleId=" + roleId + 53 | "}"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/model/UserRoleModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableField; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import java.io.Serializable; 6 | 7 | /** 8 | *

9 | * 用户-角色-关系表 10 | *

11 | * 12 | * @author wsm 13 | * @since 2019-07-18 14 | */ 15 | @TableName("user_role") 16 | public class UserRoleModel implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * 用户id 22 | */ 23 | @TableField("user_id") 24 | private Long userId; 25 | /** 26 | * 角色id 27 | */ 28 | @TableField("role_id") 29 | private Long roleId; 30 | 31 | 32 | public Long getUserId() { 33 | return userId; 34 | } 35 | 36 | public void setUserId(Long userId) { 37 | this.userId = userId; 38 | } 39 | 40 | public Long getRoleId() { 41 | return roleId; 42 | } 43 | 44 | public void setRoleId(Long roleId) { 45 | this.roleId = roleId; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "UserRoleModel{" + 51 | ", userId=" + userId + 52 | ", roleId=" + roleId + 53 | "}"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/model/OauthClientDetailsModel.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import io.swagger.annotations.ApiModel; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | *

13 | * 14 | *

15 | * 16 | * @author wsm 17 | * @since 2019-10-24 18 | */ 19 | @Getter 20 | @Setter 21 | @ToString 22 | @TableName("oauth_client_details") 23 | @ApiModel(value="OauthClientDetailsModel对象", description="") 24 | public class OauthClientDetailsModel implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | private String clientId; 29 | 30 | private String resourceIds; 31 | 32 | private String clientSecret; 33 | 34 | private String scope; 35 | 36 | private String authorizedGrantTypes; 37 | 38 | private String webServerRedirectUri; 39 | 40 | private String authorities; 41 | 42 | private Integer accessTokenValidity; 43 | 44 | private Integer refreshTokenValidity; 45 | 46 | private String additionalInformation; 47 | 48 | private String autoapprove; 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /java/v2/README.md: -------------------------------------------------------------------------------- 1 | ## 本项目为:spring cloud、zull/gateway、security、oauth2、jwt角色权限整合项目 2 | 3 | 请用idea打开parent父文件,他会自动加载其他子模块(服务)。 4 | 5 | 运行此项目请到DB文件夹导入sql文件到你的本地当中。 6 | 7 | DB文件夹有postman测试接口示例文件,导入postman即可。 8 | 9 | **v1文件夹 在下游服务进行token权限验证** 10 | 11 | **v2文件夹 升级在网关进行token权限验证** 12 | 13 | ***如果解决了你的问题麻烦点个星星哟***😘😘😘 14 | 15 | 16 | 17 | ### wsm-discovery是eureka注册中心 18 | 19 | 20 | 21 | ### wsm-gateway(网关,token权限验证) 22 | 23 | 1、token权限验证。 24 | 25 | 2、用的spring-cloud-starter-gateway依赖,有gateway网关的一些配置方式,hystrix 熔断器。 26 | 27 | 3、**wsm-gateway**、**wsm-zull**随便用哪种都可以。 28 | 29 | 30 | 31 | ### wsm-zull(网关,token权限验证) 32 | 33 | 1、配置了资源服务,根据域code从数据库读取出来的角色,资源url信息(即接口地址)给接口使用security权限。 34 | 35 | 2、有zull网关的配置方式,熔断器配置。 36 | 37 | 3、**wsm-gateway**、**wsm-zull**随便用哪种都可以。 38 | 39 | 40 | 41 | ### wsm-oauth(oauth2认证中心,集成了jwt) 42 | 43 | 1、spirng security, oauth2认证中心服务,集成了jwt。 44 | 45 | 2、可以用oauth2方式生成token,也可以用jwt(对称加密,非对称加密都有)的方式生成token,jwt可以自定义token生成携带的信息,根据代码里的注释用哪种即可。 46 | 47 | 3、token的存储方式可以是:内存、数据库、redis、jwt等。根据代码里的注释用哪种即可。 48 | 49 | 4、有自定义token异常信息,用于token校验失败返回信息。有资源授权异常处理。 50 | 51 | 5、根据/oauth/token接口获取的token,携带该token可以请求各服务有security权限的接口。 52 | 53 | 54 | 55 | ### wsm-upms(通用用户系统) 56 | 57 | 1、有注册,登录,退出,各控制器等接口。。。 58 | 59 | 2、mybatis-plus代码生成器。 60 | 61 | 62 | 63 | ### wsm-work(服务) 64 | 65 | 66 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/resources/file.conf: -------------------------------------------------------------------------------- 1 | transport { 2 | # tcp udt unix-domain-socket 3 | type = "TCP" 4 | #NIO NATIVE 5 | server = "NIO" 6 | #enable heartbeat 7 | heartbeat = true 8 | #thread factory for netty 9 | thread-factory { 10 | boss-thread-prefix = "NettyBoss" 11 | worker-thread-prefix = "NettyServerNIOWorker" 12 | server-executor-thread-prefix = "NettyServerBizHandler" 13 | share-boss-worker = false 14 | client-selector-thread-prefix = "NettyClientSelector" 15 | client-selector-thread-size = 1 16 | client-worker-thread-prefix = "NettyClientWorkerThread" 17 | # netty boss thread size,will not be used for UDT 18 | boss-thread-size = 1 19 | #auto default pin or 8 20 | worker-thread-size = 8 21 | } 22 | } 23 | service { 24 | #vgroup->rgroup 25 | #格式:vgroup_mapping.对应yml里阿里seata 服务组 = "seata server application名称" 26 | vgroup_mapping.wsm-upms-seata-group = "default" 27 | #only support single node 28 | default.grouplist = "127.0.0.1:8091" 29 | #degrade current not support 30 | enableDegrade = false 31 | #disable 32 | disable = false 33 | disableGlobalTransaction = false 34 | } 35 | 36 | client { 37 | async.commit.buffer.limit = 10000 38 | lock { 39 | retry.internal = 10 40 | retry.times = 30 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/resources/file.conf: -------------------------------------------------------------------------------- 1 | transport { 2 | # tcp udt unix-domain-socket 3 | type = "TCP" 4 | #NIO NATIVE 5 | server = "NIO" 6 | #enable heartbeat 7 | heartbeat = true 8 | #thread factory for netty 9 | thread-factory { 10 | boss-thread-prefix = "NettyBoss" 11 | worker-thread-prefix = "NettyServerNIOWorker" 12 | server-executor-thread-prefix = "NettyServerBizHandler" 13 | share-boss-worker = false 14 | client-selector-thread-prefix = "NettyClientSelector" 15 | client-selector-thread-size = 1 16 | client-worker-thread-prefix = "NettyClientWorkerThread" 17 | # netty boss thread size,will not be used for UDT 18 | boss-thread-size = 1 19 | #auto default pin or 8 20 | worker-thread-size = 8 21 | } 22 | } 23 | service { 24 | #vgroup->rgroup 25 | #格式:vgroup_mapping.对应yml里阿里seata 服务组 = "seata server application名称" 26 | vgroup_mapping.wsm-work-seata-group = "default" 27 | #only support single node 28 | default.grouplist = "127.0.0.1:8091" 29 | #degrade current not support 30 | enableDegrade = false 31 | #disable 32 | disable = false 33 | disableGlobalTransaction = false 34 | } 35 | 36 | client { 37 | async.commit.buffer.limit = 10000 38 | lock { 39 | retry.internal = 10 40 | retry.times = 30 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /java/v2/wsm-common-utils/src/main/java/com/study/MyConstant.java: -------------------------------------------------------------------------------- 1 | package com.study; 2 | 3 | /** 4 | * 常量类 5 | */ 6 | public class MyConstant { 7 | 8 | //服务名 9 | public static final String wsm_discovery = "wsm-discovery"; 10 | public static final String wsm_zull = "wsm-zull"; 11 | public static final String wsm_gateway = "wsm-gateway"; 12 | public static final String wsm_oauth = "wsm-oauth"; 13 | public static final String wsm_upms = "wsm-upms"; 14 | public static final String wsm_work = "wsm-work"; 15 | 16 | //表名 17 | public static final String T_User = "用户"; 18 | public static final String T_Work = "职业信息"; 19 | public static final String T_RecruitPlatform = "招聘平台"; 20 | public static final String T_Job = "岗位"; 21 | 22 | //是否 23 | public static final int One = 1; 24 | public static final int Zero = 0; 25 | 26 | //外键删除提示 27 | public static final String ForignKeyMsg = ",不能删除!"; 28 | 29 | //设置无效提示 30 | public static final String NotEnableMsg = ",不能设置为无效!"; 31 | 32 | //资源id 33 | public static final String ResourceAauth = "resource_oauth"; 34 | public static final String ClientId = "client_oauth"; 35 | public static final String ClientSecret = "secret_wsm"; 36 | public static final String Scope = "scope_wsm"; 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/dto/UserAddDTO.java: -------------------------------------------------------------------------------- 1 | package com.study.dto; 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 | import org.hibernate.validator.constraints.Range; 8 | 9 | import javax.validation.constraints.NotEmpty; 10 | import javax.validation.constraints.Size; 11 | 12 | @Data 13 | @ApiModel(value="UserAddDTO", description="用户新增业务对象") 14 | public class UserAddDTO { 15 | 16 | private Long id; 17 | 18 | @NotEmpty(message = "用户名不能为空") 19 | @ApiModelProperty(value = "用户名") 20 | @Size(min = 3, max = 8, message = "用户名长度为 3-8 位") 21 | private String name; 22 | 23 | @ApiModelProperty(value = "昵称") 24 | private String nickname; 25 | 26 | @NotEmpty(message = "密码不能为空") 27 | @Length(min = 6, max = 20, message = "密码长度为 6-20 位") 28 | @ApiModelProperty(value = "密码") 29 | private String password; 30 | 31 | @Range(min = 0, max = 1, message = "性别选择错误") 32 | @ApiModelProperty(value = "性别(0女,1男)") 33 | private Integer sex; 34 | 35 | @Range(min = 1, max = 3, message = "用户状态选择错误") 36 | @ApiModelProperty(value = "用户状态(1:正常,2:异常,3:禁用)") 37 | private Integer status; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /java/v1/wsm-work/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-work") 33 | .description("工作服务Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/v2/wsm-work/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-work") 33 | .description("工作服务Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-upms") 33 | .description("通用用户权限服务Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/v2/wsm-upms/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-upms") 33 | .description("通用用户权限服务Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-common-utils/src/main/java/com/study/dto/ResourceRoleInfoDto.java: -------------------------------------------------------------------------------- 1 | package com.study.dto; 2 | 3 | import com.study.model.ResourceRoleModel; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 资源角色信息 14 | * 15 | * @author wsm 16 | * @since 2019-07-24 17 | */ 18 | @Getter 19 | @Setter 20 | @ToString 21 | @ApiModel(value = "ResourceRoleInfoDto对象", description = "资源角色信息") 22 | public class ResourceRoleInfoDto { 23 | 24 | /** 25 | * 权限API路径匹配(注:即后台控制器名,后面带authority,或者authority_button(对应button字段)代表受权限控制) 26 | */ 27 | @ApiModelProperty(value = "权限API路径匹配(注:即后台控制器名,后面带authority,或者authority_button(对应button字段)代表受权限控制)") 28 | private String urlPattern; 29 | /** 30 | * 按钮(页面要权限控制的按钮,也是后台接口方法名,多个用逗号分隔) 31 | */ 32 | @ApiModelProperty(value = "按钮(页面要权限控制的按钮,也是后台接口方法名,多个用逗号分隔)") 33 | private String button; 34 | /** 35 | * 权限API路径匹配(注:即后台控制器名,后面带authority,或者authority_button(对应button字段)代表受权限控制) 36 | * 所对应的角色信息 37 | */ 38 | @ApiModelProperty(value = "所对应的角色信息,权限API路径匹配(注:即后台控制器名,后面带authority,或者authority_button(对应button字段)代表受权限控制)") 39 | private List resourceRoleModels; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-demo/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-demo") 33 | .description("演示练习Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-public/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-public") 33 | .description("公共服务Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-upms") 33 | .description("通用用户权限服务Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-work/src/main/java/com/study/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2配置类 15 | */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class Swagger2Config { 19 | 20 | @Bean 21 | public Docket CreateRestApi() { 22 | return new Docket(DocumentationType.SWAGGER_2) 23 | .apiInfo(apiInfo()) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("com.study.controller")) 26 | .paths(PathSelectors.any()) 27 | .build(); 28 | } 29 | 30 | private ApiInfo apiInfo() { 31 | return new ApiInfoBuilder() 32 | .title("wsm-work") 33 | .description("工作服务Api") 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /java/wsm-demo/wsm-upms/src/main/java/com/study/controller/RabbitProducerController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import com.study.result.ResultView; 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiOperation; 6 | import io.swagger.annotations.ApiParam; 7 | import org.springframework.amqp.core.AmqpTemplate; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | /** 15 | * rabbitmq生产者 16 | */ 17 | @Api(tags = "rabbitmq生产者") 18 | @RestController 19 | @RequestMapping("/rabbitProducer") 20 | public class RabbitProducerController { 21 | 22 | @Autowired 23 | private AmqpTemplate amqpTemplate; 24 | 25 | @ApiOperation(value = "根据服务名刷新权限") 26 | @GetMapping("/loadResourceDefine") 27 | public ResultView loadResourceDefine(@ApiParam("服务名,多个用逗号隔开") @RequestParam String[] serverNames) { 28 | for (String serverName : serverNames) { 29 | amqpTemplate.convertAndSend(serverName, "", serverName + "刷新权限"); 30 | } 31 | return ResultView.success(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /web/wsm-manage/src/assets/css/main.scss: -------------------------------------------------------------------------------- 1 | //* { 2 | // padding: 0px; 3 | // margin: 0px auto; 4 | //} 5 | // 6 | //a { 7 | // text-decoration: none; 8 | //} 9 | // 10 | //#app { 11 | // font-family: 'Avenir', Helvetica, Arial, sans-serif; 12 | // -webkit-font-smoothing: antialiased; 13 | // -moz-osx-font-smoothing: grayscale; 14 | // text-align: left; 15 | // color: #2c3e50; 16 | //} 17 | 18 | //他的样式 19 | //home.vue 20 | .el-menu-item, .el-submenu__title { 21 | color: #fff; 22 | } 23 | 24 | .el-menu .el-menu-item, .el-submenu .el-submenu__title { 25 | height: 46px; 26 | line-height: 46px; 27 | } 28 | 29 | .el-menu-item:hover, .el-submenu .el-menu-item:hover, .el-submenu__title:hover { 30 | background-color: #7ed2df; 31 | } 32 | 33 | .el-submenu .el-menu-item { 34 | background-color: #333744 35 | } 36 | 37 | .el-submenu .el-menu-item:hover { 38 | background-color: #4A5064 39 | } 40 | 41 | .el-submenu .el-menu-item.is-active, .el-menu-item.is-active, 42 | .el-submenu .el-menu-item.is-active:hover, .el-menu-item.is-active:hover { 43 | background-color: #00C1DE; 44 | color: #fff; 45 | } 46 | 47 | .el-menu .iconfont { 48 | vertical-align: baseline; 49 | margin-right: 6px; 50 | } 51 | 52 | .warp-breadcrum { 53 | margin: 5px 10px 15px 0px; 54 | } 55 | 56 | //我的样式 57 | //element-ui 58 | .el-row { 59 | padding-bottom: 23px; 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /web/wsm-manage/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /web/wsm-manage1/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /java/v1/README.md: -------------------------------------------------------------------------------- 1 | ## 本项目为:spring cloud、zull/gateway、security、oauth2、jwt角色权限整合项目 2 | 3 | 请用idea打开parent父文件,他会自动加载其他子模块(服务)。 4 | 5 | 运行此项目请到DB文件夹导入sql文件到你的本地当中。 6 | 7 | DB文件夹有postman测试接口示例文件,导入postman即可。 8 | 9 | **v1文件夹 在下游服务进行token权限验证** 10 | 11 | **v2文件夹 升级在网关进行token权限验证** 12 | 13 | ***如果解决了你的问题麻烦点个星星哟***😘😘😘 14 | 15 | 16 | 17 | ### wsm-discovery是eureka注册中心 18 | 19 | 20 | 21 | ### wsm-gateway(网关) 22 | 23 | 1、用的spring-cloud-starter-gateway依赖,有gateway网关的一些配置方式,hystrix 熔断器。 24 | 25 | 2、**wsm-gateway**、**wsm-zull**随便用哪种都可以。 26 | 27 | 28 | 29 | ### wsm-zull(网关) 30 | 31 | 1、有zull网关的配置方式,熔断器配置。 32 | 33 | 2、**wsm-gateway**、**wsm-zull**随便用哪种都可以。 34 | 35 | 36 | 37 | ### wsm-oauth(oauth2认证中心,集成了jwt) 38 | 39 | 1、spirng security, oauth2认证中心服务,集成了jwt。 40 | 41 | 2、可以用oauth2方式生成token,也可以用jwt(对称加密,非对称加密都有)的方式生成token,jwt可以自定义token生成携带的信息,根据代码里的注释用哪种即可。 42 | 43 | 3、token的存储方式可以是:内存、数据库、redis、jwt等。根据代码里的注释用哪种即可。 44 | 45 | 4、有自定义token异常信息,用于token校验失败返回信息。有资源授权异常处理。 46 | 47 | 5、根据/oauth/token接口获取的token,携带该token可以请求各服务有security权限的接口。 48 | 49 | 50 | 51 | ### wsm-upms(通用用户权限系统、资源服务) 52 | 53 | 1、配置了资源服务,根据项目code从数据库读取出来的角色,资源url信息(即接口地址)给接口使用security权限。 54 | 55 | 2、有注册,登录,退出,各控制器等接口。。。 56 | 57 | 3、mybatis-plus代码生成器。 58 | 59 | 60 | 61 | ### wsm-work(资源服务) 62 | 63 | 1、配置了资源服务,根据项目code从**wsm-upms服务**调用feign读取出来的角色,资源url信息(即接口地址)给接口使用security权限。 64 | 65 | 2、运行此服务请先运行**wsm-upms服务**。 66 | 67 | 68 | -------------------------------------------------------------------------------- /java/v1/wsm-upms/src/main/java/com/study/feign/OauthFeign.java: -------------------------------------------------------------------------------- 1 | package com.study.feign; 2 | 3 | import com.study.MyConstant; 4 | import com.study.result.ResultView; 5 | import org.springframework.cloud.openfeign.FeignClient; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | 10 | import java.util.Map; 11 | 12 | /** 13 | * feign调用wsm-oauth服务 14 | */ 15 | @FeignClient(value = MyConstant.wsm_oauth, fallback = OauthHystrix.class) 16 | public interface OauthFeign { 17 | 18 | /** 19 | * 获取token 20 | * 21 | * @param username 22 | * @param password 23 | * @param client_id 24 | * @param client_secret 25 | * @param grant_type 26 | * @param scope 27 | * @return 28 | */ 29 | @PostMapping("/oauth/token") 30 | Map getOauthToken(@RequestParam("username") String username, @RequestParam("password") String password, @RequestParam("client_id") String client_id, @RequestParam("client_secret") String client_secret, @RequestParam("grant_type") String grant_type, @RequestParam("scope") String scope); 31 | 32 | /** 33 | * 清除token(注销登录) 34 | * 35 | * @return 36 | */ 37 | @GetMapping("/user/logout") 38 | ResultView logout(@RequestParam("token") String token); 39 | 40 | } 41 | --------------------------------------------------------------------------------