├── edu-com ├── com-aliyun-service │ └── src │ │ ├── test │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── clark │ │ │ └── daxian │ │ │ ├── Run.java │ │ │ └── test │ │ │ └── RunTests.java │ │ └── main │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ └── aliyun │ │ ├── enums │ │ └── SMSCodeType.java │ │ ├── annotation │ │ ├── EnableAliOss.java │ │ ├── EnableAliSms.java │ │ └── EnableAliVod.java │ │ ├── exception │ │ └── AliyunException.java │ │ ├── properties │ │ ├── VodProperties.java │ │ ├── SmsProperties.java │ │ └── OssProperties.java │ │ └── config │ │ ├── SmsAutoConfig.java │ │ ├── VodAutoConfig.java │ │ └── OssAutoConfig.java ├── com-wechat-service │ └── src │ │ ├── test │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── clark │ │ │ └── daxian │ │ │ ├── Run.java │ │ │ └── test │ │ │ └── RunTests.java │ │ └── main │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ └── wechat │ │ ├── annotation │ │ └── EnableWeChat.java │ │ ├── exception │ │ └── WeChatException.java │ │ ├── properties │ │ └── WeChatProperties.java │ │ └── util │ │ └── WXPayXmlUtil.java ├── com-spring-boot-autoconfigure │ └── src │ │ ├── test │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── clark │ │ │ └── daxian │ │ │ ├── Run.java │ │ │ └── test │ │ │ └── RunTests.java │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── spring.factories │ │ └── banner.txt │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ ├── config │ │ └── GlobalExceptionHandler.java │ │ └── swagger │ │ └── SwaggerConfig.java ├── com-spring-boot-starter │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── spring.provides │ └── pom.xml ├── com-mq-service │ ├── src │ │ ├── test │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── clark │ │ │ │ │ └── daxian │ │ │ │ │ ├── entity │ │ │ │ │ └── User.java │ │ │ │ │ ├── Run.java │ │ │ │ │ ├── test │ │ │ │ │ └── RunTests.java │ │ │ │ │ └── listener │ │ │ │ │ └── TestDirectListener.java │ │ │ └── resources │ │ │ │ └── application.yml │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── clark │ │ │ └── daxian │ │ │ └── mq │ │ │ ├── annotation │ │ │ └── EnableRabbitMq.java │ │ │ ├── exception │ │ │ └── MqException.java │ │ │ └── service │ │ │ └── impl │ │ │ └── ProducerServiceImpl.java │ └── pom.xml ├── com-provider-api │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ └── api │ │ ├── aliyun │ │ ├── SmsService.java │ │ ├── VodService.java │ │ └── OssService.java │ │ ├── mq │ │ ├── ProducerService.java │ │ └── entity │ │ │ └── MqMessage.java │ │ ├── enums │ │ └── SMSTemplate.java │ │ ├── wechat │ │ ├── WeChatPayService.java │ │ ├── WeChatComService.java │ │ └── dto │ │ │ └── WxPayRequest.java │ │ ├── util │ │ └── base64 │ │ │ └── Base64Utils.java │ │ ├── entity │ │ └── Constant.java │ │ └── exception │ │ └── EduException.java └── pom.xml ├── docs ├── 系统框架图.png └── nacos │ ├── conf │ ├── cluster.conf.example │ ├── application.properties.example │ └── application.properties │ ├── bin │ ├── shutdown.cmd │ └── shutdown.sh │ └── NOTICE ├── edu-auth ├── auth-spring-boot-starter │ ├── src │ │ └── resources │ │ │ └── spring.provides │ └── pom.xml ├── auth-center-provider │ └── src │ │ └── main │ │ ├── resources │ │ ├── kevin_key.jks │ │ └── bootstrap-dev.yml │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ └── auth │ │ ├── server │ │ ├── service │ │ │ ├── web │ │ │ │ ├── QrUserDetailService.java │ │ │ │ ├── OpenIdUserDetailService.java │ │ │ │ ├── UsernameUserDetailService.java │ │ │ │ └── PhoneUserDetailService.java │ │ │ └── webflux │ │ │ │ ├── ReactiveRequestContextHolder.java │ │ │ │ └── ReactiveRequestContextFilter.java │ │ ├── feign │ │ │ ├── WeChatService.java │ │ │ └── UserService.java │ │ ├── exception │ │ │ └── AuthException.java │ │ ├── token │ │ │ ├── QrAuthenticationToken.java │ │ │ ├── OpenIdAuthenticationToken.java │ │ │ └── PhoneAuthenticationToken.java │ │ ├── controller │ │ │ └── JWTController.java │ │ ├── handler │ │ │ ├── webflux │ │ │ │ ├── WebfluxLogoutSuccessHandler.java │ │ │ │ └── WebfluxLoginFailureHandler.java │ │ │ └── web │ │ │ │ ├── WebLogoutSuccessHandler.java │ │ │ │ ├── WebLoginFailureHandler.java │ │ │ │ └── WebLogoutHandler.java │ │ ├── properties │ │ │ └── AuthServerProperties.java │ │ ├── config │ │ │ └── RedisObjectSerializer.java │ │ └── util │ │ │ └── IPUtil.java │ │ └── ServerApplication.java ├── auth-spring-boot-autoconfigure │ └── src │ │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── spring.factories │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ └── auth │ │ └── resource │ │ ├── filter │ │ ├── ReactiveRequestContextFilter.java │ │ └── CorsFilter.java │ │ ├── config │ │ ├── RedisObjectSerializer.java │ │ ├── RedisConfig.java │ │ └── SecurityConfig.java │ │ └── content │ │ └── ReactiveRequestContextHolder.java ├── auth-api-provider │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ └── auth │ │ └── api │ │ ├── entity │ │ ├── TokenEntity.java │ │ └── BaseUser.java │ │ └── util │ │ └── JsonUtils.java └── pom.xml ├── edu-job ├── job-spring-boot-starter │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── spring.provides │ └── pom.xml ├── job-admin-center │ └── src │ │ └── main │ │ ├── resources │ │ ├── static │ │ │ ├── favicon.ico │ │ │ ├── plugins │ │ │ │ ├── layer │ │ │ │ │ └── theme │ │ │ │ │ │ └── default │ │ │ │ │ │ ├── icon.png │ │ │ │ │ │ ├── icon-ext.png │ │ │ │ │ │ ├── loading-0.gif │ │ │ │ │ │ ├── loading-1.gif │ │ │ │ │ │ └── loading-2.gif │ │ │ │ └── codemirror │ │ │ │ │ └── addon │ │ │ │ │ └── hint │ │ │ │ │ ├── show-hint.css │ │ │ │ │ └── anyword-hint.js │ │ │ └── adminlte │ │ │ │ ├── plugins │ │ │ │ └── iCheck │ │ │ │ │ └── square │ │ │ │ │ ├── blue.png │ │ │ │ │ └── blue@2x.png │ │ │ │ └── bower_components │ │ │ │ ├── Ionicons │ │ │ │ └── fonts │ │ │ │ │ ├── ionicons.eot │ │ │ │ │ ├── ionicons.ttf │ │ │ │ │ └── ionicons.woff │ │ │ │ ├── font-awesome │ │ │ │ └── fonts │ │ │ │ │ ├── FontAwesome.otf │ │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ │ └── fontawesome-webfont.woff2 │ │ │ │ └── bootstrap │ │ │ │ └── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── templates │ │ │ ├── common │ │ │ │ └── common.exception.ftl │ │ │ └── help.ftl │ │ └── logback.xml │ │ └── java │ │ └── com │ │ └── xxl │ │ └── job │ │ └── admin │ │ ├── core │ │ ├── exception │ │ │ └── XxlJobException.java │ │ ├── alarm │ │ │ └── JobAlarm.java │ │ ├── route │ │ │ ├── strategy │ │ │ │ ├── ExecutorRouteFirst.java │ │ │ │ ├── ExecutorRouteLast.java │ │ │ │ ├── ExecutorRouteRandom.java │ │ │ │ └── ExecutorRouteRound.java │ │ │ └── ExecutorRouter.java │ │ ├── trigger │ │ │ └── TriggerTypeEnum.java │ │ ├── util │ │ │ └── FtlUtil.java │ │ ├── old │ │ │ ├── RemoteHttpJobBean.java │ │ │ └── XxlJobThreadPool.java │ │ └── model │ │ │ ├── XxlJobLogReport.java │ │ │ ├── XxlJobRegistry.java │ │ │ ├── XxlJobUser.java │ │ │ └── XxlJobLogGlue.java │ │ ├── XxlJobAdminApplication.java │ │ ├── controller │ │ ├── annotation │ │ │ └── PermissionLimit.java │ │ └── interceptor │ │ │ ├── WebMvcConfig.java │ │ │ └── CookieInterceptor.java │ │ ├── dao │ │ ├── XxlJobLogGlueDao.java │ │ ├── XxlJobGroupDao.java │ │ ├── XxlJobLogReportDao.java │ │ ├── XxlJobUserDao.java │ │ └── XxlJobRegistryDao.java │ │ └── service │ │ └── XxlJobService.java ├── job-spring-boot-autoconfigure │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── spring.factories │ │ │ └── application.yml │ │ │ └── java │ │ │ └── com │ │ │ └── clark │ │ │ └── daxian │ │ │ └── config │ │ │ └── XXLJobConfig.java │ └── pom.xml ├── job-core-provider │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── xxl │ │ │ └── job │ │ │ └── core │ │ │ ├── enums │ │ │ ├── RegistryConfig.java │ │ │ └── ExecutorBlockStrategyEnum.java │ │ │ ├── handler │ │ │ ├── annotation │ │ │ │ ├── JobHandler.java │ │ │ │ └── XxlJob.java │ │ │ ├── impl │ │ │ │ ├── GlueJobHandler.java │ │ │ │ └── MethodJobHandler.java │ │ │ └── IJobHandler.java │ │ │ ├── biz │ │ │ ├── AdminBiz.java │ │ │ ├── ExecutorBiz.java │ │ │ ├── model │ │ │ │ ├── LogResult.java │ │ │ │ ├── ReturnT.java │ │ │ │ ├── HandleCallbackParam.java │ │ │ │ └── RegistryParam.java │ │ │ └── client │ │ │ │ └── AdminBizClient.java │ │ │ ├── util │ │ │ └── ShardingUtil.java │ │ │ └── glue │ │ │ └── GlueTypeEnum.java │ └── pom.xml └── pom.xml ├── mybatis-plugins └── src │ ├── test │ ├── java │ │ └── com │ │ │ └── clark │ │ │ └── daxian │ │ │ ├── entity │ │ │ ├── Base.java │ │ │ └── User.java │ │ │ ├── Run.java │ │ │ └── mapper │ │ │ └── UserMapper.java │ └── resources │ │ └── application.yml │ └── main │ └── java │ └── com │ └── clark │ └── daxian │ └── mybatis │ ├── annotation │ ├── Table.java │ ├── Column.java │ ├── UserParent.java │ ├── Invisiable.java │ ├── Id.java │ └── EnableShardingJdbc.java │ ├── sharding │ ├── ShardingMasterSlaveConfig.java │ └── MyBatisConfiguration.java │ ├── config │ └── MybatisConfig.java │ └── mapper │ └── BaseMapper.java ├── edu-pojo ├── src │ └── main │ │ └── java │ │ └── com │ │ └── clark │ │ └── daxian │ │ ├── enums │ │ └── user_center │ │ │ └── PermissionType.java │ │ ├── dto │ │ ├── base │ │ │ └── PageRequest.java │ │ └── user │ │ │ └── UserRequest.java │ │ └── entity │ │ ├── base │ │ └── BaseEntity.java │ │ └── user_center │ │ ├── Role.java │ │ ├── User.java │ │ └── Permission.java └── pom.xml ├── edu-im └── src │ └── main │ ├── java │ └── com │ │ └── clark │ │ └── daxian │ │ └── im │ │ ├── enums │ │ └── MessageType.java │ │ ├── service │ │ └── TokenCheckService.java │ │ ├── entity │ │ └── WsMessage.java │ │ ├── feign │ │ └── AuthService.java │ │ ├── exception │ │ └── ImException.java │ │ ├── properties │ │ └── ImProperties.java │ │ ├── ImApplication.java │ │ ├── config │ │ ├── RedisConfig.java │ │ └── RedisObjectSerializer.java │ │ ├── util │ │ └── UrlUtil.java │ │ └── controller │ │ └── SendController.java │ └── resources │ └── bootstrap.yml ├── edu-user-center └── src │ └── main │ ├── resources │ └── bootstrap-dev.yml │ └── java │ └── com │ └── clark │ └── daxian │ └── user │ ├── exception │ └── UserException.java │ ├── service │ ├── RoleService.java │ ├── PermissionService.java │ ├── UserService.java │ └── iml │ │ └── RoleServiceImpl.java │ ├── UserApplication.java │ ├── mapper │ ├── RoleMapper.java │ ├── PermissionMapper.java │ └── UserMapper.java │ └── config │ ├── RedisConfig.java │ └── RedisObjectSerializer.java ├── edu-gateway └── src │ └── main │ ├── java │ └── com │ │ └── clark │ │ └── daxian │ │ └── gateway │ │ ├── service │ │ └── UserService.java │ │ ├── entity │ │ └── UserResponse.java │ │ ├── GatewayApplication.java │ │ └── controller │ │ └── UserController.java │ └── resources │ └── bootstrap-dev.yml ├── README.md └── .gitignore /edu-com/com-aliyun-service/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /edu-com/com-wechat-service/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /edu-com/com-spring-boot-autoconfigure/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/系统框架图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/docs/系统框架图.png -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-starter/src/resources/spring.provides: -------------------------------------------------------------------------------- 1 | provides: auth-spring-boot-autoconfigure -------------------------------------------------------------------------------- /edu-com/com-spring-boot-starter/src/main/resources/spring.provides: -------------------------------------------------------------------------------- 1 | provides: com-spring-boot-autoconfigure -------------------------------------------------------------------------------- /docs/nacos/conf/cluster.conf.example: -------------------------------------------------------------------------------- 1 | #it is ip 2 | #example 3 | 10.10.109.214 4 | 11.16.128.34 5 | 11.16.128.36 -------------------------------------------------------------------------------- /edu-job/job-spring-boot-starter/src/main/resources/META-INF/spring.provides: -------------------------------------------------------------------------------- 1 | provides: job-spring-boot-autoconfigure -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/resources/kevin_key.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-auth/auth-center-provider/src/main/resources/kevin_key.jks -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/favicon.ico -------------------------------------------------------------------------------- /edu-job/job-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.clark.daxian.config.XXLJobConfig -------------------------------------------------------------------------------- /mybatis-plugins/src/test/java/com/clark/daxian/entity/Base.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Base { 7 | 8 | protected Long id; 9 | } 10 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/icon.png -------------------------------------------------------------------------------- /edu-com/com-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.clark.daxian.swagger.SwaggerConfig,\ 3 | com.clark.daxian.config.GlobalExceptionHandler -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/icon-ext.png -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/loading-0.gif -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/loading-1.gif -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/plugins/layer/theme/default/loading-2.gif -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/enums/SMSCodeType.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.enums; 2 | 3 | /** 4 | * 发送验证码的类型 5 | * @author 大仙 6 | */ 7 | public enum SMSCodeType { 8 | 9 | LOGIN; 10 | } 11 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff -------------------------------------------------------------------------------- /edu-job/job-spring-boot-autoconfigure/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #xxl: 2 | # job: 3 | # admin: 4 | # addresses: http://127.0.0.1:8666/xxl-job 5 | # executor: 6 | # appname: ${spring.application.name} 7 | # ip: 8 | # port: 9998 9 | # accessToken: -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /edu-pojo/src/main/java/com/clark/daxian/enums/user_center/PermissionType.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.enums.user_center; 2 | 3 | /** 4 | * 权限类型 5 | * @author 大仙 6 | */ 7 | public enum PermissionType { 8 | SYSTEM, 9 | MENU, 10 | BUTTON, 11 | REQUEST; 12 | } 13 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/test/java/com/clark/daxian/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.entity; 2 | 3 | import com.clark.daxian.api.mq.entity.MqMessage; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class User extends MqMessage { 8 | 9 | private String name; 10 | } 11 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.clark.daxian.auth.resource.config.SecurityConfig,\ 3 | com.clark.daxian.auth.resource.config.RedisConfig,\ 4 | com.clark.daxian.auth.resource.util.PermissionUtil -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxian-zhu/online-edu-star/HEAD/edu-job/job-admin-center/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/enums/MessageType.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.enums; 2 | 3 | /** 4 | * 消息类型 5 | * @author 大仙 6 | */ 7 | public enum MessageType { 8 | 9 | REGISTER, 10 | SINGLE_SENDING, 11 | GROUP_SENDING, 12 | FILE_MSG_SINGLE_SENDING, 13 | FILE_MSG_GROUP_SENDING; 14 | } 15 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/service/TokenCheckService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.service; 2 | 3 | /** 4 | * 检查token的有效性 5 | * @author 朱维 6 | */ 7 | public interface TokenCheckService { 8 | /** 9 | * 检查token是否有效 10 | * @param token 11 | * @return 12 | */ 13 | Boolean checkTokenValid(String token); 14 | } 15 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/test/java/com/clark/daxian/Run.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Run { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Run.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/test/java/com/clark/daxian/Run.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Run { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Run.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /edu-com/com-wechat-service/src/test/java/com/clark/daxian/Run.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Run { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Run.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /mybatis-plugins/src/test/java/com/clark/daxian/Run.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | 7 | @SpringBootApplication 8 | public class Run { 9 | public static void main(String[] args) { 10 | SpringApplication.run(Run.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/enums/RegistryConfig.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.enums; 2 | 3 | /** 4 | * Created by xuxueli on 17/5/10. 5 | */ 6 | public class RegistryConfig { 7 | 8 | public static final int BEAT_TIMEOUT = 30; 9 | public static final int DEAD_TIMEOUT = BEAT_TIMEOUT * 3; 10 | 11 | public enum RegistType{ EXECUTOR, ADMIN } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /edu-pojo/src/main/java/com/clark/daxian/dto/base/PageRequest.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.dto.base; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 分页请求实体 7 | * @author clark 8 | */ 9 | @Data 10 | public class PageRequest { 11 | /** 12 | * 那条开始 13 | */ 14 | private Integer page; 15 | /** 16 | * 查询多少条 17 | */ 18 | private Integer pageSize; 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /edu-pojo/src/main/java/com/clark/daxian/dto/user/UserRequest.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.dto.user; 2 | 3 | import com.clark.daxian.dto.base.PageRequest; 4 | import lombok.Data; 5 | 6 | /** 7 | * 用户列表查询 8 | * @author clark 9 | */ 10 | @Data 11 | public class UserRequest extends PageRequest { 12 | 13 | private String email; 14 | 15 | private String telephone; 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /edu-com/com-spring-boot-autoconfigure/src/test/java/com/clark/daxian/Run.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Run { 8 | public static void main(String[] args) { 9 | SpringApplication.run(Run.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/exception/XxlJobException.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.exception; 2 | 3 | /** 4 | * @author xuxueli 2019-05-04 23:19:29 5 | */ 6 | public class XxlJobException extends RuntimeException { 7 | 8 | public XxlJobException() { 9 | } 10 | public XxlJobException(String message) { 11 | super(message); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /edu-user-center/src/main/resources/bootstrap-dev.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8662 3 | spring: 4 | application: 5 | name: user 6 | cloud: 7 | nacos: 8 | discovery: 9 | server-addr: 127.0.0.1:8848 10 | config: 11 | server-addr: 127.0.0.1:8848 12 | file-extension: yaml 13 | #mybatis的配置 14 | mybatis: 15 | configuration: 16 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl -------------------------------------------------------------------------------- /edu-gateway/src/main/java/com/clark/daxian/gateway/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.gateway.service; 2 | 3 | import com.clark.daxian.gateway.entity.UserResponse; 4 | import reactor.core.publisher.Mono; 5 | 6 | /** 7 | * 用户相关业务接口 8 | * @author 大仙 9 | */ 10 | public interface UserService { 11 | /** 12 | * 获取用户信息 13 | * @return 14 | */ 15 | Mono getUserInfoByAccess(); 16 | } 17 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/annotation/Table.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Table { 11 | 12 | String name(); 13 | } 14 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/annotation/Column.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.FIELD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Column { 11 | 12 | String name(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/annotation/UserParent.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 是否使用父类属性 11 | */ 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface UserParent { 15 | } 16 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/aliyun/SmsService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.aliyun; 2 | 3 | import com.clark.daxian.api.enums.SMSTemplate; 4 | 5 | /** 6 | * 短信业务接口 7 | * @author 大仙 8 | */ 9 | public interface SmsService { 10 | /** 11 | * 发送短信 12 | * @param phoneNum 13 | * @param templateCode 14 | * @param params 15 | */ 16 | void sendSMS(String phoneNum, SMSTemplate templateCode, String params); 17 | } 18 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/annotation/Invisiable.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 属性上标志,不被转换为表对应的属性值 11 | */ 12 | @Target(ElementType.FIELD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Invisiable { 15 | } 16 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/mq/ProducerService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.mq; 2 | 3 | import com.clark.daxian.api.mq.entity.MqMessage; 4 | 5 | /** 6 | * 发送消息 7 | * @author 大仙 8 | */ 9 | public interface ProducerService { 10 | 11 | /** 12 | * 发送消息 13 | * @param content 14 | * @param exchangeName 15 | * @param routingKey 16 | */ 17 | void sendMsg(MqMessage content, String exchangeName, String routingKey); 18 | } 19 | -------------------------------------------------------------------------------- /docs/nacos/conf/application.properties.example: -------------------------------------------------------------------------------- 1 | # spring 2 | 3 | server.contextPath=/nacos 4 | server.servlet.contextPath=/nacos 5 | server.port=8848 6 | 7 | 8 | db.num=2 9 | db.url.0=jdbc:mysql://11.162.196.16:3306/nacos_devtest?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true 10 | db.url.1=jdbc:mysql://11.163.152.9:3306/nacos_devtest?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true 11 | db.user=nacos_devtest 12 | db.password=nacos -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/annotation/Id.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 指定主键 11 | */ 12 | @Target(ElementType.FIELD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Id { 15 | 16 | String name() default ""; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mybatis-plugins/src/test/java/com/clark/daxian/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.entity; 2 | 3 | import com.clark.daxian.mybatis.annotation.Column; 4 | import com.clark.daxian.mybatis.annotation.Table; 5 | import com.clark.daxian.mybatis.annotation.UserParent; 6 | import lombok.Data; 7 | 8 | @Data 9 | @UserParent 10 | @Table(name="user") 11 | public class User extends Base{ 12 | 13 | @Column(name="name") 14 | private String nameBig; 15 | 16 | private String telephone; 17 | } 18 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/entity/WsMessage.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.entity; 2 | 3 | import com.clark.daxian.api.mq.entity.MqMessage; 4 | import com.clark.daxian.im.enums.MessageType; 5 | import lombok.Data; 6 | 7 | /** 8 | * 聊天消息构造 9 | * @author 大仙 10 | */ 11 | @Data 12 | public class WsMessage extends MqMessage { 13 | 14 | private Long from; 15 | 16 | private Long to; 17 | 18 | private String content; 19 | 20 | private MessageType messageType; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /mybatis-plugins/src/test/java/com/clark/daxian/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mapper; 2 | 3 | import com.clark.daxian.entity.User; 4 | import com.clark.daxian.mybatis.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | @Mapper 11 | public interface UserMapper extends BaseMapper { 12 | 13 | 14 | @Select("select * from user ") 15 | List getAll(); 16 | } 17 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/XxlJobAdminApplication.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author xuxueli 2018-10-28 00:38:13 8 | */ 9 | @SpringBootApplication 10 | public class XxlJobAdminApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(XxlJobAdminApplication.class, args); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/alarm/JobAlarm.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.alarm; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobInfo; 4 | import com.xxl.job.admin.core.model.XxlJobLog; 5 | 6 | /** 7 | * @author xuxueli 2020-01-19 8 | */ 9 | public interface JobAlarm { 10 | 11 | /** 12 | * job alarm 13 | * 14 | * @param info 15 | * @param jobLog 16 | * @return 17 | */ 18 | public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/enums/SMSTemplate.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.enums; 2 | 3 | /** 4 | * 短信模板枚举 5 | * @author 大仙 6 | * 7 | */ 8 | public enum SMSTemplate { 9 | //验证码 10 | SMS_141606808("{\"code\":\"%s\"}"); 11 | 12 | private String display; 13 | 14 | SMSTemplate(String display) { 15 | this.display = display; 16 | } 17 | 18 | public String getDisplay() { 19 | return display; 20 | } 21 | 22 | public void setDisplay(String display) { 23 | this.display = display; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/handler/annotation/JobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.handler.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * annotation for job handler 7 | * 8 | * will be replaced by {@link com.xxl.job.core.handler.annotation.XxlJob} 9 | * 10 | * @author 2016-5-17 21:06:49 11 | */ 12 | @Target({ElementType.TYPE}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Inherited 15 | @Deprecated 16 | public @interface JobHandler { 17 | 18 | String value(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/mq/entity/MqMessage.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.mq.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.util.UUID; 7 | 8 | /** 9 | * @Author: 朱维 10 | * @Date 11:42 2019/12/10 11 | */ 12 | @Data 13 | public class MqMessage implements Serializable { 14 | /** 15 | * 消息ID 16 | */ 17 | protected String id = UUID.randomUUID().toString(); 18 | /** 19 | * 单个消息过期时间 20 | */ 21 | protected String expiration; 22 | } 23 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/service/web/QrUserDetailService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.service.web; 2 | 3 | import com.clark.daxian.entity.user_center.User; 4 | import org.springframework.stereotype.Service; 5 | 6 | /** 7 | * @Author: 朱维 8 | * @Date 17:33 2019/11/27 9 | */ 10 | @Service 11 | public class QrUserDetailService extends BaseUserDetailService { 12 | 13 | @Override 14 | protected User getUser(String userName, String clientId) { 15 | return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /edu-com/com-spring-boot-autoconfigure/src/test/java/com/clark/daxian/test/RunTests.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.test; 2 | 3 | import com.clark.daxian.Run; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest(classes = Run.class) 11 | @EnableAutoConfiguration 12 | public class RunTests { 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /mybatis-plugins/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | type: com.alibaba.druid.pool.DruidDataSource 4 | driver-class-name: com.mysql.jdbc.Driver 5 | url: jdbc:mysql://127.0.0.1:8306/wecode_saas_qc?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 6 | username: write_user 7 | password: write@codeus 8 | #mybatis的配置 9 | mybatis: 10 | type-handlers-package: com.clark.type.hanlder 11 | configuration: 12 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 13 | map-underscore-to-camel-case: true 14 | -------------------------------------------------------------------------------- /edu-gateway/src/main/java/com/clark/daxian/gateway/entity/UserResponse.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.gateway.entity; 2 | 3 | import com.clark.daxian.auth.api.entity.BaseUser; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * 用户信息节课 11 | */ 12 | @Data 13 | public class UserResponse implements Serializable { 14 | 15 | 16 | private static final long serialVersionUID = 5291438641174821152L; 17 | /** 18 | * 用户信息 19 | */ 20 | private BaseUser baseUser; 21 | /** 22 | * 权限列表 23 | */ 24 | private List access; 25 | } 26 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/annotation/EnableShardingJdbc.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.annotation; 2 | 3 | import com.clark.daxian.mybatis.sharding.ShardingDataSourceConfig; 4 | import org.springframework.context.annotation.Import; 5 | 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.TYPE) 13 | @Import(ShardingDataSourceConfig.class) 14 | public @interface EnableShardingJdbc { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /edu-com/com-spring-boot-autoconfigure/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | 2 | ______ .__ __. __ __ .__ __. _______ _______ _______ __ __ 3 | / __ \ | \ | | | | | | | \ | | | ____| | ____|| \ | | | | 4 | | | | | | \| | | | | | | \| | | |__ | |__ | .--. || | | | 5 | | | | | | . ` | | | | | | . ` | | __| | __| | | | || | | | 6 | | `--' | | |\ | | `----.| | | |\ | | |____ | |____ | '--' || `--' | 7 | \______/ |__| \__| |_______||__| |__| \__| |_______| |_______||_______/ \______/ 8 | 9 | Online Edu 教学平台 -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/annotation/EnableAliOss.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.annotation; 2 | 3 | import com.clark.daxian.aliyun.config.OssAutoConfig; 4 | import org.springframework.context.annotation.Import; 5 | 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | /** 12 | * 阿里云Oss的启动注解 13 | * @author 大仙 14 | */ 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Target(ElementType.TYPE) 17 | @Import(OssAutoConfig.class) 18 | public @interface EnableAliOss { 19 | } 20 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/main/java/com/clark/daxian/mq/annotation/EnableRabbitMq.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mq.annotation; 2 | 3 | 4 | import com.clark.daxian.mq.config.RabbitConfig; 5 | import org.springframework.context.annotation.Import; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | /** 13 | * rabbitConfig相关配置 14 | * @author 大仙 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target(ElementType.TYPE) 18 | @Import(RabbitConfig.class) 19 | public @interface EnableRabbitMq { 20 | } 21 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/wechat/WeChatPayService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.wechat; 2 | 3 | import com.clark.daxian.api.wechat.dto.WxPayRequest; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * 微信支付相关 9 | */ 10 | public interface WeChatPayService { 11 | 12 | /** 13 | * 微信H5支付 14 | * @param wxPayRequest 支付必要参数 15 | * @return CommonResponse 16 | */ 17 | String payWeChatH5(WxPayRequest wxPayRequest); 18 | 19 | /** 20 | * 构建JS支付 21 | * @param wxPayRequest 22 | * @return 23 | */ 24 | Map createJSPay(WxPayRequest wxPayRequest); 25 | } 26 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/feign/WeChatService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.feign; 2 | 3 | import org.springframework.cloud.openfeign.FeignClient; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.PathVariable; 6 | 7 | /** 8 | * 微信相关业务 9 | * @author 大仙 10 | */ 11 | @FeignClient(name = "wechat") 12 | public interface WeChatService { 13 | /** 14 | * 获取openId 15 | * @param code 16 | * @return 17 | */ 18 | @GetMapping("/com/{code}") 19 | String getOpenId(@PathVariable("code") String code); 20 | } 21 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/annotation/EnableAliSms.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.annotation; 2 | 3 | 4 | import com.clark.daxian.aliyun.config.SmsAutoConfig; 5 | import org.springframework.context.annotation.Import; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | /** 13 | * 阿里云启动短信注解 14 | * @author 大仙 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target(ElementType.TYPE) 18 | @Import(SmsAutoConfig.class) 19 | public @interface EnableAliSms { 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 项目介绍 2 | 教育之星是基于微服务构建的在线教育管理产品。技术基础是基于Spring Cloud体系构建,使用的是最新的稳定2.1.12.RELEASE的Spring boot 版本 3 | Spring boot与Spring Cloud 版本对照请参考:[版本对照](https://start.spring.io/actuator/info) 4 | ![foryou](docs/系统框架图.png "框架图") 5 | ### 项目技术栈 6 | #### 后端技术栈 7 | 1. Spring Cloud 系列 8 | 2. Spring Boot 9 | 3. Spring Security 10 | 4. Oauth2 11 | 5. nacos 12 | 6. seata 13 | 7. rabbitMq 14 | 8. redis 15 | 9. mysql 16 | 10. Mybatis 17 | 11. Websocket 18 | 12. Sharding-jdbc 19 | 13. openFeign 20 | 14. ... 21 | #### 前端技术栈 22 | 23 | 1. Vue 24 | 2. ElementUI 25 | 3. axios 26 | 4. vue-router 27 | 5. Vuex 28 | 6. WebSocket 29 | 7. vue-cli4 30 | 8. ... 31 | 32 | 33 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/annotation/EnableAliVod.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.annotation; 2 | 3 | 4 | import com.clark.daxian.aliyun.config.VodAutoConfig; 5 | import org.springframework.context.annotation.Import; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | /** 13 | * 阿里云启动视频注解 14 | * @author 大仙 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target(ElementType.TYPE) 18 | @Import(VodAutoConfig.class) 19 | public @interface EnableAliVod { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /edu-com/com-wechat-service/src/main/java/com/clark/daxian/wechat/annotation/EnableWeChat.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.wechat.annotation; 2 | 3 | 4 | import com.clark.daxian.wechat.config.WeChatAuthConfig; 5 | import org.springframework.context.annotation.Import; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | /** 13 | * 开启WeChat配置 14 | * @author 大仙 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target(ElementType.TYPE) 18 | @Import(WeChatAuthConfig.class) 19 | public @interface EnableWeChat { 20 | } 21 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route.strategy; 2 | 3 | import com.xxl.job.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by xuxueli on 17/3/10. 11 | */ 12 | public class ExecutorRouteFirst extends ExecutorRouter { 13 | 14 | @Override 15 | public ReturnT route(TriggerParam triggerParam, List addressList){ 16 | return new ReturnT(addressList.get(0)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/feign/AuthService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.feign; 2 | 3 | import org.springframework.cloud.openfeign.FeignClient; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestParam; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * 调用检查token的方法 11 | * @author clark 12 | */ 13 | @FeignClient(name = "oauth2-server") 14 | public interface AuthService { 15 | 16 | /** 17 | * 检查token 18 | * @param token 19 | * @return 20 | */ 21 | @GetMapping("/oauth/check_token") 22 | Map checkToken(@RequestParam("token") String token); 23 | } 24 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | #redis配置 3 | redis: 4 | host: 127.0.0.1 5 | password: redis@2019 6 | port: 26379 7 | database: 1 8 | timeout: 60000 9 | rabbitmq: 10 | host: 127.0.0.1 11 | port: 5672 12 | username: wecode_sas 13 | password: wecodeSasRabbtimq@codeus 14 | virtual-host: wecode_sas 15 | # 开启发送确认 16 | publisher-confirms: true 17 | # 开启发送失败退回 18 | publisher-returns: true 19 | listener: 20 | simple: 21 | retry: 22 | enabled: false #消费者端的重试 23 | acknowledge-mode: manual # 开启ACK 24 | auto-startup: true #启动时自动启动容器 true 25 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route.strategy; 2 | 3 | import com.xxl.job.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by xuxueli on 17/3/10. 11 | */ 12 | public class ExecutorRouteLast extends ExecutorRouter { 13 | 14 | @Override 15 | public ReturnT route(TriggerParam triggerParam, List addressList) { 16 | return new ReturnT(addressList.get(addressList.size()-1)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /edu-auth/auth-api-provider/src/main/java/com/clark/daxian/auth/api/entity/TokenEntity.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.api.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.time.LocalDateTime; 7 | 8 | /** 9 | * token存储实体 10 | * @author 大仙 11 | */ 12 | @Data 13 | public class TokenEntity implements Serializable { 14 | /** 15 | * 唯一标识 16 | */ 17 | private String id; 18 | /** 19 | * token 20 | */ 21 | private String token; 22 | /** 23 | * 失效事件 24 | */ 25 | private LocalDateTime invalidDate; 26 | /** 27 | * 失效 1 有效 0 无效 28 | */ 29 | private Integer status = 1; 30 | } 31 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/exception/ImException.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.exception; 2 | 3 | import com.clark.daxian.api.exception.EduException; 4 | 5 | /** 6 | * IM业务相关异常 7 | * @author clark 8 | */ 9 | public class ImException extends EduException { 10 | 11 | 12 | public ImException(String message) { 13 | super(message); 14 | } 15 | 16 | public ImException(String message, int code) { 17 | super(message); 18 | this.code = code; 19 | } 20 | 21 | public ImException(String message, int code, String title) { 22 | super(message); 23 | this.code = code; 24 | this.title = title; 25 | } 26 | } -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/main/java/com/clark/daxian/mq/exception/MqException.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mq.exception; 2 | 3 | import com.clark.daxian.api.exception.EduException; 4 | 5 | /** 6 | * 阿里云业务异常 7 | * @author 大仙 8 | */ 9 | public class MqException extends EduException { 10 | 11 | public MqException(String message) { 12 | super(message); 13 | } 14 | 15 | public MqException(String message, int code) { 16 | super(message); 17 | this.code = code; 18 | } 19 | 20 | public MqException(String message, int code, String title) { 21 | super(message); 22 | this.code = code; 23 | this.title = title; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/properties/ImProperties.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * 相关配置文件 9 | * @author 大仙 10 | */ 11 | @Data 12 | @ConfigurationProperties(prefix = "edu.im") 13 | @Component 14 | public class ImProperties { 15 | 16 | private Integer port; 17 | 18 | private int maxFrameLength; 19 | 20 | private int IdleReadTimeout; 21 | 22 | private int IdleWriteTimeout; 23 | 24 | private int IdleAllTimeout; 25 | 26 | private String websocketUrl; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/exception/UserException.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.exception; 2 | 3 | import com.clark.daxian.api.exception.EduException; 4 | 5 | /** 6 | * 自定义用户业务异常 7 | * @author 大仙 8 | */ 9 | public class UserException extends EduException { 10 | 11 | public UserException(String message) { 12 | super(message); 13 | } 14 | 15 | public UserException(String message, int code) { 16 | super(message); 17 | this.code = code; 18 | } 19 | 20 | public UserException(String message, int code, String title) { 21 | super(message); 22 | this.code = code; 23 | this.title = title; 24 | } 25 | } -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/service/web/OpenIdUserDetailService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.service.web; 2 | 3 | import com.clark.daxian.entity.user_center.User; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | * @Author: 朱维 10 | * @Date 2:57 2019/11/28 11 | */ 12 | @Service 13 | public class OpenIdUserDetailService extends BaseUserDetailService { 14 | 15 | private Logger logger = LoggerFactory.getLogger(this.getClass()); 16 | 17 | 18 | @Override 19 | protected User getUser(String openId, String clientId) { 20 | 21 | return null; 22 | } 23 | } -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/service/webflux/ReactiveRequestContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.service.webflux; 2 | 3 | import org.springframework.http.server.reactive.ServerHttpRequest; 4 | import reactor.core.publisher.Mono; 5 | 6 | /** 7 | * 仿造 RequestContextHolder 切面获取request 8 | */ 9 | public class ReactiveRequestContextHolder { 10 | 11 | static final Class CONTEXT_KEY = ServerHttpRequest.class; 12 | 13 | /** 14 | * 通过上下文获取request 15 | * @return 16 | */ 17 | public static Mono getRequest() { 18 | return Mono.subscriberContext() 19 | .map(ctx -> ctx.get(CONTEXT_KEY)); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /edu-gateway/src/main/java/com/clark/daxian/gateway/GatewayApplication.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.gateway; 2 | 3 | 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 | * 启动类 11 | * @author 大仙 12 | */ 13 | @SpringBootApplication 14 | @EnableDiscoveryClient 15 | @EnableFeignClients 16 | public class GatewayApplication { 17 | 18 | public static void main(String[] args) throws Exception { 19 | SpringApplication.run(GatewayApplication.class, args); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/exception/AliyunException.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.exception; 2 | 3 | import com.clark.daxian.api.exception.EduException; 4 | 5 | /** 6 | * 阿里云业务异常 7 | * @author 大仙 8 | */ 9 | public class AliyunException extends EduException { 10 | 11 | public AliyunException(String message) { 12 | super(message); 13 | } 14 | 15 | public AliyunException(String message, int code) { 16 | super(message); 17 | this.code = code; 18 | } 19 | 20 | public AliyunException(String message, int code, String title) { 21 | super(message); 22 | this.code = code; 23 | this.title = title; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/controller/annotation/PermissionLimit.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.controller.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 权限限制 11 | * @author xuxueli 2015-12-12 18:29:02 12 | */ 13 | @Target(ElementType.METHOD) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface PermissionLimit { 16 | 17 | /** 18 | * 登录拦截 (默认拦截) 19 | */ 20 | boolean limit() default true; 21 | 22 | /** 23 | * 要求管理员权限 24 | * 25 | * @return 26 | */ 27 | boolean adminuser() default false; 28 | 29 | } -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/exception/AuthException.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.exception; 2 | 3 | import com.clark.daxian.api.exception.EduException; 4 | 5 | /** 6 | * 权限相关异常 7 | * @author 大仙 8 | */ 9 | public class AuthException extends EduException { 10 | 11 | 12 | public AuthException(String message) { 13 | super(message); 14 | } 15 | 16 | public AuthException(String message, int code) { 17 | super(message); 18 | this.code = code; 19 | } 20 | 21 | public AuthException(String message, int code, String title) { 22 | super(message); 23 | this.code = code; 24 | this.title = title; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /edu-com/com-wechat-service/src/main/java/com/clark/daxian/wechat/exception/WeChatException.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.wechat.exception; 2 | 3 | import com.clark.daxian.api.exception.EduException; 4 | 5 | /** 6 | * WeChat业务异常 7 | * @author 大仙 8 | */ 9 | public class WeChatException extends EduException { 10 | 11 | 12 | public WeChatException(String message) { 13 | super(message); 14 | } 15 | 16 | public WeChatException(String message, int code) { 17 | super(message); 18 | this.code = code; 19 | } 20 | 21 | public WeChatException(String message, int code, String title) { 22 | super(message); 23 | this.code = code; 24 | this.title = title; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/token/QrAuthenticationToken.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.token; 2 | 3 | import org.springframework.security.core.GrantedAuthority; 4 | 5 | import java.util.Collection; 6 | 7 | /** 8 | * 二维码token 9 | * @Author: 朱维 10 | * @Date 16:32 2019/11/27 11 | */ 12 | public class QrAuthenticationToken extends MyAuthenticationToken { 13 | public QrAuthenticationToken(Object principal, Object credentials) { 14 | super(principal, credentials); 15 | } 16 | 17 | public QrAuthenticationToken(Object principal, Object credentials, Collection authorities) { 18 | super(principal, credentials, authorities); 19 | } 20 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobLogGlue; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * job log for glue 11 | * @author xuxueli 2016-5-19 18:04:56 12 | */ 13 | @Mapper 14 | public interface XxlJobLogGlueDao { 15 | 16 | public int save(XxlJobLogGlue xxlJobLogGlue); 17 | 18 | public List findByJobId(@Param("jobId") int jobId); 19 | 20 | public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit); 21 | 22 | public int deleteByJobId(@Param("jobId") int jobId); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/handler/annotation/XxlJob.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.handler.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * annotation for method jobhandler 7 | * 8 | * @author xuxueli 2019-12-11 20:50:13 9 | */ 10 | @Target({ElementType.METHOD}) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Inherited 13 | public @interface XxlJob { 14 | 15 | /** 16 | * jobhandler name 17 | */ 18 | String value(); 19 | 20 | /** 21 | * init handler, invoked when JobThread init 22 | */ 23 | String init() default ""; 24 | 25 | /** 26 | * destroy handler, invoked when JobThread destroy 27 | */ 28 | String destroy() default ""; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/token/OpenIdAuthenticationToken.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.token; 2 | 3 | import org.springframework.security.core.GrantedAuthority; 4 | 5 | import java.util.Collection; 6 | 7 | /** 8 | * OPENDID的token 9 | * @Author: 朱维 10 | * @Date 16:32 2019/11/27 11 | */ 12 | public class OpenIdAuthenticationToken extends MyAuthenticationToken { 13 | public OpenIdAuthenticationToken(Object principal, Object credentials) { 14 | super(principal, credentials); 15 | } 16 | 17 | public OpenIdAuthenticationToken(Object principal, Object credentials, Collection authorities) { 18 | super(principal, credentials, authorities); 19 | } 20 | } -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/token/PhoneAuthenticationToken.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.token; 2 | 3 | import org.springframework.security.core.GrantedAuthority; 4 | 5 | import java.util.Collection; 6 | 7 | /** 8 | * 电话token 9 | * @Author: 朱维 10 | * @Date 16:29 2019/11/27 11 | */ 12 | public class PhoneAuthenticationToken extends MyAuthenticationToken{ 13 | 14 | public PhoneAuthenticationToken(Object principal, Object credentials) { 15 | super(principal, credentials); 16 | } 17 | 18 | public PhoneAuthenticationToken(Object principal, Object credentials, Collection authorities) { 19 | super(principal, credentials, authorities); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.biz.model.TriggerParam; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by xuxueli on 17/3/10. 12 | */ 13 | public abstract class ExecutorRouter { 14 | protected static Logger logger = LoggerFactory.getLogger(ExecutorRouter.class); 15 | 16 | /** 17 | * route address 18 | * 19 | * @param addressList 20 | * @return ReturnT.content=address 21 | */ 22 | public abstract ReturnT route(TriggerParam triggerParam, List addressList); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/dao/XxlJobGroupDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobGroup; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by xuxueli on 16/9/30. 11 | */ 12 | @Mapper 13 | public interface XxlJobGroupDao { 14 | 15 | public List findAll(); 16 | 17 | public List findByAddressType(@Param("addressType") int addressType); 18 | 19 | public int save(XxlJobGroup xxlJobGroup); 20 | 21 | public int update(XxlJobGroup xxlJobGroup); 22 | 23 | public int remove(@Param("id") int id); 24 | 25 | public XxlJobGroup load(@Param("id") int id); 26 | } 27 | -------------------------------------------------------------------------------- /edu-pojo/src/main/java/com/clark/daxian/entity/base/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.entity.base; 2 | 3 | import com.clark.daxian.mybatis.annotation.Invisiable; 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 基础实体 12 | * @author 大仙 13 | */ 14 | @Data 15 | public class BaseEntity implements Serializable { 16 | 17 | 18 | @Invisiable 19 | private static final long serialVersionUID = 8316892901228306882L; 20 | /** 21 | * 主键Id 22 | */ 23 | protected Long id; 24 | 25 | /** 26 | * 数据创建时间 27 | */ 28 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 29 | protected LocalDateTime createDate = LocalDateTime.now(); 30 | } 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.war 15 | *.ear 16 | *.zip 17 | *.tar.gz 18 | *.rar 19 | 20 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 21 | hs_err_pid* 22 | 23 | # idea文件 24 | .idea/ 25 | .DS_Store 26 | *.iml 27 | */output/ 28 | */target/ 29 | */issue.info 30 | logs/ 31 | output 32 | target 33 | *.log 34 | temp_code.py 35 | */application-dev_redis.properties 36 | generator/* 37 | .classpath 38 | .project 39 | **/.settings/** 40 | **/.txlcn/** 41 | .factorypath 42 | .springBeans 43 | 44 | #txlcn 45 | .txlcn 46 | order_center/src/main/resources/bootstrap-zhu.yml 47 | **/bootstrap-syf.yml 48 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/service/web/UsernameUserDetailService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.service.web; 2 | 3 | import com.clark.daxian.auth.server.exception.AuthException; 4 | import com.clark.daxian.entity.user_center.User; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * @Author: 朱维 9 | * @Date 17:35 2019/11/27 10 | */ 11 | @Service 12 | public class UsernameUserDetailService extends BaseUserDetailService { 13 | 14 | 15 | 16 | @Override 17 | protected User getUser(String email, String clientId) { 18 | User user = userService.getUserByEmail(email).getData(); 19 | if(user==null){ 20 | throw new AuthException("用户不存在"); 21 | } 22 | return user; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.service; 2 | 3 | import com.clark.daxian.entity.user_center.Role; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 角色业务接口 9 | * @author 大仙 10 | */ 11 | public interface RoleService { 12 | 13 | /** 14 | * 根据用户查询角色列表 15 | * @param userId 16 | * @return 17 | */ 18 | List getRoleByUser(Long userId); 19 | 20 | /** 21 | * 保存角色 22 | * @param role 23 | * @return 24 | */ 25 | Long save(Role role); 26 | 27 | /** 28 | * 删除角色 29 | * @param id 30 | */ 31 | void deleteRole(Long id); 32 | 33 | /** 34 | * 修改状态 35 | * @param id 36 | * @param status 37 | */ 38 | void updateStatus(Long id,Integer status); 39 | } 40 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/wechat/WeChatComService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.wechat; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | 5 | /** 6 | * WeChat共业务模块 7 | */ 8 | public interface WeChatComService { 9 | /** 10 | * 获取openId 11 | * @param code 12 | * @return 13 | */ 14 | String getOpenId(String code); 15 | /** 16 | * 获取授权地址 17 | * @param redirectUrl 18 | * @param state 透传参数 19 | * @return 20 | */ 21 | String getAuthUrl(String redirectUrl, String state); 22 | 23 | /** 24 | * 获取Token 25 | * @return 26 | */ 27 | String getAccessToken(); 28 | 29 | /** 30 | * 获取用户信息 31 | * @param openId 32 | * @return 33 | */ 34 | JSONObject getWeChaUserInfo(String openId); 35 | } 36 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route.strategy; 2 | 3 | import com.xxl.job.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | import java.util.Random; 9 | 10 | /** 11 | * Created by xuxueli on 17/3/10. 12 | */ 13 | public class ExecutorRouteRandom extends ExecutorRouter { 14 | 15 | private static Random localRandom = new Random(); 16 | 17 | @Override 18 | public ReturnT route(TriggerParam triggerParam, List addressList) { 19 | String address = addressList.get(localRandom.nextInt(addressList.size())); 20 | return new ReturnT(address); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/UserApplication.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user; 2 | 3 | import com.clark.daxian.mybatis.annotation.EnableShardingJdbc; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.cloud.openfeign.EnableFeignClients; 9 | 10 | /** 11 | * 启动类 12 | * @author 大仙 13 | */ 14 | @SpringBootApplication 15 | @EnableDiscoveryClient 16 | @EnableFeignClients 17 | @EnableShardingJdbc 18 | public class UserApplication { 19 | 20 | public static void main(String[] args) throws Exception { 21 | SpringApplication.run(UserApplication.class, args); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-autoconfigure/src/main/java/com/clark/daxian/auth/resource/filter/ReactiveRequestContextFilter.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.resource.filter; 2 | 3 | import com.clark.daxian.auth.resource.content.ReactiveRequestContextHolder; 4 | import org.springframework.web.server.ServerWebExchange; 5 | import org.springframework.web.server.WebFilter; 6 | import org.springframework.web.server.WebFilterChain; 7 | import reactor.core.publisher.Mono; 8 | 9 | /** 10 | * ReactiveRequestContextFilter 11 | * 12 | * @author L.cm 13 | */ 14 | public class ReactiveRequestContextFilter implements WebFilter{ 15 | 16 | @Override 17 | public Mono filter(ServerWebExchange exchange, WebFilterChain chain) { 18 | return chain.filter(exchange).subscriberContext(ctx -> ReactiveRequestContextHolder.put(ctx, exchange)); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobLogReport; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * job log 12 | * @author xuxueli 2019-11-22 13 | */ 14 | @Mapper 15 | public interface XxlJobLogReportDao { 16 | 17 | public int save(XxlJobLogReport xxlJobLogReport); 18 | 19 | public int update(XxlJobLogReport xxlJobLogReport); 20 | 21 | public List queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom, 22 | @Param("triggerDayTo") Date triggerDayTo); 23 | 24 | public XxlJobLogReport queryLogReportTotal(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/ServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth; 2 | 3 | import com.clark.daxian.mybatis.annotation.EnableShardingJdbc; 4 | import com.clark.daxian.wechat.annotation.EnableWeChat; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.cloud.openfeign.EnableFeignClients; 9 | 10 | /** 11 | * 启动类 12 | * @author 大仙 13 | */ 14 | @SpringBootApplication 15 | @EnableDiscoveryClient 16 | @EnableFeignClients 17 | @EnableShardingJdbc 18 | public class ServerApplication { 19 | 20 | public static void main(String[] args) { 21 | SpringApplication.run(ServerApplication.class, args); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/aliyun/VodService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.aliyun; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | 5 | import java.io.InputStream; 6 | 7 | /** 8 | * 阿里云视频点播业务 9 | * @author 大仙 10 | */ 11 | public interface VodService { 12 | /** 13 | * 获取播放权限 14 | * @param vid 15 | * @return 16 | */ 17 | JSONObject getVideoPlayAuth(String vid); 18 | 19 | /** 20 | * 上传视频 21 | * @param source 22 | * @param cateId 23 | * @return 24 | */ 25 | JSONObject uploadVideoToVOD(String source, Long cateId); 26 | 27 | /** 28 | * 通过文件上传 29 | * @param title 30 | * @param fileName 31 | * @param file 32 | * @return 33 | */ 34 | String uploadVideoByStream(String title, String fileName,InputStream file); 35 | } 36 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.trigger; 2 | 3 | import com.xxl.job.admin.core.util.I18nUtil; 4 | 5 | /** 6 | * trigger type enum 7 | * 8 | * @author xuxueli 2018-09-16 04:56:41 9 | */ 10 | public enum TriggerTypeEnum { 11 | 12 | MANUAL(I18nUtil.getString("jobconf_trigger_type_manual")), 13 | CRON(I18nUtil.getString("jobconf_trigger_type_cron")), 14 | RETRY(I18nUtil.getString("jobconf_trigger_type_retry")), 15 | PARENT(I18nUtil.getString("jobconf_trigger_type_parent")), 16 | API(I18nUtil.getString("jobconf_trigger_type_api")); 17 | 18 | private TriggerTypeEnum(String title){ 19 | this.title = title; 20 | } 21 | private String title; 22 | public String getTitle() { 23 | return title; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /edu-pojo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | online-edu 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | edu-pojo 13 | 14 | edu-pojo 15 | 16 | 17 | 18 | com.clark.daxian 19 | mybatis-plugins 20 | ${project.version} 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/plugins/codemirror/addon/hint/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | white-space: pre; 29 | color: black; 30 | cursor: pointer; 31 | } 32 | 33 | li.CodeMirror-hint-active { 34 | background: #08f; 35 | color: white; 36 | } 37 | -------------------------------------------------------------------------------- /edu-gateway/src/main/java/com/clark/daxian/gateway/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.gateway.controller; 2 | 3 | import com.clark.daxian.gateway.entity.UserResponse; 4 | import com.clark.daxian.gateway.service.UserService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import reactor.core.publisher.Mono; 9 | 10 | /** 11 | * 用户控制器 12 | * @author 大仙 13 | */ 14 | @RestController 15 | public class UserController { 16 | 17 | @Autowired 18 | private UserService userService; 19 | 20 | /** 21 | * 获取用户信息 22 | * @return 23 | */ 24 | @GetMapping("/user") 25 | public Mono getUserInfo(){ 26 | return userService.getUserInfoByAccess(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /edu-job/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | online-edu 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | edu-job 13 | pom 14 | 15 | edu-job 16 | 17 | job-core-provider 18 | job-admin-center 19 | job-spring-boot-autoconfigure 20 | job-spring-boot-starter 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/aliyun/OssService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.aliyun; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | 8 | /** 9 | * 操作OSS的业务接口 10 | * 11 | * @author 大仙 12 | */ 13 | public interface OssService { 14 | /** 15 | * 通过字节数组上传 16 | * 17 | * @param content 18 | * @param key 19 | * @return 20 | * @throws IOException 21 | */ 22 | String uploadByte(byte[] content, String key) throws IOException; 23 | 24 | /** 25 | * 通过流上传 26 | * 27 | * @param key 28 | * @param inputStream 29 | * @return 30 | */ 31 | String upload(String key, InputStream inputStream); 32 | 33 | /** 34 | * 获取oss上传token 35 | * @return 36 | */ 37 | JSONObject getToken(String key); 38 | } 39 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/properties/VodProperties.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 视频配置类 10 | * @author 大仙 11 | */ 12 | @Data 13 | @ConfigurationProperties(prefix = "edu.aliyun.vod") 14 | public class VodProperties implements Serializable { 15 | /** 16 | * key:单独权限 17 | */ 18 | private String key; 19 | /** 20 | * secret: 单独权限 21 | */ 22 | private String secret; 23 | /** 24 | * 区域 25 | */ 26 | private String region; 27 | /** 28 | * 用户ID 29 | */ 30 | private String uid; 31 | /** 32 | * 图片前缀 33 | */ 34 | private String coverUrl; 35 | /** 36 | * 模板组 37 | */ 38 | private String templateMode; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/service/web/PhoneUserDetailService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.service.web; 2 | 3 | import com.clark.daxian.auth.server.exception.AuthException; 4 | import com.clark.daxian.entity.user_center.User; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @Author: 朱维 11 | * @Date 17:30 2019/11/27 12 | */ 13 | @Service 14 | public class PhoneUserDetailService extends BaseUserDetailService { 15 | 16 | private Logger logger = LoggerFactory.getLogger(this.getClass()); 17 | 18 | @Override 19 | protected User getUser(String telephone, String clientId) { 20 | User user = userService.getUserByTel(telephone).getData(); 21 | if(user==null){ 22 | throw new AuthException("用户不存在"); 23 | } 24 | return user; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/sharding/ShardingMasterSlaveConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.sharding; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import io.shardingsphere.core.api.config.MasterSlaveRuleConfiguration; 5 | import lombok.Data; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * 13 | *

14 | * 功能描述:配置DataSource 15 | *

16 | *

17 | * @author 朱维 18 | * @date 2018年10月17日 19 | * @time 上午9:40:20 20 | * @Path: com.xuebaclass.crm.conf.ShardingMasterSlaveConfig.java 21 | */ 22 | @Data 23 | @ConfigurationProperties(prefix = "sharding.jdbc") 24 | public class ShardingMasterSlaveConfig { 25 | 26 | private Map dataSources = new HashMap<>(); 27 | 28 | private MasterSlaveRuleConfiguration masterSlaveRule; 29 | } 30 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/util/base64/Base64Utils.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.util.base64; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * base64工具类 7 | * @author 大仙 8 | */ 9 | public class Base64Utils { 10 | /** 11 | * 编码 12 | * @param bStr 13 | * @return String 14 | */ 15 | public static String encode(byte[] bStr){ 16 | return new sun.misc.BASE64Encoder().encode(bStr); 17 | } 18 | 19 | /** 20 | * 解码 21 | * @param str 22 | * @return string 23 | */ 24 | public static String decode(String str){ 25 | try { 26 | sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder(); 27 | byte[] bt = decoder.decodeBuffer( str ); 28 | return new String(bt,"UTF-8"); 29 | } catch (IOException e) { 30 | e.printStackTrace(); 31 | } 32 | return null; 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/wechat/dto/WxPayRequest.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.wechat.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.math.BigDecimal; 7 | 8 | 9 | /** 10 | * 请求支付相关参数 11 | */ 12 | @Data 13 | @Builder 14 | public class WxPayRequest { 15 | /** 16 | * 商品信息 17 | */ 18 | private String body; 19 | /** 20 | * 订单号 21 | */ 22 | private String orderNum; 23 | /** 24 | * 公众号Id 25 | */ 26 | private String openId; 27 | /** 28 | * 实际支付金额 29 | */ 30 | private BigDecimal payMoney; 31 | /** 32 | * 产品ID 33 | */ 34 | private String productId; 35 | /** 36 | * ip 37 | */ 38 | private String clientIp; 39 | /** 40 | * 回调地址 41 | */ 42 | private String notifyUrl; 43 | 44 | /** 45 | * 自定义参数(json对象) 46 | */ 47 | private String attach; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/templates/common/common.exception.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error 6 | 18 | 19 | 20 | 21 | 22 | 23 |

24 |

System Error

25 |

${exceptionMsg}

26 | Back 27 |

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/config/SmsAutoConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.config; 2 | 3 | 4 | import com.clark.daxian.aliyun.impl.SmsServiceImpl; 5 | import com.clark.daxian.aliyun.properties.SmsProperties; 6 | import com.clark.daxian.api.aliyun.SmsService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 9 | import org.springframework.context.annotation.Bean; 10 | 11 | @EnableConfigurationProperties({ SmsProperties.class}) 12 | public class SmsAutoConfig { 13 | 14 | @Autowired 15 | SmsProperties smsProperties; 16 | 17 | /** 18 | * 实例化OSS 19 | * @return 20 | */ 21 | @Bean 22 | SmsService smsService(){ 23 | SmsServiceImpl smsService = new SmsServiceImpl(); 24 | smsService.setSmsProperties(smsProperties); 25 | return smsService; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/properties/SmsProperties.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 短信配置类 10 | * @author 大仙 11 | */ 12 | @Data 13 | @ConfigurationProperties(prefix = "edu.aliyun.sms") 14 | public class SmsProperties implements Serializable { 15 | /** 16 | * 短信API产品名称(短信产品名固定,无需修改) 17 | */ 18 | private String product; 19 | /** 20 | * 短信API产品域名(接口地址固定,无需修改) 21 | */ 22 | private String domain; 23 | /** 24 | * 签名名称 25 | */ 26 | private String signName; 27 | /** 28 | * 断点 29 | */ 30 | private String endpoint; 31 | /** 32 | * key:单独授权 33 | */ 34 | private String key; 35 | /** 36 | * secret: 单独授权 37 | */ 38 | private String secret; 39 | } 40 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/config/VodAutoConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.config; 2 | 3 | import com.clark.daxian.aliyun.impl.VodServiceImpl; 4 | import com.clark.daxian.aliyun.properties.VodProperties; 5 | import com.clark.daxian.api.aliyun.VodService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | @EnableConfigurationProperties({ VodProperties.class}) 11 | public class VodAutoConfig { 12 | 13 | @Autowired 14 | private VodProperties vodProperties; 15 | 16 | /** 17 | * 阿里云视频点播业务 18 | * @return 19 | */ 20 | @Bean 21 | VodService vodService(){ 22 | VodServiceImpl vodService = new VodServiceImpl(); 23 | vodService.setVodProperties(vodProperties); 24 | return vodService; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/service/PermissionService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.service; 2 | 3 | import com.clark.daxian.entity.user_center.Permission; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 权限业务接口 9 | * @author 大仙 10 | */ 11 | public interface PermissionService { 12 | /** 13 | * 通过角色查询权限 14 | * @param roleId 15 | * @return 16 | */ 17 | List getPermissionByRole(Long roleId); 18 | /** 19 | * 保存权限 20 | * @param permission 21 | * @return 22 | */ 23 | Long save(Permission permission); 24 | 25 | /** 26 | * 删除权限 27 | * @param id 28 | */ 29 | void deletePermission(Long id); 30 | 31 | /** 32 | * 删除状态 33 | * @param id 34 | * @param status 35 | */ 36 | void updateStatus(Long id,Integer status); 37 | 38 | /** 39 | * 根据系统查询全部权限 40 | * @return 41 | */ 42 | List all(); 43 | } 44 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/sharding/MyBatisConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.sharding; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.Properties; 8 | 9 | /** 10 | * 设置mybatis的分页配置 11 | * 12 | * @author 朱维 13 | */ 14 | @Configuration 15 | public class MyBatisConfiguration { 16 | 17 | /** 18 | * 注册MyBatis分页插件PageHelper 19 | * 20 | * @return 21 | */ 22 | @Bean 23 | public PageHelper pageHelper() { 24 | PageHelper pageHelper = new PageHelper(); 25 | Properties p = new Properties(); 26 | p.setProperty("offsetAsPageNum", "true"); 27 | p.setProperty("rowBoundsWithCount", "true"); 28 | p.setProperty("reasonable", "true"); 29 | pageHelper.setProperties(p); 30 | return pageHelper; 31 | } 32 | } -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/handler/impl/GlueJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.handler.impl; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | 7 | /** 8 | * glue job handler 9 | * 10 | * @author xuxueli 2016-5-19 21:05:45 11 | */ 12 | public class GlueJobHandler extends IJobHandler { 13 | 14 | private long glueUpdatetime; 15 | private IJobHandler jobHandler; 16 | public GlueJobHandler(IJobHandler jobHandler, long glueUpdatetime) { 17 | this.jobHandler = jobHandler; 18 | this.glueUpdatetime = glueUpdatetime; 19 | } 20 | public long getGlueUpdatetime() { 21 | return glueUpdatetime; 22 | } 23 | 24 | @Override 25 | public ReturnT execute(String param) throws Exception { 26 | XxlJobLogger.log("----------- glue.version:"+ glueUpdatetime +" -----------"); 27 | return jobHandler.execute(param); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /edu-pojo/src/main/java/com/clark/daxian/entity/user_center/Role.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.entity.user_center; 2 | 3 | import com.clark.daxian.entity.base.BaseEntity; 4 | import com.clark.daxian.mybatis.annotation.Invisiable; 5 | import com.clark.daxian.mybatis.annotation.Table; 6 | import com.clark.daxian.mybatis.annotation.UserParent; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * 角色表 13 | * @author 大仙 14 | */ 15 | @Data 16 | @UserParent 17 | @Table(name = "role") 18 | public class Role extends BaseEntity implements Serializable { 19 | 20 | @Invisiable 21 | private static final long serialVersionUID = 4791049986935562849L; 22 | /** 23 | * 角色名称 24 | */ 25 | private String roleName; 26 | /** 27 | * 角色编码 28 | */ 29 | private String roleCode; 30 | /** 31 | * 说明 32 | */ 33 | private String comment; 34 | /** 35 | * 状态 36 | */ 37 | private Integer status; 38 | } 39 | -------------------------------------------------------------------------------- /edu-com/com-wechat-service/src/test/java/com/clark/daxian/test/RunTests.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.test; 2 | 3 | import com.clark.daxian.Run; 4 | import com.clark.daxian.wechat.annotation.EnableWeChat; 5 | import com.clark.daxian.api.wechat.WeChatComService; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 10 | import org.springframework.boot.test.context.SpringBootTest; 11 | import org.springframework.test.context.junit4.SpringRunner; 12 | 13 | @RunWith(SpringRunner.class) 14 | @SpringBootTest(classes = Run.class) 15 | @EnableAutoConfiguration 16 | @EnableWeChat 17 | public class RunTests { 18 | 19 | @Autowired 20 | private WeChatComService weChatComService; 21 | 22 | 23 | @Test 24 | public void test() throws Exception { 25 | System.out.println(weChatComService.getAccessToken()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /edu-auth/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | online-edu 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | edu-auth 13 | pom 14 | 15 | edu-auth 16 | 17 | https://github.com/daxian-zhu/online-edu-star 18 | 19 | 授权中心 20 | 21 | 22 | auth-center-provider 23 | auth-api-provider 24 | auth-spring-boot-autoconfigure 25 | auth-spring-boot-starter 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/properties/OssProperties.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * oss配置类 10 | * @author 大仙 11 | */ 12 | @Data 13 | @ConfigurationProperties(prefix = "edu.aliyun.oss") 14 | public class OssProperties implements Serializable { 15 | 16 | /** 17 | * 站点 18 | */ 19 | private String point; 20 | /** 21 | * keyId 22 | */ 23 | private String key; 24 | /** 25 | * key密码 26 | */ 27 | private String secret; 28 | /** 29 | * bucket名称 30 | */ 31 | private String buckName; 32 | /** 33 | * 访问路径 34 | */ 35 | private String baseUrl; 36 | /** 37 | * 角色管理获得 38 | */ 39 | private String roleArn; 40 | /** 41 | * session名称 42 | */ 43 | private String roleSessionName; 44 | } 45 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/main/java/com/clark/daxian/aliyun/config/OssAutoConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.aliyun.config; 2 | 3 | import com.clark.daxian.aliyun.impl.OssServiceImpl; 4 | import com.clark.daxian.aliyun.properties.OssProperties; 5 | import com.clark.daxian.api.aliyun.OssService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | /** 11 | * OSS config 12 | * @author 大仙 13 | */ 14 | @EnableConfigurationProperties({ OssProperties.class}) 15 | public class OssAutoConfig { 16 | 17 | @Autowired 18 | OssProperties ossProperties; 19 | 20 | /** 21 | * 实例化OSS 22 | * @return 23 | */ 24 | @Bean 25 | OssService ossService(){ 26 | OssServiceImpl ossService = new OssServiceImpl(); 27 | ossService.setOssProperties(ossProperties); 28 | return ossService; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/controller/JWTController.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.controller; 2 | 3 | import com.nimbusds.jose.jwk.JWKSet; 4 | import com.nimbusds.jose.jwk.RSAKey; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import java.security.KeyPair; 10 | import java.security.interfaces.RSAPublicKey; 11 | import java.util.Map; 12 | 13 | /** 14 | * jwt相关控制器 15 | * @author 大仙 16 | */ 17 | @RestController 18 | public class JWTController { 19 | 20 | @Autowired 21 | private KeyPair keyPair; 22 | 23 | @GetMapping("/pub-key/jwt.json") 24 | public Map getKey() { 25 | RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); 26 | RSAKey key = new RSAKey.Builder(publicKey).build(); 27 | return new JWKSet(key).toJSONObject(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /edu-auth/auth-api-provider/src/main/java/com/clark/daxian/auth/api/entity/BaseUser.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.api.entity; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 基础用户 12 | * @author 大仙 13 | */ 14 | @Data 15 | public class BaseUser implements Serializable { 16 | /** 17 | * 主键Id 18 | */ 19 | protected Long id; 20 | 21 | /** 22 | * 数据创建时间 23 | */ 24 | @JSONField(format = "yyyy-MM-dd HH:mm:ss") 25 | protected LocalDateTime createDate = LocalDateTime.now(); 26 | /** 27 | * 用户名称 28 | */ 29 | private String userName; 30 | /** 31 | * 邮箱,用户企业人员进行登录 32 | */ 33 | private String email; 34 | /** 35 | * 电话号码,用户客户登录 36 | */ 37 | private String telephone; 38 | /** 39 | * 头像 40 | */ 41 | private String headerUrl; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/entity/Constant.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.entity; 2 | 3 | /** 4 | * 常量类 5 | * @author 大仙 6 | */ 7 | public class Constant { 8 | 9 | /** 10 | * 成功 11 | */ 12 | public static final String SUCCESS_MSG = "success"; 13 | /** 14 | * 错误 15 | */ 16 | public static final String ERROR_MSG = "failed"; 17 | /** 18 | * 正确业务码 19 | */ 20 | public static final Integer SUCCESS_CODE = 0; 21 | 22 | /** 23 | * 错误业务码 24 | */ 25 | public static final Integer FAIL_CODE = 500; 26 | /** 27 | * 权限头 28 | */ 29 | public static final String AUTHORIZATION = "Authorization"; 30 | 31 | /** 32 | * 初始密码 33 | */ 34 | public static final String INIT_PWD = "clark"; 35 | /** 36 | * 用户信息 37 | */ 38 | public static final String USER_INFO = "user_info"; 39 | 40 | /** 41 | * redis存储前缀 42 | */ 43 | public static final String PERMISSIONS = "permissions:"; 44 | /** 45 | * 所有的权限 46 | */ 47 | public static final String ALL = "all"; 48 | 49 | 50 | } -------------------------------------------------------------------------------- /edu-im/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: im 4 | cloud: 5 | nacos: 6 | discovery: 7 | server-addr: 127.0.0.1:8848 8 | config: 9 | server-addr: 127.0.0.1:8848 10 | file-extension: yaml 11 | #redis配置 12 | redis: 13 | host: 127.0.0.1 14 | password: 15 | port: 6379 16 | database: 0 17 | timeout: 60000 18 | rabbitmq: 19 | host: 127.0.0.1 20 | port: 5672 21 | username: guest 22 | password: guest 23 | virtual-host: / 24 | # 开启发送确认 25 | publisher-confirms: true 26 | # 开启发送失败退回 27 | publisher-returns: true 28 | listener: 29 | simple: 30 | retry: 31 | enabled: false #消费者端的重试 32 | acknowledge-mode: manual # 开启ACK 33 | auto-startup: true #启动时自动启动容器 true 34 | edu: 35 | im: 36 | port: 8666 37 | max-frame-length: 1024 38 | idle-read-timeout: 4 39 | idle-write-timeout: 5 40 | idle-all-timeout: 7 41 | websocketUrl: ws://localhost:${edu.im.port} 42 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/service/webflux/ReactiveRequestContextFilter.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.service.webflux; 2 | 3 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; 4 | import org.springframework.http.server.reactive.ServerHttpRequest; 5 | import org.springframework.web.server.ServerWebExchange; 6 | import org.springframework.web.server.WebFilter; 7 | import org.springframework.web.server.WebFilterChain; 8 | import reactor.core.publisher.Mono; 9 | 10 | /** 11 | * 新建过滤,捕获过滤器 12 | * @author 大仙 13 | */ 14 | @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) 15 | public class ReactiveRequestContextFilter implements WebFilter { 16 | 17 | @Override 18 | public Mono filter(ServerWebExchange exchange, WebFilterChain chain) { 19 | ServerHttpRequest request = exchange.getRequest(); 20 | return chain.filter(exchange) 21 | .subscriberContext(ctx -> ctx.put(ReactiveRequestContextHolder.CONTEXT_KEY, request)); 22 | } 23 | } -------------------------------------------------------------------------------- /docs/nacos/bin/shutdown.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | rem Licensed under the Apache License, Version 2.0 (the "License"); 4 | rem you may not use this file except in compliance with the License. 5 | rem You may obtain a copy of the License at 6 | rem 7 | rem http://www.apache.org/licenses/LICENSE-2.0 8 | rem 9 | rem Unless required by applicable law or agreed to in writing, software 10 | rem distributed under the License is distributed on an "AS IS" BASIS, 11 | rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | rem See the License for the specific language governing permissions and 13 | rem limitations under the License. 14 | if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1 15 | 16 | setlocal 17 | 18 | set "PATH=%JAVA_HOME%\bin;%PATH%" 19 | 20 | echo killing nacos server 21 | 22 | for /f "tokens=1" %%i in ('jps -m ^| find "nacos.nacos"') do ( taskkill /F /PID %%i ) 23 | 24 | echo Done! 25 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.service; 2 | 3 | import com.clark.daxian.dto.user.UserRequest; 4 | import com.clark.daxian.entity.user_center.User; 5 | import com.github.pagehelper.PageInfo; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 用户业务接口 11 | * @author 大仙 12 | */ 13 | public interface UserService { 14 | 15 | /** 16 | * 添加用户 17 | * @param user 18 | * @return 19 | */ 20 | Long insertUser(User user); 21 | 22 | /** 23 | * 通过ID获取用户 24 | * @param id 25 | * @return 26 | */ 27 | User getById(Long id); 28 | 29 | /** 30 | * 通过电话 31 | * @param telephone 32 | * @return 33 | */ 34 | User getByTel(String telephone); 35 | 36 | /** 37 | * 通过邮箱 38 | * @param email 39 | * @return 40 | */ 41 | User getByEmail(String email); 42 | 43 | /** 44 | * 获取用户列表 45 | * @param userRequest 46 | * @return 47 | */ 48 | PageInfo userList(UserRequest userRequest); 49 | } 50 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.controller.interceptor; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * web mvc config 11 | * 12 | * @author xuxueli 2018-04-02 20:48:20 13 | */ 14 | @Configuration 15 | public class WebMvcConfig extends WebMvcConfigurerAdapter { 16 | 17 | @Resource 18 | private PermissionInterceptor permissionInterceptor; 19 | @Resource 20 | private CookieInterceptor cookieInterceptor; 21 | 22 | @Override 23 | public void addInterceptors(InterceptorRegistry registry) { 24 | registry.addInterceptor(permissionInterceptor).addPathPatterns("/**"); 25 | registry.addInterceptor(cookieInterceptor).addPathPatterns("/**"); 26 | super.addInterceptors(registry); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /docs/nacos/bin/shutdown.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 1999-2018 Alibaba Group Holding Ltd. 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | cd `dirname $0`/../target 16 | target_dir=`pwd` 17 | 18 | pid=`ps ax | grep -i 'nacos.nacos' | grep ${target_dir} | grep java | grep -v grep | awk '{print $1}'` 19 | if [ -z "$pid" ] ; then 20 | echo "No nacosServer running." 21 | exit -1; 22 | fi 23 | 24 | echo "The nacosServer(${pid}) is running..." 25 | 26 | kill ${pid} 27 | 28 | echo "Send shutdown request to nacosServer(${pid}) OK" 29 | -------------------------------------------------------------------------------- /edu-com/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | online-edu 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | edu-com 13 | pom 14 | 15 | edu-com 16 | 17 | https://github.com/daxian-zhu/online-edu-star 18 | 19 | 通用工具模块 20 | 21 | 22 | com-spring-boot-starter 23 | com-spring-boot-autoconfigure 24 | com-provider-api 25 | com-aliyun-service 26 | com-wechat-service 27 | com-mq-service 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /edu-com/com-aliyun-service/src/test/java/com/clark/daxian/test/RunTests.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.test; 2 | 3 | import com.clark.daxian.Run; 4 | import com.clark.daxian.aliyun.annotation.EnableAliOss; 5 | import com.clark.daxian.aliyun.annotation.EnableAliSms; 6 | import com.clark.daxian.api.aliyun.OssService; 7 | import com.clark.daxian.api.enums.SMSTemplate; 8 | import com.clark.daxian.api.aliyun.SmsService; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 13 | import org.springframework.boot.test.context.SpringBootTest; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest(classes = Run.class) 18 | @EnableAutoConfiguration 19 | @EnableAliOss 20 | public class RunTests { 21 | 22 | @Autowired 23 | private OssService ossService; 24 | 25 | @Test 26 | public void test() throws Exception { 27 | ossService.getToken("aa.sb3"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /edu-job/job-spring-boot-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | edu-job 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | job-spring-boot-starter 13 | 14 | job-spring-boot-starter 15 | 16 | 17 | com.clark.daxian 18 | job-spring-boot-autoconfigure 19 | ${project.version} 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-autoconfigure 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/ImApplication.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im; 2 | 3 | import com.clark.daxian.im.netty.NettyServer; 4 | import com.clark.daxian.mq.annotation.EnableRabbitMq; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.CommandLineRunner; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.springframework.cloud.openfeign.EnableFeignClients; 10 | 11 | /** 12 | * IM服务启动类 13 | */ 14 | @SpringBootApplication 15 | @EnableRabbitMq 16 | @EnableFeignClients 17 | public class ImApplication implements CommandLineRunner { 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(ImApplication.class); 21 | } 22 | 23 | @Autowired 24 | private NettyServer nettyServer; 25 | /** 26 | * 项目启动之后启动netty服务 27 | * @param args 28 | * @throws Exception 29 | */ 30 | @Override 31 | public void run(String... args) throws Exception { 32 | nettyServer.start(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/enums/ExecutorBlockStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.enums; 2 | 3 | /** 4 | * Created by xuxueli on 17/5/9. 5 | */ 6 | public enum ExecutorBlockStrategyEnum { 7 | 8 | SERIAL_EXECUTION("Serial execution"), 9 | /*CONCURRENT_EXECUTION("并行"),*/ 10 | DISCARD_LATER("Discard Later"), 11 | COVER_EARLY("Cover Early"); 12 | 13 | private String title; 14 | private ExecutorBlockStrategyEnum (String title) { 15 | this.title = title; 16 | } 17 | 18 | public void setTitle(String title) { 19 | this.title = title; 20 | } 21 | public String getTitle() { 22 | return title; 23 | } 24 | 25 | public static ExecutorBlockStrategyEnum match(String name, ExecutorBlockStrategyEnum defaultItem) { 26 | if (name != null) { 27 | for (ExecutorBlockStrategyEnum item: ExecutorBlockStrategyEnum.values()) { 28 | if (item.name().equals(name)) { 29 | return item; 30 | } 31 | } 32 | } 33 | return defaultItem; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /edu-com/com-provider-api/src/main/java/com/clark/daxian/api/exception/EduException.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.api.exception; 2 | 3 | /** 4 | * 自定义异常的父类 5 | * @author 大仙 6 | */ 7 | public class EduException extends RuntimeException { 8 | 9 | private static final long serialVersionUID = -8879123682017730252L; 10 | protected Integer code; 11 | protected String title = "Online edu star Exception"; 12 | 13 | public EduException(String message) { 14 | super(message); 15 | } 16 | 17 | public EduException(String message, int code) { 18 | super(message); 19 | this.code = code; 20 | } 21 | 22 | public EduException(String message, int code, String title) { 23 | super(message); 24 | this.code = code; 25 | this.title = title; 26 | } 27 | 28 | public Integer getCode() { 29 | return code; 30 | } 31 | 32 | public void setCode(Integer code) { 33 | this.code = code; 34 | } 35 | 36 | public String getTitle() { 37 | return title; 38 | } 39 | 40 | public void setTitle(String title) { 41 | this.title = title; 42 | } 43 | } -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/biz/AdminBiz.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz; 2 | 3 | import com.xxl.job.core.biz.model.HandleCallbackParam; 4 | import com.xxl.job.core.biz.model.RegistryParam; 5 | import com.xxl.job.core.biz.model.ReturnT; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author xuxueli 2017-07-27 21:52:49 11 | */ 12 | public interface AdminBiz { 13 | 14 | 15 | // ---------------------- callback ---------------------- 16 | 17 | /** 18 | * callback 19 | * 20 | * @param callbackParamList 21 | * @return 22 | */ 23 | public ReturnT callback(List callbackParamList); 24 | 25 | 26 | // ---------------------- registry ---------------------- 27 | 28 | /** 29 | * registry 30 | * 31 | * @param registryParam 32 | * @return 33 | */ 34 | public ReturnT registry(RegistryParam registryParam); 35 | 36 | /** 37 | * registry remove 38 | * 39 | * @param registryParam 40 | * @return 41 | */ 42 | public ReturnT registryRemove(RegistryParam registryParam); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/biz/ExecutorBiz.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz; 2 | 3 | import com.xxl.job.core.biz.model.LogResult; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | /** 8 | * Created by xuxueli on 17/3/1. 9 | */ 10 | public interface ExecutorBiz { 11 | 12 | /** 13 | * beat 14 | * @return 15 | */ 16 | public ReturnT beat(); 17 | 18 | /** 19 | * idle beat 20 | * 21 | * @param jobId 22 | * @return 23 | */ 24 | public ReturnT idleBeat(int jobId); 25 | 26 | /** 27 | * kill 28 | * @param jobId 29 | * @return 30 | */ 31 | public ReturnT kill(int jobId); 32 | 33 | /** 34 | * log 35 | * @param logDateTim 36 | * @param logId 37 | * @param fromLineNum 38 | * @return 39 | */ 40 | public ReturnT log(long logDateTim, long logId, int fromLineNum); 41 | 42 | /** 43 | * run 44 | * @param triggerParam 45 | * @return 46 | */ 47 | public ReturnT run(TriggerParam triggerParam); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /edu-pojo/src/main/java/com/clark/daxian/entity/user_center/User.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.entity.user_center; 2 | 3 | 4 | import com.clark.daxian.entity.base.BaseEntity; 5 | import com.clark.daxian.mybatis.annotation.Invisiable; 6 | import com.clark.daxian.mybatis.annotation.Table; 7 | import com.clark.daxian.mybatis.annotation.UserParent; 8 | import lombok.Data; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 用户实体 14 | */ 15 | @Data 16 | @Table(name = "user") 17 | @UserParent 18 | public class User extends BaseEntity implements Serializable { 19 | 20 | @Invisiable 21 | private static final long serialVersionUID = 5662750052896147675L; 22 | 23 | /** 24 | * 用户名称 25 | */ 26 | private String userName; 27 | /** 28 | * 邮箱,用户企业人员进行登录 29 | */ 30 | private String email; 31 | /** 32 | * 电话号码,用户客户登录 33 | */ 34 | private String telephone; 35 | /** 36 | * 密码 37 | */ 38 | private String password; 39 | /** 40 | * 头像 41 | */ 42 | private String headerUrl; 43 | /** 44 | * 登录状态 45 | * 1:允许 0:不允许 46 | */ 47 | private Integer loginStatus = 1; 48 | } 49 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/test/java/com/clark/daxian/test/RunTests.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.test; 2 | 3 | import com.clark.daxian.Run; 4 | import com.clark.daxian.api.mq.ProducerService; 5 | import com.clark.daxian.entity.User; 6 | import com.clark.daxian.mq.annotation.EnableRabbitMq; 7 | import com.clark.daxian.mq.config.RabbitConfig; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 12 | import org.springframework.boot.test.context.SpringBootTest; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest(classes = Run.class) 17 | @EnableAutoConfiguration 18 | @EnableRabbitMq 19 | public class RunTests { 20 | 21 | @Autowired 22 | private ProducerService producerService; 23 | 24 | @Test 25 | public void test() throws Exception { 26 | User user = new User(); 27 | user.setId("1"); 28 | user.setName("张三"); 29 | producerService.sendMsg(user, RabbitConfig.TEST_EXCHANGE,RabbitConfig.TEST_ROUTINGKEY); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobUser; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author xuxueli 2019-05-04 16:44:59 11 | */ 12 | @Mapper 13 | public interface XxlJobUserDao { 14 | 15 | public List pageList(@Param("offset") int offset, 16 | @Param("pagesize") int pagesize, 17 | @Param("username") String username, 18 | @Param("role") int role); 19 | public int pageListCount(@Param("offset") int offset, 20 | @Param("pagesize") int pagesize, 21 | @Param("username") String username, 22 | @Param("role") int role); 23 | 24 | public XxlJobUser loadByUserName(@Param("username") String username); 25 | 26 | public int save(XxlJobUser xxlJobUser); 27 | 28 | public int update(XxlJobUser xxlJobUser); 29 | 30 | public int delete(@Param("id") int id); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /edu-com/com-spring-boot-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | edu-com 5 | com.clark.daxian 6 | 1.0-SNAPSHOT 7 | 8 | 4.0.0 9 | com-spring-boot-starter 10 | jar 11 | 12 | com-spring-boot-starter 13 | 14 | https://github.com/daxian-zhu/online-edu-star 15 | 16 | 17 | 18 | 19 | org.springframework.boot 20 | spring-boot-autoconfigure 21 | 22 | 23 | 24 | com.clark.daxian 25 | com-spring-boot-autoconfigure 26 | ${project.version} 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | edu-auth 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | auth-spring-boot-starter 13 | 14 | auth-spring-boot-starter 15 | 16 | 授权中心starter 17 | 18 | 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-autoconfigure 24 | 25 | 26 | com.clark.daxian 27 | auth-spring-boot-autoconfigure 28 | ${project.version} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/util/FtlUtil.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.util; 2 | 3 | import freemarker.ext.beans.BeansWrapper; 4 | import freemarker.ext.beans.BeansWrapperBuilder; 5 | import freemarker.template.Configuration; 6 | import freemarker.template.TemplateHashModel; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | /** 11 | * ftl util 12 | * 13 | * @author xuxueli 2018-01-17 20:37:48 14 | */ 15 | public class FtlUtil { 16 | private static Logger logger = LoggerFactory.getLogger(FtlUtil.class); 17 | 18 | private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance(); 19 | 20 | public static TemplateHashModel generateStaticModel(String packageName) { 21 | try { 22 | TemplateHashModel staticModels = wrapper.getStaticModels(); 23 | TemplateHashModel fileStatics = (TemplateHashModel) staticModels.get(packageName); 24 | return fileStatics; 25 | } catch (Exception e) { 26 | logger.error(e.getMessage(), e); 27 | } 28 | return null; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/handler/webflux/WebfluxLogoutSuccessHandler.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.handler.webflux; 2 | 3 | import com.clark.daxian.auth.server.util.ResponseUtil; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.security.core.Authentication; 9 | import org.springframework.security.web.server.WebFilterExchange; 10 | import org.springframework.security.web.server.authentication.logout.ServerLogoutSuccessHandler; 11 | import reactor.core.publisher.Mono; 12 | 13 | /** 14 | * 退出成功处理逻辑 15 | * @author 大仙 16 | */ 17 | public class WebfluxLogoutSuccessHandler implements ServerLogoutSuccessHandler, ResponseUtil { 18 | 19 | private Logger logger = LoggerFactory.getLogger(getClass()); 20 | 21 | @Autowired 22 | private ObjectMapper objectMapper; 23 | 24 | 25 | @Override 26 | public Mono onLogoutSuccess(WebFilterExchange webFilterExchange, Authentication authentication) { 27 | return getResponse(webFilterExchange,objectMapper,"退出成功"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /edu-pojo/src/main/java/com/clark/daxian/entity/user_center/Permission.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.entity.user_center; 2 | 3 | import com.clark.daxian.entity.base.BaseEntity; 4 | import com.clark.daxian.enums.user_center.PermissionType; 5 | import com.clark.daxian.mybatis.annotation.Invisiable; 6 | import com.clark.daxian.mybatis.annotation.Table; 7 | import com.clark.daxian.mybatis.annotation.UserParent; 8 | import lombok.Data; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 权限表 14 | * @author 大仙 15 | */ 16 | @Data 17 | @Table(name = "permission") 18 | @UserParent 19 | public class Permission extends BaseEntity implements Serializable { 20 | 21 | 22 | @Invisiable 23 | private static final long serialVersionUID = -7559506107525485531L; 24 | /** 25 | * 权限名称 26 | */ 27 | private String authName; 28 | /** 29 | * 权限编码 30 | */ 31 | private String authCode; 32 | /** 33 | * 权限类型 34 | */ 35 | private PermissionType authType; 36 | /** 37 | * 路由地址 38 | */ 39 | private String requestUrl; 40 | /** 41 | * 状态 42 | */ 43 | private Integer status; 44 | /** 45 | * 父权限 46 | */ 47 | private Long parentPermission; 48 | } 49 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/test/java/com/clark/daxian/listener/TestDirectListener.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.listener; 2 | 3 | import com.clark.daxian.api.mq.entity.MqMessage; 4 | import com.clark.daxian.entity.User; 5 | import com.clark.daxian.mq.config.RabbitConfig; 6 | import com.clark.daxian.mq.listener.DefaultListener; 7 | import com.rabbitmq.client.Channel; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.amqp.core.Message; 10 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.io.IOException; 14 | 15 | @Component 16 | @Slf4j 17 | public class TestDirectListener extends DefaultListener { 18 | 19 | @Override 20 | protected void execute(User content) throws Exception { 21 | log.info("执行内容"+content.toString()); 22 | } 23 | 24 | @Override 25 | protected void failExecute(User content) { 26 | log.info("失败处理"+content.toString()); 27 | } 28 | 29 | @RabbitListener(queues=RabbitConfig.TEST_QUEUE) 30 | @Override 31 | protected void receiveMessage(Message message, Channel channel) throws IOException{ 32 | super.receiveMessage(message,channel); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.mapper; 2 | 3 | 4 | import com.clark.daxian.entity.user_center.Role; 5 | import com.clark.daxian.mybatis.mapper.BaseMapper; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.apache.ibatis.annotations.Select; 9 | import org.apache.ibatis.annotations.Update; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * 角色管理数据层 15 | * @author 大仙 16 | */ 17 | @Mapper 18 | public interface RoleMapper extends BaseMapper { 19 | 20 | /** 21 | * 查询角色列表 22 | * @param userId 23 | * @return 24 | */ 25 | @Select("select r.* from user u" + 26 | " LEFT JOIN user_role_rel urr ON urr.USER_ID = u.ID " + 27 | " LEFT JOIN role r on urr.ROLE_ID = r.ID " + 28 | " where u.ID = #{userId} AND r.STATUS = 1 ") 29 | List getRoleByUser(@Param("userId") Long userId); 30 | 31 | /** 32 | * 变更角色 33 | * @param id 34 | * @param status 35 | */ 36 | @Update("update role set STATUS = #{status} where ID = #{id}") 37 | void updateStatus(@Param("id") Long id,@Param("status") Integer status); 38 | } 39 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/properties/AuthServerProperties.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.properties; 2 | 3 | 4 | import lombok.Data; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.core.io.Resource; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * 认证服务器配置 13 | * @author 大仙 14 | */ 15 | @Data 16 | @ConfigurationProperties(prefix = "edu.auth.server") 17 | public class AuthServerProperties implements Serializable { 18 | /** 19 | * 最大登录次数 20 | */ 21 | private Integer maxClient; 22 | /** 23 | * 最大有效时间,单位秒 24 | */ 25 | private Integer tokenValid; 26 | /** 27 | * 是否允许强行登录 28 | */ 29 | private Boolean force; 30 | /** 31 | * 是否开启刷新token 32 | */ 33 | private Boolean startRefresh; 34 | /** 35 | * 刷新token有效时间 36 | */ 37 | private Integer refreshTokenValid; 38 | /** 39 | * 路径 40 | */ 41 | private Resource keyPath; 42 | /** 43 | * 别名 44 | */ 45 | private String alias; 46 | /** 47 | * 密码 48 | */ 49 | private String secret; 50 | } 51 | -------------------------------------------------------------------------------- /edu-com/com-wechat-service/src/main/java/com/clark/daxian/wechat/properties/WeChatProperties.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.wechat.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.io.Serializable; 7 | 8 | @Data 9 | @ConfigurationProperties(prefix = "edu.wechat") 10 | public class WeChatProperties implements Serializable { 11 | /** 12 | * 设置微信公众号的appid 13 | */ 14 | private String appId; 15 | /** 16 | * 微信公众号Secret 17 | */ 18 | private String appSecret; 19 | /** 20 | * 使用开启token缓存 21 | */ 22 | private Boolean startTokenCache = false; 23 | 24 | /** 25 | * 微信支付商户号 26 | */ 27 | private String mchId; 28 | 29 | /** 30 | * 微信支付商户密钥 31 | */ 32 | private String mchKey; 33 | 34 | /** 35 | * 服务商模式下的子商户公众账号ID,普通模式请不要配置,请在配置文件中将对应项删除 36 | */ 37 | @Deprecated 38 | private String subAppId; 39 | 40 | /** 41 | * 服务商模式下的子商户号,普通模式请不要配置,最好是请在配置文件中将对应项删除 42 | */ 43 | @Deprecated 44 | private String subMchId; 45 | 46 | /** 47 | * apiclient_cert.p12文件的绝对路径,或者如果放在项目中,请以classpath:开头指定 48 | */ 49 | private String keyPath; 50 | } 51 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/old/RemoteHttpJobBean.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.old;//package com.xxl.job.admin.core.jobbean; 2 | // 3 | //import com.xxl.job.admin.core.thread.JobTriggerPoolHelper; 4 | //import com.xxl.job.admin.core.trigger.TriggerTypeEnum; 5 | //import org.quartz.JobExecutionContext; 6 | //import org.quartz.JobExecutionException; 7 | //import org.quartz.JobKey; 8 | //import org.slf4j.Logger; 9 | //import org.slf4j.LoggerFactory; 10 | //import org.springframework.scheduling.quartz.QuartzJobBean; 11 | // 12 | ///** 13 | // * http job bean 14 | // * “@DisallowConcurrentExecution” disable concurrent, thread size can not be only one, better given more 15 | // * @author xuxueli 2015-12-17 18:20:34 16 | // */ 17 | ////@DisallowConcurrentExecution 18 | //public class RemoteHttpJobBean extends QuartzJobBean { 19 | // private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class); 20 | // 21 | // @Override 22 | // protected void executeInternal(JobExecutionContext context) 23 | // throws JobExecutionException { 24 | // 25 | // // load jobId 26 | // JobKey jobKey = context.getTrigger().getJobKey(); 27 | // Integer jobId = Integer.valueOf(jobKey.getName()); 28 | // 29 | // 30 | // } 31 | // 32 | //} -------------------------------------------------------------------------------- /edu-gateway/src/main/resources/bootstrap-dev.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8661 3 | spring: 4 | application: 5 | name: gateway 6 | cloud: 7 | nacos: 8 | discovery: 9 | server-addr: 127.0.0.1:8848 10 | config: 11 | server-addr: 127.0.0.1:8848 12 | file-extension: yaml 13 | #开启自动路由 14 | gateway: 15 | discovery: 16 | locator: 17 | enabled: true 18 | lower-case-service-id: true 19 | routes: 20 | - id: auth #权限 21 | uri: lb://oauth2-server 22 | order: 0 23 | predicates: 24 | - Path=/auth/** 25 | filters: 26 | - StripPrefix=1 27 | #redis配置 28 | redis: 29 | host: 127.0.0.1 30 | password: 31 | port: 6379 32 | database: 0 33 | timeout: 60000 34 | security: 35 | oauth2: 36 | resourceserver: 37 | jwt: 38 | jwk-set-uri: http://localhost:8663/pub-key/jwt.json 39 | edu: 40 | security: 41 | ignored: | 42 | /favicon.ico, 43 | /user/v2/api-docs/**,/user/webjars/**,/user/swagger-resources/**,/user/*.html, 44 | /im/v2/api-docs/**,/im/webjars/**,/im/swagger-resources/**,/im/*.html, 45 | /auth/login 46 | notRole: | 47 | /user,/user/permission/all -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/util/ShardingUtil.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.util; 2 | 3 | /** 4 | * sharding vo 5 | * @author xuxueli 2017-07-25 21:26:38 6 | */ 7 | public class ShardingUtil { 8 | 9 | private static InheritableThreadLocal contextHolder = new InheritableThreadLocal(); 10 | 11 | public static class ShardingVO { 12 | 13 | private int index; // sharding index 14 | private int total; // sharding total 15 | 16 | public ShardingVO(int index, int total) { 17 | this.index = index; 18 | this.total = total; 19 | } 20 | 21 | public int getIndex() { 22 | return index; 23 | } 24 | 25 | public void setIndex(int index) { 26 | this.index = index; 27 | } 28 | 29 | public int getTotal() { 30 | return total; 31 | } 32 | 33 | public void setTotal(int total) { 34 | this.total = total; 35 | } 36 | } 37 | 38 | public static void setShardingVo(ShardingVO shardingVo){ 39 | contextHolder.set(shardingVo); 40 | } 41 | 42 | public static ShardingVO getShardingVo(){ 43 | return contextHolder.get(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/config/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.config; 2 | 3 | import com.clark.daxian.entity.user_center.Permission; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.data.redis.connection.RedisConnectionFactory; 8 | import org.springframework.data.redis.core.RedisTemplate; 9 | import org.springframework.data.redis.serializer.StringRedisSerializer; 10 | 11 | /** 12 | * redis配置 13 | * @author 大仙 14 | * 15 | */ 16 | @Configuration 17 | public class RedisConfig { 18 | 19 | @Autowired 20 | private RedisConnectionFactory redisConnectionFactory; 21 | /** 22 | * 存储权限 23 | * @return 24 | */ 25 | @Bean 26 | public RedisTemplate permissionRedisTemplate() { 27 | RedisTemplate redisTemplate = new RedisTemplate<>(); 28 | redisTemplate.setKeySerializer(new StringRedisSerializer()); 29 | redisTemplate.setValueSerializer(new RedisObjectSerializer()); 30 | redisTemplate.setConnectionFactory(redisConnectionFactory); 31 | return redisTemplate; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/handler/web/WebLogoutSuccessHandler.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.handler.web; 2 | 3 | import com.clark.daxian.auth.server.util.ResponseUtil; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.security.core.Authentication; 9 | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | 16 | /** 17 | * 退出成功处理逻辑 18 | * @author 大仙 19 | */ 20 | public class WebLogoutSuccessHandler implements LogoutSuccessHandler, ResponseUtil { 21 | 22 | private Logger logger = LoggerFactory.getLogger(getClass()); 23 | 24 | @Autowired 25 | private ObjectMapper objectMapper; 26 | 27 | @Override 28 | public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { 29 | getResponseWeb(response,objectMapper,"退出成功"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.model; 2 | 3 | import java.util.Date; 4 | 5 | public class XxlJobLogReport { 6 | 7 | private int id; 8 | 9 | private Date triggerDay; 10 | 11 | private int runningCount; 12 | private int sucCount; 13 | private int failCount; 14 | 15 | public int getId() { 16 | return id; 17 | } 18 | 19 | public void setId(int id) { 20 | this.id = id; 21 | } 22 | 23 | public Date getTriggerDay() { 24 | return triggerDay; 25 | } 26 | 27 | public void setTriggerDay(Date triggerDay) { 28 | this.triggerDay = triggerDay; 29 | } 30 | 31 | public int getRunningCount() { 32 | return runningCount; 33 | } 34 | 35 | public void setRunningCount(int runningCount) { 36 | this.runningCount = runningCount; 37 | } 38 | 39 | public int getSucCount() { 40 | return sucCount; 41 | } 42 | 43 | public void setSucCount(int sucCount) { 44 | this.sucCount = sucCount; 45 | } 46 | 47 | public int getFailCount() { 48 | return failCount; 49 | } 50 | 51 | public void setFailCount(int failCount) { 52 | this.failCount = failCount; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/handler/IJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.handler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | 5 | import java.lang.reflect.InvocationTargetException; 6 | 7 | /** 8 | * job handler 9 | * 10 | * @author xuxueli 2015-12-19 19:06:38 11 | */ 12 | public abstract class IJobHandler { 13 | 14 | 15 | /** success */ 16 | public static final ReturnT SUCCESS = new ReturnT(200, null); 17 | /** fail */ 18 | public static final ReturnT FAIL = new ReturnT(500, null); 19 | /** fail timeout */ 20 | public static final ReturnT FAIL_TIMEOUT = new ReturnT(502, null); 21 | 22 | 23 | /** 24 | * execute handler, invoked when executor receives a scheduling request 25 | * 26 | * @param param 27 | * @return 28 | * @throws Exception 29 | */ 30 | public abstract ReturnT execute(String param) throws Exception; 31 | 32 | 33 | /** 34 | * init handler, invoked when JobThread init 35 | */ 36 | public void init() throws InvocationTargetException, IllegalAccessException { 37 | // do something 38 | } 39 | 40 | 41 | /** 42 | * destroy handler, invoked when JobThread destroy 43 | */ 44 | public void destroy() throws InvocationTargetException, IllegalAccessException { 45 | // do something 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/handler/webflux/WebfluxLoginFailureHandler.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.handler.webflux; 2 | 3 | import com.clark.daxian.auth.server.util.ResponseUtil; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.authentication.BadCredentialsException; 7 | import org.springframework.security.core.AuthenticationException; 8 | import org.springframework.security.web.server.WebFilterExchange; 9 | import org.springframework.security.web.server.authentication.ServerAuthenticationFailureHandler; 10 | import reactor.core.publisher.Mono; 11 | 12 | /** 13 | * @Author: 朱维 14 | * @Date 1:55 2019/11/28 15 | */ 16 | public class WebfluxLoginFailureHandler implements ServerAuthenticationFailureHandler, ResponseUtil { 17 | 18 | @Autowired 19 | private ObjectMapper objectMapper; 20 | 21 | @Override 22 | public Mono onAuthenticationFailure(WebFilterExchange webFilterExchange, AuthenticationException exception) { 23 | String msg = null; 24 | if (exception instanceof BadCredentialsException) { 25 | msg = "账号或密码错误"; 26 | } else { 27 | msg = "认证失败:"+exception.getMessage(); 28 | } 29 | return getResponse(webFilterExchange,objectMapper,msg); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/config/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.config; 2 | 3 | import com.clark.daxian.auth.api.entity.TokenEntity; 4 | import io.netty.channel.ChannelHandlerContext; 5 | import io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.data.redis.connection.RedisConnectionFactory; 10 | import org.springframework.data.redis.core.RedisTemplate; 11 | import org.springframework.data.redis.serializer.StringRedisSerializer; 12 | 13 | /** 14 | * redis配置 15 | * @author 大仙 16 | * 17 | */ 18 | @Configuration 19 | public class RedisConfig { 20 | 21 | @Autowired 22 | private RedisConnectionFactory redisConnectionFactory; 23 | 24 | /** 25 | * 存储tokenEntity 26 | * @return 27 | */ 28 | @Bean 29 | public RedisTemplate tokenEntityRedisTemplate() { 30 | RedisTemplate redisTemplate = new RedisTemplate<>(); 31 | redisTemplate.setKeySerializer(new StringRedisSerializer()); 32 | redisTemplate.setValueSerializer(new RedisObjectSerializer()); 33 | redisTemplate.setConnectionFactory(redisConnectionFactory); 34 | return redisTemplate; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by xuxueli on 16/9/30. 7 | */ 8 | public class XxlJobRegistry { 9 | 10 | private int id; 11 | private String registryGroup; 12 | private String registryKey; 13 | private String registryValue; 14 | private Date updateTime; 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getRegistryGroup() { 25 | return registryGroup; 26 | } 27 | 28 | public void setRegistryGroup(String registryGroup) { 29 | this.registryGroup = registryGroup; 30 | } 31 | 32 | public String getRegistryKey() { 33 | return registryKey; 34 | } 35 | 36 | public void setRegistryKey(String registryKey) { 37 | this.registryKey = registryKey; 38 | } 39 | 40 | public String getRegistryValue() { 41 | return registryValue; 42 | } 43 | 44 | public void setRegistryValue(String registryValue) { 45 | this.registryValue = registryValue; 46 | } 47 | 48 | public Date getUpdateTime() { 49 | return updateTime; 50 | } 51 | 52 | public void setUpdateTime(Date updateTime) { 53 | this.updateTime = updateTime; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/mapper/PermissionMapper.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.mapper; 2 | 3 | import com.clark.daxian.entity.user_center.Permission; 4 | import com.clark.daxian.mybatis.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | import org.apache.ibatis.annotations.Update; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 权限管理 14 | * @author 大仙 15 | */ 16 | @Mapper 17 | public interface PermissionMapper extends BaseMapper { 18 | /** 19 | * 根据角色查询权限 20 | * @param roleId 21 | * @return 22 | */ 23 | @Select(" select p.* from role r " + 24 | " LEFT JOIN role_permission_rel rpr ON r.ID = rpr.ROLE_ID " + 25 | " LEFT JOIN permission p ON rpr.PERMISSION_ID = p.ID " + 26 | " where r.ID = #{roleId} AND p.STATUS = 1 ") 27 | List getPermissionByRole(@Param("roleId") Long roleId); 28 | /** 29 | * 修改状态 30 | * @param id 31 | * @param status 32 | */ 33 | @Update(" update permission set STATUS = #{status} where ID = #{id} ") 34 | void updateStatus(@Param("id") Long id,@Param("status") Integer status); 35 | 36 | /** 37 | * 查询所有的权限集合 38 | * @return 39 | */ 40 | @Select("select * from permission where STATUS = 1 ") 41 | List all(); 42 | } 43 | -------------------------------------------------------------------------------- /docs/nacos/NOTICE: -------------------------------------------------------------------------------- 1 | Nacos 2 | Copyright 2018-2019 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Alibaba MiddleWare Group. 6 | 7 | ------ 8 | This product has a bundle netty: 9 | The Spring oot Project 10 | ================= 11 | 12 | Please visit the Netty web site for more information: 13 | 14 | * http://netty.io/ 15 | 16 | Copyright 2014 The Netty Project 17 | 18 | The Netty Project licenses this file to you under the Apache License, 19 | version 2.0 (the "License"); you may not use this file except in compliance 20 | with the License. You may obtain a copy of the License at: 21 | 22 | http://www.apache.org/licenses/LICENSE-2.0 23 | 24 | Unless required by applicable law or agreed to in writing, software 25 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 26 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 27 | License for the specific language governing permissions and limitations 28 | under the License. 29 | 30 | Also, please refer to each LICENSE..txt file, which is located in 31 | the 'license' directory of the distribution file, for the license terms of the 32 | components that this product depends on. 33 | 34 | ------ 35 | This product has a bundle commons-lang, which includes software from the Spring Framework, 36 | under the Apache License 2.0 (see: StringUtils.containsWhitespace()) -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/old/XxlJobThreadPool.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.old;//package com.xxl.job.admin.core.quartz; 2 | // 3 | //import org.quartz.SchedulerConfigException; 4 | //import org.quartz.spi.ThreadPool; 5 | // 6 | ///** 7 | // * single thread pool, for async trigger 8 | // * 9 | // * @author xuxueli 2019-03-06 10 | // */ 11 | //public class XxlJobThreadPool implements ThreadPool { 12 | // 13 | // @Override 14 | // public boolean runInThread(Runnable runnable) { 15 | // 16 | // // async run 17 | // runnable.run(); 18 | // return true; 19 | // 20 | // //return false; 21 | // } 22 | // 23 | // @Override 24 | // public int blockForAvailableThreads() { 25 | // return 1; 26 | // } 27 | // 28 | // @Override 29 | // public void initialize() throws SchedulerConfigException { 30 | // 31 | // } 32 | // 33 | // @Override 34 | // public void shutdown(boolean waitForJobsToComplete) { 35 | // 36 | // } 37 | // 38 | // @Override 39 | // public int getPoolSize() { 40 | // return 1; 41 | // } 42 | // 43 | // @Override 44 | // public void setInstanceId(String schedInstId) { 45 | // 46 | // } 47 | // 48 | // @Override 49 | // public void setInstanceName(String schedName) { 50 | // 51 | // } 52 | // 53 | // // support 54 | // public void setThreadCount(int count) { 55 | // // 56 | // } 57 | // 58 | //} 59 | -------------------------------------------------------------------------------- /edu-com/com-wechat-service/src/main/java/com/clark/daxian/wechat/util/WXPayXmlUtil.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.wechat.util; 2 | import org.w3c.dom.Document; 3 | 4 | import javax.xml.XMLConstants; 5 | import javax.xml.parsers.DocumentBuilder; 6 | import javax.xml.parsers.DocumentBuilderFactory; 7 | import javax.xml.parsers.ParserConfigurationException; 8 | 9 | public final class WXPayXmlUtil { 10 | public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { 11 | DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); 12 | documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); 13 | documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); 14 | documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); 15 | documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); 16 | documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); 17 | documentBuilderFactory.setXIncludeAware(false); 18 | documentBuilderFactory.setExpandEntityReferences(false); 19 | 20 | return documentBuilderFactory.newDocumentBuilder(); 21 | } 22 | 23 | public static Document newDocument() throws ParserConfigurationException { 24 | return newDocumentBuilder().newDocument(); 25 | } 26 | } -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/biz/model/LogResult.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by xuxueli on 17/3/23. 7 | */ 8 | public class LogResult implements Serializable { 9 | private static final long serialVersionUID = 42L; 10 | 11 | public LogResult(int fromLineNum, int toLineNum, String logContent, boolean isEnd) { 12 | this.fromLineNum = fromLineNum; 13 | this.toLineNum = toLineNum; 14 | this.logContent = logContent; 15 | this.isEnd = isEnd; 16 | } 17 | 18 | private int fromLineNum; 19 | private int toLineNum; 20 | private String logContent; 21 | private boolean isEnd; 22 | 23 | public int getFromLineNum() { 24 | return fromLineNum; 25 | } 26 | 27 | public void setFromLineNum(int fromLineNum) { 28 | this.fromLineNum = fromLineNum; 29 | } 30 | 31 | public int getToLineNum() { 32 | return toLineNum; 33 | } 34 | 35 | public void setToLineNum(int toLineNum) { 36 | this.toLineNum = toLineNum; 37 | } 38 | 39 | public String getLogContent() { 40 | return logContent; 41 | } 42 | 43 | public void setLogContent(String logContent) { 44 | this.logContent = logContent; 45 | } 46 | 47 | public boolean isEnd() { 48 | return isEnd; 49 | } 50 | 51 | public void setEnd(boolean end) { 52 | isEnd = end; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/biz/model/ReturnT.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * common return 7 | * @author xuxueli 2015-12-4 16:32:31 8 | * @param 9 | */ 10 | public class ReturnT implements Serializable { 11 | public static final long serialVersionUID = 42L; 12 | 13 | public static final int SUCCESS_CODE = 200; 14 | public static final int FAIL_CODE = 500; 15 | 16 | public static final ReturnT SUCCESS = new ReturnT(null); 17 | public static final ReturnT FAIL = new ReturnT(FAIL_CODE, null); 18 | 19 | private int code; 20 | private String msg; 21 | private T content; 22 | 23 | public ReturnT(){} 24 | public ReturnT(int code, String msg) { 25 | this.code = code; 26 | this.msg = msg; 27 | } 28 | public ReturnT(T content) { 29 | this.code = SUCCESS_CODE; 30 | this.content = content; 31 | } 32 | 33 | public int getCode() { 34 | return code; 35 | } 36 | public void setCode(int code) { 37 | this.code = code; 38 | } 39 | public String getMsg() { 40 | return msg; 41 | } 42 | public void setMsg(String msg) { 43 | this.msg = msg; 44 | } 45 | public T getContent() { 46 | return content; 47 | } 48 | public void setContent(T content) { 49 | this.content = content; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "ReturnT [code=" + code + ", msg=" + msg + ", content=" + content + "]"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.mapper; 2 | 3 | import com.clark.daxian.dto.user.UserRequest; 4 | import com.clark.daxian.entity.user_center.User; 5 | import com.clark.daxian.mybatis.mapper.BaseMapper; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.apache.ibatis.annotations.Select; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 用户数据接口 14 | * @author 大仙 15 | */ 16 | @Mapper 17 | public interface UserMapper extends BaseMapper { 18 | 19 | /** 20 | * 根据电话号码查询用户 21 | * @param telephone 22 | * @return 23 | */ 24 | @Select("select * from user where TELEPHONE = #{telephone}") 25 | User getByTel(@Param("telephone") String telephone); 26 | 27 | /** 28 | * 根据邮箱查询用户 29 | * @param email 30 | * @return 31 | */ 32 | @Select("select * from user where EMAIL = #{email}") 33 | User getByEmail(@Param("email")String email); 34 | 35 | /** 36 | * 查询用户列表 37 | * @param params 38 | * @return 39 | */ 40 | @Select(" ") 45 | List userList(@Param("params") UserRequest params); 46 | } 47 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/handler/web/WebLoginFailureHandler.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.handler.web; 2 | 3 | import com.clark.daxian.auth.server.util.ResponseUtil; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.authentication.BadCredentialsException; 7 | import org.springframework.security.core.AuthenticationException; 8 | import org.springframework.security.web.authentication.AuthenticationFailureHandler; 9 | 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import java.io.IOException; 14 | 15 | /** 16 | * @Author: 朱维 17 | * @Date 1:55 2019/11/28 18 | */ 19 | public class WebLoginFailureHandler implements AuthenticationFailureHandler, ResponseUtil { 20 | 21 | 22 | @Autowired 23 | private ObjectMapper objectMapper; 24 | 25 | @Override 26 | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { 27 | String msg = null; 28 | if (exception instanceof BadCredentialsException) { 29 | msg = "账号或密码错误"; 30 | } else { 31 | msg = exception.getMessage(); 32 | } 33 | response.setStatus(500); 34 | getResponseWeb(response,objectMapper,msg); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/config/MybatisConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.config; 2 | 3 | import org.apache.ibatis.binding.MapperRegistry; 4 | import org.apache.ibatis.session.Configuration; 5 | import org.apache.ibatis.session.SqlSession; 6 | 7 | /** 8 | * 重写mybatis的configureation 9 | * @author 大仙 10 | */ 11 | public class MybatisConfig extends Configuration { 12 | 13 | protected final MapperRegistry mapperRegistry; 14 | 15 | public MybatisConfig(){ 16 | super(); 17 | this.mapperRegistry = new MybatisMapperRegistry(this); 18 | this.mapUnderscoreToCamelCase = true; 19 | } 20 | 21 | @Override 22 | public MapperRegistry getMapperRegistry() { 23 | return this.mapperRegistry; 24 | } 25 | @Override 26 | public void addMappers(String packageName, Class superType) { 27 | this.mapperRegistry.addMappers(packageName, superType); 28 | } 29 | 30 | @Override 31 | public void addMappers(String packageName) { 32 | this.mapperRegistry.addMappers(packageName); 33 | } 34 | 35 | @Override 36 | public void addMapper(Class type) { 37 | this.mapperRegistry.addMapper(type); 38 | } 39 | 40 | @Override 41 | public T getMapper(Class type, SqlSession sqlSession) { 42 | return this.mapperRegistry.getMapper(type, sqlSession); 43 | } 44 | 45 | @Override 46 | public boolean hasMapper(Class type) { 47 | return this.mapperRegistry.hasMapper(type); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/util/UrlUtil.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.util; 2 | 3 | import com.clark.daxian.im.exception.ImException; 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | /** 7 | * 处理URL的工具类 8 | */ 9 | public class UrlUtil { 10 | 11 | /** 12 | * 获取请求参数 13 | * @param url 14 | * @param name 15 | * @return 16 | */ 17 | public static String getParam(String url,String name){ 18 | if(StringUtils.isBlank(url)||StringUtils.isBlank(name)){ 19 | throw new ImException("请确认查询参数"); 20 | } 21 | String[] arr1 = url.split("\\?"); 22 | if(arr1.length<2){ 23 | throw new ImException("请携带请求凭证",403); 24 | } 25 | String[] params = arr1[1].split("&"); 26 | for(String param :params){ 27 | String[] map = param.split("="); 28 | if(map.length<2){ 29 | continue; 30 | } 31 | if(StringUtils.isBlank(map[0])){ 32 | continue; 33 | } 34 | if(map[0].equals(name)){ 35 | return map[1]; 36 | } 37 | } 38 | throw new ImException("找不到该请求参数"); 39 | } 40 | 41 | /** 42 | * 获取无参数的URL 43 | * @param url 44 | * @return 45 | */ 46 | public static String getUrl(String url){ 47 | if(StringUtils.isBlank(url)){ 48 | throw new ImException("请确认查询参数"); 49 | } 50 | String[] arr1 = url.split("\\?"); 51 | return arr1[0]; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/controller/SendController.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.controller; 2 | 3 | import com.clark.daxian.api.mq.ProducerService; 4 | import com.clark.daxian.api.response.ComResponse; 5 | import com.clark.daxian.im.entity.WsMessage; 6 | import com.clark.daxian.im.netty.handler.AbstractHandler; 7 | import com.clark.daxian.mq.config.RabbitConfig; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiOperation; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.PostMapping; 13 | import org.springframework.web.bind.annotation.RequestBody; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | @RestController 17 | @Api(tags = "发送消息") 18 | @Slf4j 19 | public class SendController implements AbstractHandler { 20 | 21 | @Autowired 22 | private ProducerService producerService; 23 | 24 | /** 25 | * 发送消息 26 | * @param wsMessage 27 | * @return 28 | */ 29 | @PostMapping("/send") 30 | @ApiOperation(value = "发送消息") 31 | public ComResponse senMessage(@RequestBody WsMessage wsMessage){ 32 | //先本地发 33 | Boolean result = sendMessage(wsMessage.getTo(),wsMessage.getContent()); 34 | //本地发送失败,广播出去发送 35 | if(!result){ 36 | producerService.sendMsg(wsMessage, RabbitConfig.WEBSOCKET_EX,null); 37 | log.info("广播出去"); 38 | } 39 | return ComResponse.successResponse(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/glue/GlueTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.glue; 2 | 3 | /** 4 | * Created by xuxueli on 17/4/26. 5 | */ 6 | public enum GlueTypeEnum { 7 | 8 | BEAN("BEAN", false, null, null), 9 | GLUE_GROOVY("GLUE(Java)", false, null, null), 10 | GLUE_SHELL("GLUE(Shell)", true, "bash", ".sh"), 11 | GLUE_PYTHON("GLUE(Python)", true, "python", ".py"), 12 | GLUE_PHP("GLUE(PHP)", true, "php", ".php"), 13 | GLUE_NODEJS("GLUE(Nodejs)", true, "node", ".js"), 14 | GLUE_POWERSHELL("GLUE(PowerShell)", true, "powershell", ".ps1"); 15 | 16 | private String desc; 17 | private boolean isScript; 18 | private String cmd; 19 | private String suffix; 20 | 21 | private GlueTypeEnum(String desc, boolean isScript, String cmd, String suffix) { 22 | this.desc = desc; 23 | this.isScript = isScript; 24 | this.cmd = cmd; 25 | this.suffix = suffix; 26 | } 27 | 28 | public String getDesc() { 29 | return desc; 30 | } 31 | 32 | public boolean isScript() { 33 | return isScript; 34 | } 35 | 36 | public String getCmd() { 37 | return cmd; 38 | } 39 | 40 | public String getSuffix() { 41 | return suffix; 42 | } 43 | 44 | public static GlueTypeEnum match(String name){ 45 | for (GlueTypeEnum item: GlueTypeEnum.values()) { 46 | if (item.name().equals(name)) { 47 | return item; 48 | } 49 | } 50 | return null; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /edu-job/job-spring-boot-autoconfigure/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | edu-job 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | job-spring-boot-autoconfigure 13 | 14 | job-spring-boot-autoconfigure 15 | 16 | 17 | com.clark.daxian 18 | job-core-provider 19 | ${project.version} 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-configuration-processor 29 | true 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-autoconfigure 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /mybatis-plugins/src/main/java/com/clark/daxian/mybatis/mapper/BaseMapper.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mybatis.mapper; 2 | 3 | import com.clark.daxian.mybatis.driver.BaseMapperDriver; 4 | import org.apache.ibatis.annotations.*; 5 | 6 | /** 7 | * 基础base 8 | * @param 9 | * @param 10 | */ 11 | public interface BaseMapper { 12 | /** 13 | * 插入 14 | * @param model 15 | * @return 16 | */ 17 | @Lang(BaseMapperDriver.class) 18 | @Insert({""}) 19 | @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id") 20 | Long insert(T model); 21 | 22 | /** 23 | * 修改 24 | * @param model 25 | * @return 26 | */ 27 | @Lang(BaseMapperDriver.class) 28 | @Update({""}) 29 | Long updateById(T model); 30 | 31 | /** 32 | * 删除 33 | * @param id 34 | * @return 35 | */ 36 | @Lang(BaseMapperDriver.class) 37 | @Delete("DELETE FROM ${table} WHERE ${id}=#{id}") 38 | Long deleteById(@Param("id") K id); 39 | 40 | /** 41 | * 根据ID获取 42 | * @param id 43 | * @return 44 | */ 45 | @Lang(BaseMapperDriver.class) 46 | @Select("SELECT * FROM ${table} WHERE ${id}=#{id}") 47 | T getById(@Param("id") K id); 48 | 49 | /** 50 | * 判断是否存在 51 | * @param id 52 | * @return 53 | */ 54 | @Lang(BaseMapperDriver.class) 55 | @Select("SELECT COUNT(1) FROM ${table} WHERE ${id}=#{id}") 56 | Boolean existById(@Param("id") K id); 57 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRound.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route.strategy; 2 | 3 | import com.xxl.job.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | import java.util.Random; 9 | import java.util.concurrent.ConcurrentHashMap; 10 | import java.util.concurrent.ConcurrentMap; 11 | 12 | /** 13 | * Created by xuxueli on 17/3/10. 14 | */ 15 | public class ExecutorRouteRound extends ExecutorRouter { 16 | 17 | private static ConcurrentMap routeCountEachJob = new ConcurrentHashMap(); 18 | private static long CACHE_VALID_TIME = 0; 19 | private static int count(int jobId) { 20 | // cache clear 21 | if (System.currentTimeMillis() > CACHE_VALID_TIME) { 22 | routeCountEachJob.clear(); 23 | CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24; 24 | } 25 | 26 | // count++ 27 | Integer count = routeCountEachJob.get(jobId); 28 | count = (count==null || count>1000000)?(new Random().nextInt(100)):++count; // 初始化时主动Random一次,缓解首次压力 29 | routeCountEachJob.put(jobId, count); 30 | return count; 31 | } 32 | 33 | @Override 34 | public ReturnT route(TriggerParam triggerParam, List addressList) { 35 | String address = addressList.get(count(triggerParam.getJobId())%addressList.size()); 36 | return new ReturnT(address); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.controller.interceptor; 2 | 3 | import com.xxl.job.admin.core.util.FtlUtil; 4 | import com.xxl.job.admin.core.util.I18nUtil; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.servlet.ModelAndView; 7 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; 8 | 9 | import javax.servlet.http.Cookie; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.util.HashMap; 13 | 14 | /** 15 | * push cookies to model as cookieMap 16 | * 17 | * @author xuxueli 2015-12-12 18:09:04 18 | */ 19 | @Component 20 | public class CookieInterceptor extends HandlerInterceptorAdapter { 21 | 22 | @Override 23 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, 24 | ModelAndView modelAndView) throws Exception { 25 | 26 | // cookie 27 | if (modelAndView!=null && request.getCookies()!=null && request.getCookies().length>0) { 28 | HashMap cookieMap = new HashMap(); 29 | for (Cookie ck : request.getCookies()) { 30 | cookieMap.put(ck.getName(), ck); 31 | } 32 | modelAndView.addObject("cookieMap", cookieMap); 33 | } 34 | 35 | // static method 36 | if (modelAndView != null) { 37 | modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName())); 38 | } 39 | 40 | super.postHandle(request, response, handler, modelAndView); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /edu-com/com-spring-boot-autoconfigure/src/main/java/com/clark/daxian/config/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.config; 2 | 3 | import com.clark.daxian.api.exception.EduException; 4 | import com.clark.daxian.api.response.ComResponse; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.validation.FieldError; 7 | import org.springframework.web.bind.MethodArgumentNotValidException; 8 | import org.springframework.web.bind.annotation.ControllerAdvice; 9 | import org.springframework.web.bind.annotation.ExceptionHandler; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | import org.springframework.web.bind.annotation.ResponseStatus; 12 | 13 | /** 14 | * 全局异常捕获 15 | * @author 大仙 16 | */ 17 | @ControllerAdvice 18 | public class GlobalExceptionHandler { 19 | /** 20 | * 处理验证信息返回 21 | * @param ex 22 | * @return 23 | */ 24 | @ExceptionHandler(MethodArgumentNotValidException.class) 25 | @ResponseBody 26 | public ComResponse handleBindException(MethodArgumentNotValidException ex) { 27 | FieldError fieldError = ex.getBindingResult().getFieldError(); 28 | return ComResponse.failResponse(null,500,fieldError.getDefaultMessage()); 29 | } 30 | 31 | /** 32 | * 处理自定义异常 33 | * @param ex 34 | * @return 35 | */ 36 | @ExceptionHandler(EduException.class) 37 | @ResponseBody 38 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 39 | public ComResponse handleOrderException(EduException ex) { 40 | return ComResponse.failResponse(null,ex.getCode()==null?500:ex.getCode(),ex.getMessage()); 41 | } 42 | } -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/biz/model/HandleCallbackParam.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by xuxueli on 17/3/2. 7 | */ 8 | public class HandleCallbackParam implements Serializable { 9 | private static final long serialVersionUID = 42L; 10 | 11 | private long logId; 12 | private long logDateTim; 13 | 14 | private ReturnT executeResult; 15 | 16 | public HandleCallbackParam(){} 17 | public HandleCallbackParam(long logId, long logDateTim, ReturnT executeResult) { 18 | this.logId = logId; 19 | this.logDateTim = logDateTim; 20 | this.executeResult = executeResult; 21 | } 22 | 23 | public long getLogId() { 24 | return logId; 25 | } 26 | 27 | public void setLogId(long logId) { 28 | this.logId = logId; 29 | } 30 | 31 | public long getLogDateTim() { 32 | return logDateTim; 33 | } 34 | 35 | public void setLogDateTim(long logDateTim) { 36 | this.logDateTim = logDateTim; 37 | } 38 | 39 | public ReturnT getExecuteResult() { 40 | return executeResult; 41 | } 42 | 43 | public void setExecuteResult(ReturnT executeResult) { 44 | this.executeResult = executeResult; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "HandleCallbackParam{" + 50 | "logId=" + logId + 51 | ", logDateTim=" + logDateTim + 52 | ", executeResult=" + executeResult + 53 | '}'; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /edu-auth/auth-api-provider/src/main/java/com/clark/daxian/auth/api/util/JsonUtils.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.api.util; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.core.type.TypeReference; 5 | import com.fasterxml.jackson.databind.DeserializationFeature; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | import org.apache.commons.lang3.StringUtils; 8 | 9 | import java.io.IOException; 10 | 11 | /** 12 | * json 工具类 13 | * @author 大仙 14 | */ 15 | public class JsonUtils { 16 | private static ObjectMapper mapper = new ObjectMapper(); 17 | 18 | public JsonUtils() { 19 | } 20 | 21 | public static T serializable(String json, Class clazz) { 22 | if (StringUtils.isEmpty(json)) { 23 | return null; 24 | } else { 25 | try { 26 | return mapper.readValue(json, clazz); 27 | } catch (IOException var3) { 28 | return null; 29 | } 30 | } 31 | } 32 | 33 | public static T serializable(String json, TypeReference reference) { 34 | if (StringUtils.isEmpty(json)) { 35 | return null; 36 | } else { 37 | try { 38 | return mapper.readValue(json, reference); 39 | } catch (IOException var3) { 40 | return null; 41 | } 42 | } 43 | } 44 | 45 | public static String deserializer(Object json) { 46 | if (json == null) { 47 | return null; 48 | } else { 49 | try { 50 | return mapper.writeValueAsString(json); 51 | } catch (JsonProcessingException var2) { 52 | return null; 53 | } 54 | } 55 | } 56 | 57 | static { 58 | mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/resources/bootstrap-dev.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8663 3 | spring: 4 | application: 5 | name: oauth2-server 6 | cloud: 7 | nacos: 8 | discovery: 9 | server-addr: 127.0.0.1:8848 10 | config: 11 | server-addr: 127.0.0.1:8848 12 | file-extension: yaml 13 | #redis配置 14 | redis: 15 | host: 127.0.0.1 16 | password: 17 | port: 6379 18 | database: 0 19 | timeout: 60000 20 | edu: 21 | auth: 22 | server: 23 | maxClient: 30000 24 | tokenValid: 14400 25 | force: false 26 | startRefresh: false 27 | keyPath: classpath:kevin_key.jks 28 | alias: wecode 29 | secret: wecodeCloud 30 | #sharding-jdbc读写分离的配置 ,如果不想读写分离配置,设置2个数据库同源即可 31 | sharding.jdbc: 32 | data-sources: 33 | ds_master: 34 | driver-class-name: com.mysql.jdbc.Driver 35 | url: jdbc:mysql://127.0.0.1:3306/edu_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8 36 | username: root 37 | password: 123456 38 | ds_slave_0: 39 | driver-class-name: com.mysql.jdbc.Driver 40 | url: jdbc:mysql://127.0.0.1:3306/edu_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8 41 | username: root 42 | password: 123456 43 | master-slave-rule: 44 | name: ds_ms 45 | master-data-source-name: ds_master 46 | slave-data-source-names: ds_slave_0 47 | load-balance-algorithm-type: round_robin 48 | props: 49 | sql.show: true 50 | #mybatis的配置 51 | mybatis: 52 | configuration: 53 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl -------------------------------------------------------------------------------- /edu-job/job-core-provider/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | edu-job 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | job-core-provider 13 | 14 | job-core-provider 15 | 16 | 17 | 18 | 19 | 20 | com.xuxueli 21 | xxl-rpc-core 22 | 1.5.0 23 | 24 | 25 | 26 | 27 | org.codehaus.groovy 28 | groovy 29 | 2.5.9 30 | 31 | 32 | 33 | 34 | org.springframework 35 | spring-context 36 | 5.2.3.RELEASE 37 | provided 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | test 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/feign/UserService.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.feign; 2 | 3 | import com.clark.daxian.api.response.ComResponse; 4 | import com.clark.daxian.entity.user_center.Permission; 5 | import com.clark.daxian.entity.user_center.Role; 6 | import com.clark.daxian.entity.user_center.User; 7 | import io.swagger.annotations.ApiOperation; 8 | import org.springframework.cloud.openfeign.FeignClient; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PathVariable; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 用户业务接口 16 | * @author 大仙 17 | */ 18 | @FeignClient(name = "user") 19 | public interface UserService { 20 | /** 21 | * 通过用户名,或者email获取用户名 22 | * @param email 23 | * @return 24 | */ 25 | @GetMapping("/user/email/{email}") 26 | ComResponse getUserByEmail(@PathVariable("email") String email); 27 | 28 | /** 29 | * 通过用户名,或者email获取用户名 30 | * @param telephone 31 | * @return 32 | */ 33 | @GetMapping("/user/tel/{telephone}") 34 | ComResponse getUserByTel(@PathVariable("telephone") String telephone); 35 | 36 | /** 37 | * 根据用户查询角色 38 | * @param userId 39 | * @return 40 | */ 41 | @GetMapping("/role/list/{userId}") 42 | ComResponse> listByUser(@PathVariable("userId") Long userId); 43 | /** 44 | * 通过用户查询权限 45 | * @param roleId 46 | * @return 47 | */ 48 | @GetMapping("/permission/list/{roleId}") 49 | ComResponse> listByRole(@PathVariable("roleId") Long roleId); 50 | } 51 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/model/XxlJobUser.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.model; 2 | 3 | import org.springframework.util.StringUtils; 4 | 5 | /** 6 | * @author xuxueli 2019-05-04 16:43:12 7 | */ 8 | public class XxlJobUser { 9 | 10 | private int id; 11 | private String username; // 账号 12 | private String password; // 密码 13 | private int role; // 角色:0-普通用户、1-管理员 14 | private String permission; // 权限:执行器ID列表,多个逗号分割 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getUsername() { 25 | return username; 26 | } 27 | 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getPassword() { 33 | return password; 34 | } 35 | 36 | public void setPassword(String password) { 37 | this.password = password; 38 | } 39 | 40 | public int getRole() { 41 | return role; 42 | } 43 | 44 | public void setRole(int role) { 45 | this.role = role; 46 | } 47 | 48 | public String getPermission() { 49 | return permission; 50 | } 51 | 52 | public void setPermission(String permission) { 53 | this.permission = permission; 54 | } 55 | 56 | // plugin 57 | public boolean validPermission(int jobGroup){ 58 | if (this.role == 1) { 59 | return true; 60 | } else { 61 | if (StringUtils.hasText(this.permission)) { 62 | for (String permissionItem : this.permission.split(",")) { 63 | if (String.valueOf(jobGroup).equals(permissionItem)) { 64 | return true; 65 | } 66 | } 67 | } 68 | return false; 69 | } 70 | 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/handler/impl/MethodJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.handler.impl; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | 9 | /** 10 | * @author xuxueli 2019-12-11 21:12:18 11 | */ 12 | public class MethodJobHandler extends IJobHandler { 13 | 14 | private final Object target; 15 | private final Method method; 16 | private Method initMethod; 17 | private Method destroyMethod; 18 | 19 | public MethodJobHandler(Object target, Method method, Method initMethod, Method destroyMethod) { 20 | this.target = target; 21 | this.method = method; 22 | 23 | this.initMethod =initMethod; 24 | this.destroyMethod =destroyMethod; 25 | } 26 | 27 | @Override 28 | public ReturnT execute(String param) throws Exception { 29 | return (ReturnT) method.invoke(target, new Object[]{param}); 30 | } 31 | 32 | @Override 33 | public void init() throws InvocationTargetException, IllegalAccessException { 34 | if(initMethod != null) { 35 | initMethod.invoke(target); 36 | } 37 | } 38 | 39 | @Override 40 | public void destroy() throws InvocationTargetException, IllegalAccessException { 41 | if(destroyMethod != null) { 42 | destroyMethod.invoke(target); 43 | } 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return super.toString()+"["+ target.getClass() + "#" + method.getName() +"]"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /edu-com/com-spring-boot-autoconfigure/src/main/java/com/clark/daxian/swagger/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.swagger; 2 | 3 | import com.clark.daxian.api.entity.Constant; 4 | import com.google.common.collect.Lists; 5 | import org.springframework.context.annotation.Bean; 6 | import springfox.documentation.builders.ApiInfoBuilder; 7 | import springfox.documentation.builders.ParameterBuilder; 8 | import springfox.documentation.builders.PathSelectors; 9 | import springfox.documentation.builders.RequestHandlerSelectors; 10 | import springfox.documentation.schema.ModelRef; 11 | import springfox.documentation.service.Contact; 12 | import springfox.documentation.spi.DocumentationType; 13 | import springfox.documentation.spring.web.plugins.Docket; 14 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 15 | 16 | /** 17 | * API文档配置 18 | * @author 大仙 19 | * 20 | */ 21 | @EnableSwagger2 22 | public class SwaggerConfig { 23 | 24 | @Bean 25 | public Docket createRestApi(){ 26 | ParameterBuilder builder = new ParameterBuilder(); 27 | builder.parameterType("header").name(Constant.AUTHORIZATION) 28 | .description("header参数") 29 | .required(false) 30 | .modelRef(new ModelRef("string")); // 在swagger里显示header 31 | return new Docket(DocumentationType.SWAGGER_2).groupName("Online Edu教学平台--接口文档") 32 | .apiInfo(new ApiInfoBuilder().title("Online Edu教学平台--接口文档") 33 | .contact(new Contact("朱维", "", "zhuwei680913@163.com")).version("1.0").build()) 34 | .globalOperationParameters(Lists.newArrayList(builder.build())) 35 | .select() 36 | .apis(RequestHandlerSelectors.basePackage("com.clark")) 37 | .paths(PathSelectors.any()).build(); 38 | } 39 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobRegistry; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by xuxueli on 16/9/30. 12 | */ 13 | @Mapper 14 | public interface XxlJobRegistryDao { 15 | 16 | public List findDead(@Param("timeout") int timeout, 17 | @Param("nowTime") Date nowTime); 18 | 19 | public int removeDead(@Param("ids") List ids); 20 | 21 | public List findAll(@Param("timeout") int timeout, 22 | @Param("nowTime") Date nowTime); 23 | 24 | public int registryUpdate(@Param("registryGroup") String registryGroup, 25 | @Param("registryKey") String registryKey, 26 | @Param("registryValue") String registryValue, 27 | @Param("updateTime") Date updateTime); 28 | 29 | public int registrySave(@Param("registryGroup") String registryGroup, 30 | @Param("registryKey") String registryKey, 31 | @Param("registryValue") String registryValue, 32 | @Param("updateTime") Date updateTime); 33 | 34 | public int registryDelete(@Param("registryGroup") String registryGroup, 35 | @Param("registryKey") String registryKey, 36 | @Param("registryValue") String registryValue); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/biz/client/AdminBizClient.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.client; 2 | 3 | import com.xxl.job.core.biz.AdminBiz; 4 | import com.xxl.job.core.biz.model.HandleCallbackParam; 5 | import com.xxl.job.core.biz.model.RegistryParam; 6 | import com.xxl.job.core.biz.model.ReturnT; 7 | import com.xxl.job.core.util.XxlJobRemotingUtil; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * admin api test 13 | * 14 | * @author xuxueli 2017-07-28 22:14:52 15 | */ 16 | public class AdminBizClient implements AdminBiz { 17 | 18 | public AdminBizClient() { 19 | } 20 | public AdminBizClient(String addressUrl, String accessToken) { 21 | this.addressUrl = addressUrl; 22 | this.accessToken = accessToken; 23 | 24 | // valid 25 | if (!this.addressUrl.endsWith("/")) { 26 | this.addressUrl = this.addressUrl + "/"; 27 | } 28 | } 29 | 30 | private String addressUrl ; 31 | private String accessToken; 32 | 33 | 34 | @Override 35 | public ReturnT callback(List callbackParamList) { 36 | return XxlJobRemotingUtil.postBody(addressUrl+"api/callback", accessToken, callbackParamList, 3); 37 | } 38 | 39 | @Override 40 | public ReturnT registry(RegistryParam registryParam) { 41 | return XxlJobRemotingUtil.postBody(addressUrl + "api/registry", accessToken, registryParam, 3); 42 | } 43 | 44 | @Override 45 | public ReturnT registryRemove(RegistryParam registryParam) { 46 | return XxlJobRemotingUtil.postBody(addressUrl + "api/registryRemove", accessToken, registryParam, 3); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/service/iml/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.service.iml; 2 | 3 | import com.clark.daxian.entity.user_center.Role; 4 | import com.clark.daxian.user.exception.UserException; 5 | import com.clark.daxian.user.mapper.RoleMapper; 6 | import com.clark.daxian.user.service.RoleService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 角色业务接口实现 14 | * @author 大仙 15 | */ 16 | @Service 17 | public class RoleServiceImpl implements RoleService { 18 | 19 | 20 | @Autowired 21 | private RoleMapper roleMapper; 22 | 23 | @Override 24 | public List getRoleByUser(Long userId) { 25 | if(userId==null){ 26 | throw new UserException("缺失请求参数"); 27 | } 28 | return roleMapper.getRoleByUser(userId); 29 | } 30 | 31 | @Override 32 | public Long save(Role role) { 33 | try{ 34 | roleMapper.insert(role); 35 | }catch (Exception e){ 36 | e.printStackTrace(); 37 | throw new UserException("添加角色失败"); 38 | } 39 | return role.getId(); 40 | } 41 | 42 | @Override 43 | public void deleteRole(Long id) { 44 | if(id==null){ 45 | throw new UserException("缺失请求参数"); 46 | } 47 | roleMapper.deleteById(id); 48 | } 49 | 50 | @Override 51 | public void updateStatus(Long id, Integer status) { 52 | if(id==null||status==null){ 53 | throw new UserException("缺失请求参数"); 54 | } 55 | roleMapper.updateStatus(id,status); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /edu-im/src/main/java/com/clark/daxian/im/config/RedisObjectSerializer.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.im.config; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.core.serializer.support.DeserializingConverter; 5 | import org.springframework.core.serializer.support.SerializingConverter; 6 | import org.springframework.data.redis.serializer.RedisSerializer; 7 | import org.springframework.data.redis.serializer.SerializationException; 8 | 9 | /** 10 | * redis编码解码类 11 | * @Author: 朱维 12 | * @Date 17:38 2019/11/27 13 | */ 14 | public class RedisObjectSerializer implements RedisSerializer { 15 | 16 | static final byte[] EMPTY_ARRAY = new byte[0]; 17 | 18 | private Converter serializer = new SerializingConverter(); 19 | private Converter deserializer = new DeserializingConverter(); 20 | 21 | @Override 22 | public byte[] serialize(Object o) throws SerializationException { 23 | if(o == null) { 24 | return EMPTY_ARRAY; 25 | } 26 | try { 27 | return serializer.convert(o); 28 | }catch (Exception e){ 29 | return EMPTY_ARRAY; 30 | } 31 | 32 | } 33 | 34 | @Override 35 | public Object deserialize(byte[] bytes) throws SerializationException { 36 | if(isEmpty(bytes)) 37 | return null; 38 | try { 39 | return deserializer.convert(bytes); 40 | }catch (Exception e){ 41 | throw new SerializationException("Cannot deserialize", e); 42 | } 43 | } 44 | 45 | private boolean isEmpty(byte[] bytes){ 46 | return (bytes == null || bytes.length == 0) ; 47 | } 48 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * xxl-job log for glue, used to track job code process 7 | * @author xuxueli 2016-5-19 17:57:46 8 | */ 9 | public class XxlJobLogGlue { 10 | 11 | private int id; 12 | private int jobId; // 任务主键ID 13 | private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum 14 | private String glueSource; 15 | private String glueRemark; 16 | private Date addTime; 17 | private Date updateTime; 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | public int getJobId() { 28 | return jobId; 29 | } 30 | 31 | public void setJobId(int jobId) { 32 | this.jobId = jobId; 33 | } 34 | 35 | public String getGlueType() { 36 | return glueType; 37 | } 38 | 39 | public void setGlueType(String glueType) { 40 | this.glueType = glueType; 41 | } 42 | 43 | public String getGlueSource() { 44 | return glueSource; 45 | } 46 | 47 | public void setGlueSource(String glueSource) { 48 | this.glueSource = glueSource; 49 | } 50 | 51 | public String getGlueRemark() { 52 | return glueRemark; 53 | } 54 | 55 | public void setGlueRemark(String glueRemark) { 56 | this.glueRemark = glueRemark; 57 | } 58 | 59 | public Date getAddTime() { 60 | return addTime; 61 | } 62 | 63 | public void setAddTime(Date addTime) { 64 | this.addTime = addTime; 65 | } 66 | 67 | public Date getUpdateTime() { 68 | return updateTime; 69 | } 70 | 71 | public void setUpdateTime(Date updateTime) { 72 | this.updateTime = updateTime; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /edu-job/job-core-provider/src/main/java/com/xxl/job/core/biz/model/RegistryParam.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by xuxueli on 2017-05-10 20:22:42 7 | */ 8 | public class RegistryParam implements Serializable { 9 | private static final long serialVersionUID = 42L; 10 | 11 | private String registryGroup; 12 | private String registryKey; 13 | private String registryValue; 14 | 15 | public RegistryParam(){} 16 | public RegistryParam(String registryGroup, String registryKey, String registryValue) { 17 | this.registryGroup = registryGroup; 18 | this.registryKey = registryKey; 19 | this.registryValue = registryValue; 20 | } 21 | 22 | public String getRegistryGroup() { 23 | return registryGroup; 24 | } 25 | 26 | public void setRegistryGroup(String registryGroup) { 27 | this.registryGroup = registryGroup; 28 | } 29 | 30 | public String getRegistryKey() { 31 | return registryKey; 32 | } 33 | 34 | public void setRegistryKey(String registryKey) { 35 | this.registryKey = registryKey; 36 | } 37 | 38 | public String getRegistryValue() { 39 | return registryValue; 40 | } 41 | 42 | public void setRegistryValue(String registryValue) { 43 | this.registryValue = registryValue; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "RegistryParam{" + 49 | "registryGroup='" + registryGroup + '\'' + 50 | ", registryKey='" + registryKey + '\'' + 51 | ", registryValue='" + registryValue + '\'' + 52 | '}'; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /edu-user-center/src/main/java/com/clark/daxian/user/config/RedisObjectSerializer.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.user.config; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.core.serializer.support.DeserializingConverter; 5 | import org.springframework.core.serializer.support.SerializingConverter; 6 | import org.springframework.data.redis.serializer.RedisSerializer; 7 | import org.springframework.data.redis.serializer.SerializationException; 8 | 9 | /** 10 | * redis编码解码类 11 | * @Author: 朱维 12 | * @Date 17:38 2019/11/27 13 | */ 14 | public class RedisObjectSerializer implements RedisSerializer { 15 | 16 | static final byte[] EMPTY_ARRAY = new byte[0]; 17 | 18 | private Converter serializer = new SerializingConverter(); 19 | private Converter deserializer = new DeserializingConverter(); 20 | 21 | @Override 22 | public byte[] serialize(Object o) throws SerializationException { 23 | if(o == null) { 24 | return EMPTY_ARRAY; 25 | } 26 | try { 27 | return serializer.convert(o); 28 | }catch (Exception e){ 29 | return EMPTY_ARRAY; 30 | } 31 | 32 | } 33 | 34 | @Override 35 | public Object deserialize(byte[] bytes) throws SerializationException { 36 | if(isEmpty(bytes)) 37 | return null; 38 | try { 39 | return deserializer.convert(bytes); 40 | }catch (Exception e){ 41 | throw new SerializationException("Cannot deserialize", e); 42 | } 43 | } 44 | 45 | private boolean isEmpty(byte[] bytes){ 46 | return (bytes == null || bytes.length == 0) ; 47 | } 48 | } -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/templates/help.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <#import "./common/common.macro.ftl" as netCommon> 5 | <@netCommon.commonStyle /> 6 | ${I18n.admin_name} 7 | 8 | sidebar-collapse "> 9 |
10 | 11 | <@netCommon.commonHeader /> 12 | 13 | <@netCommon.commonLeft "help" /> 14 | 15 | 16 |
17 | 18 |
19 |

${I18n.job_help}

20 |
21 | 22 | 23 |
24 |
25 |

${I18n.admin_name_full}

26 |
27 |

28 | Github     29 | 30 |

31 | ${I18n.job_help_document} 32 |

33 | 34 |

35 |

36 |
37 |
38 | 39 |
40 | 41 | 42 | 43 | <@netCommon.commonFooter /> 44 |
45 | <@netCommon.commonScript /> 46 | 47 | 48 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/config/RedisObjectSerializer.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.config; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.core.serializer.support.DeserializingConverter; 5 | import org.springframework.core.serializer.support.SerializingConverter; 6 | import org.springframework.data.redis.serializer.RedisSerializer; 7 | import org.springframework.data.redis.serializer.SerializationException; 8 | 9 | /** 10 | * redis编码解码类 11 | * @Author: 朱维 12 | * @Date 17:38 2019/11/27 13 | */ 14 | public class RedisObjectSerializer implements RedisSerializer { 15 | 16 | static final byte[] EMPTY_ARRAY = new byte[0]; 17 | 18 | private Converter serializer = new SerializingConverter(); 19 | private Converter deserializer = new DeserializingConverter(); 20 | 21 | @Override 22 | public byte[] serialize(Object o) throws SerializationException { 23 | if(o == null) { 24 | return EMPTY_ARRAY; 25 | } 26 | try { 27 | return serializer.convert(o); 28 | }catch (Exception e){ 29 | return EMPTY_ARRAY; 30 | } 31 | 32 | } 33 | 34 | @Override 35 | public Object deserialize(byte[] bytes) throws SerializationException { 36 | if(isEmpty(bytes)) 37 | return null; 38 | try { 39 | return deserializer.convert(bytes); 40 | }catch (Exception e){ 41 | throw new SerializationException("Cannot deserialize", e); 42 | } 43 | } 44 | 45 | private boolean isEmpty(byte[] bytes){ 46 | return (bytes == null || bytes.length == 0) ; 47 | } 48 | } -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-autoconfigure/src/main/java/com/clark/daxian/auth/resource/config/RedisObjectSerializer.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.resource.config; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.core.serializer.support.DeserializingConverter; 5 | import org.springframework.core.serializer.support.SerializingConverter; 6 | import org.springframework.data.redis.serializer.RedisSerializer; 7 | import org.springframework.data.redis.serializer.SerializationException; 8 | 9 | /** 10 | * redis编码解码类 11 | * @Author: 朱维 12 | * @Date 17:38 2019/11/27 13 | */ 14 | public class RedisObjectSerializer implements RedisSerializer { 15 | 16 | static final byte[] EMPTY_ARRAY = new byte[0]; 17 | 18 | private Converter serializer = new SerializingConverter(); 19 | private Converter deserializer = new DeserializingConverter(); 20 | 21 | @Override 22 | public byte[] serialize(Object o) throws SerializationException { 23 | if(o == null) { 24 | return EMPTY_ARRAY; 25 | } 26 | try { 27 | return serializer.convert(o); 28 | }catch (Exception e){ 29 | return EMPTY_ARRAY; 30 | } 31 | 32 | } 33 | 34 | @Override 35 | public Object deserialize(byte[] bytes) throws SerializationException { 36 | if(isEmpty(bytes)) 37 | return null; 38 | try { 39 | return deserializer.convert(bytes); 40 | }catch (Exception e){ 41 | throw new SerializationException("Cannot deserialize", e); 42 | } 43 | } 44 | 45 | private boolean isEmpty(byte[] bytes){ 46 | return (bytes == null || bytes.length == 0) ; 47 | } 48 | } -------------------------------------------------------------------------------- /docs/nacos/conf/application.properties: -------------------------------------------------------------------------------- 1 | # spring 2 | 3 | server.contextPath=/nacos 4 | server.servlet.contextPath=/nacos 5 | server.port=8848 6 | 7 | # nacos.cmdb.dumpTaskInterval=3600 8 | # nacos.cmdb.eventTaskInterval=10 9 | # nacos.cmdb.labelTaskInterval=300 10 | # nacos.cmdb.loadDataAtStart=false 11 | 12 | 13 | # metrics for prometheus 14 | #management.endpoints.web.exposure.include=* 15 | 16 | # metrics for elastic search 17 | management.metrics.export.elastic.enabled=false 18 | #management.metrics.export.elastic.host=http://localhost:9200 19 | 20 | # metrics for influx 21 | management.metrics.export.influx.enabled=false 22 | #management.metrics.export.influx.db=springboot 23 | #management.metrics.export.influx.uri=http://localhost:8086 24 | #management.metrics.export.influx.auto-create-db=true 25 | #management.metrics.export.influx.consistency=one 26 | #management.metrics.export.influx.compressed=true 27 | 28 | server.tomcat.accesslog.enabled=true 29 | server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i 30 | # default current work dir 31 | server.tomcat.basedir= 32 | 33 | ## spring security config 34 | ### turn off security 35 | #spring.security.enabled=false 36 | #management.security=false 37 | #security.basic.enabled=false 38 | #nacos.security.ignore.urls=/** 39 | 40 | nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health/**,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/**,/v1/console/server/** 41 | 42 | # nacos.naming.distro.taskDispatchPeriod=200 43 | # nacos.naming.distro.batchSyncKeyCount=1000 44 | # nacos.naming.distro.syncRetryDelay=5000 45 | # nacos.naming.data.warmup=true 46 | # nacos.naming.expireInstance=true 47 | 48 | nacos.istio.mcp.server.enabled=false 49 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | edu-com 7 | com.clark.daxian 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | com-mq-service 13 | 14 | com-mq-service 15 | 16 | 17 | 18 | com.clark.daxian 19 | com-provider-api 20 | ${project.version} 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-configuration-processor 25 | true 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-amqp 30 | 31 | 32 | 33 | junit 34 | junit 35 | 4.12 36 | test 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-test 41 | test 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-autoconfigure/src/main/java/com/clark/daxian/auth/resource/config/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.resource.config; 2 | 3 | import com.clark.daxian.auth.api.entity.TokenEntity; 4 | import com.clark.daxian.entity.user_center.Permission; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.redis.connection.RedisConnectionFactory; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.serializer.StringRedisSerializer; 11 | 12 | /** 13 | * redis配置 14 | * @author 大仙 15 | * 16 | */ 17 | public class RedisConfig { 18 | 19 | @Autowired 20 | private RedisConnectionFactory redisConnectionFactory; 21 | 22 | @Bean 23 | public RedisTemplate tokenEntityRedisTemplate() { 24 | RedisTemplate redisTemplate = new RedisTemplate<>(); 25 | redisTemplate.setKeySerializer(new StringRedisSerializer()); 26 | redisTemplate.setValueSerializer(new RedisObjectSerializer()); 27 | redisTemplate.setConnectionFactory(redisConnectionFactory); 28 | return redisTemplate; 29 | } 30 | 31 | /** 32 | * 存储权限 33 | * @return 34 | */ 35 | @Bean 36 | public RedisTemplate permissionRedisTemplate() { 37 | RedisTemplate redisTemplate = new RedisTemplate<>(); 38 | redisTemplate.setKeySerializer(new StringRedisSerializer()); 39 | redisTemplate.setValueSerializer(new RedisObjectSerializer()); 40 | redisTemplate.setConnectionFactory(redisConnectionFactory); 41 | return redisTemplate; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/java/com/xxl/job/admin/service/XxlJobService.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.service; 2 | 3 | 4 | import com.xxl.job.admin.core.model.XxlJobInfo; 5 | import com.xxl.job.core.biz.model.ReturnT; 6 | 7 | import java.util.Date; 8 | import java.util.Map; 9 | 10 | /** 11 | * core job action for xxl-job 12 | * 13 | * @author xuxueli 2016-5-28 15:30:33 14 | */ 15 | public interface XxlJobService { 16 | 17 | /** 18 | * page list 19 | * 20 | * @param start 21 | * @param length 22 | * @param jobGroup 23 | * @param jobDesc 24 | * @param executorHandler 25 | * @param author 26 | * @return 27 | */ 28 | public Map pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author); 29 | 30 | /** 31 | * add job 32 | * 33 | * @param jobInfo 34 | * @return 35 | */ 36 | public ReturnT add(XxlJobInfo jobInfo); 37 | 38 | /** 39 | * update job 40 | * 41 | * @param jobInfo 42 | * @return 43 | */ 44 | public ReturnT update(XxlJobInfo jobInfo); 45 | 46 | /** 47 | * remove job 48 | * * 49 | * @param id 50 | * @return 51 | */ 52 | public ReturnT remove(int id); 53 | 54 | /** 55 | * start job 56 | * 57 | * @param id 58 | * @return 59 | */ 60 | public ReturnT start(int id); 61 | 62 | /** 63 | * stop job 64 | * 65 | * @param id 66 | * @return 67 | */ 68 | public ReturnT stop(int id); 69 | 70 | /** 71 | * dashboard info 72 | * 73 | * @return 74 | */ 75 | public Map dashboardInfo(); 76 | 77 | /** 78 | * chart info 79 | * 80 | * @param startDate 81 | * @param endDate 82 | * @return 83 | */ 84 | public ReturnT> chartInfo(Date startDate, Date endDate); 85 | 86 | } 87 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/util/IPUtil.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.util; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | /** 8 | * IP工具类 9 | */ 10 | public class IPUtil { 11 | /** 12 | * 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址, 13 | * 14 | * 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢? 15 | * 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。 16 | * 17 | * 如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 18 | * 192.168.1.100 19 | * 20 | * 用户真实IP为: 192.168.1.110 21 | * 22 | * @param request 23 | * @return 24 | */ 25 | public static String getIpAddress(HttpServletRequest request) { 26 | String ip = request.getHeader("x-forwarded-for"); 27 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 28 | ip = request.getHeader("Proxy-Client-IP"); 29 | } 30 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 31 | ip = request.getHeader("WL-Proxy-Client-IP"); 32 | } 33 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 34 | ip = request.getHeader("HTTP_CLIENT_IP"); 35 | } 36 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 37 | ip = request.getHeader("HTTP_X_FORWARDED_FOR"); 38 | } 39 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 40 | ip = request.getRemoteAddr(); 41 | } 42 | if (StringUtils.isNotBlank(ip) && ip.contains(",")) { 43 | ip = ip.split(",")[0]; 44 | } 45 | return ip; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /edu-auth/auth-center-provider/src/main/java/com/clark/daxian/auth/server/handler/web/WebLogoutHandler.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.server.handler.web; 2 | 3 | import com.auth0.jwt.JWT; 4 | import com.auth0.jwt.interfaces.DecodedJWT; 5 | import com.clark.daxian.api.entity.Constant; 6 | import com.clark.daxian.auth.api.entity.TokenEntity; 7 | import com.clark.daxian.auth.api.util.TokenUtil; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.security.core.Authentication; 13 | import org.springframework.security.web.authentication.logout.LogoutHandler; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | import javax.servlet.http.HttpServletResponse; 17 | 18 | /** 19 | * 退出登录逻辑 20 | * @author 大仙 21 | */ 22 | public class WebLogoutHandler implements LogoutHandler { 23 | 24 | private Logger logger = LoggerFactory.getLogger(getClass()); 25 | 26 | @Autowired 27 | private RedisTemplate tokenEntityRedisTemplate; 28 | 29 | 30 | @Override 31 | public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { 32 | logger.info("开始执行退出逻辑==="); 33 | // 获取Token 34 | String accessToken = request.getHeader(Constant.AUTHORIZATION); 35 | accessToken = accessToken.replace("Bearer ", ""); 36 | String id = null; 37 | if (accessToken != null) { 38 | DecodedJWT jwt = JWT.decode(accessToken); 39 | id = String.valueOf(jwt.getClaims().get(Constant.USER_INFO).asMap().get("id")); 40 | } 41 | TokenUtil.logout(id,tokenEntityRedisTemplate,accessToken); 42 | logger.info("执行退出成功=="); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-autoconfigure/src/main/java/com/clark/daxian/auth/resource/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.resource.config; 2 | 3 | 4 | import com.clark.daxian.auth.resource.filter.CorsFilter; 5 | import com.clark.daxian.auth.resource.filter.ReactiveRequestContextFilter; 6 | import com.clark.daxian.auth.resource.manager.WebfluxReactiveAuthorizationManager; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.security.authorization.ReactiveAuthorizationManager; 9 | import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; 10 | import org.springframework.security.config.web.server.SecurityWebFiltersOrder; 11 | import org.springframework.security.config.web.server.ServerHttpSecurity; 12 | import org.springframework.security.web.server.SecurityWebFilterChain; 13 | 14 | 15 | /** 16 | * 资源服务器配置 17 | * @author 大仙 18 | */ 19 | @EnableWebFluxSecurity 20 | public class SecurityConfig { 21 | 22 | @Bean 23 | public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { 24 | http.cors().and().csrf().disable() 25 | .authorizeExchange() 26 | .anyExchange().access(reactiveAuthorizationManager()); 27 | http.addFilterAt(new CorsFilter(), SecurityWebFiltersOrder.SECURITY_CONTEXT_SERVER_WEB_EXCHANGE); 28 | http.addFilterAt(new ReactiveRequestContextFilter(), SecurityWebFiltersOrder.SECURITY_CONTEXT_SERVER_WEB_EXCHANGE); 29 | http.oauth2ResourceServer().jwt(); 30 | return http.build(); 31 | } 32 | 33 | /** 34 | * 注入授权管理器 35 | * @return 36 | */ 37 | @Bean 38 | public ReactiveAuthorizationManager reactiveAuthorizationManager(){ 39 | WebfluxReactiveAuthorizationManager webfluxReactiveAuthorizationManager = new WebfluxReactiveAuthorizationManager(); 40 | return webfluxReactiveAuthorizationManager; 41 | } 42 | } -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-autoconfigure/src/main/java/com/clark/daxian/auth/resource/content/ReactiveRequestContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.resource.content; 2 | import org.springframework.http.server.reactive.ServerHttpRequest; 3 | import org.springframework.web.server.ServerWebExchange; 4 | import reactor.core.publisher.Mono; 5 | import reactor.util.context.Context; 6 | 7 | /** 8 | * ReactiveRequestContextHolder 9 | * 10 | * @author L.cm 11 | */ 12 | public class ReactiveRequestContextHolder { 13 | 14 | private static final Class CONTEXT_KEY = ServerWebExchange.class; 15 | 16 | /** 17 | * Gets the {@code Mono} from Reactor {@link Context} 18 | * 19 | * @return the {@code Mono} 20 | */ 21 | public static Mono getExchange() { 22 | /** 23 | * mica中是这么写的,但是我这样写一直会报错 content is null; 24 | */ 25 | // return Mono.subscriberContext() 26 | // .map(ctx -> ctx.get(CONTEXT_KEY)); 27 | /** 28 | * 下面是我仿照Security中的改写的。 29 | */ 30 | return Mono.subscriberContext() 31 | .filter(c -> c.hasKey(CONTEXT_KEY)) 32 | .flatMap(c -> Mono.just(c.get(CONTEXT_KEY))); 33 | } 34 | 35 | /** 36 | * Gets the {@code Mono} from Reactor {@link Context} 37 | * 38 | * @return the {@code Mono} 39 | */ 40 | public static Mono getRequest() { 41 | return ReactiveRequestContextHolder.getExchange() 42 | .map(ServerWebExchange::getRequest); 43 | } 44 | 45 | /** 46 | * Put the {@code ServerWebExchange} to Reactor {@link Context} 47 | * 48 | * @param context Context 49 | * @param exchange ServerWebExchange 50 | * @return the Reactor {@link Context} 51 | */ 52 | public static Context put(Context context, ServerWebExchange exchange) { 53 | return context.put(CONTEXT_KEY, exchange); 54 | } 55 | } -------------------------------------------------------------------------------- /edu-auth/auth-spring-boot-autoconfigure/src/main/java/com/clark/daxian/auth/resource/filter/CorsFilter.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.auth.resource.filter; 2 | 3 | import org.springframework.http.HttpHeaders; 4 | import org.springframework.http.HttpMethod; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.http.server.reactive.ServerHttpRequest; 7 | import org.springframework.http.server.reactive.ServerHttpResponse; 8 | import org.springframework.web.cors.reactive.CorsUtils; 9 | import org.springframework.web.server.ServerWebExchange; 10 | import org.springframework.web.server.WebFilter; 11 | import org.springframework.web.server.WebFilterChain; 12 | import reactor.core.publisher.Mono; 13 | 14 | /** 15 | * 跨域配置 16 | * @author 大仙 17 | */ 18 | public class CorsFilter implements WebFilter { 19 | 20 | 21 | @Override 22 | public Mono filter(ServerWebExchange ctx, WebFilterChain chain) { 23 | ServerHttpRequest request = ctx.getRequest(); 24 | if (CorsUtils.isCorsRequest(request)) { 25 | ServerHttpResponse response = ctx.getResponse(); 26 | HttpHeaders headers = response.getHeaders(); 27 | headers.set(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*"); 28 | headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "*"); 29 | headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, ""); 30 | headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "false"); 31 | headers.add(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "*"); 32 | headers.add(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "3600"); 33 | if (request.getMethod() == HttpMethod.OPTIONS) { 34 | response.setStatusCode(HttpStatus.OK); 35 | return Mono.empty(); 36 | } 37 | } 38 | return chain.filter(ctx); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /edu-job/job-spring-boot-autoconfigure/src/main/java/com/clark/daxian/config/XXLJobConfig.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.config; 2 | 3 | import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.apache.commons.lang3.StringUtils; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | import java.net.InetAddress; 10 | 11 | @Slf4j 12 | public class XXLJobConfig { 13 | 14 | @Value("${xxl.job.admin.addresses}") 15 | private String adminAddresses; 16 | 17 | @Value("${xxl.job.executor.appname}") 18 | private String appName; 19 | 20 | @Value("${xxl.job.executor.ip}") 21 | private String ip; 22 | 23 | @Value("${xxl.job.executor.port}") 24 | private int port; 25 | 26 | @Value("${xxl.job.accessToken}") 27 | private String accessToken; 28 | 29 | 30 | @Bean 31 | public XxlJobSpringExecutor xxlJobExecutor() { 32 | log.info(">>>>>>>>>>> xxl-job config init."); 33 | XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); 34 | xxlJobSpringExecutor.setAdminAddresses(adminAddresses); 35 | xxlJobSpringExecutor.setAppName(appName); 36 | if(StringUtils.isBlank(ip)){ 37 | ip = getServerIp(); 38 | } 39 | xxlJobSpringExecutor.setIp(ip); 40 | xxlJobSpringExecutor.setPort(port); 41 | xxlJobSpringExecutor.setAccessToken(accessToken); 42 | 43 | return xxlJobSpringExecutor; 44 | } 45 | 46 | /** 47 | * 获取本地IP 48 | * @return 49 | */ 50 | private String getServerIp(){ 51 | try { 52 | String ip = InetAddress.getLocalHost().getHostAddress(); 53 | log.info("Ip:"+ip); 54 | return ip; 55 | }catch (Exception e){ 56 | return null; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /edu-com/com-mq-service/src/main/java/com/clark/daxian/mq/service/impl/ProducerServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.clark.daxian.mq.service.impl; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.clark.daxian.api.mq.ProducerService; 5 | import com.clark.daxian.api.mq.entity.MqMessage; 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.springframework.amqp.core.Message; 8 | import org.springframework.amqp.core.MessageBuilder; 9 | import org.springframework.amqp.core.MessageProperties; 10 | import org.springframework.amqp.rabbit.connection.CorrelationData; 11 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.data.redis.core.RedisTemplate; 14 | 15 | /** 16 | * @Author: 朱维 17 | * @Date 15:51 2019/12/10 18 | */ 19 | public class ProducerServiceImpl implements ProducerService { 20 | 21 | 22 | @Autowired 23 | private RabbitTemplate rabbitTemplate; 24 | 25 | @Autowired 26 | private RedisTemplate redisTemplate; 27 | 28 | @Override 29 | public void sendMsg (MqMessage content, String exchangeName, String routingKey){ 30 | Message message = MessageBuilder.withBody(JSONObject.toJSONString(content).getBytes()) 31 | .setContentType(MessageProperties.CONTENT_TYPE_JSON) 32 | .setCorrelationId(content.getId()) 33 | .build(); 34 | if(StringUtils.isNotBlank(content.getExpiration())){ 35 | message = MessageBuilder.fromMessage(message).setExpiration(content.getExpiration()).build(); 36 | } 37 | CorrelationData data = new CorrelationData(content.getId()); 38 | //存储到redis 39 | redisTemplate.opsForValue().set(data.getId(),JSONObject.toJSONString(content)); 40 | rabbitTemplate.convertAndSend(exchangeName,routingKey,message,data); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /edu-job/job-admin-center/src/main/resources/static/plugins/codemirror/addon/hint/anyword-hint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var WORD = /[\w$]+/, RANGE = 500; 15 | 16 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) { 17 | var word = options && options.word || WORD; 18 | var range = options && options.range || RANGE; 19 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line); 20 | var end = cur.ch, start = end; 21 | while (start && word.test(curLine.charAt(start - 1))) --start; 22 | var curWord = start != end && curLine.slice(start, end); 23 | 24 | var list = options && options.list || [], seen = {}; 25 | var re = new RegExp(word.source, "g"); 26 | for (var dir = -1; dir <= 1; dir += 2) { 27 | var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir; 28 | for (; line != endLine; line += dir) { 29 | var text = editor.getLine(line), m; 30 | while (m = re.exec(text)) { 31 | if (line == cur.line && m[0] === curWord) continue; 32 | if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) { 33 | seen[m[0]] = true; 34 | list.push(m[0]); 35 | } 36 | } 37 | } 38 | } 39 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)}; 40 | }); 41 | }); 42 | --------------------------------------------------------------------------------